diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-29 12:04:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-29 12:11:09 +0200 |
commit | 580c86925ddf8c85d2e6f57ed55dd75853748b29 (patch) | |
tree | ece1fac050df9fac73b81b0b8b8fa268d9adcd84 | |
parent | cd63252f1ff61d894a1c3a59fee7d1e49dbfdeb4 (diff) | |
parent | 54986d6db9116ef9704b1ce8414ffdb7f1ca127f (diff) | |
download | ffmpeg-580c86925ddf8c85d2e6f57ed55dd75853748b29.tar.gz |
Merge commit '54986d6db9116ef9704b1ce8414ffdb7f1ca127f'
* commit '54986d6db9116ef9704b1ce8414ffdb7f1ca127f':
h264: move context reinit lower down in update_thread_context()
Conflicts:
libavcodec/h264_slice.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/h264_slice.c | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index fbb6526ecc..9624c36d73 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -436,7 +436,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst, { H264Context *h = dst->priv_data, *h1 = src->priv_data; int inited = h->context_initialized, err = 0; - int context_reinitialized = 0; + int need_reinit = 0; int i, ret; if (dst == src) @@ -451,36 +451,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst, h->sps.chroma_format_idc != h1->sps.chroma_format_idc || h->sps.colorspace != h1->sps.colorspace)) { - h->width = h1->width; - h->height = h1->height; - h->mb_height = h1->mb_height; - h->mb_width = h1->mb_width; - h->mb_num = h1->mb_num; - h->mb_stride = h1->mb_stride; - h->b_stride = h1->b_stride; - // SPS/PPS - if ((ret = copy_parameter_set((void **)h->sps_buffers, - (void **)h1->sps_buffers, - MAX_SPS_COUNT, sizeof(SPS))) < 0) - return ret; - h->sps = h1->sps; - if ((ret = copy_parameter_set((void **)h->pps_buffers, - (void **)h1->pps_buffers, - MAX_PPS_COUNT, sizeof(PPS))) < 0) - return ret; - h->pps = h1->pps; - - if ((err = h264_slice_header_init(h, 1)) < 0) { - av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); - return err; - } - context_reinitialized = 1; - -#if 0 - h264_set_parameter_from_sps(h); - //Note we set context_reinitialized which will cause h264_set_parameter_from_sps to be reexecuted - h->cur_chroma_format_idc = h1->cur_chroma_format_idc; -#endif + need_reinit = 1; } /* copy block_offset since frame_start may not be called */ @@ -624,8 +595,25 @@ int ff_h264_update_thread_context(AVCodecContext *dst, h->frame_recovered = h1->frame_recovered; - if (context_reinitialized) + if (need_reinit) { + h->width = h1->width; + h->height = h1->height; + h->mb_height = h1->mb_height; + h->mb_width = h1->mb_width; + h->mb_num = h1->mb_num; + h->mb_stride = h1->mb_stride; + h->b_stride = h1->b_stride; + + if ((err = h264_slice_header_init(h, 1)) < 0) { + av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed"); + return err; + } + + /* copy block_offset since frame_start may not be called */ + memcpy(h->block_offset, h1->block_offset, sizeof(h->block_offset)); + ff_h264_set_parameter_from_sps(h); + } if (!h->cur_pic_ptr) return 0; |