FFmpeg
Loading...
Searching...
No Matches
yuv2rgb_lsx.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Loongson Technology Co. Ltd.
3 * Contributed by Bo Jin(jinbo@loongson.cn)
4 * All rights reserved.
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include "swscale_loongarch.h"
25
26#define YUV2RGB_LOAD_COE \
27 /* Load x_offset */ \
28 __m128i y_offset = __lsx_vreplgr2vr_d(c->yOffset); \
29 __m128i u_offset = __lsx_vreplgr2vr_d(c->uOffset); \
30 __m128i v_offset = __lsx_vreplgr2vr_d(c->vOffset); \
31 /* Load x_coeff */ \
32 __m128i ug_coeff = __lsx_vreplgr2vr_d(c->ugCoeff); \
33 __m128i vg_coeff = __lsx_vreplgr2vr_d(c->vgCoeff); \
34 __m128i y_coeff = __lsx_vreplgr2vr_d(c->yCoeff); \
35 __m128i ub_coeff = __lsx_vreplgr2vr_d(c->ubCoeff); \
36 __m128i vr_coeff = __lsx_vreplgr2vr_d(c->vrCoeff); \
37
38#define LOAD_YUV_16 \
39 m_y1 = __lsx_vld(py_1, 0); \
40 m_y2 = __lsx_vld(py_2, 0); \
41 m_u = __lsx_vldrepl_d(pu, 0); \
42 m_v = __lsx_vldrepl_d(pv, 0); \
43 DUP2_ARG2(__lsx_vilvl_b, m_u, m_u, m_v, m_v, m_u, m_v); \
44 DUP2_ARG2(__lsx_vilvh_b, zero, m_u, zero, m_v, m_u_h, m_v_h); \
45 DUP2_ARG2(__lsx_vilvl_b, zero, m_u, zero, m_v, m_u, m_v); \
46 DUP2_ARG2(__lsx_vilvh_b, zero, m_y1, zero, m_y2, m_y1_h, m_y2_h); \
47 DUP2_ARG2(__lsx_vilvl_b, zero, m_y1, zero, m_y2, m_y1, m_y2); \
48
49#define LOAD_YUV_16_NV12 \
50 m_y1 = __lsx_vld(py_1, 0); \
51 m_y2 = __lsx_vld(py_2, 0); \
52 m_uv = __lsx_vld(puv, 0); \
53 m_u = __lsx_vshuf_b(zero, m_uv, shuf_u); \
54 m_u_h = __lsx_vshuf_b(zero, m_uv, shuf_uh); \
55 m_v = __lsx_vshuf_b(zero, m_uv, shuf_v); \
56 m_v_h = __lsx_vshuf_b(zero, m_uv, shuf_vh); \
57 DUP2_ARG2(__lsx_vilvh_b, zero, m_y1, zero, m_y2, m_y1_h, m_y2_h); \
58 DUP2_ARG2(__lsx_vilvl_b, zero, m_y1, zero, m_y2, m_y1, m_y2); \
59
60/* YUV2RGB method
61 * The conversion method is as follows:
62 * R = Y' * y_coeff + V' * vr_coeff
63 * G = Y' * y_coeff + V' * vg_coeff + U' * ug_coeff
64 * B = Y' * y_coeff + U' * ub_coeff
65 *
66 * where X' = X * 8 - x_offset
67 *
68 */
69
70#define YUV2RGB(y1, y2, u, v, r1, g1, b1, r2, g2, b2) \
71{ \
72 y1 = __lsx_vslli_h(y1, 3); \
73 y2 = __lsx_vslli_h(y2, 3); \
74 u = __lsx_vslli_h(u, 3); \
75 v = __lsx_vslli_h(v, 3); \
76 y1 = __lsx_vsub_h(y1, y_offset); \
77 y2 = __lsx_vsub_h(y2, y_offset); \
78 u = __lsx_vsub_h(u, u_offset); \
79 v = __lsx_vsub_h(v, v_offset); \
80 y_1 = __lsx_vmuh_h(y1, y_coeff); \
81 y_2 = __lsx_vmuh_h(y2, y_coeff); \
82 u2g = __lsx_vmuh_h(u, ug_coeff); \
83 u2b = __lsx_vmuh_h(u, ub_coeff); \
84 v2r = __lsx_vmuh_h(v, vr_coeff); \
85 v2g = __lsx_vmuh_h(v, vg_coeff); \
86 r1 = __lsx_vsadd_h(y_1, v2r); \
87 v2g = __lsx_vsadd_h(v2g, u2g); \
88 g1 = __lsx_vsadd_h(y_1, v2g); \
89 b1 = __lsx_vsadd_h(y_1, u2b); \
90 r2 = __lsx_vsadd_h(y_2, v2r); \
91 g2 = __lsx_vsadd_h(y_2, v2g); \
92 b2 = __lsx_vsadd_h(y_2, u2b); \
93 DUP4_ARG1(__lsx_vclip255_h, r1, g1, b1, r2, r1, g1, b1, r2); \
94 DUP2_ARG1(__lsx_vclip255_h, g2, b2, g2, b2); \
95}
96
97#define RGB_PACK(r, g, b, rgb_l, rgb_h) \
98{ \
99 __m128i rg; \
100 rg = __lsx_vpackev_b(g, r); \
101 DUP2_ARG3(__lsx_vshuf_b, b, rg, shuf2, b, rg, shuf3, rgb_l, rgb_h); \
102}
103
104#define RGB32_PACK(a, r, g, b, rgb_l, rgb_h) \
105{ \
106 __m128i ra, bg; \
107 ra = __lsx_vpackev_b(r, a); \
108 bg = __lsx_vpackev_b(b, g); \
109 rgb_l = __lsx_vilvl_h(bg, ra); \
110 rgb_h = __lsx_vilvh_h(bg, ra); \
111}
112
113#define RGB_STORE(rgb_l, rgb_h, image) \
114{ \
115 __lsx_vstelm_d(rgb_l, image, 0, 0); \
116 __lsx_vstelm_d(rgb_l, image, 8, 1); \
117 __lsx_vstelm_d(rgb_h, image, 16, 0); \
118}
119
120#define RGB32_STORE(rgb_l, rgb_h, image) \
121{ \
122 __lsx_vst(rgb_l, image, 0); \
123 __lsx_vst(rgb_h, image, 16); \
124}
125
126#define YUV2RGBFUNC(func_name, dst_type, alpha) \
127 int func_name(SwsInternal *c, const uint8_t *const src[], \
128 const int srcStride[], int srcSliceY, int srcSliceH, \
129 uint8_t *const dst[], const int dstStride[]) \
130{ \
131 int x, y, h_size, vshift, res; \
132 __m128i m_y1, m_y2, m_u, m_v; \
133 __m128i m_y1_h, m_y2_h, m_u_h, m_v_h; \
134 __m128i y_1, y_2, u2g, v2g, u2b, v2r, rgb1_l, rgb1_h; \
135 __m128i rgb2_l, rgb2_h, r1, g1, b1, r2, g2, b2; \
136 __m128i shuf2 = {0x0504120302100100, 0x0A18090816070614}; \
137 __m128i shuf3 = {0x1E0F0E1C0D0C1A0B, 0x0101010101010101}; \
138 __m128i zero = __lsx_vldi(0); \
139 \
140 YUV2RGB_LOAD_COE \
141 \
142 h_size = c->opts.dst_w >> 4; \
143 res = (c->opts.dst_w & 15) >> 1; \
144 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
145 for (y = 0; y < srcSliceH; y += 2) { \
146 av_unused dst_type *r, *g, *b; \
147 dst_type *image1 = (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]);\
148 dst_type *image2 = (dst_type *)(image1 + dstStride[0]);\
149 const uint8_t *py_1 = src[0] + y * srcStride[0]; \
150 const uint8_t *py_2 = py_1 + srcStride[0]; \
151 const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; \
152 const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \
153 for(x = 0; x < h_size; x++) { \
154
155#define YUV2RGBFUNC32(func_name, dst_type, alpha) \
156 int func_name(SwsInternal *c, const uint8_t *const src[], \
157 const int srcStride[], int srcSliceY, int srcSliceH, \
158 uint8_t *const dst[], const int dstStride[]) \
159{ \
160 int x, y, h_size, vshift, res; \
161 __m128i m_y1, m_y2, m_u, m_v; \
162 __m128i m_y1_h, m_y2_h, m_u_h, m_v_h; \
163 __m128i y_1, y_2, u2g, v2g, u2b, v2r, rgb1_l, rgb1_h; \
164 __m128i rgb2_l, rgb2_h, r1, g1, b1, r2, g2, b2; \
165 __m128i a = __lsx_vldi(0xFF); \
166 __m128i zero = __lsx_vldi(0); \
167 \
168 YUV2RGB_LOAD_COE \
169 \
170 h_size = c->opts.dst_w >> 4; \
171 res = (c->opts.dst_w & 15) >> 1; \
172 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
173 for (y = 0; y < srcSliceH; y += 2) { \
174 int yd = y + srcSliceY; \
175 av_unused dst_type *r, *g, *b; \
176 dst_type *image1 = (dst_type *)(dst[0] + (yd) * dstStride[0]); \
177 dst_type *image2 = (dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \
178 const uint8_t *py_1 = src[0] + y * srcStride[0]; \
179 const uint8_t *py_2 = py_1 + srcStride[0]; \
180 const uint8_t *pu = src[1] + (y >> vshift) * srcStride[1]; \
181 const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \
182 for(x = 0; x < h_size; x++) { \
183
184#define DEALYUV2RGBREMAIN \
185 py_1 += 16; \
186 py_2 += 16; \
187 pu += 8; \
188 pv += 8; \
189 image1 += 48; \
190 image2 += 48; \
191 } \
192 for (x = 0; x < res; x++) { \
193 av_unused int U, V, Y; \
194 U = pu[0]; \
195 V = pv[0]; \
196 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
197 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] \
198 + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \
199 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM];
200
201#define DEALYUV2RGBREMAIN32 \
202 py_1 += 16; \
203 py_2 += 16; \
204 pu += 8; \
205 pv += 8; \
206 image1 += 16; \
207 image2 += 16; \
208 } \
209 for (x = 0; x < res; x++) { \
210 av_unused int U, V, Y; \
211 U = pu[0]; \
212 V = pv[0]; \
213 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
214 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] \
215 + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \
216 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; \
217
218#define PUTRGB24(dst, src) \
219 Y = src[0]; \
220 dst[0] = r[Y]; \
221 dst[1] = g[Y]; \
222 dst[2] = b[Y]; \
223 Y = src[1]; \
224 dst[3] = r[Y]; \
225 dst[4] = g[Y]; \
226 dst[5] = b[Y];
227
228#define PUTBGR24(dst, src) \
229 Y = src[0]; \
230 dst[0] = b[Y]; \
231 dst[1] = g[Y]; \
232 dst[2] = r[Y]; \
233 Y = src[1]; \
234 dst[3] = b[Y]; \
235 dst[4] = g[Y]; \
236 dst[5] = r[Y];
237
238#define PUTRGB(dst, src) \
239 Y = src[0]; \
240 dst[0] = r[Y] + g[Y] + b[Y]; \
241 Y = src[1]; \
242 dst[1] = r[Y] + g[Y] + b[Y]; \
243
244#define ENDRES \
245 pu += 1; \
246 pv += 1; \
247 py_1 += 2; \
248 py_2 += 2; \
249 image1 += 6; \
250 image2 += 6; \
251
252#define ENDRES32 \
253 pu += 1; \
254 pv += 1; \
255 py_1 += 2; \
256 py_2 += 2; \
257 image1 += 2; \
258 image2 += 2; \
259
260#define END_FUNC() \
261 } \
262 } \
263 return srcSliceH; \
264}
265
266#define SHUF_UV_EVEN {0x1002100210001000, 0x1006100610041004}
267#define SHUF_UV_EVEN_HI {0x100a100a10081008, 0x100e100e100c100c}
268#define SHUF_UV_ODD {0x1003100310011001, 0x1007100710051005}
269#define SHUF_UV_ODD_HI {0x100b100b10091009, 0x100f100f100d100d}
270
271#define YUV2RGBFUNC32_NV12(func_name, dst_type, alpha, \
272 SHUF_U, SHUF_UH, SHUF_V, SHUF_VH) \
273 int func_name(SwsInternal *c, const uint8_t *const src[], \
274 const int srcStride[], int srcSliceY, int srcSliceH, \
275 uint8_t *const dst[], const int dstStride[]) \
276{ \
277 int x, y, h_size, vshift, res; \
278 __m128i m_y1, m_y2, m_u, m_v, m_uv; \
279 __m128i m_y1_h, m_y2_h, m_u_h, m_v_h; \
280 __m128i y_1, y_2, u2g, v2g, u2b, v2r, rgb1_l, rgb1_h; \
281 __m128i rgb2_l, rgb2_h, r1, g1, b1, r2, g2, b2; \
282 __m128i a = __lsx_vldi(0xFF); \
283 __m128i zero = __lsx_vldi(0); \
284 __m128i shuf_u = SHUF_U; \
285 __m128i shuf_uh = SHUF_UH; \
286 __m128i shuf_v = SHUF_V; \
287 __m128i shuf_vh = SHUF_VH; \
288 \
289 YUV2RGB_LOAD_COE \
290 \
291 h_size = c->opts.dst_w >> 4; \
292 res = (c->opts.dst_w & 15) >> 1; \
293 vshift = c->opts.src_format != AV_PIX_FMT_YUV422P; \
294 for (y = 0; y < srcSliceH; y += 2) { \
295 int yd = y + srcSliceY; \
296 dst_type av_unused *r, *g, *b; \
297 dst_type *image1 = (dst_type *)(dst[0] + (yd) * dstStride[0]); \
298 dst_type *image2 = (dst_type *)(dst[0] + (yd + 1) * dstStride[0]); \
299 const uint8_t *py_1 = src[0] + y * srcStride[0]; \
300 const uint8_t *py_2 = py_1 + srcStride[0]; \
301 const uint8_t *puv = src[1] + (y >> vshift) * srcStride[1]; \
302 for(x = 0; x < h_size; x++) { \
303
304#define DEALYUV2RGBREMAIN32_NV12 \
305 py_1 += 16; \
306 py_2 += 16; \
307 puv += 16; \
308 image1 += 16; \
309 image2 += 16; \
310 } \
311 for (x = 0; x < res; x++) { \
312 av_unused int U, V, Y; \
313 U = puv[0]; \
314 V = puv[1]; \
315 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
316 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] \
317 + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \
318 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; \
319
320#define DEALYUV2RGBREMAIN32_NV21 \
321 py_1 += 16; \
322 py_2 += 16; \
323 puv += 16; \
324 image1 += 16; \
325 image2 += 16; \
326 } \
327 for (x = 0; x < res; x++) { \
328 av_unused int U, V, Y; \
329 U = puv[1]; \
330 V = puv[0]; \
331 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; \
332 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] \
333 + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); \
334 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; \
335
336#define ENDRES32_NV12 \
337 puv += 2; \
338 py_1 += 2; \
339 py_2 += 2; \
340 image1 += 2; \
341 image2 += 2; \
342
343YUV2RGBFUNC(yuv420_rgb24_lsx, uint8_t, 0)
345 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
346 RGB_PACK(r1, g1, b1, rgb1_l, rgb1_h);
347 RGB_PACK(r2, g2, b2, rgb2_l, rgb2_h);
348 RGB_STORE(rgb1_l, rgb1_h, image1);
349 RGB_STORE(rgb2_l, rgb2_h, image2);
350 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
351 RGB_PACK(r1, g1, b1, rgb1_l, rgb1_h);
352 RGB_PACK(r2, g2, b2, rgb2_l, rgb2_h);
353 RGB_STORE(rgb1_l, rgb1_h, image1 + 24);
354 RGB_STORE(rgb2_l, rgb2_h, image2 + 24);
356 PUTRGB24(image1, py_1);
357 PUTRGB24(image2, py_2);
358 ENDRES
359 END_FUNC()
360
361YUV2RGBFUNC(yuv420_bgr24_lsx, uint8_t, 0)
363 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
364 RGB_PACK(b1, g1, r1, rgb1_l, rgb1_h);
365 RGB_PACK(b2, g2, r2, rgb2_l, rgb2_h);
366 RGB_STORE(rgb1_l, rgb1_h, image1);
367 RGB_STORE(rgb2_l, rgb2_h, image2);
368 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
369 RGB_PACK(b1, g1, r1, rgb1_l, rgb1_h);
370 RGB_PACK(b2, g2, r2, rgb2_l, rgb2_h);
371 RGB_STORE(rgb1_l, rgb1_h, image1 + 24);
372 RGB_STORE(rgb2_l, rgb2_h, image2 + 24);
374 PUTBGR24(image1, py_1);
375 PUTBGR24(image2, py_2);
376 ENDRES
377 END_FUNC()
378
381 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
382 RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
383 RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
384 RGB32_STORE(rgb1_l, rgb1_h, image1);
385 RGB32_STORE(rgb2_l, rgb2_h, image2);
386 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
387 RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
388 RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
389 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
390 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
392 PUTRGB(image1, py_1);
393 PUTRGB(image2, py_2);
395 END_FUNC()
396
399 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
400 RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
401 RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
402 RGB32_STORE(rgb1_l, rgb1_h, image1);
403 RGB32_STORE(rgb2_l, rgb2_h, image2);
404 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
405 RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
406 RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
407 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
408 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
410 PUTRGB(image1, py_1);
411 PUTRGB(image2, py_2);
413 END_FUNC()
414
417 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
418 RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
419 RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
420 RGB32_STORE(rgb1_l, rgb1_h, image1);
421 RGB32_STORE(rgb2_l, rgb2_h, image2);
422 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
423 RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
424 RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
425 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
426 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
428 PUTRGB(image1, py_1);
429 PUTRGB(image2, py_2);
431 END_FUNC()
432
435 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
436 RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
437 RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
438 RGB32_STORE(rgb1_l, rgb1_h, image1);
439 RGB32_STORE(rgb2_l, rgb2_h, image2);
440 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
441 RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
442 RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
443 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
444 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
446 PUTRGB(image1, py_1);
447 PUTRGB(image2, py_2);
449 END_FUNC()
450
457 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
458 RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
459 RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
460 RGB32_STORE(rgb1_l, rgb1_h, image1);
461 RGB32_STORE(rgb2_l, rgb2_h, image2);
462 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
463 RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
464 RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
465 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
466 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
468 PUTRGB(image1, py_1);
469 PUTRGB(image2, py_2);
471 END_FUNC()
472
479 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
480 RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
481 RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
482 RGB32_STORE(rgb1_l, rgb1_h, image1);
483 RGB32_STORE(rgb2_l, rgb2_h, image2);
484 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
485 RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
486 RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
487 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
488 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
490 PUTRGB(image1, py_1);
491 PUTRGB(image2, py_2);
493 END_FUNC()
494
501 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
502 RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
503 RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
504 RGB32_STORE(rgb1_l, rgb1_h, image1);
505 RGB32_STORE(rgb2_l, rgb2_h, image2);
506 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
507 RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
508 RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
509 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
510 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
512 PUTRGB(image1, py_1);
513 PUTRGB(image2, py_2);
515 END_FUNC()
516
523 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
524 RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
525 RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
526 RGB32_STORE(rgb1_l, rgb1_h, image1);
527 RGB32_STORE(rgb2_l, rgb2_h, image2);
528 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
529 RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
530 RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
531 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
532 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
534 PUTRGB(image1, py_1);
535 PUTRGB(image2, py_2);
537 END_FUNC()
538
545 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
546 RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
547 RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
548 RGB32_STORE(rgb1_l, rgb1_h, image1);
549 RGB32_STORE(rgb2_l, rgb2_h, image2);
550 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
551 RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
552 RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
553 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
554 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
556 PUTRGB(image1, py_1);
557 PUTRGB(image2, py_2);
559 END_FUNC()
560
567 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
568 RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
569 RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
570 RGB32_STORE(rgb1_l, rgb1_h, image1);
571 RGB32_STORE(rgb2_l, rgb2_h, image2);
572 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
573 RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
574 RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
575 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
576 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
578 PUTRGB(image1, py_1);
579 PUTRGB(image2, py_2);
581 END_FUNC()
582
589 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
590 RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
591 RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
592 RGB32_STORE(rgb1_l, rgb1_h, image1);
593 RGB32_STORE(rgb2_l, rgb2_h, image2);
594 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
595 RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
596 RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
597 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
598 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
600 PUTRGB(image1, py_1);
601 PUTRGB(image2, py_2);
603 END_FUNC()
604
611 YUV2RGB(m_y1, m_y2, m_u, m_v, r1, g1, b1, r2, g2, b2);
612 RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
613 RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
614 RGB32_STORE(rgb1_l, rgb1_h, image1);
615 RGB32_STORE(rgb2_l, rgb2_h, image2);
616 YUV2RGB(m_y1_h, m_y2_h, m_u_h, m_v_h, r1, g1, b1, r2, g2, b2);
617 RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
618 RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
619 RGB32_STORE(rgb1_l, rgb1_h, image1 + 8);
620 RGB32_STORE(rgb2_l, rgb2_h, image2 + 8);
622 PUTRGB(image1, py_1);
623 PUTRGB(image2, py_2);
625 END_FUNC()
int a
#define YUV2RGB(NAME, TYPE)
Definition pngdec.c:317
int yuv420_argb32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv21_argb32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_rgba32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_bgra32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_rgb24_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv12_bgra32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv21_abgr32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv12_abgr32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv21_bgra32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv12_rgba32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_bgr24_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_abgr32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv21_rgba32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
int yuv420_nv12_argb32_lsx(SwsInternal *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
static double b1(void *priv, double x, double y)
Definition vf_xfade.c:2041
static double b2(void *priv, double x, double y)
Definition vf_xfade.c:2042
py_2
Definition yuv2rgb.c:484
py_1
Definition yuv2rgb.c:483
#define END_FUNC()
#define RGB_STORE(rgb_l, rgb_h, image)
#define YUV2RGBFUNC(func_name, dst_type, alpha)
#define RGB32_PACK(a, r, g, b, rgb_l, rgb_h)
#define RGB32_STORE(rgb_l, rgb_h, image)
#define LOAD_YUV_16
#define YUV2RGBFUNC32(func_name, dst_type, alpha)
#define RGB_PACK(r, g, b, rgb_l, rgb_h)
#define PUTRGB(dst, src)
#define PUTBGR24(dst, src)
#define ENDRES32_NV12
#define DEALYUV2RGBREMAIN32_NV12
#define SHUF_UV_EVEN
#define PUTRGB24(dst, src)
#define ENDRES32
#define LOAD_YUV_16_NV12
Definition yuv2rgb_lsx.c:49
#define SHUF_UV_EVEN_HI
#define DEALYUV2RGBREMAIN32_NV21
#define YUV2RGBFUNC(func_name, dst_type, alpha)
#define YUV2RGBFUNC32_NV12(func_name, dst_type, alpha, SHUF_U, SHUF_UH, SHUF_V, SHUF_VH)
#define DEALYUV2RGBREMAIN
#define SHUF_UV_ODD
#define DEALYUV2RGBREMAIN32
#define ENDRES
#define SHUF_UV_ODD_HI