[FFmpeg-devel] [PATCH] avfilter: add hflip x86 SIMD

James Almer jamrial at gmail.com
Sun Dec 3 23:15:47 EET 2017


On 12/3/2017 5:50 PM, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/hflip.h             |  38 ++++++++++++
>  libavfilter/vf_hflip.c          | 133 ++++++++++++++++++++++++++--------------
>  libavfilter/x86/Makefile        |   2 +
>  libavfilter/x86/vf_hflip.asm    | 102 ++++++++++++++++++++++++++++++
>  libavfilter/x86/vf_hflip_init.c |  41 +++++++++++++
>  5 files changed, 269 insertions(+), 47 deletions(-)
>  create mode 100644 libavfilter/hflip.h
>  create mode 100644 libavfilter/x86/vf_hflip.asm
>  create mode 100644 libavfilter/x86/vf_hflip_init.c

[...]

> @@ -80,6 +139,24 @@ static int config_props(AVFilterLink *inlink)
>      s->planeheight[0] = s->planeheight[3] = inlink->h;
>      s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
>  
> +    nb_planes = av_pix_fmt_count_planes(inlink->format);
> +
> +    for (i = 0; i < nb_planes; i++) {
> +        switch (s->max_step[i]) {
> +        case 1: s->flip_line[i] = hflip_byte_c;  break;
> +        case 2: s->flip_line[i] = hflip_short_c; break;
> +        case 3: s->flip_line[i] = hflip_b24_c;   break;
> +        case 4: s->flip_line[i] = hflip_dword_c; break;
> +        case 6: s->flip_line[i] = hflip_b48_c;   break;
> +        case 8: s->flip_line[i] = hflip_qword_c; break;
> +        default:
> +            return AVERROR_BUG;
> +        }
> +    }
> +
> +    if (ARCH_X86)
> +        ff_hflip_init_x86(s, s->max_step);

Pass nb_planes here and use it instead of the hardcoded 4.

Should be good aside from that.


More information about the ffmpeg-devel mailing list