[FFmpeg-soc] [PATCH 8/9] Obfusticate the mimic decoder to make the context copyable earlier.

Alexander Strange astrange at ithinksw.com
Thu May 29 05:59:27 CEST 2008


Flaw of git-format-email: the original commit message is a bad email  
subject, but it's better next to the name of the file.
Is there a better solution for this?
---
  libavcodec/mimic.c |   12 +++++++++---
  1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index bbb9229..530692a 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -51,6 +51,9 @@ typedef struct {
      ScanTable       scantable;
      DSPContext      dsp;
      VLC             vlc;
+
+    int             next_cur_index;
+    int             next_prev_index;
  } MimicContext;

  static const uint32_t huffcodes[] = {
@@ -329,6 +332,10 @@ static int mimic_decode_frame(AVCodecContext  
*avctx, void *data,
          return -1;
      }

+    ctx->next_prev_index = ctx->cur_index;
+    ctx->next_cur_index = ctx->cur_index - 1;
+    ctx->next_cur_index &= 15;
+
      prepare_avpic(ctx, &ctx->flipped_ptrs[ctx->cur_index],
                    (AVPicture*) &ctx->buf_ptrs[ctx->cur_index]);

@@ -351,9 +358,8 @@ static int mimic_decode_frame(AVCodecContext  
*avctx, void *data,
      *(AVFrame*)data = ctx->buf_ptrs[ctx->cur_index];
      *data_size = sizeof(AVFrame);

-    ctx->prev_index = ctx->cur_index;
-    ctx->cur_index--;
-    ctx->cur_index &= 15;
+    ctx->prev_index = ctx->next_prev_index;
+    ctx->cur_index = ctx->next_cur_index;

      /* Only release frames that aren't used for backreferences  
anymore */
      if(ctx->buf_ptrs[ctx->cur_index].data[0])
-- 
1.5.5.1





More information about the FFmpeg-soc mailing list