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

Function lfe_downsample

libavcodec/dcaenc.c:414–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414static void lfe_downsample(DCAEncContext *c, const int32_t *input)
415{
416 /* FIXME: make 128x LFE downsampling possible */
417 const int lfech = lfe_index[c->channel_config];
418 int i, j, lfes;
419 int32_t hist[512];
420 int32_t accum;
421 int hist_start = 0;
422
423 memcpy(hist, &c->history[c->channels - 1][0], 512 * sizeof(int32_t));
424
425 for (lfes = 0; lfes < DCA_LFE_SAMPLES; lfes++) {
426 /* Calculate the convolution */
427 accum = 0;
428
429 for (i = hist_start, j = 0; i < 512; i++, j++)
430 accum += mul32(hist[i], c->lfe_fir_64i[j]);
431 for (i = 0; i < hist_start; i++, j++)
432 accum += mul32(hist[i], c->lfe_fir_64i[j]);
433
434 c->downsampled_lfe[lfes] = accum;
435
436 /* Copy in 64 new samples from input */
437 for (i = 0; i < 64; i++)
438 hist[i + hist_start] = input[(lfes * 64 + i) * c->channels + lfech];
439
440 hist_start = (hist_start + 64) & 511;
441 }
442}
443
444static uint32_t dca_vlc_calc_alloc_bits(const int values[], uint8_t n, uint8_t sel)
445{

Callers 1

encode_frameFunction · 0.85

Calls 1

mul32Function · 0.85

Tested by

no test coverage detected