# HG changeset patch # User ramiro # Date 1238384239 0 # Node ID f2f4f136add4cfa58a061cf85fe9f47c914a1361 # Parent 4072adff072ec94a4c617677f3dedfa941caed53 mlpdec: Prettify substream parity check. diff -r 4072adff072e -r f2f4f136add4 mlpdec.c --- a/mlpdec.c Mon Mar 30 03:34:15 2009 +0000 +++ b/mlpdec.c Mon Mar 30 03:37:19 2009 +0000 @@ -1040,15 +1040,13 @@ 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",