mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-03 06:27:44 +08:00
avcodec/mpegvideo: Defer init of enc slice ctxs in ff_mpv_common_init()
This will allow to perform initializations between ff_mpv_common_init() and ff_mpv_init_duplicate_contexts() that will be automatically copied to the slice contexts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -431,9 +431,11 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
|
|||||||
s->slice_context_count = nb_slices;
|
s->slice_context_count = nb_slices;
|
||||||
|
|
||||||
// if (s->width && s->height) {
|
// if (s->width && s->height) {
|
||||||
ret = ff_mpv_init_duplicate_contexts(s);
|
if (!s->encoding) {
|
||||||
if (ret < 0)
|
ret = ff_mpv_init_duplicate_contexts(s);
|
||||||
goto fail;
|
if (ret < 0)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1023,9 +1023,9 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
m->lmin = m->lmax;
|
m->lmin = m->lmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ff_mpv_common_init() will copy (memdup) the contents of the main slice
|
/* ff_mpv_init_duplicate_contexts() will copy (memdup) the contents of the
|
||||||
* to the slice contexts, so we initialize various fields of it
|
* main slice to the slice contexts, so we initialize various fields of it
|
||||||
* before calling ff_mpv_common_init(). */
|
* before calling ff_mpv_init_duplicate_contexts(). */
|
||||||
s->parent = m;
|
s->parent = m;
|
||||||
ff_mpv_idct_init(&s->c);
|
ff_mpv_idct_init(&s->c);
|
||||||
init_unquantize(s, avctx);
|
init_unquantize(s, avctx);
|
||||||
@ -1057,6 +1057,9 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
s->c.slice_ctx_size = sizeof(*s);
|
s->c.slice_ctx_size = sizeof(*s);
|
||||||
ret = ff_mpv_common_init(&s->c);
|
ret = ff_mpv_common_init(&s->c);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
ret = ff_mpv_init_duplicate_contexts(&s->c);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user