forked from FFmpeg/FFmpeg
aacdec: move fixed-point clipping to a separate function
This commit is contained in:
parent
87a93a5670
commit
41c04bec0a
3 changed files with 20 additions and 14 deletions
|
@ -554,6 +554,21 @@ static void AAC_RENAME(imdct_and_windowing_eld)(AACDecContext *ac, SingleChannel
|
|||
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) = {
|
||||
.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_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_ld)(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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2129,20 +2129,7 @@ static void spectral_to_sample(AACDecContext *ac, int samples)
|
|||
}
|
||||
if (type <= TYPE_CCE)
|
||||
apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, ac->dsp.apply_independent_coupling);
|
||||
|
||||
#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 */
|
||||
ac->dsp.clip_output(ac, che, type, samples);
|
||||
che->present = 0;
|
||||
} else if (che) {
|
||||
av_log(ac->avctx, AV_LOG_VERBOSE, "ChannelElement %d.%d missing \n", type, i);
|
||||
|
|
Loading…
Add table
Reference in a new issue