[FFmpeg-cvslog] apedec: do not unnecessarily zero output samples for mono frames

Justin Ruggles git at videolan.org
Wed Feb 8 06:04:54 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Feb  6 16:34:50 2012 -0500| [39575eead279662a27d9d585d14b96ec639be8ad] | committer: Justin Ruggles

apedec: do not unnecessarily zero output samples for mono frames

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

 libavcodec/apedec.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 438d833..028c29c 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -474,16 +474,10 @@ static void entropy_decode(APEContext *ctx, int blockstodecode, int stereo)
     int32_t *decoded0 = ctx->decoded[0];
     int32_t *decoded1 = ctx->decoded[1];
 
-    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
-        /* We are pure silence, just memset the output buffer. */
-        memset(decoded0, 0, blockstodecode * sizeof(*decoded0));
-        memset(decoded1, 0, blockstodecode * sizeof(*decoded1));
-    } else {
-        while (blockstodecode--) {
-            *decoded0++ = ape_decode_value(ctx, &ctx->riceY);
-            if (stereo)
-                *decoded1++ = ape_decode_value(ctx, &ctx->riceX);
-        }
+    while (blockstodecode--) {
+        *decoded0++ = ape_decode_value(ctx, &ctx->riceY);
+        if (stereo)
+            *decoded1++ = ape_decode_value(ctx, &ctx->riceX);
     }
 }
 
@@ -778,7 +772,6 @@ static int init_frame_decoder(APEContext *ctx)
 static void ape_unpack_mono(APEContext *ctx, int count)
 {
     if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
-        entropy_decode(ctx, count, 0);
         /* We are pure silence, so we're done. */
         av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n");
         return;



More information about the ffmpeg-cvslog mailing list