/*
- * yuv2rgb_mmx.c, Software YUV to RGB converter with Intel MMX "technology"
+ * yuv2rgb_mmx.c, software YUV to RGB converter with Intel MMX "technology"
*
- * Copyright (C) 2000, Silicon Integrated System Corp.
+ * Copyright (C) 2000, Silicon Integrated System Corp
*
* Author: Olie Lho <ollie@sis.com.tw>
*
#undef EMMS
#undef SFENCE
-#ifdef HAVE_3DNOW
-/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
+#if HAVE_AMD3DNOW
+/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
#define EMMS "femms"
#else
#define EMMS "emms"
#endif
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
#define MOVNTQ "movntq"
#define SFENCE "sfence"
#else
h_size= (c->dstW+7)&~7;
if(h_size*2 > FFABS(dstStride[0])) h_size-=8;
- __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
- //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0],
+ __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ );
+ //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&c->blueDither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0],
//srcStride[0],srcStride[1],srcStride[2],dstStride[0]);
for (y= 0; y<srcSliceH; y++ ) {
uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0];
uint8_t *pv = src[2] + (y>>1)*srcStride[2];
long index= -h_size/2;
- b5Dither= ff_dither8[y&1];
- g6Dither= ff_dither4[y&1];
- g5Dither= ff_dither8[y&1];
- r5Dither= ff_dither8[(y+1)&1];
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__ (
+ c->blueDither= ff_dither8[y&1];
+ c->greenDither= ff_dither4[y&1];
+ c->redDither= ff_dither8[(y+1)&1];
+ /* This MMX assembly code deals with a SINGLE scan line at a time,
+ * it converts 8 pixels in each iteration. */
+ __asm__ volatile (
/* load data for start of next scan line */
"movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
"movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
"movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
//".balign 16 \n\t"
"1: \n\t"
- /* no speed diference on my p3@500 with prefetch,
- * if it is faster for anyone with -benchmark then tell me
+ /* No speed difference on my p3@500 with prefetch,
+ * if it is faster for anyone with -benchmark then tell me.
PREFETCH" 64(%0) \n\t"
PREFETCH" 64(%1) \n\t"
PREFETCH" 64(%2) \n\t"
YUV2RGB
#ifdef DITHER1XBPP
- "paddusb "MANGLE(b5Dither)", %%mm0;"
- "paddusb "MANGLE(g6Dither)", %%mm2;"
- "paddusb "MANGLE(r5Dither)", %%mm1;"
+ "paddusb "BLUE_DITHER"(%4), %%mm0;"
+ "paddusb "GREEN_DITHER"(%4), %%mm2;"
+ "paddusb "RED_DITHER"(%4), %%mm1;"
#endif
/* mask unneeded bits off */
"pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
"movq %%mm0, %%mm5;" /* Copy B7-B0 */
"movq %%mm2, %%mm7;" /* Copy G7-G0 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
"punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
"punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
"movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
"punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
"punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
);
}
- __asm__ __volatile__ (EMMS);
+ __asm__ volatile (EMMS);
return srcSliceH;
}
h_size= (c->dstW+7)&~7;
if(h_size*2 > FFABS(dstStride[0])) h_size-=8;
- __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
- //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0],
+ __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ );
+ //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&c->blueDither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0],
//srcStride[0],srcStride[1],srcStride[2],dstStride[0]);
for (y= 0; y<srcSliceH; y++ ) {
uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0];
uint8_t *pv = src[2] + (y>>1)*srcStride[2];
long index= -h_size/2;
- b5Dither= ff_dither8[y&1];
- g6Dither= ff_dither4[y&1];
- g5Dither= ff_dither8[y&1];
- r5Dither= ff_dither8[(y+1)&1];
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__ (
+ c->blueDither= ff_dither8[y&1];
+ c->greenDither= ff_dither8[y&1];
+ c->redDither= ff_dither8[(y+1)&1];
+ /* This MMX assembly code deals with a SINGLE scan line at a time,
+ * it converts 8 pixels in each iteration. */
+ __asm__ volatile (
/* load data for start of next scan line */
"movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
"movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
YUV2RGB
#ifdef DITHER1XBPP
- "paddusb "MANGLE(b5Dither)", %%mm0 \n\t"
- "paddusb "MANGLE(g5Dither)", %%mm2 \n\t"
- "paddusb "MANGLE(r5Dither)", %%mm1 \n\t"
+ "paddusb "BLUE_DITHER"(%4), %%mm0 \n\t"
+ "paddusb "GREEN_DITHER"(%4), %%mm2 \n\t"
+ "paddusb "RED_DITHER"(%4), %%mm1 \n\t"
#endif
/* mask unneeded bits off */
"movq %%mm0, %%mm5;" /* Copy B7-B0 */
"movq %%mm2, %%mm7;" /* Copy G7-G0 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
"punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
"punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
"movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
- /* convert rgb24 plane to rgb16 pack for pixel 0-3 */
+ /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
"punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
"punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
);
}
- __asm__ __volatile__ (EMMS);
+ __asm__ volatile (EMMS);
return srcSliceH;
}
h_size= (c->dstW+7)&~7;
if(h_size*3 > FFABS(dstStride[0])) h_size-=8;
- __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
+ __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ );
for (y= 0; y<srcSliceH; y++ ) {
uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0];
uint8_t *pv = src[2] + (y>>1)*srcStride[2];
long index= -h_size/2;
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__ (
+ /* This MMX assembly code deals with a SINGLE scan line at a time,
+ * it converts 8 pixels in each iteration. */
+ __asm__ volatile (
/* load data for start of next scan line */
"movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
"movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
"1: \n\t"
YUV2RGB
/* mm0=B, %%mm2=G, %%mm1=R */
-#ifdef HAVE_MMX2
+#if HAVE_MMX2
"movq "MANGLE(ff_M24A)", %%mm4 \n\t"
"movq "MANGLE(ff_M24C)", %%mm7 \n\t"
"pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */
);
}
- __asm__ __volatile__ (EMMS);
+ __asm__ volatile (EMMS);
return srcSliceH;
}
h_size= (c->dstW+7)&~7;
if(h_size*4 > FFABS(dstStride[0])) h_size-=8;
- __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ );
+ __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ );
for (y= 0; y<srcSliceH; y++ ) {
uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0];
uint8_t *pv = src[2] + (y>>1)*srcStride[2];
long index= -h_size/2;
- /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8
- pixels in each iteration */
- __asm__ __volatile__ (
+ /* This MMX assembly code deals with a SINGLE scan line at a time,
+ * it converts 8 pixels in each iteration. */
+ __asm__ volatile (
/* load data for start of next scan line */
"movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
"movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
);
}
- __asm__ __volatile__ (EMMS);
+ __asm__ volatile (EMMS);
return srcSliceH;
}