[FFmpeg-cvslog] imc: make IMDCT support stereo output

Kostya Shishkov git at videolan.org
Wed Jun 6 01:20:57 CEST 2012


ffmpeg | branch: master | Kostya Shishkov <kostya.shishkov at gmail.com> | Sat Jun  2 20:35:41 2012 +0200| [34271cabacb20f24ad07bff818e3447330cdd851] | committer: Kostya Shishkov

imc: make IMDCT support stereo output

This will be useful for Indeo Audio decoder which is almost the same
but supports stereo.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34271cabacb20f24ad07bff818e3447330cdd851
---

 libavcodec/imc.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index d53693c..4b8ad7c 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -589,10 +589,12 @@ static void imc_adjust_bit_allocation(IMCContext *q, IMCChannel *chctx,
     }
 }
 
-static void imc_imdct256(IMCContext *q, IMCChannel *chctx)
+static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels)
 {
     int i;
     float re, im;
+    float *dst1 = q->out_samples;
+    float *dst2 = q->out_samples + (COEFFS - 1) * channels;
 
     /* prerotation */
     for (i = 0; i < COEFFS / 2; i++) {
@@ -610,10 +612,12 @@ static void imc_imdct256(IMCContext *q, IMCChannel *chctx)
     for (i = 0; i < COEFFS / 2; i++) {
         re = ( q->samples[i].re * q->post_cos[i]) + (-q->samples[i].im * q->post_sin[i]);
         im = (-q->samples[i].im * q->post_cos[i]) - ( q->samples[i].re * q->post_sin[i]);
-        q->out_samples[i * 2]              =  (q->mdct_sine_window[COEFFS - 1 - i * 2] * chctx->last_fft_im[i])
-                                            + (q->mdct_sine_window[i * 2] * re);
-        q->out_samples[COEFFS - 1 - i * 2] =  (q->mdct_sine_window[i * 2] * chctx->last_fft_im[i])
-                                            - (q->mdct_sine_window[COEFFS - 1 - i * 2] * re);
+        *dst1 =  (q->mdct_sine_window[COEFFS - 1 - i * 2] * chctx->last_fft_im[i])
+               + (q->mdct_sine_window[i * 2] * re);
+        *dst2 =  (q->mdct_sine_window[i * 2] * chctx->last_fft_im[i])
+               - (q->mdct_sine_window[COEFFS - 1 - i * 2] * re);
+        dst1 += channels * 2;
+        dst2 -= channels * 2;
         chctx->last_fft_im[i] = im;
     }
 }
@@ -840,7 +844,7 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
 
     memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
 
-    imc_imdct256(q, chctx);
+    imc_imdct256(q, chctx, avctx->channels);
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list