Go to the documentation of this file.
65 void (*
yv12toyuy2)(
const uint8_t *ysrc,
const uint8_t *usrc,
66 const uint8_t *vsrc, uint8_t *
dst,
68 int lumStride,
int chromStride,
int dstStride);
69 void (*
yv12touyvy)(
const uint8_t *ysrc,
const uint8_t *usrc,
70 const uint8_t *vsrc, uint8_t *
dst,
72 int lumStride,
int chromStride,
int dstStride);
74 const uint8_t *vsrc, uint8_t *
dst,
76 int lumStride,
int chromStride,
int dstStride);
78 const uint8_t *vsrc, uint8_t *
dst,
80 int lumStride,
int chromStride,
int dstStride);
82 uint8_t *udst, uint8_t *vdst,
84 int lumStride,
int chromStride,
int srcStride);
86 uint8_t *udst, uint8_t *vdst,
88 int lumStride,
int chromStride,
int srcStride,
91 int srcStride,
int dstStride);
94 int src2Stride,
int dstStride);
97 int dst1Stride,
int dst2Stride);
99 uint8_t *dst1, uint8_t *dst2,
101 int srcStride1,
int srcStride2,
102 int dstStride1,
int dstStride2);
104 const uint8_t *src3, uint8_t *
dst,
106 int srcStride1,
int srcStride2,
107 int srcStride3,
int dstStride);
110 int lumStride,
int chromStride,
int srcStride);
113 int lumStride,
int chromStride,
int srcStride);
116 int lumStride,
int chromStride,
int srcStride);
119 int lumStride,
int chromStride,
int srcStride);
121 #define BY ((int)( 0.098 * (1 << RGB2YUV_SHIFT) + 0.5))
122 #define BV ((int)(-0.071 * (1 << RGB2YUV_SHIFT) + 0.5))
123 #define BU ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
124 #define GY ((int)( 0.504 * (1 << RGB2YUV_SHIFT) + 0.5))
125 #define GV ((int)(-0.368 * (1 << RGB2YUV_SHIFT) + 0.5))
126 #define GU ((int)(-0.291 * (1 << RGB2YUV_SHIFT) + 0.5))
127 #define RY ((int)( 0.257 * (1 << RGB2YUV_SHIFT) + 0.5))
128 #define RV ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
129 #define RU ((int)(-0.148 * (1 << RGB2YUV_SHIFT) + 0.5))
150 #elif ARCH_LOONGARCH64
157 int i, num_pixels = src_size >> 2;
159 for (
i = 0;
i < num_pixels;
i++) {
177 for (
i = 0; 3 *
i < src_size;
i++) {
180 dst[4 *
i + 0] = 255;
188 dst[4 *
i + 3] = 255;
196 const uint16_t *
s = (
const uint16_t *)
src;
197 const uint16_t *end =
s + src_size / 2;
200 register uint16_t bgr = *
s++;
203 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
204 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
205 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
207 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
208 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
209 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
218 uint16_t *d = (uint16_t *)
dst;
219 const uint16_t *
s = (
const uint16_t *)
src;
220 const uint16_t *end =
s + src_size / 2;
227 r = (
r << 3) | ((
r & 0x800) >> 1);
228 g = (
g << 2) | ((
g & 0x080) >> 2);
229 b = (
b << 1) | (
b >> 3);
237 const uint16_t *
s = (
const uint16_t *)
src;
238 const uint16_t *end =
s + src_size / 2;
241 register uint16_t bgr = *
s++;
242 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
243 *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
244 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
250 int i, num_pixels = src_size >> 1;
252 for (
i = 0;
i < num_pixels;
i++) {
253 unsigned rgb = ((
const uint16_t *)
src)[
i];
254 ((uint16_t *)
dst)[
i] = (
rgb >> 11) | (
rgb & 0x7E0) | (
rgb << 11);
260 int i, num_pixels = src_size >> 1;
262 for (
i = 0;
i < num_pixels;
i++) {
263 unsigned rgb = ((
const uint16_t *)
src)[
i];
264 ((uint16_t *)
dst)[
i] = (
rgb >> 11) | ((
rgb & 0x7C0) >> 1) | ((
rgb & 0x1F) << 10);
271 const uint16_t *
s = (
const uint16_t *)
src;
272 const uint16_t *end =
s + src_size / 2;
275 register uint16_t bgr = *
s++;
278 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
279 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
280 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
282 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
283 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
284 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
293 const uint16_t *
s = (
const uint16_t *)
src;
294 const uint16_t *end =
s + src_size / 2;
297 register uint16_t bgr = *
s++;
298 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
299 *d++ = ((bgr&0x03E0)>>2) | ((bgr&0x03E0)>> 7);
300 *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
306 int i, num_pixels = src_size >> 1;
308 for (
i = 0;
i < num_pixels;
i++) {
309 unsigned rgb = ((
const uint16_t *)
src)[
i];
310 ((uint16_t *)
dst)[
i] = ((
rgb & 0x7C00) >> 10) | ((
rgb & 0x3E0) << 1) | (
rgb << 11);
316 int i, num_pixels = src_size >> 1;
318 for (
i = 0;
i < num_pixels;
i++) {
319 unsigned rgb = ((
const uint16_t *)
src)[
i];
320 unsigned br =
rgb & 0x7C1F;
321 ((uint16_t *)
dst)[
i] = (br >> 10) | (
rgb & 0x3E0) | (br << 10);
327 uint16_t *d = (uint16_t *)
dst;
328 const uint16_t *
s = (
const uint16_t *)
src;
329 int i, num_pixels = src_size >> 1;
331 for (
i = 0;
i < num_pixels;
i++) {
337 #define DEFINE_RGB48TOBGR48(need_bswap, swap) \
338 void rgb48tobgr48_ ## need_bswap(const uint8_t *src, \
339 uint8_t *dst, int src_size) \
341 uint16_t *d = (uint16_t *)dst; \
342 const uint16_t *s = (const uint16_t *)src; \
343 int i, num_pixels = src_size >> 1; \
345 for (i = 0; i < num_pixels; i += 3) { \
346 d[i ] = swap ? av_bswap16(s[i + 2]) : s[i + 2]; \
347 d[i + 1] = swap ? av_bswap16(s[i + 1]) : s[i + 1]; \
348 d[i + 2] = swap ? av_bswap16(s[i ]) : s[i ]; \
355 #define DEFINE_RGB64TOBGR48(need_bswap, swap) \
356 void rgb64tobgr48_ ## need_bswap(const uint8_t *src, \
357 uint8_t *dst, int src_size) \
359 uint16_t *d = (uint16_t *)dst; \
360 const uint16_t *s = (const uint16_t *)src; \
361 int i, num_pixels = src_size >> 3; \
363 for (i = 0; i < num_pixels; i++) { \
364 d[3 * i ] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \
365 d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
366 d[3 * i + 2] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
373 #define DEFINE_RGB64TO48(need_bswap, swap) \
374 void rgb64to48_ ## need_bswap(const uint8_t *src, \
375 uint8_t *dst, int src_size) \
377 uint16_t *d = (uint16_t *)dst; \
378 const uint16_t *s = (const uint16_t *)src; \
379 int i, num_pixels = src_size >> 3; \
381 for (i = 0; i < num_pixels; i++) { \
382 d[3 * i ] = swap ? av_bswap16(s[4 * i ]) : s[4 * i ]; \
383 d[3 * i + 1] = swap ? av_bswap16(s[4 * i + 1]) : s[4 * i + 1]; \
384 d[3 * i + 2] = swap ? av_bswap16(s[4 * i + 2]) : s[4 * i + 2]; \
391 #define DEFINE_RGB48TOBGR64(need_bswap, swap) \
392 void rgb48tobgr64_ ## need_bswap(const uint8_t *src, \
393 uint8_t *dst, int src_size) \
395 uint16_t *d = (uint16_t *)dst; \
396 const uint16_t *s = (const uint16_t *)src; \
397 int i, num_pixels = src_size / 6; \
399 for (i = 0; i < num_pixels; i++) { \
400 d[4 * i ] = swap ? av_bswap16(s[3 * i + 2]) : s[3 * i + 2]; \
401 d[4 * i + 1] = swap ? av_bswap16(s[3 * i + 1]) : s[3 * i + 1]; \
402 d[4 * i + 2] = swap ? av_bswap16(s[3 * i ]) : s[3 * i ]; \
403 d[4 * i + 3] = 0xFFFF; \
410 #define DEFINE_RGB48TO64(need_bswap, swap) \
411 void rgb48to64_ ## need_bswap(const uint8_t *src, \
412 uint8_t *dst, int src_size) \
414 uint16_t *d = (uint16_t *)dst; \
415 const uint16_t *s = (const uint16_t *)src; \
416 int i, num_pixels = src_size / 6; \
418 for (i = 0; i < num_pixels; i++) { \
419 d[4 * i ] = swap ? av_bswap16(s[3 * i ]) : s[3 * i ]; \
420 d[4 * i + 1] = swap ? av_bswap16(s[3 * i + 1]) : s[3 * i + 1]; \
421 d[4 * i + 2] = swap ? av_bswap16(s[3 * i + 2]) : s[3 * i + 2]; \
422 d[4 * i + 3] = 0xFFFF; \
429 #define DEFINE_X2RGB10TO16(need_bswap, swap, bits, alpha) \
430 void x2rgb10to ## bits ## _ ## need_bswap(const uint8_t *src, \
431 uint8_t *dst, int src_size) \
433 uint16_t *d = (uint16_t *)dst; \
434 const uint32_t *s = (const uint32_t *)src; \
435 int i, num_pixels = src_size >> 2; \
436 unsigned component; \
438 for (i = 0; i < num_pixels; i++) { \
439 unsigned p = AV_RL32(s + i); \
440 component = (p >> 20) & 0x3FF; \
441 d[(3 + alpha) * i + 0] = swap ? av_bswap16(component << 6 | component >> 4) \
442 : component << 6 | component >> 4; \
443 component = (p >> 10) & 0x3FF; \
444 d[(3 + alpha) * i + 1] = swap ? av_bswap16(component << 6 | component >> 4) \
445 : component << 6 | component >> 4; \
446 component = p & 0x3FF; \
447 d[(3 + alpha) * i + 2] = swap ? av_bswap16(component << 6 | component >> 4) \
448 : component << 6 | component >> 4; \
449 if (alpha) d[(3 + alpha) * i + 3] = 0xffff; \
458 #define DEFINE_X2RGB10TOBGR16(need_bswap, swap, bits, alpha) \
459 void x2rgb10tobgr ## bits ## _ ## need_bswap(const uint8_t *src, \
460 uint8_t *dst, int src_size) \
462 uint16_t *d = (uint16_t *)dst; \
463 const uint32_t *s = (const uint32_t *)src; \
464 int i, num_pixels = src_size >> 2; \
465 unsigned component; \
467 for (i = 0; i < num_pixels; i++) { \
468 unsigned p = AV_RL32(s + i); \
469 component = p & 0x3FF; \
470 d[(3 + alpha) * i + 0] = swap ? av_bswap16(component << 6 | component >> 4) \
471 : component << 6 | component >> 4; \
472 component = (p >> 10) & 0x3FF; \
473 d[(3 + alpha) * i + 1] = swap ? av_bswap16(component << 6 | component >> 4) \
474 : component << 6 | component >> 4; \
475 component = (p >> 20) & 0x3FF; \
476 d[(3 + alpha) * i + 2] = swap ? av_bswap16(component << 6 | component >> 4) \
477 : component << 6 | component >> 4; \
478 if (alpha) d[(3 + alpha) * i + 3] = 0xffff; \
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
void(* shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size)
void(* yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Height should be a multiple of 2 and width should be a multiple of 16.
void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size)
void(* yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride)
Height should be a multiple of 2 and width should be a multiple of 16.
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void(* shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size)
static const char rgb2yuv[]
void(* rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
void(* yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
void(* rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size)
#define DEFINE_RGB48TOBGR48(need_bswap, swap)
void(* yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Height should be a multiple of 2 and width should be a multiple of 16.
void(* rgb32to16)(const uint8_t *src, uint8_t *dst, int src_size)
void(* shuffle_bytes_2130)(const uint8_t *src, uint8_t *dst, int src_size)
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
#define DEFINE_RGB64TOBGR48(need_bswap, swap)
void(* rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
void(* shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
void(* yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Width should be a multiple of 16.
void(* shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size)
void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
void(* interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, int width, int height, int src1Stride, int src2Stride, int dstStride)
av_cold void rgb2rgb_init_aarch64(void)
void(* yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, int width, int height, int srcStride1, int srcStride2, int srcStride3, int dstStride)
void(* shuffle_bytes_3102)(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size)
av_cold void ff_sws_rgb2rgb_init(void)
void(* yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size)
#define DEFINE_RGB48TOBGR64(need_bswap, swap)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
av_cold void rgb2rgb_init_x86(void)
void(* shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size)
void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size)
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb24to16)(const uint8_t *src, uint8_t *dst, int src_size)
void(* uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
void(* ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, int width, int height, int lumStride, int chromStride, int srcStride, const int32_t *rgb2yuv)
Height should be a multiple of 2 and width should be a multiple of 2.
#define i(width, name, range_min, range_max)
void(* rgb24to15)(const uint8_t *src, uint8_t *dst, int src_size)
#define DEFINE_X2RGB10TOBGR16(need_bswap, swap, bits, alpha)
void(* rgb32to15)(const uint8_t *src, uint8_t *dst, int src_size)
av_cold void rgb2rgb_init_riscv(void)
#define DEFINE_X2RGB10TO16(need_bswap, swap, bits, alpha)
void(* deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
static av_cold void rgb2rgb_init_c(void)
void(* uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride)
void(* rgb16to32)(const uint8_t *src, uint8_t *dst, int src_size)
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int src_size)
void(* shuffle_bytes_2013)(const uint8_t *src, uint8_t *dst, int src_size)
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void(* rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size)
void(* shuffle_bytes_1203)(const uint8_t *src, uint8_t *dst, int src_size)
#define DEFINE_RGB48TO64(need_bswap, swap)
void(* yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, int width, int height, int lumStride, int chromStride, int dstStride)
Width should be a multiple of 16.
void(* vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride1, int srcStride2, int dstStride1, int dstStride2)
void(* rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
#define DEFINE_RGB64TO48(need_bswap, swap)
void(* planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride)
static const SheerTable rgb[2]
av_cold void rgb2rgb_init_loongarch(void)
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int src_size)