diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-03-30 03:37:19 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-03-30 03:37:19 +0000 |
commit | d544dcdf38411c8f4ebd872d69f89f087cf69751 (patch) | |
tree | 285559e5a1fbe820abc71f39cf27cbe7b05e9b1a /libavcodec/mlpdec.c | |
parent | 7b18e13a7c158a1bf50bcbeb363ecb0fe38cd5be (diff) | |
download | ffmpeg-d544dcdf38411c8f4ebd872d69f89f087cf69751.tar.gz |
mlpdec: Prettify substream parity check.
Originally committed as revision 18237 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r-- | libavcodec/mlpdec.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 3be27b40f8..7bda70356f 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -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", |