FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
yuv2rgb_template.c File Reference
#include <stdint.h>
#include "libavutil/x86/asm.h"
#include "libswscale/swscale_internal.h"

Go to the source code of this file.

Macros

#define MOVNTQ   "movq"
 
#define SFENCE   " # nop"
 
#define REG_BLUE   "0"
 
#define REG_RED   "1"
 
#define REG_GREEN   "2"
 
#define REG_ALPHA   "3"
 
#define YUV2RGB_LOOP(depth)
 
#define YUV2RGB_INITIAL_LOAD
 
#define YUV2RGB
 
#define RGB_PACK_INTERLEAVE
 
#define YUV2RGB_ENDLOOP(depth)
 
#define RGB_PACK24_B_OPERANDS
 
#define YUV2RGB_OPERANDS
 
#define YUV2RGB_OPERANDS_ALPHA
 
#define YUV2RGB_ENDFUNC
 
#define IF0(x)
 
#define IF1(x)   x
 
#define RGB_PACK16(gmask, is15)
 
#define DITHER_RGB
 
#define RGB_PACK24(blue, red)
 
#define RGB_PACK24_B
 
#define SET_EMPTY_ALPHA   "pcmpeqd %%mm"REG_ALPHA", %%mm"REG_ALPHA"\n\t" /* set alpha to 0xFF */ \
 
#define LOAD_ALPHA   "movq (%6, %0, 2), %%mm"REG_ALPHA"\n\t" \
 
#define RGB_PACK32(red, green, blue, alpha)
 

Functions

static int yuv420_rgb15_TMPL (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 
static int yuv420_rgb16_TMPL (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 
static int yuv420_rgb24_TMPL (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 
static int yuv420_bgr24_TMPL (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 
static int yuv420_rgb32_TMPL (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 
static int yuv420_bgr32_TMPL (SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[])
 

Macro Definition Documentation

#define MOVNTQ   "movq"

Definition at line 37 of file yuv2rgb_template.c.

#define SFENCE   " # nop"

Definition at line 38 of file yuv2rgb_template.c.

#define REG_BLUE   "0"

Definition at line 41 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define REG_RED   "1"

Definition at line 42 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define REG_GREEN   "2"

Definition at line 43 of file yuv2rgb_template.c.

Referenced by yuv420_rgb32_TMPL().

#define REG_ALPHA   "3"

Definition at line 44 of file yuv2rgb_template.c.

Referenced by yuv420_bgr32_TMPL(), and yuv420_rgb32_TMPL().

#define YUV2RGB_LOOP (   depth)
Value:
h_size = (c->dstW + 7) & ~7; \
if (h_size * depth > FFABS(dstStride[0])) \
h_size -= 8; \
\
vshift = c->srcFormat != AV_PIX_FMT_YUV422P; \
\
__asm__ volatile ("pxor %mm4, %mm4\n\t"); \
for (y = 0; y < srcSliceH; y++) { \
uint8_t *image = dst[0] + (y + srcSliceY) * dstStride[0]; \
const uint8_t *py = src[0] + y * srcStride[0]; \
const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; \
const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \
x86_reg index = -h_size / 2; \
uint8_t
#define pv
Definition: regdef.h:60
int depth
Definition: v4l.c:62
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:67
float y
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:68
AVS_Value src
Definition: avisynth_c.h:482
int index
Definition: gxfenc.c:89
if(ret< 0)
Definition: vf_mcdeint.c:280
static double c[64]
int x86_reg
Definition: asm.h:72
for(j=16;j >0;--j)

Definition at line 46 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define YUV2RGB_INITIAL_LOAD
Value:
__asm__ volatile ( \
"movq (%5, %0, 2), %%mm6\n\t" \
"movd (%2, %0), %%mm0\n\t" \
"movd (%3, %0), %%mm1\n\t" \
"1: \n\t" \

Definition at line 61 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define YUV2RGB
#define RGB_PACK_INTERLEAVE
Value:
/* pack and interleave even/odd pixels */ \
"packuswb %%mm1, %%mm0\n\t" \
"packuswb %%mm5, %%mm3\n\t" \
"packuswb %%mm2, %%mm2\n\t" \
"movq %%mm0, %%mm1\n\n" \
"packuswb %%mm7, %%mm7\n\t" \
"punpcklbw %%mm3, %%mm0\n\t" \
"punpckhbw %%mm3, %%mm1\n\t" \
"punpcklbw %%mm7, %%mm2\n\t" \

Definition at line 123 of file yuv2rgb_template.c.

Referenced by yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), and yuv420_rgb32_TMPL().

#define YUV2RGB_ENDLOOP (   depth)
Value:
"movq 8 (%5, %0, 2), %%mm6\n\t" \
"movd 4 (%3, %0), %%mm1\n\t" \
"movd 4 (%2, %0), %%mm0\n\t" \
"add $"AV_STRINGIFY(depth * 8)", %1\n\t" \
"add $4, %0\n\t" \
"js 1b\n\t" \
int depth
Definition: v4l.c:62
#define AV_STRINGIFY(s)
Definition: macros.h:36

Definition at line 134 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define RGB_PACK24_B_OPERANDS

Definition at line 147 of file yuv2rgb_template.c.

#define YUV2RGB_OPERANDS
Value:
: "+r" (index), "+r" (image) \
: "r" (pu - index), "r" (pv - index), "r"(&c->redDither), \
"r" (py - 2*index) \
NAMED_CONSTRAINTS_ADD(mmx_00ffw,pb_03,pb_07,mmx_redmask,pb_e0) \
: "memory" \
); \
} \
#define RGB_PACK24_B_OPERANDS
#define pv
Definition: regdef.h:60
int index
Definition: gxfenc.c:89
static double c[64]
#define NAMED_CONSTRAINTS_ADD(...)
Definition: asm.h:145

Definition at line 150 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define YUV2RGB_OPERANDS_ALPHA
Value:
: "+r" (index), "+r" (image) \
: "r" (pu - index), "r" (pv - index), "r"(&c->redDither), \
"r" (py - 2*index), "r" (pa - 2*index) \
NAMED_CONSTRAINTS_ADD(mmx_00ffw) \
: "memory" \
); \
} \
#define pv
Definition: regdef.h:60
int index
Definition: gxfenc.c:89
static double c[64]
#define NAMED_CONSTRAINTS_ADD(...)
Definition: asm.h:145

Definition at line 160 of file yuv2rgb_template.c.

#define YUV2RGB_ENDFUNC
Value:
__asm__ volatile (SFENCE"\n\t" \
"emms \n\t"); \
return srcSliceH; \
#define SFENCE
return

Definition at line 169 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().

#define IF0 (   x)

Definition at line 174 of file yuv2rgb_template.c.

#define IF1 (   x)    x

Definition at line 175 of file yuv2rgb_template.c.

#define RGB_PACK16 (   gmask,
  is15 
)
Value:
"pand "MANGLE(mmx_redmask)", %%mm0\n\t" \
"pand "MANGLE(mmx_redmask)", %%mm1\n\t" \
"movq %%mm2, %%mm3\n\t" \
"psllw $"AV_STRINGIFY(3-is15)", %%mm2\n\t" \
"psrlw $"AV_STRINGIFY(5+is15)", %%mm3\n\t" \
"psrlw $3, %%mm0\n\t" \
IF##is15("psrlw $1, %%mm1\n\t") \
"pand "MANGLE(pb_e0)", %%mm2\n\t" \
"pand "MANGLE(gmask)", %%mm3\n\t" \
"por %%mm2, %%mm0\n\t" \
"por %%mm3, %%mm1\n\t" \
"movq %%mm0, %%mm2\n\t" \
"punpcklbw %%mm1, %%mm0\n\t" \
"punpckhbw %%mm1, %%mm2\n\t" \
MOVNTQ " %%mm0, (%1)\n\t" \
MOVNTQ " %%mm2, 8(%1)\n\t" \
#define MANGLE(a)
Definition: asm.h:127
#define MOVNTQ
#define AV_STRINGIFY(s)
Definition: macros.h:36

Definition at line 177 of file yuv2rgb_template.c.

Referenced by yuv420_rgb15_TMPL(), and yuv420_rgb16_TMPL().

#define DITHER_RGB
Value:
"paddusb "BLUE_DITHER"(%4), %%mm0\n\t" \
"paddusb "GREEN_DITHER"(%4), %%mm2\n\t" \
"paddusb "RED_DITHER"(%4), %%mm1\n\t" \
#define GREEN_DITHER
#define RED_DITHER
#define BLUE_DITHER

Definition at line 195 of file yuv2rgb_template.c.

Referenced by yuv420_rgb15_TMPL(), and yuv420_rgb16_TMPL().

#define RGB_PACK24 (   blue,
  red 
)
Value:
"packuswb %%mm3, %%mm0 \n" /* R0 R2 R4 R6 R1 R3 R5 R7 */\
"packuswb %%mm5, %%mm1 \n" /* B0 B2 B4 B6 B1 B3 B5 B7 */\
"packuswb %%mm7, %%mm2 \n" /* G0 G2 G4 G6 G1 G3 G5 G7 */\
"movq %%mm"red", %%mm3 \n"\
"movq %%mm"blue", %%mm6 \n"\
"psrlq $32, %%mm"red" \n" /* R1 R3 R5 R7 */\
"punpcklbw %%mm2, %%mm3 \n" /* R0 G0 R2 G2 R4 G4 R6 G6 */\
"punpcklbw %%mm"red", %%mm6 \n" /* B0 R1 B2 R3 B4 R5 B6 R7 */\
"movq %%mm3, %%mm5 \n"\
"punpckhbw %%mm"blue", %%mm2 \n" /* G1 B1 G3 B3 G5 B5 G7 B7 */\
"punpcklwd %%mm6, %%mm3 \n" /* R0 G0 B0 R1 R2 G2 B2 R3 */\
"punpckhwd %%mm6, %%mm5 \n" /* R4 G4 B4 R5 R6 G6 B6 R7 */\
#define RGB_PACK24_B

Definition at line 258 of file yuv2rgb_template.c.

Referenced by yuv420_bgr24_TMPL(), and yuv420_rgb24_TMPL().

#define RGB_PACK24_B
Value:
"movd %%mm3, (%1) \n" /* R0 G0 B0 R1 */\
"movd %%mm2, 4(%1) \n" /* G1 B1 */\
"psrlq $32, %%mm3 \n"\
"psrlq $16, %%mm2 \n"\
"movd %%mm3, 6(%1) \n" /* R2 G2 B2 R3 */\
"movd %%mm2, 10(%1) \n" /* G3 B3 */\
"psrlq $16, %%mm2 \n"\
"movd %%mm5, 12(%1) \n" /* R4 G4 B4 R5 */\
"movd %%mm2, 16(%1) \n" /* G5 B5 */\
"psrlq $32, %%mm5 \n"\
"movd %%mm2, 20(%1) \n" /* -- -- G7 B7 */\
"movd %%mm5, 18(%1) \n" /* R6 G6 B6 R7 */\

Definition at line 303 of file yuv2rgb_template.c.

#define SET_EMPTY_ALPHA   "pcmpeqd %%mm"REG_ALPHA", %%mm"REG_ALPHA"\n\t" /* set alpha to 0xFF */ \

Definition at line 356 of file yuv2rgb_template.c.

Referenced by yuv420_bgr32_TMPL(), and yuv420_rgb32_TMPL().

#define LOAD_ALPHA   "movq (%6, %0, 2), %%mm"REG_ALPHA"\n\t" \

Definition at line 359 of file yuv2rgb_template.c.

#define RGB_PACK32 (   red,
  green,
  blue,
  alpha 
)
Value:
"movq %%mm"blue", %%mm5\n\t" \
"movq %%mm"red", %%mm6\n\t" \
"punpckhbw %%mm"green", %%mm5\n\t" \
"punpcklbw %%mm"green", %%mm"blue"\n\t" \
"punpckhbw %%mm"alpha", %%mm6\n\t" \
"punpcklbw %%mm"alpha", %%mm"red"\n\t" \
"movq %%mm"blue", %%mm"green"\n\t" \
"movq %%mm5, %%mm"alpha"\n\t" \
"punpcklwd %%mm"red", %%mm"blue"\n\t" \
"punpckhwd %%mm"red", %%mm"green"\n\t" \
"punpcklwd %%mm6, %%mm5\n\t" \
"punpckhwd %%mm6, %%mm"alpha"\n\t" \
MOVNTQ " %%mm"blue", 0(%1)\n\t" \
MOVNTQ " %%mm"green", 8(%1)\n\t" \
MOVNTQ " %%mm5, 16(%1)\n\t" \
MOVNTQ " %%mm"alpha", 24(%1)\n\t" \
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:99
#define MOVNTQ

Definition at line 362 of file yuv2rgb_template.c.

Referenced by yuv420_bgr32_TMPL(), and yuv420_rgb32_TMPL().

Function Documentation

static int yuv420_rgb15_TMPL ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
inlinestatic

Definition at line 201 of file yuv2rgb_template.c.

static int yuv420_rgb16_TMPL ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
inlinestatic

Definition at line 229 of file yuv2rgb_template.c.

static int yuv420_rgb24_TMPL ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
inlinestatic

Definition at line 319 of file yuv2rgb_template.c.

static int yuv420_bgr24_TMPL ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
inlinestatic

Definition at line 337 of file yuv2rgb_template.c.

static int yuv420_rgb32_TMPL ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
inlinestatic

Definition at line 381 of file yuv2rgb_template.c.

static int yuv420_bgr32_TMPL ( SwsContext c,
const uint8_t src[],
int  srcStride[],
int  srcSliceY,
int  srcSliceH,
uint8_t dst[],
int  dstStride[] 
)
inlinestatic

Definition at line 424 of file yuv2rgb_template.c.