[FFmpeg-devel] [PATCH] avfilter/vf_zscale: add slice threading

Song, Ruiling ruiling.song at intel.com
Fri May 31 07:20:31 EEST 2019


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Paul B Mahol
> Sent: Thursday, May 30, 2019 3:22 AM
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH] avfilter/vf_zscale: add slice threading
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/vf_zscale.c | 335 +++++++++++++++++++++++++---------------
>  1 file changed, 211 insertions(+), 124 deletions(-)

Doing some testing show that this patch introduce big performance drop for below scale from 1080p to 720p:
./ffmpeg -I 1080p.mp4 -vf zscale=w=1280:h=720 -f null /dev/null
On my local machine(i7-6770HQ with 4 cores, thus 8 threads), the fps number drops from 240 to 160.
Did you observe any performance gain with this patch for some use-case?

 [...]
> @@ -706,10 +790,12 @@ static void uninit(AVFilterContext *ctx)
>  {
>      ZScaleContext *s = ctx->priv;
> 
> -    zimg_filter_graph_free(s->graph);
> -    zimg_filter_graph_free(s->alpha_graph);
> -    av_freep(&s->tmp);
> -    s->tmp_size = 0;
> +    for (int i = 0; i < s->nb_threads; i++) {
> +        zimg_filter_graph_free(s->ztd[i].graph);
> +        zimg_filter_graph_free(s->ztd[i].alpha_graph);
> +        av_freep(&s->ztd[i].tmp);
> +        s->ztd[i].tmp_size = 0;
> +    }
Missing av_freep(&s->ztd) here?
>  }
> 
>  static int process_command(AVFilterContext *ctx, const char *cmd, const
> char *args,
> @@ -890,4 +976,5 @@ AVFilter ff_vf_zscale = {
>      .inputs          = avfilter_vf_zscale_inputs,
>      .outputs         = avfilter_vf_zscale_outputs,
>      .process_command = process_command,
> +    .flags           = AVFILTER_FLAG_SLICE_THREADS,
>  };
> --
> 2.17.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list