[FFmpeg-devel] [ffmpeg-devel][PATCH] OpenHEVC new MC with ASM

James Almer jamrial at gmail.com
Tue May 6 18:04:35 CEST 2014


On 29/04/14 12:09 PM, Pierre Edouard Lepere wrote:
> Hello,
> here is a patch submission changing the way MC is done : 4 and 8 tap filters now do the weighting too.
> x86 ASM is also added in the second file.
> 
> Best Regards,
> Pierre-Edouard Lepere

> +void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth)
> +{
> +    int mm_flags = av_get_cpu_flags();
> +
> +    if (bit_depth == 8) {
> +        if (EXTERNAL_MMX(mm_flags)) {
> +
> +            if (EXTERNAL_MMXEXT(mm_flags)) {
> +
> +                if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {

The asm functions and the prototypes are all SSE4, yet you're checking for SSSE3 support 
at runtime here.
This will crash on CPUs like first gen Core 2, Atom and AMD Bobcat.

Also, there's no need to check for MMX and MMXEXT in a chain like this. EXTERNAL_SSSE3() 
is enough.

> +
> +                    EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels,  8);
> +                    EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h,      8);
> +                    EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v,      8);
> +                    EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv,     8);
> +
> +                    QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 8);
> +                    QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h,     8);
> +                    QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v,     8);
> +                    QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv,    8);
> +
> +                }
> +            }
> +        }
> +    } else if (bit_depth == 10) {
> +        if (EXTERNAL_MMX(mm_flags)) {
> +            if (EXTERNAL_MMXEXT(mm_flags) && ARCH_X86_64) {
> +
> +                if (EXTERNAL_SSSE3(mm_flags)) {

Same as above.

> +
> +                    EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 10);
> +                    EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h,     10);
> +                    EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v,     10);
> +                    EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv,    10);
> +
> +                    QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 10);
> +                    QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h,     10);
> +                    QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v,     10);
> +                    QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv,    10);
> +                }
> +
> +            }
> +        }
> +    }
> +}


More information about the ffmpeg-devel mailing list