Commit c5c2060c authored by Janne Grunau's avatar Janne Grunau

x86: h264qpel: add cpu flag checks for init function

The code was copied from per cpu extension init function so the checks
for supported extensions was overlooked.
parent 6bdb841b
......@@ -21,6 +21,7 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/h264qpel.h"
#include "libavcodec/mpegvideo.h"
......@@ -530,10 +531,11 @@ QPEL16(mmxext)
void ff_h264qpel_init_x86(H264QpelContext *c, int bit_depth)
{
#if HAVE_YASM
int high_bit_depth = bit_depth > 8;
int mm_flags = av_get_cpu_flags();
#if HAVE_MMXEXT_EXTERNAL
if (EXTERNAL_MMXEXT(mm_flags)) {
if (!high_bit_depth) {
SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmxext, );
SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmxext, );
......@@ -551,9 +553,9 @@ void ff_h264qpel_init_x86(H264QpelContext *c, int bit_depth)
SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 10_mmxext, ff_);
SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 10_mmxext, ff_);
}
#endif
}
#if HAVE_SSE2_EXTERNAL
if (EXTERNAL_SSE2(mm_flags)) {
if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW) && !high_bit_depth) {
// these functions are slower than mmx on AMD, but faster on Intel
H264_QPEL_FUNCS(0, 0, sse2);
......@@ -583,9 +585,9 @@ void ff_h264qpel_init_x86(H264QpelContext *c, int bit_depth)
H264_QPEL_FUNCS_10(2, 0, sse2_cache64);
H264_QPEL_FUNCS_10(3, 0, sse2_cache64);
}
#endif
}
#if HAVE_SSSE3_EXTERNAL
if (EXTERNAL_SSSE3(mm_flags)) {
if (!high_bit_depth) {
H264_QPEL_FUNCS(1, 0, ssse3);
H264_QPEL_FUNCS(1, 1, ssse3);
......@@ -606,13 +608,14 @@ void ff_h264qpel_init_x86(H264QpelContext *c, int bit_depth)
H264_QPEL_FUNCS_10(2, 0, ssse3_cache64);
H264_QPEL_FUNCS_10(3, 0, ssse3_cache64);
}
#endif
}
#if HAVE_AVX_EXTERNAL
if (EXTERNAL_AVX(mm_flags)) {
if (bit_depth == 10) {
H264_QPEL_FUNCS_10(1, 0, sse2);
H264_QPEL_FUNCS_10(2, 0, sse2);
H264_QPEL_FUNCS_10(3, 0, sse2);
}
}
#endif
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment