SDL  2.0
yuv_rgb.c File Reference
#include "../../SDL_internal.h"
#include "yuv_rgb.h"
#include "SDL_cpuinfo.h"
#include "yuv_rgb_std_func.h"
+ Include dependency graph for yuv_rgb.c:

Go to the source code of this file.

Data Structures

struct  RGB2YUVParam
 
struct  YUV2RGBParam
 

Macros

#define PRECISION   6
 
#define PRECISION_FACTOR   (1<<PRECISION)
 
#define V(value)   (int16_t)((value*PRECISION_FACTOR)+0.5)
 
#define YUV_FORMAT_420   1
 
#define YUV_FORMAT_422   2
 
#define YUV_FORMAT_NV12   3
 
#define RGB_FORMAT_RGB565   1
 
#define RGB_FORMAT_RGB24   2
 
#define RGB_FORMAT_RGBA   3
 
#define RGB_FORMAT_BGRA   4
 
#define RGB_FORMAT_ARGB   5
 
#define RGB_FORMAT_ABGR   6
 
#define STD_FUNCTION_NAME   yuv420_rgb565_std
 
#define YUV_FORMAT   YUV_FORMAT_420
 
#define RGB_FORMAT   RGB_FORMAT_RGB565
 
#define STD_FUNCTION_NAME   yuv420_rgb24_std
 
#define YUV_FORMAT   YUV_FORMAT_420
 
#define RGB_FORMAT   RGB_FORMAT_RGB24
 
#define STD_FUNCTION_NAME   yuv420_rgba_std
 
#define YUV_FORMAT   YUV_FORMAT_420
 
#define RGB_FORMAT   RGB_FORMAT_RGBA
 
#define STD_FUNCTION_NAME   yuv420_bgra_std
 
#define YUV_FORMAT   YUV_FORMAT_420
 
#define RGB_FORMAT   RGB_FORMAT_BGRA
 
#define STD_FUNCTION_NAME   yuv420_argb_std
 
#define YUV_FORMAT   YUV_FORMAT_420
 
#define RGB_FORMAT   RGB_FORMAT_ARGB
 
#define STD_FUNCTION_NAME   yuv420_abgr_std
 
#define YUV_FORMAT   YUV_FORMAT_420
 
#define RGB_FORMAT   RGB_FORMAT_ABGR
 
#define STD_FUNCTION_NAME   yuv422_rgb565_std
 
#define YUV_FORMAT   YUV_FORMAT_422
 
#define RGB_FORMAT   RGB_FORMAT_RGB565
 
#define STD_FUNCTION_NAME   yuv422_rgb24_std
 
#define YUV_FORMAT   YUV_FORMAT_422
 
#define RGB_FORMAT   RGB_FORMAT_RGB24
 
#define STD_FUNCTION_NAME   yuv422_rgba_std
 
#define YUV_FORMAT   YUV_FORMAT_422
 
#define RGB_FORMAT   RGB_FORMAT_RGBA
 
#define STD_FUNCTION_NAME   yuv422_bgra_std
 
#define YUV_FORMAT   YUV_FORMAT_422
 
#define RGB_FORMAT   RGB_FORMAT_BGRA
 
#define STD_FUNCTION_NAME   yuv422_argb_std
 
#define YUV_FORMAT   YUV_FORMAT_422
 
#define RGB_FORMAT   RGB_FORMAT_ARGB
 
#define STD_FUNCTION_NAME   yuv422_abgr_std
 
#define YUV_FORMAT   YUV_FORMAT_422
 
#define RGB_FORMAT   RGB_FORMAT_ABGR
 
#define STD_FUNCTION_NAME   yuvnv12_rgb565_std
 
#define YUV_FORMAT   YUV_FORMAT_NV12
 
#define RGB_FORMAT   RGB_FORMAT_RGB565
 
#define STD_FUNCTION_NAME   yuvnv12_rgb24_std
 
#define YUV_FORMAT   YUV_FORMAT_NV12
 
#define RGB_FORMAT   RGB_FORMAT_RGB24
 
#define STD_FUNCTION_NAME   yuvnv12_rgba_std
 
#define YUV_FORMAT   YUV_FORMAT_NV12
 
#define RGB_FORMAT   RGB_FORMAT_RGBA
 
#define STD_FUNCTION_NAME   yuvnv12_bgra_std
 
#define YUV_FORMAT   YUV_FORMAT_NV12
 
#define RGB_FORMAT   RGB_FORMAT_BGRA
 
#define STD_FUNCTION_NAME   yuvnv12_argb_std
 
#define YUV_FORMAT   YUV_FORMAT_NV12
 
#define RGB_FORMAT   RGB_FORMAT_ARGB
 
#define STD_FUNCTION_NAME   yuvnv12_abgr_std
 
#define YUV_FORMAT   YUV_FORMAT_NV12
 
#define RGB_FORMAT   RGB_FORMAT_ABGR
 

Functions

static uint8_t clampU8 (int32_t v)
 
void rgb24_yuv420_std (uint32_t width, uint32_t height, const uint8_t *RGB, uint32_t RGB_stride, uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, YCbCrType yuv_type)
 

Variables

static const YUV2RGBParam YUV2RGB [3]
 
static const RGB2YUVParam RGB2YUV [3]
 

Macro Definition Documentation

◆ PRECISION

#define PRECISION   6

Definition at line 13 of file yuv_rgb.c.

◆ PRECISION_FACTOR

#define PRECISION_FACTOR   (1<<PRECISION)

Definition at line 14 of file yuv_rgb.c.

◆ RGB_FORMAT [1/18]

#define RGB_FORMAT   RGB_FORMAT_RGB565

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [2/18]

#define RGB_FORMAT   RGB_FORMAT_RGB24

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [3/18]

#define RGB_FORMAT   RGB_FORMAT_RGBA

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [4/18]

#define RGB_FORMAT   RGB_FORMAT_BGRA

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [5/18]

#define RGB_FORMAT   RGB_FORMAT_ARGB

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [6/18]

#define RGB_FORMAT   RGB_FORMAT_ABGR

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [7/18]

#define RGB_FORMAT   RGB_FORMAT_RGB565

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [8/18]

#define RGB_FORMAT   RGB_FORMAT_RGB24

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [9/18]

#define RGB_FORMAT   RGB_FORMAT_RGBA

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [10/18]

#define RGB_FORMAT   RGB_FORMAT_BGRA

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [11/18]

#define RGB_FORMAT   RGB_FORMAT_ARGB

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [12/18]

#define RGB_FORMAT   RGB_FORMAT_ABGR

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [13/18]

#define RGB_FORMAT   RGB_FORMAT_RGB565

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [14/18]

#define RGB_FORMAT   RGB_FORMAT_RGB24

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [15/18]

#define RGB_FORMAT   RGB_FORMAT_RGBA

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [16/18]

#define RGB_FORMAT   RGB_FORMAT_BGRA

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [17/18]

#define RGB_FORMAT   RGB_FORMAT_ARGB

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT [18/18]

#define RGB_FORMAT   RGB_FORMAT_ABGR

Definition at line 186 of file yuv_rgb.c.

◆ RGB_FORMAT_ABGR

#define RGB_FORMAT_ABGR   6

Definition at line 74 of file yuv_rgb.c.

◆ RGB_FORMAT_ARGB

#define RGB_FORMAT_ARGB   5

Definition at line 73 of file yuv_rgb.c.

◆ RGB_FORMAT_BGRA

#define RGB_FORMAT_BGRA   4

Definition at line 72 of file yuv_rgb.c.

◆ RGB_FORMAT_RGB24

#define RGB_FORMAT_RGB24   2

Definition at line 70 of file yuv_rgb.c.

◆ RGB_FORMAT_RGB565

#define RGB_FORMAT_RGB565   1

Definition at line 69 of file yuv_rgb.c.

◆ RGB_FORMAT_RGBA

#define RGB_FORMAT_RGBA   3

Definition at line 71 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [1/18]

#define STD_FUNCTION_NAME   yuv420_rgb565_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [2/18]

#define STD_FUNCTION_NAME   yuv420_rgb24_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [3/18]

#define STD_FUNCTION_NAME   yuv420_rgba_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [4/18]

#define STD_FUNCTION_NAME   yuv420_bgra_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [5/18]

#define STD_FUNCTION_NAME   yuv420_argb_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [6/18]

#define STD_FUNCTION_NAME   yuv420_abgr_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [7/18]

#define STD_FUNCTION_NAME   yuv422_rgb565_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [8/18]

#define STD_FUNCTION_NAME   yuv422_rgb24_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [9/18]

#define STD_FUNCTION_NAME   yuv422_rgba_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [10/18]

#define STD_FUNCTION_NAME   yuv422_bgra_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [11/18]

#define STD_FUNCTION_NAME   yuv422_argb_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [12/18]

#define STD_FUNCTION_NAME   yuv422_abgr_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [13/18]

#define STD_FUNCTION_NAME   yuvnv12_rgb565_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [14/18]

#define STD_FUNCTION_NAME   yuvnv12_rgb24_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [15/18]

#define STD_FUNCTION_NAME   yuvnv12_rgba_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [16/18]

#define STD_FUNCTION_NAME   yuvnv12_bgra_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [17/18]

#define STD_FUNCTION_NAME   yuvnv12_argb_std

Definition at line 184 of file yuv_rgb.c.

◆ STD_FUNCTION_NAME [18/18]

#define STD_FUNCTION_NAME   yuvnv12_abgr_std

Definition at line 184 of file yuv_rgb.c.

◆ V

#define V (   value)    (int16_t)((value*PRECISION_FACTOR)+0.5)

Definition at line 38 of file yuv_rgb.c.

◆ YUV_FORMAT [1/18]

#define YUV_FORMAT   YUV_FORMAT_420

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [2/18]

#define YUV_FORMAT   YUV_FORMAT_420

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [3/18]

#define YUV_FORMAT   YUV_FORMAT_420

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [4/18]

#define YUV_FORMAT   YUV_FORMAT_420

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [5/18]

#define YUV_FORMAT   YUV_FORMAT_420

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [6/18]

#define YUV_FORMAT   YUV_FORMAT_420

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [7/18]

#define YUV_FORMAT   YUV_FORMAT_422

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [8/18]

#define YUV_FORMAT   YUV_FORMAT_422

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [9/18]

#define YUV_FORMAT   YUV_FORMAT_422

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [10/18]

#define YUV_FORMAT   YUV_FORMAT_422

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [11/18]

#define YUV_FORMAT   YUV_FORMAT_422

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [12/18]

#define YUV_FORMAT   YUV_FORMAT_422

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [13/18]

#define YUV_FORMAT   YUV_FORMAT_NV12

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [14/18]

#define YUV_FORMAT   YUV_FORMAT_NV12

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [15/18]

#define YUV_FORMAT   YUV_FORMAT_NV12

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [16/18]

#define YUV_FORMAT   YUV_FORMAT_NV12

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [17/18]

#define YUV_FORMAT   YUV_FORMAT_NV12

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT [18/18]

#define YUV_FORMAT   YUV_FORMAT_NV12

Definition at line 185 of file yuv_rgb.c.

◆ YUV_FORMAT_420

#define YUV_FORMAT_420   1

Definition at line 64 of file yuv_rgb.c.

◆ YUV_FORMAT_422

#define YUV_FORMAT_422   2

Definition at line 65 of file yuv_rgb.c.

◆ YUV_FORMAT_NV12

#define YUV_FORMAT_NV12   3

Definition at line 66 of file yuv_rgb.c.

Function Documentation

◆ clampU8()

static uint8_t clampU8 ( int32_t  v)
static

Definition at line 77 of file yuv_rgb.c.

78 {
79  static const uint8_t lut[512] =
80  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
81  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
82  0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
83  47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
84  91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
85  126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
86  159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
87  192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,
88  225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
89  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
90  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
91  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
92  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
93  };
94  return lut[(v+128*PRECISION_FACTOR)>>PRECISION];
95 }

References PRECISION, and PRECISION_FACTOR.

Referenced by rgb24_yuv420_std().

◆ rgb24_yuv420_std()

void rgb24_yuv420_std ( uint32_t  width,
uint32_t  height,
const uint8_t RGB,
uint32_t  RGB_stride,
uint8_t Y,
uint8_t U,
uint8_t V,
uint32_t  Y_stride,
uint32_t  UV_stride,
YCbCrType  yuv_type 
)

Definition at line 188 of file yuv_rgb.c.

193 {
194  const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
195 
196  uint32_t x, y;
197  for(y=0; y<(height-1); y+=2)
198  {
199  const uint8_t *rgb_ptr1=RGB+y*RGB_stride,
200  *rgb_ptr2=RGB+(y+1)*RGB_stride;
201 
202  uint8_t *y_ptr1=Y+y*Y_stride,
203  *y_ptr2=Y+(y+1)*Y_stride,
204  *u_ptr=U+(y/2)*UV_stride,
205  *v_ptr=V+(y/2)*UV_stride;
206 
207  for(x=0; x<(width-1); x+=2)
208  {
209  // compute yuv for the four pixels, u and v values are summed
210  int32_t y_tmp, u_tmp, v_tmp;
211 
212  y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2];
213  u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2];
214  v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2];
215  y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
216 
217  y_tmp = param->matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5];
218  u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5];
219  v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5];
220  y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
221 
222  y_tmp = param->matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2];
223  u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2];
224  v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2];
225  y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
226 
227  y_tmp = param->matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5];
228  u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5];
229  v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5];
230  y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
231 
232  u_ptr[0] = clampU8(u_tmp/4+(128<<PRECISION));
233  v_ptr[0] = clampU8(v_tmp/4+(128<<PRECISION));
234 
235  rgb_ptr1 += 6;
236  rgb_ptr2 += 6;
237  y_ptr1 += 2;
238  y_ptr2 += 2;
239  u_ptr += 1;
240  v_ptr += 1;
241  }
242  }
243 }

References clampU8(), PRECISION, RGB, RGB2YUV, V, and Y.

Referenced by SDL_ConvertPixels_RGB_to_YUV().

Variable Documentation

◆ RGB2YUV

const RGB2YUVParam RGB2YUV[3]
static
Initial value:
= {
{ 0, {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}},
{ 16, {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}},
{ 16, {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}}
}

Definition at line 53 of file yuv_rgb.c.

Referenced by rgb24_yuv420_std().

◆ YUV2RGB

const YUV2RGBParam YUV2RGB[3]
static
Initial value:
= {
{ 0, V(1.0), V(1.402), -V(0.3441), -V(0.7141), V(1.772)},
{ 16, V(1.1644), V(1.596), -V(0.3918), -V(0.813), V(2.0172)},
{ 16, V(1.1644), V(1.7927), -V(0.2132), -V(0.5329), V(2.1124)}
}

Definition at line 44 of file yuv_rgb.c.

Referenced by SSE_FUNCTION_NAME(), and STD_FUNCTION_NAME().

clampU8
static uint8_t clampU8(int32_t v)
Definition: yuv_rgb.c:77
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
RGB
@ RGB
Definition: edid.h:20
v
const GLdouble * v
Definition: SDL_opengl.h:2064
RGB2YUV
static const RGB2YUVParam RGB2YUV[3]
Definition: yuv_rgb.c:53
RGB2YUVParam
Definition: yuv_rgb.c:16
V
#define V(value)
Definition: yuv_rgb.c:37
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
int32_t
signed int int32_t
Definition: SDL_config_windows.h:62
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
param
GLfloat param
Definition: SDL_opengl_glext.h:373
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
PRECISION
#define PRECISION
Definition: yuv_rgb.c:12
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
uint8_t
unsigned char uint8_t
Definition: SDL_config_windows.h:59
Y
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF lsl PF lsl PF lsl PF endif SIZE macro preload_middle scratch_holds_offset if bpp if else PF PF endif endif endif endm macro preload_trailing base if bpp if bpp *pix_per_block PF PF lsl PF PF PF PF PF else PF lsl PF lsl PF PF PF PF PF base if bpp if narrow_case &&bpp<=dst_w_bpp) PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, LSL #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 90f PF pld,[WK1]90:.else PF bic, WK0, base, #31 PF pld,[WK0] PF add, WK1, base, X, lsl #bpp_shift PF sub, WK1, WK1, #1 PF bic, WK1, WK1, #31 PF cmp, WK1, WK0 PF beq, 92f91:PF add, WK0, WK0, #32 PF cmp, WK0, WK1 PF pld,[WK0] PF bne, 91b92:.endif .endif.endm.macro conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx process_head cond, numbytes, firstreg, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond X, X, #8 *numbytes/dst_w_bpp .endif process_tail cond, numbytes, firstreg .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst cond, numbytes, firstreg, DST .endif.endm.macro conditional_process1 cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_BRANCH_OVER .ifc cond, mi bpl 100f .endif .ifc cond, cs bcc 100f .endif .ifc cond, ne beq 100f .endif conditional_process1_helper, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx100:.else conditional_process1_helper cond, process_head, process_tail, numbytes, firstreg, unaligned_src, unaligned_mask, decrementx .endif.endm.macro conditional_process2 test, cond1, cond2, process_head, process_tail, numbytes1, numbytes2, firstreg1, firstreg2, unaligned_src, unaligned_mask, decrementx .if(flags) &(FLAG_DST_READWRITE|FLAG_BRANCH_OVER|FLAG_PROCESS_CORRUPTS_PSR|FLAG_PROCESS_DOES_STORE) test conditional_process1 cond1, process_head, process_tail, numbytes1, firstreg1, unaligned_src, unaligned_mask, decrementx .if(flags) &FLAG_PROCESS_CORRUPTS_PSR test .endif conditional_process1 cond2, process_head, process_tail, numbytes2, firstreg2, unaligned_src, unaligned_mask, decrementx .else test process_head cond1, numbytes1, firstreg1, unaligned_src, unaligned_mask, 0 process_head cond2, numbytes2, firstreg2, unaligned_src, unaligned_mask, 0 .if decrementx sub &cond1 X, X, #8 *numbytes1/dst_w_bpp sub &cond2 X, X, #8 *numbytes2/dst_w_bpp .endif process_tail cond1, numbytes1, firstreg1 process_tail cond2, numbytes2, firstreg2 pixst cond1, numbytes1, firstreg1, DST pixst cond2, numbytes2, firstreg2, DST .endif.endm.macro test_bits_1_0_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-1 .else movs SCRATCH, WK0, lsl #32-1 .endif.endm.macro test_bits_3_2_ptr .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 movs SCRATCH, X, lsl #32-3 .else movs SCRATCH, WK0, lsl #32-3 .endif.endm.macro leading_15bytes process_head, process_tail .set DECREMENT_X, 1 .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 .set DECREMENT_X, 0 sub X, X, WK0, lsr #dst_bpp_shift str X,[sp, #LINE_SAVED_REG_COUNT *4] mov X, WK0 .endif .if dst_w_bpp==8 conditional_process2 test_bits_1_0_ptr, mi, cs, process_head, process_tail, 1, 2, 1, 2, 1, 1, DECREMENT_X .elseif dst_w_bpp==16 test_bits_1_0_ptr conditional_process1 cs, process_head, process_tail, 2, 2, 1, 1, DECREMENT_X .endif conditional_process2 test_bits_3_2_ptr, mi, cs, process_head, process_tail, 4, 8, 1, 2, 1, 1, DECREMENT_X .if(flags) &FLAG_PROCESS_CORRUPTS_WK0 ldr X,[sp, #LINE_SAVED_REG_COUNT *4] .endif.endm.macro test_bits_3_2_pix movs SCRATCH, X, lsl #dst_bpp_shift+32-3.endm.macro test_bits_1_0_pix .if dst_w_bpp==8 movs SCRATCH, X, lsl #dst_bpp_shift+32-1 .else movs SCRATCH, X, lsr #1 .endif.endm.macro trailing_15bytes process_head, process_tail, unaligned_src, unaligned_mask conditional_process2 test_bits_3_2_pix, cs, mi, process_head, process_tail, 8, 4, 0, 2, unaligned_src, unaligned_mask, 0 .if dst_w_bpp==16 test_bits_1_0_pix conditional_process1 cs, process_head, process_tail, 2, 0, unaligned_src, unaligned_mask, 0 .elseif dst_w_bpp==8 conditional_process2 test_bits_1_0_pix, cs, mi, process_head, process_tail, 2, 1, 0, 1, unaligned_src, unaligned_mask, 0 .endif.endm.macro wide_case_inner_loop process_head, process_tail, unaligned_src, unaligned_mask, dst_alignment110:.set SUBBLOCK, 0 .rept pix_per_block *dst_w_bpp/128 process_head, 16, 0, unaligned_src, unaligned_mask, 1 .if(src_bpp > 0) &&(mask_bpp==0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle src_bpp, SRC, 1 .elseif(src_bpp==0) &&(mask_bpp > 0) &&((flags) &FLAG_PROCESS_PRESERVES_SCRATCH) preload_middle mask_bpp, MASK, 1 .else preload_middle src_bpp, SRC, 0 preload_middle mask_bpp, MASK, 0 .endif .if(dst_r_bpp > 0) &&((SUBBLOCK % 2)==0) &&(((flags) &FLAG_NO_PRELOAD_DST)==0) PF pld,[DST, #32 *prefetch_distance - dst_alignment] .endif process_tail, 16, 0 .if !((flags) &FLAG_PROCESS_DOES_STORE) pixst, 16, 0, DST .endif .set SUBBLOCK, SUBBLOCK+1 .endr subs X, X, #pix_per_block bhs 110b.endm.macro wide_case_inner_loop_and_trailing_pixels process_head, process_tail, process_inner_loop, exit_label, unaligned_src, unaligned_mask .if dst_r_bpp > tst bne process_inner_loop DST_PRELOAD_BIAS endif preload_trailing SRC preload_trailing MASK DST endif add medium_case_inner_loop_and_trailing_pixels unaligned_mask endm macro medium_case_inner_loop_and_trailing_pixels DST endif subs bhs tst beq exit_label trailing_15bytes unaligned_mask endm macro narrow_case_inner_loop_and_trailing_pixels unaligned_mask tst conditional_process1 trailing_15bytes unaligned_mask endm macro switch_on_alignment exit_label if bne endif if bne endif action if endif if bne endif action if endif endif endm macro end_of_line last_one if SINGLE_SCANLINE ifc b endif else if vars_spilled word LINE_SAVED_REGS endif subs Y
Definition: pixman-arm-simd-asm.h:554
PRECISION_FACTOR
#define PRECISION_FACTOR
Definition: yuv_rgb.c:13