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

ramiro subversion at mplayerhq.hu
Sat Aug 9 20:35:37 CEST 2008


Author: ramiro
Date: Sat Aug  9 20:35:37 2008
New Revision: 3096

Log:
Don't cast 'sample' to different bit depths all over the place.

Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Sat Aug  9 20:35:37 2008
@@ -545,8 +545,8 @@ static void input_data(MLPEncodeContext 
         for (channel = 0; channel <= rh->max_channel; channel++) {
             for (i = 0; i < dp->blocksize; i++) {
                 int32_t sample = samples[i * (rh->max_channel + 1) + channel];
-                sample = (sample << 8) & 0x00ffffff;
-                lossless_check_data_temp ^= sample << channel;
+                sample <<= 8;
+                lossless_check_data_temp ^= (sample & 0x00ffffff) << channel;
                 ctx->sample_buffer[i][channel] = sample;
             }
         }
@@ -597,7 +597,7 @@ static void apply_filter(MLPEncodeContex
     }
 
     for (i = 0; i < ctx->avctx->frame_size; i++) {
-        int32_t sample = (int32_t) ((int16_t)(ctx->sample_buffer[i][channel] >> 8)) << 8;
+        int32_t sample = ctx->sample_buffer[i][channel];
         unsigned int order;
         int64_t accum = 0;
         int32_t residual;
@@ -722,7 +722,7 @@ static void codebook_bits_offset(MLPEnco
     mask   = unsign - 1;
 
     for (i = 0; i < dp->blocksize; i++) {
-        int32_t sample = (int16_t) (ctx->sample_buffer[i][channel] >> 8);
+        int32_t sample = ctx->sample_buffer[i][channel] >> 8;
         int temp_next;
 
         sample  -= offset;
@@ -857,7 +857,7 @@ static void write_block_data(MLPEncodeCo
 
     for (i = 0; i < dp->blocksize; i++) {
         for (ch = rh->min_channel; ch <= rh->max_channel; ch++) {
-            int32_t sample = (int16_t) (ctx->sample_buffer[i][ch] >> 8);
+            int32_t sample = ctx->sample_buffer[i][ch] >> 8;
 
             sample -= offset[ch];
             sample += unsign[ch];



More information about the FFmpeg-soc mailing list