[FFmpeg-cvslog] mpegvideo: simplify REBASE_PICTURE

Anton Khirnov git at videolan.org
Mon Feb 4 13:04:00 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jan 31 20:24:06 2013 +0100| [d9df93efbf59b1dc8b013d174ca4ad9c634c28f7] | committer: Anton Khirnov

mpegvideo: simplify REBASE_PICTURE

Always evaluate to NULL when the source Picture is not located in the
MpegEncContext.picture array. That will only happen for
next/last_picture_ptr when updating the thread context during h264 frame
threaded decoding, where they will point to elements of ref_list. Since
ref_list is not copied during updating the context and is invalid until
it is constructed for the current slice, there is no point in doing
anything complicated with next/last_picture_ptr, as they will get
updated when the ref_list is filled.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9df93efbf59b1dc8b013d174ca4ad9c634c28f7
---

 libavcodec/mpegvideo.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 51e422b..1294d0c 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -712,10 +712,10 @@ typedef struct MpegEncContext {
     int context_reinit;
 } MpegEncContext;
 
-#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] : (Picture*) ((uint8_t*)pic - (uint8_t*)old_ctx + (uint8_t*)new_ctx))\
-    : 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] : NULL)
 
 /* mpegvideo_enc common options */
 #define FF_MPV_FLAG_SKIP_RD      0x0001



More information about the ffmpeg-cvslog mailing list