]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
mlpdec: Prettify substream parity check.
authorramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 30 Mar 2009 03:37:19 +0000 (03:37 +0000)
committerramiro <ramiro@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 30 Mar 2009 03:37:19 +0000 (03:37 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18237 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/mlpdec.c

index 3be27b40f833f04aa895475eeb0279ea903afda5..7bda70356f2a016b5129411cce04fd66a8930026 100644 (file)
@@ -1040,15 +1040,13 @@ static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
             substream_parity_present[substr]) {
             uint8_t parity, checksum;
 
-            parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2);
-            if ((parity ^ get_bits(&gb, 8)) != 0xa9)
-                av_log(m->avctx, AV_LOG_ERROR,
-                       "Substream %d parity check failed.\n", substr);
+            parity   = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2);
+            checksum = ff_mlp_checksum8       (buf, substream_data_len[substr] - 2);
 
-            checksum = ff_mlp_checksum8(buf, substream_data_len[substr] - 2);
-            if (checksum != get_bits(&gb, 8))
-                av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n",
-                       substr);
+            if ((get_bits(&gb, 8) ^ parity) != 0xa9    )
+                av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr);
+            if ( get_bits(&gb, 8)           != checksum)
+                av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n"    , substr);
         }
         if (substream_data_len[substr] * 8 != get_bits_count(&gb)) {
             av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n",