OSDN Git Service

Fix REBASE_PICTURE with h.264
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 5 Apr 2011 22:14:56 +0000 (00:14 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 5 Apr 2011 23:09:04 +0000 (01:09 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo.h

index 3a47ebe..fee75b2 100644 (file)
@@ -686,7 +686,10 @@ typedef struct MpegEncContext {
     void (*denoise_dct)(struct MpegEncContext *s, DCTELEM *block);
 } MpegEncContext;
 
-#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? &new_ctx->picture[pic - old_ctx->picture] : NULL)
+#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
+    (pic >= old_ctx->picture && pic < old_ctx->picture+old_ctx->picture_count ?\
+        &new_ctx->picture[pic - old_ctx->picture] : pic - (Picture*)old_ctx + (Picture*)new_ctx)\
+    : NULL)
 
 void MPV_decode_defaults(MpegEncContext *s);
 int MPV_common_init(MpegEncContext *s);