[FFmpeg-soc] [soc]: r3634 - mlp/mlpenc.c

ramiro subversion at mplayerhq.hu
Wed Aug 27 02:28:53 CEST 2008


Author: ramiro
Date: Wed Aug 27 02:28:53 2008
New Revision: 3634

Log:
Follow pengvado's doctrine:
<pengvado> I still don't believe in "offset"

Always use offset = 0 for filtered samples. Besides reducing the overhead of
changing parameters all the time, this improves compression by about 2%, and
reduces encoding time by about 35%.


Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Wed Aug 27 02:28:53 2008
@@ -1547,10 +1547,11 @@ static void determine_bits(MLPEncodeCont
     unsigned int channel;
 
     for (channel = 0; channel <= rh->max_channel; channel++) {
+        ChannelParams *cp = &ctx->cur_channel_params[channel];
         int32_t *sample_buffer = ctx->sample_buffer + channel;
         int32_t min = INT32_MAX, max = INT32_MIN;
         int average = 0;
-        int offset;
+        int offset = 0;
         int i;
 
         /* Determine extremes and average. */
@@ -1567,6 +1568,7 @@ static void determine_bits(MLPEncodeCont
 
         no_codebook_bits(ctx, channel, min, max, &ctx->cur_best_offset[channel][0]);
 
+        if (!cp->filter_params[FIR].order)
         offset = av_clip(average, HUFF_OFFSET_MIN, HUFF_OFFSET_MAX);
 
         for (i = 1; i < NUM_CODEBOOKS; i++) {
@@ -1577,12 +1579,14 @@ static void determine_bits(MLPEncodeCont
                                  min, max, offset,
                                  &temp_bo);
 
+            if (!cp->filter_params[FIR].order) {
             offset_max = temp_bo.max;
 
             codebook_bits(ctx, channel, i - 1, temp_bo.min - 1,
                           min, max, &temp_bo, 0);
             codebook_bits(ctx, channel, i - 1, offset_max + 1,
                           min, max, &temp_bo, 1);
+            }
 
             ctx->cur_best_offset[channel][i] = temp_bo;
         }



More information about the FFmpeg-soc mailing list