---
 libavcodec/mpegvideo.c |   96 +++++++++++++++++++++++-------------------------
 libavcodec/mpegvideo.h |    1 -
 2 files changed, 46 insertions(+), 51 deletions(-)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 89e6ae4..fa1b00a 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -363,55 +363,6 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){
 //STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
 }
 
-void MPV_update_picture_pointers(MpegEncContext *dst, MpegEncContext *src){
-    memcpy(dst->picture, src->picture, src->picture_count * sizeof(Picture));
-    memcpy(dst->prev_pict_types, src->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE);
-
-    dst->avctx->coded_height  = src->avctx->coded_height;
-    dst->avctx->coded_width   = src->avctx->coded_width;
-    dst->height               = src->height;
-    dst->width                = src->width;
-
-    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;
-    dst->input_picture_number = src->input_picture_number;
-
-    dst->last_pict_type       = src->pict_type;
-    if (src->current_picture_ptr) dst->last_lambda_for[src->pict_type] = src->current_picture_ptr->quality;
-
-    if(src->pict_type!=FF_B_TYPE){
-        dst->last_non_b_pict_type= src->pict_type;
-    }
-
-    //copy mpeg4 pts info
-    memcpy(&dst->time_increment_bits, &src->time_increment_bits, (char*)&src->shape - (char*)&src->time_increment_bits);
-
-    //memcpy(dst->mbintra_table, src->mbintra_table, mb_array_size);  //FIXME why does copying this break decoding?
-
-    if (src->bitstream_buffer) {
-        dst->bitstream_buffer      = av_fast_realloc(dst->bitstream_buffer, &dst->allocated_bitstream_buffer_size, src->allocated_bitstream_buffer_size);
-        dst->bitstream_buffer_size = src->bitstream_buffer_size;
-        memcpy(dst->bitstream_buffer, src->bitstream_buffer, src->bitstream_buffer_size);
-    }
-
-    dst->avctx->idct_algo    = src->avctx->idct_algo;
-
-    dst->divx_packed         = src->divx_packed;
-    dst->workaround_bugs     = src->workaround_bugs;
-    dst->next_p_frame_damaged= src->next_p_frame_damaged;
-
-    dst->max_b_frames        = src->max_b_frames;
-    dst->picture_structure   = src->picture_structure;
-    dst->first_field         = src->first_field;
-    dst->avctx->has_b_frames = src->avctx->has_b_frames;
-    dst->low_delay           = src->low_delay;
-    dst->dropable            = src->dropable;
-}
-
 int ff_mpeg_update_context(AVCodecContext *dst, AVCodecContext *src)
 {
     MpegEncContext *s = dst->priv_data, *s1 = src->priv_data;
@@ -431,7 +382,52 @@ int ff_mpeg_update_context(AVCodecContext *dst, AVCodecContext *src)
         MPV_common_init(s);
     }
 
-    MPV_update_picture_pointers(s, s1);
+    memcpy(s->picture, s1->picture, s1->picture_count * sizeof(Picture));
+    memcpy(s->prev_pict_types, s1->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE);
+
+    s->avctx->coded_height  = s1->avctx->coded_height;
+    s->avctx->coded_width   = s1->avctx->coded_width;
+    s->height               = s1->height;
+    s->width                = s1->width;
+
+    s->last_picture_ptr     = REBASE_PICTURE(s1->last_picture_ptr,    s, s1);
+    s->current_picture_ptr  = REBASE_PICTURE(s1->current_picture_ptr, s, s1);
+    s->next_picture_ptr     = REBASE_PICTURE(s1->next_picture_ptr,    s, s1);
+
+    s->coded_picture_number = s1->coded_picture_number;
+    s->picture_number       = s1->picture_number;
+    s->input_picture_number = s1->input_picture_number;
+
+    s->last_pict_type       = s1->pict_type;
+    if (s1->current_picture_ptr) s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->quality;
+
+    if(s1->pict_type!=FF_B_TYPE){
+        s->last_non_b_pict_type= s1->pict_type;
+    }
+
+    //copy mpeg4 pts info
+    memcpy(&s->time_increment_bits, &s1->time_increment_bits, (char*)&s1->shape - (char*)&s1->time_increment_bits);
+
+    //memcpy(s->mbintra_table, s1->mbintra_table, mb_array_size);  //FIXME why does copying this break decoding?
+
+    if (s1->bitstream_buffer) {
+        s->bitstream_buffer      = av_fast_realloc(s->bitstream_buffer, &s->allocated_bitstream_buffer_size, s1->allocated_bitstream_buffer_size);
+        s->bitstream_buffer_size = s1->bitstream_buffer_size;
+        memcpy(s->bitstream_buffer, s1->bitstream_buffer, s1->bitstream_buffer_size);
+    }
+
+    s->avctx->idct_algo    = s1->avctx->idct_algo;
+
+    s->divx_packed         = s1->divx_packed;
+    s->workaround_bugs     = s1->workaround_bugs;
+    s->next_p_frame_damaged= s1->next_p_frame_damaged;
+
+    s->max_b_frames        = s1->max_b_frames;
+    s->picture_structure   = s1->picture_structure;
+    s->first_field         = s1->first_field;
+    s->avctx->has_b_frames = s1->avctx->has_b_frames;
+    s->low_delay           = s1->low_delay;
+    s->dropable            = s1->dropable;
 
     return 0;
 }
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index a8c78ac..38e4bac 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -695,7 +695,6 @@ void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
 int ff_find_unused_picture(MpegEncContext *s, int shared);
 void ff_denoise_dct(MpegEncContext *s, DCTELEM *block);
 void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
-void MPV_update_picture_pointers(MpegEncContext *dst, MpegEncContext *src);
 int MPV_lowest_referenced_row(MpegEncContext *s, int dir);
 void MPV_report_decode_progress(MpegEncContext *s);
 int ff_mpeg_update_context(AVCodecContext *dst, AVCodecContext *src);
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to