[FFmpeg-devel] [PATCH] vp9:enable multi-thread decoding when refreshctx is equal to 0

Ronald S. Bultje rsbultje at gmail.com
Thu Oct 9 01:46:39 CEST 2014


Hi,

On Thu, Oct 9, 2014 at 3:41 PM, <di1028.wu at samsung.com> wrote:

> From: Di Wu <di1028.wu at samsung.com>
>
> Multi-thread decoding doesn't work when refreshctx is equal to 0. Fix
> it by call ff_thread_finish_setup function in the condition when
> refreshctx is equal to 0.
>
> In vp9_decode_frame function, ff_thread_finish_setup is not called
> when refreshctx is equal to 0. The next decoding thread can not
> start work until the cunrrent frame has been decoded completely. So
> multi-thread decoding in frame level is not enabled when  refreshctx
> is equal to 0.
>
> Signed-off-by: Di Wu <di1028.wu at samsung.com>
> ---
>  libavcodec/vp9.c |    3 +++
>  1 file changed, 3 insertions(+)
>  mode change 100644 => 100755 libavcodec/vp9.c
>
> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> old mode 100644
> new mode 100755
> index 31725e6..364b36a
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -3799,6 +3799,9 @@ static int vp9_decode_frame(AVCodecContext *ctx,
> void *frame,
>                 "Failed to allocate block buffers\n");
>          return res;
>      }
> +    if (!s->refreshctx){
> +        ff_thread_finish_setup(ctx);
> +    }
>      if (s->refreshctx && s->parallelmode) {


I think functionally this looks OK, thanks for finding it. Please do follow
Reynaldo's suggestions on style/cosmetics. I'd go as far as to change the
second if into an else if, since they do related stuff, but I don't mind
either way.

Ronald


More information about the ffmpeg-devel mailing list