SDL  2.0
yuv_rgb_std_func.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PACK_PIXEL(rgb_ptr)
 
#define y_pixel_stride   1
 
#define uv_pixel_stride   1
 
#define uv_x_sample_interval   2
 
#define uv_y_sample_interval   2
 

Functions

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

Macro Definition Documentation

◆ PACK_PIXEL

#define PACK_PIXEL (   rgb_ptr)
Value:
*(Uint16 *)rgb_ptr = \
((((Uint16)clampU8(y_tmp+r_tmp)) << 8 ) & 0xF800) | \
((((Uint16)clampU8(y_tmp+g_tmp)) << 3) & 0x07E0) | \
(((Uint16)clampU8(y_tmp+b_tmp)) >> 3); \
rgb_ptr += 2; \

Definition at line 12 of file yuv_rgb_std_func.h.

◆ uv_pixel_stride

#define uv_pixel_stride   1

◆ uv_x_sample_interval

#define uv_x_sample_interval   2

◆ uv_y_sample_interval

#define uv_y_sample_interval   2

◆ y_pixel_stride

#define y_pixel_stride   1

Function Documentation

◆ STD_FUNCTION_NAME()

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

Definition at line 72 of file yuv_rgb_std_func.h.

77 {
78  const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
79 #if YUV_FORMAT == YUV_FORMAT_420
80  #define y_pixel_stride 1
81  #define uv_pixel_stride 1
82  #define uv_x_sample_interval 2
83  #define uv_y_sample_interval 2
84 #elif YUV_FORMAT == YUV_FORMAT_422
85  #define y_pixel_stride 2
86  #define uv_pixel_stride 4
87  #define uv_x_sample_interval 2
88  #define uv_y_sample_interval 1
89 #elif YUV_FORMAT == YUV_FORMAT_NV12
90  #define y_pixel_stride 1
91  #define uv_pixel_stride 2
92  #define uv_x_sample_interval 2
93  #define uv_y_sample_interval 2
94 #endif
95 
96  uint32_t x, y;
98  {
99  const uint8_t *y_ptr1=Y+y*Y_stride,
100  *y_ptr2=Y+(y+1)*Y_stride,
101  *u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
102  *v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
103 
104  uint8_t *rgb_ptr1=RGB+y*RGB_stride;
105 
106  #if uv_y_sample_interval > 1
107  uint8_t *rgb_ptr2=RGB+(y+1)*RGB_stride;
108  #endif
109 
111  {
112  // Compute U and V contributions, common to the four pixels
113 
114  int32_t u_tmp = ((*u_ptr)-128);
115  int32_t v_tmp = ((*v_ptr)-128);
116 
117  int32_t r_tmp = (v_tmp*param->v_r_factor);
118  int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
119  int32_t b_tmp = (u_tmp*param->u_b_factor);
120 
121  // Compute the Y contribution for each pixel
122 
123  int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
124  PACK_PIXEL(rgb_ptr1);
125 
126  y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
127  PACK_PIXEL(rgb_ptr1);
128 
129  #if uv_y_sample_interval > 1
130  y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
131  PACK_PIXEL(rgb_ptr2);
132 
133  y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor);
134  PACK_PIXEL(rgb_ptr2);
135  #endif
136 
137  y_ptr1+=2*y_pixel_stride;
138  y_ptr2+=2*y_pixel_stride;
141  }
142 
143  /* Catch the last pixel, if needed */
144  if (uv_x_sample_interval == 2 && x == (width-1))
145  {
146  // Compute U and V contributions, common to the four pixels
147 
148  int32_t u_tmp = ((*u_ptr)-128);
149  int32_t v_tmp = ((*v_ptr)-128);
150 
151  int32_t r_tmp = (v_tmp*param->v_r_factor);
152  int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
153  int32_t b_tmp = (u_tmp*param->u_b_factor);
154 
155  // Compute the Y contribution for each pixel
156 
157  int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
158  PACK_PIXEL(rgb_ptr1);
159 
160  #if uv_y_sample_interval > 1
161  y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
162  PACK_PIXEL(rgb_ptr2);
163  #endif
164  }
165  }
166 
167  /* Catch the last line, if needed */
168  if (uv_y_sample_interval == 2 && y == (height-1))
169  {
170  const uint8_t *y_ptr1=Y+y*Y_stride,
171  *u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
172  *v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
173 
174  uint8_t *rgb_ptr1=RGB+y*RGB_stride;
175 
177  {
178  // Compute U and V contributions, common to the four pixels
179 
180  int32_t u_tmp = ((*u_ptr)-128);
181  int32_t v_tmp = ((*v_ptr)-128);
182 
183  int32_t r_tmp = (v_tmp*param->v_r_factor);
184  int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
185  int32_t b_tmp = (u_tmp*param->u_b_factor);
186 
187  // Compute the Y contribution for each pixel
188 
189  int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
190  PACK_PIXEL(rgb_ptr1);
191 
192  y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
193  PACK_PIXEL(rgb_ptr1);
194 
195  y_ptr1+=2*y_pixel_stride;
198  }
199 
200  /* Catch the last pixel, if needed */
201  if (uv_x_sample_interval == 2 && x == (width-1))
202  {
203  // Compute U and V contributions, common to the four pixels
204 
205  int32_t u_tmp = ((*u_ptr)-128);
206  int32_t v_tmp = ((*v_ptr)-128);
207 
208  int32_t r_tmp = (v_tmp*param->v_r_factor);
209  int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
210  int32_t b_tmp = (u_tmp*param->u_b_factor);
211 
212  // Compute the Y contribution for each pixel
213 
214  int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
215  PACK_PIXEL(rgb_ptr1);
216  }
217  }
218 
219  #undef y_pixel_stride
220  #undef uv_pixel_stride
221  #undef uv_x_sample_interval
222  #undef uv_y_sample_interval
223 }

References PACK_PIXEL, RGB, uv_pixel_stride, uv_x_sample_interval, uv_y_sample_interval, V, Y, y_pixel_stride, and YUV2RGB.

Referenced by SSE_FUNCTION_NAME().

y_pixel_stride
#define y_pixel_stride
YUV2RGB
static const YUV2RGBParam YUV2RGB[3]
Definition: yuv_rgb.c:44
YUV2RGBParam
Definition: yuv_rgb.c:24
PACK_PIXEL
#define PACK_PIXEL(rgb_ptr)
Definition: yuv_rgb_std_func.h:12
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
#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
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
param
GLfloat param
Definition: SDL_opengl_glext.h:373
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
uint8_t
unsigned char uint8_t
Definition: SDL_config_windows.h:59
uv_y_sample_interval
#define uv_y_sample_interval
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
uv_pixel_stride
#define uv_pixel_stride
uv_x_sample_interval
#define uv_x_sample_interval