[FFmpeg-cvslog] adpcm_ima_wav: process channel-interleaved blocks sequentially rather than simultaneously .

Justin Ruggles git at videolan.org
Sat Oct 1 03:06:39 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Fri Sep  9 16:26:11 2011 -0400| [119974b164dd2d09031c61c87c8c59a1819f3a90] | committer: Justin Ruggles

adpcm_ima_wav: process channel-interleaved blocks sequentially rather than simultaneously.

Speeds up the ADPCM IMA WAV decoder by 15-20% overall.

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

 libavcodec/adpcm.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index df316fb..80e36e5 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -448,14 +448,18 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
         }
 
         while(src < buf + buf_size){
-            for(m=0; m<4; m++){
-                for(i=0; i<=st; i++)
-                    *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3);
-                for(i=0; i<=st; i++)
-                    *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4  , 3);
-                src++;
+            for (i = 0; i < avctx->channels; i++) {
+                cs = &c->status[i];
+                for (m = 0; m < 4; m++) {
+                    uint8_t v = *src++;
+                    *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 3);
+                    samples += avctx->channels;
+                    *samples = adpcm_ima_expand_nibble(cs, v >> 4  , 3);
+                    samples += avctx->channels;
+                }
+                samples -= 8 * avctx->channels - 1;
             }
-            src += 4*st;
+            samples += 7 * avctx->channels;
         }
         break;
     case CODEC_ID_ADPCM_4XM:



More information about the ffmpeg-cvslog mailing list