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

ramiro subversion at mplayerhq.hu
Sun Sep 14 21:31:48 CEST 2008


Author: ramiro
Date: Sun Sep 14 21:31:48 2008
New Revision: 3743

Log:
Write max_huff_lsbs field to restart header.

Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Sun Sep 14 21:31:48 2008
@@ -44,6 +44,8 @@ typedef struct {
     int             data_check_present;  ///< Set if the substream contains extra info to check the size of VLC blocks.
 
     int32_t         lossless_check_data; ///< XOR of all output samples
+
+    uint8_t         max_huff_lsbs;       ///< largest huff_lsbs
 } RestartHeader;
 
 typedef struct {
@@ -809,7 +811,9 @@ static void write_restart_header(MLPEnco
     put_bits(pb,  4, rh->max_matrix_channel);
     put_bits(pb,  4, rh->noise_shift       );
     put_bits(pb, 23, rh->noisegen_seed     );
-    put_bits(pb, 19, 0                     ); /* TODO What the hell is this? */
+    put_bits(pb,  4, 0                     ); /* TODO still unknown */
+    put_bits(pb,  5, rh->max_huff_lsbs     );
+    put_bits(pb, 10, 0                     ); /* TODO still unknown */
     put_bits(pb,  1, rh->data_check_present);
     put_bits(pb,  8, lossless_check        );
     put_bits(pb, 16, 0                     ); /* This is zero =) */
@@ -2053,12 +2057,14 @@ static void set_best_codebook(MLPEncodeC
  */
 static void set_major_params(MLPEncodeContext *ctx)
 {
+    RestartHeader *rh = ctx->cur_restart_header;
     ChannelParams (*channel_params)[ctx->sequence_size][ctx->avctx->channels] =
                  (ChannelParams (*)[ctx->sequence_size][ctx->avctx->channels]) ctx->channel_params;
     DecodingParams (*decoding_params)[ctx->sequence_size][ctx->num_substreams] =
                   (DecodingParams (*)[ctx->sequence_size][ctx->num_substreams]) ctx->decoding_params;
     unsigned int index;
     unsigned int substr;
+    uint8_t max_huff_lsbs = 0;
 
     for (substr = 0; substr < ctx->num_substreams; substr++) {
         DecodingParams (*seq_dp)[ctx->num_substreams] =
@@ -2073,11 +2079,15 @@ static void set_major_params(MLPEncodeCo
         unsigned int channel;
         for (index = 0; index < ctx->seq_size[ctx->restart_intervals-1]; index++) {
             for (channel = 0; channel < ctx->avctx->channels; channel++) {
+                if (max_huff_lsbs < seq_cp[index][channel].huff_lsbs)
+                    max_huff_lsbs = seq_cp[index][channel].huff_lsbs;
                 memcpy(&ctx->major_channel_params[index][channel], &seq_cp[index][channel], sizeof(ChannelParams));
             }
         }
     }
 
+    rh->max_huff_lsbs = max_huff_lsbs;
+
     for (substr = 0; substr < ctx->num_substreams; substr++) {
 
         ctx->cur_restart_header = &ctx->restart_header[substr];



More information about the FFmpeg-soc mailing list