#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
#ifdef ARCH_X86
/* hope these constant values are cache line aligned */
-uint64_t __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ff;
-uint64_t __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8;
-uint64_t __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfc;
+uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
+uint64_t attribute_used __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8ULL;
+uint64_t attribute_used __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfcULL;
-uint64_t __attribute__((aligned(8))) M24A= 0x00FF0000FF0000FFLL;
-uint64_t __attribute__((aligned(8))) M24B= 0xFF0000FF0000FF00LL;
-uint64_t __attribute__((aligned(8))) M24C= 0x0000FF0000FF0000LL;
+uint64_t attribute_used __attribute__((aligned(8))) M24A= 0x00FF0000FF0000FFULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24B= 0xFF0000FF0000FF00ULL;
+uint64_t attribute_used __attribute__((aligned(8))) M24C= 0x0000FF0000FF0000ULL;
// the volatile is required because gcc otherwise optimizes some writes away not knowing that these
// are read in the asm block
-volatile uint64_t __attribute__((aligned(8))) b5Dither;
-volatile uint64_t __attribute__((aligned(8))) g5Dither;
-volatile uint64_t __attribute__((aligned(8))) g6Dither;
-volatile uint64_t __attribute__((aligned(8))) r5Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) b5Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) g5Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) g6Dither;
+volatile uint64_t attribute_used __attribute__((aligned(8))) r5Dither;
uint64_t __attribute__((aligned(8))) dither4[2]={
0x0103010301030103LL,
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;\
dst_2 += dst_delta;\
}\
}\
+ return srcSliceH;\
}
PROLOG(yuv2rgb_c_32, uint32_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]; \
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;
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;
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:
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
{
- const int bpp= c->dstFormat&0xFF;
- const int isRgb= (c->dstFormat>>24) != 'R';
+ const int isRgb = IMGFMT_IS_RGB(c->dstFormat);
+ const int bpp = isRgb?IMGFMT_RGB_DEPTH(c->dstFormat):IMGFMT_BGR_DEPTH(c->dstFormat);
int i;
uint8_t table_Y[1024];
uint32_t *table_32 = 0;
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;
}