| 84 | } |
| 85 | |
| 86 | int ff_dca_parse_core_frame_header(DCACoreFrameHeader *h, GetBitContext *gb) |
| 87 | { |
| 88 | if (get_bits_long(gb, 32) != DCA_SYNCWORD_CORE_BE) |
| 89 | return DCA_PARSE_ERROR_SYNC_WORD; |
| 90 | |
| 91 | h->normal_frame = get_bits1(gb); |
| 92 | h->deficit_samples = get_bits(gb, 5) + 1; |
| 93 | if (h->deficit_samples != DCA_PCMBLOCK_SAMPLES) |
| 94 | return DCA_PARSE_ERROR_DEFICIT_SAMPLES; |
| 95 | |
| 96 | h->crc_present = get_bits1(gb); |
| 97 | h->npcmblocks = get_bits(gb, 7) + 1; |
| 98 | if (h->npcmblocks & (DCA_SUBBAND_SAMPLES - 1)) |
| 99 | return DCA_PARSE_ERROR_PCM_BLOCKS; |
| 100 | |
| 101 | h->frame_size = get_bits(gb, 14) + 1; |
| 102 | if (h->frame_size < 96) |
| 103 | return DCA_PARSE_ERROR_FRAME_SIZE; |
| 104 | |
| 105 | h->audio_mode = get_bits(gb, 6); |
| 106 | if (h->audio_mode >= DCA_AMODE_COUNT) |
| 107 | return DCA_PARSE_ERROR_AMODE; |
| 108 | |
| 109 | h->sr_code = get_bits(gb, 4); |
| 110 | if (!ff_dca_sample_rates[h->sr_code]) |
| 111 | return DCA_PARSE_ERROR_SAMPLE_RATE; |
| 112 | |
| 113 | h->br_code = get_bits(gb, 5); |
| 114 | if (get_bits1(gb)) |
| 115 | return DCA_PARSE_ERROR_RESERVED_BIT; |
| 116 | |
| 117 | h->drc_present = get_bits1(gb); |
| 118 | h->ts_present = get_bits1(gb); |
| 119 | h->aux_present = get_bits1(gb); |
| 120 | h->hdcd_master = get_bits1(gb); |
| 121 | h->ext_audio_type = get_bits(gb, 3); |
| 122 | h->ext_audio_present = get_bits1(gb); |
| 123 | h->sync_ssf = get_bits1(gb); |
| 124 | h->lfe_present = get_bits(gb, 2); |
| 125 | if (h->lfe_present == DCA_LFE_FLAG_INVALID) |
| 126 | return DCA_PARSE_ERROR_LFE_FLAG; |
| 127 | |
| 128 | h->predictor_history = get_bits1(gb); |
| 129 | if (h->crc_present) |
| 130 | skip_bits(gb, 16); |
| 131 | h->filter_perfect = get_bits1(gb); |
| 132 | h->encoder_rev = get_bits(gb, 4); |
| 133 | h->copy_hist = get_bits(gb, 2); |
| 134 | h->pcmr_code = get_bits(gb, 3); |
| 135 | if (!ff_dca_bits_per_sample[h->pcmr_code]) |
| 136 | return DCA_PARSE_ERROR_PCM_RES; |
| 137 | |
| 138 | h->sumdiff_front = get_bits1(gb); |
| 139 | h->sumdiff_surround = get_bits1(gb); |
| 140 | h->dn_code = get_bits(gb, 4); |
| 141 | return 0; |
| 142 | } |
| 143 |
no test coverage detected