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

ramiro subversion at mplayerhq.hu
Sun Aug 24 17:19:03 CEST 2008


Author: ramiro
Date: Sun Aug 24 17:19:03 2008
New Revision: 3581

Log:
Move analysis of data to right after it's read.

Modified:
   mlp/mlpenc.c

Modified: mlp/mlpenc.c
==============================================================================
--- mlp/mlpenc.c	(original)
+++ mlp/mlpenc.c	Sun Aug 24 17:19:03 2008
@@ -1714,8 +1714,37 @@ static int mlp_encode_frame(AVCodecConte
     restart_frame = !(avctx->frame_number % ctx->major_header_interval);
 
     if (restart_frame) {
+        avctx->coded_frame->key_frame = 1;
+    } else {
+        avctx->coded_frame->key_frame = 0;
+    }
+
+    bytes_written = write_access_unit(ctx, buf, buf_size, restart_frame);
+
+    ctx->timestamp += ctx->frame_size[ctx->frame_index];
+
+input_and_return:
+
+    if (data) {
+        ctx->frame_size[ctx->frame_index] = avctx->frame_size;
+        ctx->next_major_frame_size += avctx->frame_size;
+        input_data(ctx, data);
+    } else if (!ctx->last_frame) {
+        ctx->last_frame = ctx->input_buffer;
+    }
+
+    ctx->frame_index = (avctx->frame_number + 1) % ctx->major_header_interval;
+    restart_frame = !((avctx->frame_number + 1) % ctx->major_header_interval);
+
+    if (restart_frame) {
         unsigned int index, subblock;
 
+        ctx->sample_buffer = ctx->major_frame_buffer
+                           + ctx->frame_index * ctx->one_sample_buffer_size;
+
+        ctx->input_buffer = ctx->major_input_buffer
+                          + ctx->frame_index * ctx->input_buffer_frame_size;
+
         for (index = 0; index < MAJOR_HEADER_INTERVAL; index++)
             for (subblock = 0; subblock < MAX_SUBBLOCKS; subblock++)
                 clear_channel_params(ctx->channel_params[index][subblock]);
@@ -1765,24 +1794,6 @@ static int mlp_encode_frame(AVCodecConte
                 }
             }
         }
-
-        avctx->coded_frame->key_frame = 1;
-    } else {
-        avctx->coded_frame->key_frame = 0;
-    }
-
-    bytes_written = write_access_unit(ctx, buf, buf_size, restart_frame);
-
-    ctx->timestamp += ctx->frame_size[ctx->frame_index];
-
-input_and_return:
-
-    if (data) {
-        ctx->frame_size[ctx->frame_index] = avctx->frame_size;
-        ctx->next_major_frame_size += avctx->frame_size;
-        input_data(ctx, data);
-    } else if (!ctx->last_frame) {
-        ctx->last_frame = ctx->input_buffer;
     }
 
     return bytes_written;



More information about the FFmpeg-soc mailing list