[FFmpeg-cvslog] apedec: remove unneeded entropy decoder normalization.

Justin Ruggles git at videolan.org
Fri Nov 11 02:53:06 CET 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Oct 31 14:57:04 2011 -0400| [ad17207b517508c95aa9bd1f67e7beb6d09af52f] | committer: Justin Ruggles

apedec: remove unneeded entropy decoder normalization.

The decoder already skips data at the end of the packet without this.
Also remove 2 APEContext fields that were only used for the end-of-frame
normalization.

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

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

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index e906903..0619358 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -140,8 +140,6 @@ typedef struct APEContext {
 
     uint32_t CRC;                            ///< frame CRC
     int frameflags;                          ///< frame flags
-    int currentframeblocks;                  ///< samples (per channel) in current frame
-    int blocksdecoded;                       ///< count of decoded samples in current frame
     APEPredictor predictor;                  ///< predictor used for final reconstruction
 
     int32_t decoded0[BLOCKS_PER_LOOP];       ///< decoded data for the first channel
@@ -457,8 +455,6 @@ static void entropy_decode(APEContext *ctx, int blockstodecode, int stereo)
     int32_t *decoded0 = ctx->decoded0;
     int32_t *decoded1 = ctx->decoded1;
 
-    ctx->blocksdecoded = blockstodecode;
-
     if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
         /* We are pure silence, just memset the output buffer. */
         memset(decoded0, 0, blockstodecode * sizeof(int32_t));
@@ -470,9 +466,6 @@ static void entropy_decode(APEContext *ctx, int blockstodecode, int stereo)
                 *decoded1++ = ape_decode_value(ctx, &ctx->riceX);
         }
     }
-
-    if (ctx->blocksdecoded == ctx->currentframeblocks)
-        range_dec_normalize(ctx);   /* normalize to use up all bytes */
 }
 
 static int init_entropy_decoder(APEContext *ctx)
@@ -492,9 +485,6 @@ static int init_entropy_decoder(APEContext *ctx)
         ctx->frameflags = bytestream_get_be32(&ctx->ptr);
     }
 
-    /* Keep a count of the blocks decoded in this frame */
-    ctx->blocksdecoded = 0;
-
     /* Initialize the rice structs */
     ctx->riceX.k = 10;
     ctx->riceX.ksum = (1 << ctx->riceX.k) * 16;
@@ -873,7 +863,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
             av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %u.\n", nblocks);
             return AVERROR_INVALIDDATA;
         }
-        s->currentframeblocks = s->samples = nblocks;
+        s->samples = nblocks;
 
         memset(s->decoded0,  0, sizeof(s->decoded0));
         memset(s->decoded1,  0, sizeof(s->decoded1));



More information about the ffmpeg-cvslog mailing list