]> git.sesse.net Git - ffmpeg/blobdiff - postproc/yuv2rgb.c
works with old gcc versions too
[ffmpeg] / postproc / yuv2rgb.c
index 94196c4c2d0b563a6f8fe1436fcaf8a64b651e65..24295d014d0bb9861fdb76c058a651d504a5539f 100644 (file)
@@ -40,9 +40,7 @@
 #include "rgb2rgb.h"
 #include "swscale.h"
 #include "swscale_internal.h"
-#include "../cpudetect.h"
 #include "../mangle.h"
-#include "../mp_msg.h"
 #include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff
 
 #ifdef HAVE_MLIB
@@ -262,13 +260,10 @@ const int32_t Inverse_Table_6_9[8][4] = {
        dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];
 
 #define PROLOG(func_name, dst_type) \
-static void func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, \
+static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \
              int srcSliceH, uint8_t* dst[], int dstStride[]){\
-    uint8_t *src[3];\
-    int srcStride[3];\
     int y;\
 \
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);\
     if(c->srcFormat == IMGFMT_422P){\
        srcStride[1] *= 2;\
        srcStride[2] *= 2;\
@@ -294,6 +289,7 @@ static void func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[],
            dst_2 += dst_delta;\
        }\
     }\
+    return srcSliceH;\
 }
 
 PROLOG(yuv2rgb_c_32, uint32_t)
@@ -553,9 +549,9 @@ PROLOG(yuv2rgb_c_4b_ordered_dither, uint8_t)
 EPILOG(8)
 
 PROLOG(yuv2rgb_c_1_ordered_dither, uint8_t)
-       g= c->table_gU[128] + c->table_gV[128];
        const uint8_t *d128=dither_8x8_220[y&7];
        char out_1=0, out_2=0;
+       g= c->table_gU[128] + c->table_gV[128];
 
 #define DST1bpp1(i,o)                                  \
        Y = py_1[2*i];                          \
@@ -588,7 +584,7 @@ EPILOG(1)
 SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
 {
 #ifdef ARCH_X86
-    if(gCpuCaps.hasMMX2){
+    if(c->flags & SWS_CPU_CAPS_MMX2){
        switch(c->dstFormat){
        case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
        case IMGFMT_BGR24: return yuv420_rgb24_MMX2;
@@ -596,7 +592,7 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
        case IMGFMT_BGR15: return yuv420_rgb15_MMX2;
        }
     }
-    if(gCpuCaps.hasMMX){
+    if(c->flags & SWS_CPU_CAPS_MMX){
        switch(c->dstFormat){
        case IMGFMT_BGR32: return yuv420_rgb32_MMX;
        case IMGFMT_BGR24: return yuv420_rgb24_MMX;
@@ -611,7 +607,7 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
        if(t) return t;
     }
 #endif
-    mp_msg(MSGT_SWS,MSGL_WARN,"No accelerated colorspace conversion found\n");
+    MSG_WARN("No accelerated colorspace conversion found\n");
 
     switch(c->dstFormat){
     case IMGFMT_RGB32:
@@ -829,7 +825,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
 
     default:
        table_start= NULL;
-       mp_msg(MSGT_SWS,MSGL_ERR,"%ibpp not supported by yuv2rgb\n", bpp);
+       MSG_ERR("%ibpp not supported by yuv2rgb\n", bpp);
        //free mem?
        return -1;
     }