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

Function avoid_clipping

libavcodec/aacenc.c:740–755  ·  view source on GitHub ↗

* Downscale spectral coefficients for near-clipping windows to avoid artifacts */

Source from the content-addressed store, hash-verified

738 * Downscale spectral coefficients for near-clipping windows to avoid artifacts
739 */
740static void avoid_clipping(AACEncContext *s, SingleChannelElement *sce)
741{
742 int start, i, j, w;
743
744 if (sce->ics.clip_avoidance_factor < 1.0f) {
745 for (w = 0; w < sce->ics.num_windows; w++) {
746 start = 0;
747 for (i = 0; i < sce->ics.max_sfb; i++) {
748 float *swb_coeffs = &sce->coeffs[start + w*128];
749 for (j = 0; j < sce->ics.swb_sizes[i]; j++)
750 swb_coeffs[j] *= sce->ics.clip_avoidance_factor;
751 start += sce->ics.swb_sizes[i];
752 }
753 }
754 }
755}
756
757/**
758 * Encode one channel of audio data.

Callers 1

aac_encode_frameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected