mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-13 18:40:03 +01:00
aacdec: move fixed-point clipping to a separate function
This commit is contained in:
@@ -554,6 +554,21 @@ static void AAC_RENAME(imdct_and_windowing_eld)(AACDecContext *ac, SingleChannel
|
|||||||
memcpy( saved, buf, n * sizeof(*saved));
|
memcpy( saved, buf, n * sizeof(*saved));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void AAC_RENAME(clip_output)(AACDecContext *ac, ChannelElement *che,
|
||||||
|
int type, int samples)
|
||||||
|
{
|
||||||
|
#if USE_FIXED
|
||||||
|
/* preparation for resampler */
|
||||||
|
for (int j = 0; j < samples; j++){
|
||||||
|
che->ch[0].output_fixed[j] = (int32_t)av_clip64((int64_t)che->ch[0].output_fixed[j]*128,
|
||||||
|
INT32_MIN, INT32_MAX-0x8000)+0x8000;
|
||||||
|
if (type == TYPE_CPE || (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1))
|
||||||
|
che->ch[1].output_fixed[j] = (int32_t)av_clip64((int64_t)che->ch[1].output_fixed[j]*128,
|
||||||
|
INT32_MIN, INT32_MAX-0x8000)+0x8000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
const AACDecDSP AAC_RENAME(aac_dsp) = {
|
const AACDecDSP AAC_RENAME(aac_dsp) = {
|
||||||
.init_tables = &AAC_RENAME(init_tables),
|
.init_tables = &AAC_RENAME(init_tables),
|
||||||
|
|
||||||
@@ -571,4 +586,6 @@ const AACDecDSP AAC_RENAME(aac_dsp) = {
|
|||||||
|
|
||||||
.apply_dependent_coupling = AAC_RENAME(apply_dependent_coupling),
|
.apply_dependent_coupling = AAC_RENAME(apply_dependent_coupling),
|
||||||
.apply_independent_coupling = AAC_RENAME(apply_independent_coupling),
|
.apply_independent_coupling = AAC_RENAME(apply_independent_coupling),
|
||||||
|
|
||||||
|
.clip_output = AAC_RENAME(clip_output),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -239,6 +239,8 @@ typedef struct AACDecDSP {
|
|||||||
void (*imdct_and_windowing_960)(AACDecContext *ac, SingleChannelElement *sce);
|
void (*imdct_and_windowing_960)(AACDecContext *ac, SingleChannelElement *sce);
|
||||||
void (*imdct_and_windowing_ld)(AACDecContext *ac, SingleChannelElement *sce);
|
void (*imdct_and_windowing_ld)(AACDecContext *ac, SingleChannelElement *sce);
|
||||||
void (*imdct_and_windowing_eld)(AACDecContext *ac, SingleChannelElement *sce);
|
void (*imdct_and_windowing_eld)(AACDecContext *ac, SingleChannelElement *sce);
|
||||||
|
|
||||||
|
void (*clip_output)(AACDecContext *ac, ChannelElement *che, int type, int samples);
|
||||||
} AACDecDSP;
|
} AACDecDSP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2129,20 +2129,7 @@ static void spectral_to_sample(AACDecContext *ac, int samples)
|
|||||||
}
|
}
|
||||||
if (type <= TYPE_CCE)
|
if (type <= TYPE_CCE)
|
||||||
apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, ac->dsp.apply_independent_coupling);
|
apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, ac->dsp.apply_independent_coupling);
|
||||||
|
ac->dsp.clip_output(ac, che, type, samples);
|
||||||
#if USE_FIXED
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
/* preparation for resampler */
|
|
||||||
for(j = 0; j<samples; j++){
|
|
||||||
che->ch[0].output_fixed[j] = (int32_t)av_clip64((int64_t)che->ch[0].output_fixed[j]*128,
|
|
||||||
INT32_MIN, INT32_MAX-0x8000)+0x8000;
|
|
||||||
if (type == TYPE_CPE || (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1))
|
|
||||||
che->ch[1].output_fixed[j] = (int32_t)av_clip64((int64_t)che->ch[1].output_fixed[j]*128,
|
|
||||||
INT32_MIN, INT32_MAX-0x8000)+0x8000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* USE_FIXED */
|
|
||||||
che->present = 0;
|
che->present = 0;
|
||||||
} else if (che) {
|
} else if (che) {
|
||||||
av_log(ac->avctx, AV_LOG_VERBOSE, "ChannelElement %d.%d missing \n", type, i);
|
av_log(ac->avctx, AV_LOG_VERBOSE, "ChannelElement %d.%d missing \n", type, i);
|
||||||
|
|||||||
Reference in New Issue
Block a user