[FFmpeg-cvslog] atrac1: decode mono audio directly to output buffer

Justin Ruggles git at videolan.org
Sun Oct 30 02:04:13 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Fri Oct 14 00:22:01 2011 -0400| [9a35ff384124a08209a8ee5355fdec93440d0e37] | committer: Justin Ruggles

atrac1: decode mono audio directly to output buffer

For stereo we need to use intermediate planar buffers, but mono does not need
to be deinterleaved so the output buffer can be used directly.

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

 libavcodec/atrac1.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index 371f21a..4647e0c 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -310,15 +310,11 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
         ret = at1_imdct_block(su, q);
         if (ret < 0)
             return ret;
-        at1_subband_synthesis(q, su, q->out_samples[ch]);
+        at1_subband_synthesis(q, su, q->channels == 1 ? samples : q->out_samples[ch]);
     }
 
     /* interleave; FIXME, should create/use a DSP function */
-    if (q->channels == 1) {
-        /* mono */
-        memcpy(samples, q->out_samples[0], AT1_SU_SAMPLES * 4);
-    } else {
-        /* stereo */
+    if (q->channels == 2) {
         for (i = 0; i < AT1_SU_SAMPLES; i++) {
             samples[i * 2]     = q->out_samples[0][i];
             samples[i * 2 + 1] = q->out_samples[1][i];



More information about the ffmpeg-cvslog mailing list