| 773 | } |
| 774 | |
| 775 | static int alloc_sample_buffer(DCACoreDecoder *s) |
| 776 | { |
| 777 | int nchsamples = DCA_ADPCM_COEFFS + s->npcmblocks; |
| 778 | int nframesamples = nchsamples * DCA_CHANNELS * DCA_SUBBANDS; |
| 779 | int nlfesamples = DCA_LFE_HISTORY + s->npcmblocks / 2; |
| 780 | unsigned int size = s->subband_size; |
| 781 | int ch, band; |
| 782 | |
| 783 | // Reallocate subband sample buffer |
| 784 | av_fast_mallocz(&s->subband_buffer, &s->subband_size, |
| 785 | (nframesamples + nlfesamples) * sizeof(int32_t)); |
| 786 | if (!s->subband_buffer) |
| 787 | return AVERROR(ENOMEM); |
| 788 | |
| 789 | if (size != s->subband_size) { |
| 790 | for (ch = 0; ch < DCA_CHANNELS; ch++) |
| 791 | for (band = 0; band < DCA_SUBBANDS; band++) |
| 792 | s->subband_samples[ch][band] = s->subband_buffer + |
| 793 | (ch * DCA_SUBBANDS + band) * nchsamples + DCA_ADPCM_COEFFS; |
| 794 | s->lfe_samples = s->subband_buffer + nframesamples; |
| 795 | } |
| 796 | |
| 797 | if (!s->predictor_history) |
| 798 | erase_adpcm_history(s); |
| 799 | |
| 800 | return 0; |
| 801 | } |
| 802 | |
| 803 | static int parse_frame_data(DCACoreDecoder *s, enum HeaderType header, int xch_base) |
| 804 | { |
no test coverage detected