Ticket #52: libswscale_enable_cpu_runtime.diff

File libswscale_enable_cpu_runtime.diff, 2.2 KB (added by tateu, 13 years ago)
  • libswscale/rgb2rgb.c

    diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
    index a5cebcf..adc5d59 100644
    a b DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;  
    199199
    200200void sws_rgb2rgb_init(int flags)
    201201{
    202 #if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
     202#if HAVE_SSE2 || HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
    203203    if (flags & SWS_CPU_CAPS_SSE2)
    204204        rgb2rgb_init_SSE2();
    205205    else if (flags & SWS_CPU_CAPS_MMX2)
  • libswscale/swscale.c

    diff --git a/libswscale/swscale.c b/libswscale/swscale.c
    index c0e4db3..bf41180 100644
    a b untested special converters  
    6262#include "rgb2rgb.h"
    6363#include "libavutil/intreadwrite.h"
    6464#include "libavutil/x86_cpu.h"
    65 #include "libavutil/cpu.h"
    6665#include "libavutil/avutil.h"
    6766#include "libavutil/mathematics.h"
    6867#include "libavutil/bswap.h"
    SwsFunc ff_getSwsFunc(SwsContext *c)  
    13141313#if CONFIG_RUNTIME_CPUDETECT
    13151314    int flags = c->flags;
    13161315
    1317     int cpuflags = av_get_cpu_flags();
    1318 
    1319     flags |= (cpuflags & AV_CPU_FLAG_MMX ? SWS_CPU_CAPS_MMX : 0);
    1320     flags |= (cpuflags & AV_CPU_FLAG_MMX2 ? SWS_CPU_CAPS_MMX2 : 0);
    1321     flags |= (cpuflags & AV_CPU_FLAG_3DNOW ? SWS_CPU_CAPS_3DNOW : 0);
    1322 
    13231316#if ARCH_X86
    13241317    // ordered per speed fastest first
    13251318    if (flags & SWS_CPU_CAPS_MMX2) {
  • libswscale/utils.c

    diff --git a/libswscale/utils.c b/libswscale/utils.c
    index a343bf2..ecd0a76 100644
    a b  
    4141#include "rgb2rgb.h"
    4242#include "libavutil/intreadwrite.h"
    4343#include "libavutil/x86_cpu.h"
     44#include "libavutil/cpu.h"
    4445#include "libavutil/avutil.h"
    4546#include "libavutil/bswap.h"
    4647#include "libavutil/opt.h"
    static int update_flags_cpu(int flags)  
    742743               |SWS_CPU_CAPS_ALTIVEC
    743744               |SWS_CPU_CAPS_BFIN);
    744745    flags |= ff_hardcodedcpuflags();
     746#else /* !CONFIG_RUNTIME_CPUDETECT */
     747    int cpuflags = av_get_cpu_flags();
     748
     749    flags |= (cpuflags & AV_CPU_FLAG_SSE2 ? SWS_CPU_CAPS_SSE2 : 0);
     750    flags |= (cpuflags & AV_CPU_FLAG_MMX ? SWS_CPU_CAPS_MMX : 0);
     751    flags |= (cpuflags & AV_CPU_FLAG_MMX2 ? SWS_CPU_CAPS_MMX2 : 0);
     752    flags |= (cpuflags & AV_CPU_FLAG_3DNOW ? SWS_CPU_CAPS_3DNOW : 0);
    745753#endif /* CONFIG_RUNTIME_CPUDETECT */
    746754    return flags;
    747755}