You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/rv34: Simplify updating thread context
Call ff_mpeg_update_thread_context() first and update the RV34 buffers if it indicates a reinitialization. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -1538,19 +1538,21 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
|
|||||||
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
||||||
{
|
{
|
||||||
RV34DecContext *r = dst->priv_data, *r1 = src->priv_data;
|
RV34DecContext *r = dst->priv_data, *r1 = src->priv_data;
|
||||||
MpegEncContext * const s = &r->s, * const s1 = &r1->s;
|
MpegEncContext *const s1 = &r1->s;
|
||||||
int err;
|
int ret;
|
||||||
|
|
||||||
if (dst == src || !s1->context_initialized)
|
if (dst == src || !s1->context_initialized)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
|
ret = ff_mpeg_update_thread_context(dst, src);
|
||||||
s->height = s1->height;
|
if (ret < 0)
|
||||||
s->width = s1->width;
|
return ret;
|
||||||
if ((err = ff_mpv_common_frame_size_change(s)) < 0)
|
|
||||||
return err;
|
// Did ff_mpeg_update_thread_context reinit?
|
||||||
if ((err = rv34_decoder_realloc(r)) < 0)
|
if (ret > 0) {
|
||||||
return err;
|
ret = rv34_decoder_realloc(r);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->cur_pts = r1->cur_pts;
|
r->cur_pts = r1->cur_pts;
|
||||||
@ -1559,12 +1561,7 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte
|
|||||||
|
|
||||||
memset(&r->si, 0, sizeof(r->si));
|
memset(&r->si, 0, sizeof(r->si));
|
||||||
|
|
||||||
// Do no call ff_mpeg_update_thread_context on a partially initialized
|
return 0;
|
||||||
// decoder context.
|
|
||||||
if (!s1->context_initialized)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return ff_mpeg_update_thread_context(dst, src);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n, int slice_count, int buf_size)
|
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n, int slice_count, int buf_size)
|
||||||
|
Reference in New Issue
Block a user