MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / alloc_sample_buffer

Function alloc_sample_buffer

libavcodec/dca_core.c:775–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775static 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
803static int parse_frame_data(DCACoreDecoder *s, enum HeaderType header, int xch_base)
804{

Callers 1

ff_dca_core_parseFunction · 0.70

Calls 2

av_fast_malloczFunction · 0.85
erase_adpcm_historyFunction · 0.85

Tested by

no test coverage detected