comparison mlpdec.c @ 9284:4072adff072e libavcodec

mlpdec: Cleaner and better termination word check.
author ramiro
date Mon, 30 Mar 2009 03:34:15 +0000
parents a37db17a8283
children f2f4f136add4
comparison
equal deleted inserted replaced
9283:a37db17a8283 9284:4072adff072e
1019 1019
1020 } while ((get_bits_count(&gb) < substream_data_len[substr] * 8) 1020 } while ((get_bits_count(&gb) < substream_data_len[substr] * 8)
1021 && get_bits1(&gb) == 0); 1021 && get_bits1(&gb) == 0);
1022 1022
1023 skip_bits(&gb, (-get_bits_count(&gb)) & 15); 1023 skip_bits(&gb, (-get_bits_count(&gb)) & 15);
1024 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32 && 1024 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) {
1025 (show_bits_long(&gb, 32) == END_OF_STREAM || 1025 int shorten_by;
1026 show_bits_long(&gb, 20) == 0xd234e)) { 1026
1027 skip_bits(&gb, 18); 1027 if (get_bits(&gb, 16) != 0xD234)
1028 return -1;
1029
1030 shorten_by = get_bits(&gb, 16);
1031 if (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)
1032 s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
1033 else if (m->avctx->codec_id == CODEC_ID_MLP && shorten_by != 0xD234)
1034 return -1;
1035
1028 if (substr == m->max_decoded_substream) 1036 if (substr == m->max_decoded_substream)
1029 av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n"); 1037 av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
1030
1031 if (get_bits1(&gb)) {
1032 int shorten_by = get_bits(&gb, 13);
1033 shorten_by = FFMIN(shorten_by, s->blockpos);
1034 s->blockpos -= shorten_by;
1035 } else
1036 skip_bits(&gb, 13);
1037 } 1038 }
1038 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 16 && 1039 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 16 &&
1039 substream_parity_present[substr]) { 1040 substream_parity_present[substr]) {
1040 uint8_t parity, checksum; 1041 uint8_t parity, checksum;
1041 1042