---
libavcodec/h264.c | 6 +++---
libavcodec/mpegvideo.c | 6 +++---
libavcodec/mpegvideo.h | 1 +
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 09210f0..dc05116 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2349,7 +2349,7 @@ static void copy_picture_range(Picture **to, Picture **from, int count, MpegEncC
int i;
for (i=0; i<count; i++){
- to[i] = from[i] ? &new_base->picture[from[i] - old_base->picture] : NULL;
+ to[i] = REBASE_PICTURE(from[i], new_base, old_base);
}
}
@@ -2408,8 +2408,8 @@ static int decode_update_context(AVCodecContext *dst, AVCodecContext *src){
copy_picture_range(h->short_ref, h1->short_ref, h->short_ref_count, s, s1);
copy_picture_range(h->long_ref, h1->long_ref, h->long_ref_count, s, s1);
copy_picture_range(h->delayed_pic, h1->delayed_pic, MAX_DELAYED_PIC_COUNT, s, s1);
- h->delayed_output_pic = h1->delayed_output_pic ? &s->picture[h1->delayed_output_pic - s1->picture] : NULL;
- h->next_delayed_output_pic = h1->next_delayed_output_pic ? &s->picture[h1->next_delayed_output_pic - s1->picture] : NULL;
+ h->delayed_output_pic = REBASE_PICTURE(h1->delayed_output_pic, s, s1);
+ h->next_delayed_output_pic = REBASE_PICTURE(h1->next_delayed_output_pic, s, s1);
h->prev_frame_num_offset= h->frame_num_offset;
h->prev_frame_num= h->frame_num;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 90c5854..89e6ae4 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -372,9 +372,9 @@ void MPV_update_picture_pointers(MpegEncContext *dst, MpegEncContext *src){
dst->height = src->height;
dst->width = src->width;
- dst->last_picture_ptr = src->last_picture_ptr ? &dst->picture[src->last_picture_ptr - src->picture] : NULL;
- dst->current_picture_ptr = src->current_picture_ptr ? &dst->picture[src->current_picture_ptr - src->picture] : NULL;
- dst->next_picture_ptr = src->next_picture_ptr ? &dst->picture[src->next_picture_ptr - src->picture] : NULL;
+ dst->last_picture_ptr = REBASE_PICTURE(src->last_picture_ptr, dst, src);
+ dst->current_picture_ptr = REBASE_PICTURE(src->current_picture_ptr, dst, src);
+ dst->next_picture_ptr = REBASE_PICTURE(src->next_picture_ptr, dst, src);
dst->coded_picture_number = src->coded_picture_number;
dst->picture_number = src->picture_number;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 02ae738..a8c78ac 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -670,6 +670,7 @@ 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)
void MPV_decode_defaults(MpegEncContext *s);
int MPV_common_init(MpegEncContext *s);
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc