/*
- * yuv2rgb.c, Software YUV to RGB coverter
+ * yuv2rgb.c, Software YUV to RGB converter
*
* Copyright (C) 1999, Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- * All Rights Reserved.
*
* Functions broken out from display_x11.c and several new modes
- * added by Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * added by Håkan Hjort <d95hjort@dtek.chalmers.se>
*
* 15 & 16 bpp support by Franck Sicard <Franck.Sicard@solsoft.fr>
*
+ * MMX/MMX2 template stuff (needed for fast movntq support),
+ * 1,4,8bpp support and context / deglobalize stuff
+ * by Michael Niedermayer (michaelni@gmx.at)
+ *
* This file is part of mpeg2dec, a free MPEG-2 video decoder
*
* mpeg2dec is free software; you can redistribute it and/or modify
* You should have received a copy of the GNU General Public License
* along with mpeg2dec; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * MMX/MMX2 Template stuff from Michael Niedermayer (michaelni@gmx.at) (needed for fast movntq support)
- * 1,4,8bpp support by Michael Niedermayer (michaelni@gmx.at)
- * context / deglobalize stuff by Michael Niedermayer
*/
#include <stdio.h>
#include "swscale.h"
#include "swscale_internal.h"
-#ifdef HAVE_MLIB
-#include "yuv2rgb_mlib.c"
-#endif
-
#define DITHER1XBPP // only for mmx
const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={
#ifdef HAVE_MMX
/* hope these constant values are cache line aligned */
-static uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
-static uint64_t attribute_used __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8ULL;
-static uint64_t attribute_used __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfcULL;
-
-static uint64_t attribute_used __attribute__((aligned(8))) M24A= 0x00FF0000FF0000FFULL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24B= 0xFF0000FF0000FF00ULL;
-static uint64_t attribute_used __attribute__((aligned(8))) M24C= 0x0000FF0000FF0000ULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
// the volatile is required because gcc otherwise optimizes some writes away not knowing that these
// are read in the asm block
static volatile uint64_t attribute_used __attribute__((aligned(8))) g6Dither;
static volatile uint64_t attribute_used __attribute__((aligned(8))) r5Dither;
-static uint64_t __attribute__((aligned(8))) dither4[2]={
- 0x0103010301030103LL,
- 0x0200020002000200LL,};
-
-static uint64_t __attribute__((aligned(8))) dither8[2]={
- 0x0602060206020602LL,
- 0x0004000400040004LL,};
-
#undef HAVE_MMX
//MMX versions
#define RENAME(a) a ## _MMX2
#include "yuv2rgb_template.c"
-#endif /* defined(ARCH_X86) */
+#endif /* HAVE_MMX */
const int32_t Inverse_Table_6_9[8][4] = {
{117504, 138453, 13954, 34903}, /* no sequence_display_extension */
for (y=0; y<srcSliceH; y+=2){\
dst_type *dst_1= (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\
dst_type *dst_2= (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
- dst_type attribute_unused *r, *b;\
+ dst_type av_unused *r, *b;\
dst_type *g;\
uint8_t *py_1= src[0] + y*srcStride[0];\
uint8_t *py_2= py_1 + srcStride[0];\
uint8_t *pv= src[2] + (y>>1)*srcStride[2];\
unsigned int h_size= c->dstW>>3;\
while (h_size--) {\
- int attribute_unused U, V;\
+ int av_unused U, V;\
int Y;\
-#define EPILOG(dst_delta)\
+#define EPILOG1(dst_delta)\
pu += 4;\
pv += 4;\
py_1 += 8;\
dst_1 += dst_delta;\
dst_2 += dst_delta;\
}\
+ if (c->dstW & 4) {\
+ int av_unused Y, U, V;\
+
+#define EPILOG2()\
+ }\
}\
return srcSliceH;\
}
+#define EPILOG(dst_delta)\
+ EPILOG1(dst_delta)\
+ EPILOG2()
+
PROLOG(yuv2rgb_c_32, uint32_t)
RGB(0);
DST1(0);
RGB(3);
DST2(3);
DST1(3);
-EPILOG(8)
+EPILOG1(8)
+ RGB(0);
+ DST1(0);
+ DST2(0);
+
+ RGB(1);
+ DST2(1);
+ DST1(1);
+EPILOG2()
PROLOG(yuv2rgb_c_24_rgb, uint8_t)
RGB(0);
RGB(3);
DST2RGB(3);
DST1RGB(3);
-EPILOG(24)
+EPILOG1(24)
+ RGB(0);
+ DST1RGB(0);
+ DST2RGB(0);
+
+ RGB(1);
+ DST2RGB(1);
+ DST1RGB(1);
+EPILOG2()
// only trivial mods from yuv2rgb_c_24_rgb
PROLOG(yuv2rgb_c_24_bgr, uint8_t)
RGB(3);
DST2BGR(3);
DST1BGR(3);
-EPILOG(24)
+EPILOG1(24)
+ RGB(0);
+ DST1BGR(0);
+ DST2BGR(0);
+
+ RGB(1);
+ DST2BGR(1);
+ DST1BGR(1);
+EPILOG2()
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
}
}
#endif
-#ifdef HAVE_MLIB
+#ifdef HAVE_VIS
+ {
+ SwsFunc t= yuv2rgb_init_vis(c);
+ if (t) return t;
+ }
+#endif
+#ifdef CONFIG_MLIB
{
SwsFunc t= yuv2rgb_init_mlib(c);
if (t) return t;
}
#endif
+#ifdef ARCH_BFIN
+ if (c->flags & SWS_CPU_CAPS_BFIN)
+ {
+ SwsFunc t = ff_bfin_yuv2rgb_get_func_ptr (c);
+ if (t) return t;
+ }
+#endif
+
av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found\n");
switch(c->dstFormat){