[FFmpeg-cvslog] r22995 - in trunk/libavcodec: aac.c aacsbr.c aacsbr.h
alexc
subversion
Fri Apr 30 23:43:23 CEST 2010
Author: alexc
Date: Fri Apr 30 23:43:23 2010
New Revision: 22995
Log:
Rewrite ff_sbr_apply in a manner more friendly to PS.
This includes merging ff_sbr_dequant into ff_sbr_apply.
Modified:
trunk/libavcodec/aac.c
trunk/libavcodec/aacsbr.c
trunk/libavcodec/aacsbr.h
Modified: trunk/libavcodec/aac.c
==============================================================================
--- trunk/libavcodec/aac.c Fri Apr 30 23:43:18 2010 (r22994)
+++ trunk/libavcodec/aac.c Fri Apr 30 23:43:23 2010 (r22995)
@@ -1892,15 +1892,12 @@ static void spectral_to_sample(AACContex
apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling);
if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) {
imdct_and_windowing(ac, &che->ch[0], imdct_bias);
- if (ac->m4ac.sbr > 0) {
- ff_sbr_dequant(ac, &che->sbr, type == TYPE_CPE ? TYPE_CPE : TYPE_SCE);
- ff_sbr_apply(ac, &che->sbr, 0, che->ch[0].ret, che->ch[0].ret);
- }
- }
if (type == TYPE_CPE) {
imdct_and_windowing(ac, &che->ch[1], imdct_bias);
- if (ac->m4ac.sbr > 0)
- ff_sbr_apply(ac, &che->sbr, 1, che->ch[1].ret, che->ch[1].ret);
+ }
+ if (ac->m4ac.sbr > 0) {
+ ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret);
+ }
}
if (type <= TYPE_CCE)
apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling);
Modified: trunk/libavcodec/aacsbr.c
==============================================================================
--- trunk/libavcodec/aacsbr.c Fri Apr 30 23:43:18 2010 (r22994)
+++ trunk/libavcodec/aacsbr.c Fri Apr 30 23:43:23 2010 (r22995)
@@ -1709,20 +1709,19 @@ static void sbr_hf_assemble(float Y[2][3
ch_data->f_indexsine = indexsine;
}
-void ff_sbr_dequant(AACContext *ac, SpectralBandReplication *sbr, int id_aac)
+void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
+ float* L, float* R)
{
+ int downsampled = ac->m4ac.ext_sample_rate < sbr->sample_rate;
+ int ch;
+ int nch = (id_aac == TYPE_CPE) ? 2 : 1;
+
if (sbr->start) {
sbr_dequant(sbr, id_aac);
}
-}
-
-void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int ch,
- const float* in, float* out)
-{
- int downsampled = ac->m4ac.ext_sample_rate < sbr->sample_rate;
-
+ for (ch = 0; ch < nch; ch++) {
/* decode channel */
- sbr_qmf_analysis(&ac->dsp, &sbr->rdft, in, sbr->data[ch].analysis_filterbank_samples,
+ sbr_qmf_analysis(&ac->dsp, &sbr->rdft, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
(float*)sbr->qmf_filter_scratch,
sbr->data[ch].W, 1/(-1024 * ac->sf_scale));
sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W);
@@ -1743,9 +1742,16 @@ void ff_sbr_apply(AACContext *ac, Spectr
/* synthesis */
sbr_x_gen(sbr, sbr->X, sbr->X_low, sbr->data[ch].Y, ch);
- sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, out, sbr->X, sbr->qmf_filter_scratch,
- sbr->data[ch].synthesis_filterbank_samples,
- &sbr->data[ch].synthesis_filterbank_samples_offset,
+ }
+ sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X, sbr->qmf_filter_scratch,
+ sbr->data[0].synthesis_filterbank_samples,
+ &sbr->data[0].synthesis_filterbank_samples_offset,
downsampled,
ac->add_bias, -1024 * ac->sf_scale);
+ if (nch == 2)
+ sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X, sbr->qmf_filter_scratch,
+ sbr->data[1].synthesis_filterbank_samples,
+ &sbr->data[1].synthesis_filterbank_samples_offset,
+ downsampled,
+ ac->add_bias, -1024 * ac->sf_scale);
}
Modified: trunk/libavcodec/aacsbr.h
==============================================================================
--- trunk/libavcodec/aacsbr.h Fri Apr 30 23:43:18 2010 (r22994)
+++ trunk/libavcodec/aacsbr.h Fri Apr 30 23:43:23 2010 (r22995)
@@ -42,10 +42,8 @@ av_cold void ff_aac_sbr_ctx_close(Spectr
/** Decode one SBR element. */
int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
GetBitContext *gb, int crc, int cnt, int id_aac);
-/** Dequantized all channels in one SBR element. */
-void ff_sbr_dequant(AACContext *ac, SpectralBandReplication *sbr, int id_aac);
-/** Apply dequantized SBR to a single AAC channel. */
-void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int ch,
- const float* in, float* out);
+/** Apply one SBR element to one AAC element. */
+void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
+ float* L, float *R);
#endif /* AVCODEC_AACSBR_H */
More information about the ffmpeg-cvslog
mailing list