[FFmpeg-devel] [PATCH V1] lavfi/lut: Add slice threading support

Song, Ruiling ruiling.song at intel.com
Wed May 22 06:03:13 EEST 2019



> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Jun Zhao
> Sent: Wednesday, May 22, 2019 12:29 AM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Jun Zhao <barryjzhao at tencent.com>
> Subject: [FFmpeg-devel] [PATCH V1] lavfi/lut: Add slice threading support
> 
> From: Jun Zhao <barryjzhao at tencent.com>
> 
> Used the command for 1080p h264 clip as follow:
> 
> a). ffmpeg -i input -vf lutyuv="u=128:v=128" -f null /dev/null
> b). ffmpeg -i input -vf lutrgb="g=0:b=0" -f null /dev/null
> 
> after enabled the slice threading, the fps change from:
> 
> a). 144fps to 258fps (lutyuv)
> b). 94fps  to 153fps (lutrgb)
> 
> in Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
> 
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
>  libavfilter/vf_lut.c |  328 +++++++++++++++++++++++++++++++++----------
> -------
>  1 files changed, 216 insertions(+), 112 deletions(-)
> 
> diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
> index c815ddc..61550ee 100644
> --- a/libavfilter/vf_lut.c
> +++ b/libavfilter/vf_lut.c
> @@ -337,13 +337,194 @@ static int config_props(AVFilterLink *inlink)
>      return 0;
>  }
> 
> +struct thread_data {
> +    AVFrame *in;
> +    AVFrame *out;
> +
> +    int w;
> +    int h;
> +};

I think it's better to refine the patch to avoid duplicating code, the exiting source code has been copy-pasted too much.
Maybe we just need lut_packed() and lut_planar(). For 8/16 variation, I think it is easy to add one field( like "int is_16bit;")in thread_data to solve it.

Ruiling
> +
> +/* packed, 16-bit */
> +static int lut_packed_16bits(AVFilterContext *ctx, void *arg, int jobnr, int



More information about the ffmpeg-devel mailing list