Mercurial > libavcodec.hg
comparison mlpdec.c @ 9285:f2f4f136add4 libavcodec
mlpdec: Prettify substream parity check.
| author | ramiro |
|---|---|
| date | Mon, 30 Mar 2009 03:37:19 +0000 |
| parents | 4072adff072e |
| children | e02f401dde04 |
comparison
equal
deleted
inserted
replaced
| 9284:4072adff072e | 9285:f2f4f136add4 |
|---|---|
| 1038 } | 1038 } |
| 1039 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 16 && | 1039 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 16 && |
| 1040 substream_parity_present[substr]) { | 1040 substream_parity_present[substr]) { |
| 1041 uint8_t parity, checksum; | 1041 uint8_t parity, checksum; |
| 1042 | 1042 |
| 1043 parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2); | 1043 parity = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2); |
| 1044 if ((parity ^ get_bits(&gb, 8)) != 0xa9) | 1044 checksum = ff_mlp_checksum8 (buf, substream_data_len[substr] - 2); |
| 1045 av_log(m->avctx, AV_LOG_ERROR, | 1045 |
| 1046 "Substream %d parity check failed.\n", substr); | 1046 if ((get_bits(&gb, 8) ^ parity) != 0xa9 ) |
| 1047 | 1047 av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr); |
| 1048 checksum = ff_mlp_checksum8(buf, substream_data_len[substr] - 2); | 1048 if ( get_bits(&gb, 8) != checksum) |
| 1049 if (checksum != get_bits(&gb, 8)) | 1049 av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr); |
| 1050 av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n", | |
| 1051 substr); | |
| 1052 } | 1050 } |
| 1053 if (substream_data_len[substr] * 8 != get_bits_count(&gb)) { | 1051 if (substream_data_len[substr] * 8 != get_bits_count(&gb)) { |
| 1054 av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", | 1052 av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", |
| 1055 substr); | 1053 substr); |
| 1056 return -1; | 1054 return -1; |
