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

ramiro subversion at mplayerhq.hu
Sun Aug 24 18:17:09 CEST 2008


Author: ramiro
Date: Sun Aug 24 18:17:09 2008
New Revision: 3587

Log:
Add stub function to determine the best parameters for each access unit.
This function will work on data collected for many different parameters (that are not yet
being collected).

Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Sun Aug 24 18:17:09 2008
@@ -133,6 +133,9 @@ typedef struct {
     ChannelParams   restart_channel_params[MAX_CHANNELS];
     DecodingParams  restart_decoding_params[MAX_SUBSTREAMS];
 
+    ChannelParams   major_channel_params[MAJOR_HEADER_INTERVAL][MAX_SUBBLOCKS][MAX_CHANNELS];       ///< ChannelParams to be written to bitstream.
+    DecodingParams  major_decoding_params[MAJOR_HEADER_INTERVAL][MAX_SUBBLOCKS][MAX_SUBSTREAMS];    ///< DecodingParams to be written to bitstream.
+
     ChannelParams  *cur_channel_params;
     DecodingParams *cur_decoding_params;
     RestartHeader  *cur_restart_header;
@@ -1524,8 +1527,8 @@ static uint8_t *write_substrs(MLPEncodeC
 
         for (subblock = 0; subblock <= num_subblocks; subblock++) {
 
-            ctx->cur_decoding_params = &ctx->decoding_params[ctx->frame_index][subblock][substr];
-            ctx->cur_channel_params = ctx->channel_params[ctx->frame_index][subblock];
+            ctx->cur_decoding_params = &ctx->major_decoding_params[ctx->frame_index][subblock][substr];
+            ctx->cur_channel_params = ctx->major_channel_params[ctx->frame_index][subblock];
 
             params_changed = ctx->params_changed[ctx->frame_index][subblock][substr];
 
@@ -1668,6 +1671,16 @@ static void input_to_sample_buffer(MLPEn
     }
 }
 
+/** Analyzes all collected bitcounts and selects the best parameters for each
+ *  individual access unit.
+ *  TODO This is just a stub!
+ */
+static void set_major_params(MLPEncodeContext *ctx)
+{
+    memcpy(ctx->major_channel_params, ctx->channel_params, sizeof(ctx->channel_params));
+    memcpy(ctx->major_decoding_params, ctx->decoding_params, sizeof(ctx->decoding_params));
+}
+
 static int mlp_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size,
                             void *data)
 {
@@ -1713,6 +1726,10 @@ static int mlp_encode_frame(AVCodecConte
 
     restart_frame = !ctx->frame_index;
 
+    if (restart_frame) {
+        set_major_params(ctx);
+    }
+
     avctx->coded_frame->key_frame = restart_frame;
 
     bytes_written = write_access_unit(ctx, buf, buf_size, restart_frame);



More information about the FFmpeg-soc mailing list