FFmpeg
sw_rgb.c
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #include <string.h>
21 
22 #include "libavutil/common.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/mem_internal.h"
25 #include "libavutil/pixdesc.h"
26 
27 #include "libswscale/rgb2rgb.h"
28 #include "libswscale/swscale.h"
30 
31 #include "checkasm.h"
32 
33 #define randomize_buffers(buf, size) \
34  do { \
35  int j; \
36  for (j = 0; j < size; j+=4) \
37  AV_WN32(buf + j, rnd()); \
38  } while (0)
39 
40 static const uint8_t width[] = {12, 16, 20, 32, 36, 128};
41 static const struct {uint8_t w, h, s;} planes[] = {
42  {12,16,12}, {16,16,16}, {20,23,25}, {32,18,48}, {8,128,16}, {128,128,128}
43 };
44 
45 #define MAX_STRIDE 128
46 #define MAX_HEIGHT 128
47 
48 static void check_shuffle_bytes(void * func, const char * report)
49 {
50  int i;
51  LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]);
52  LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]);
53  LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]);
54  LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]);
55 
56  declare_func(void, const uint8_t *src, uint8_t *dst, int src_size);
57 
58  memset(dst0, 0, MAX_STRIDE);
59  memset(dst1, 0, MAX_STRIDE);
61  memcpy(src1, src0, MAX_STRIDE);
62 
63  if (check_func(func, "%s", report)) {
64  for (i = 0; i < 6; i ++) {
65  call_ref(src0, dst0, width[i]);
66  call_new(src1, dst1, width[i]);
67  if (memcmp(dst0, dst1, MAX_STRIDE))
68  fail();
69  }
70  bench_new(src0, dst0, width[5]);
71  }
72 }
73 
74 static void check_uyvy_to_422p(void)
75 {
76  int i;
77 
78  LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE * MAX_HEIGHT * 2]);
79  LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE * MAX_HEIGHT * 2]);
80  LOCAL_ALIGNED_32(uint8_t, dst_y_0, [MAX_STRIDE * MAX_HEIGHT]);
81  LOCAL_ALIGNED_32(uint8_t, dst_y_1, [MAX_STRIDE * MAX_HEIGHT]);
82  LOCAL_ALIGNED_32(uint8_t, dst_u_0, [(MAX_STRIDE/2) * MAX_HEIGHT]);
83  LOCAL_ALIGNED_32(uint8_t, dst_u_1, [(MAX_STRIDE/2) * MAX_HEIGHT]);
84  LOCAL_ALIGNED_32(uint8_t, dst_v_0, [(MAX_STRIDE/2) * MAX_HEIGHT]);
85  LOCAL_ALIGNED_32(uint8_t, dst_v_1, [(MAX_STRIDE/2) * MAX_HEIGHT]);
86 
87  declare_func(void, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
88  const uint8_t *src, int width, int height,
89  int lumStride, int chromStride, int srcStride);
90 
92  memcpy(src1, src0, MAX_STRIDE * MAX_HEIGHT * 2);
93 
94  if (check_func(uyvytoyuv422, "uyvytoyuv422")) {
95  for (i = 0; i < 6; i ++) {
96  memset(dst_y_0, 0, MAX_STRIDE * MAX_HEIGHT);
97  memset(dst_y_1, 0, MAX_STRIDE * MAX_HEIGHT);
98  memset(dst_u_0, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
99  memset(dst_u_1, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
100  memset(dst_v_0, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
101  memset(dst_v_1, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
102 
103  call_ref(dst_y_0, dst_u_0, dst_v_0, src0, planes[i].w, planes[i].h,
104  MAX_STRIDE, MAX_STRIDE / 2, planes[i].s);
105  call_new(dst_y_1, dst_u_1, dst_v_1, src1, planes[i].w, planes[i].h,
106  MAX_STRIDE, MAX_STRIDE / 2, planes[i].s);
107  if (memcmp(dst_y_0, dst_y_1, MAX_STRIDE * MAX_HEIGHT) ||
108  memcmp(dst_u_0, dst_u_1, (MAX_STRIDE/2) * MAX_HEIGHT) ||
109  memcmp(dst_v_0, dst_v_1, (MAX_STRIDE/2) * MAX_HEIGHT))
110  fail();
111  }
112  bench_new(dst_y_1, dst_u_1, dst_v_1, src1, planes[5].w, planes[5].h,
113  MAX_STRIDE, MAX_STRIDE / 2, planes[5].s);
114  }
115 }
116 
117 #define NUM_LINES 5
118 #define MAX_LINE_SIZE 1920
119 #define BUFSIZE (NUM_LINES * MAX_LINE_SIZE)
120 
121 static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy)
122 {
123  for (size_t i = 0; i < n; i++) {
124  if (abs(ref[i] - test[i]) > accuracy)
125  return 1;
126  }
127  return 0;
128 }
129 
131 {
132  static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, -MAX_LINE_SIZE};
134 
135  LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
136  LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);
137  LOCAL_ALIGNED_32(uint8_t, buf_y_1, [BUFSIZE]);
138  LOCAL_ALIGNED_32(uint8_t, buf_u_0, [BUFSIZE / 4]);
139  LOCAL_ALIGNED_32(uint8_t, buf_u_1, [BUFSIZE / 4]);
140  LOCAL_ALIGNED_32(uint8_t, buf_v_0, [BUFSIZE / 4]);
141  LOCAL_ALIGNED_32(uint8_t, buf_v_1, [BUFSIZE / 4]);
142 
143  declare_func(void, const uint8_t *src, uint8_t *ydst, uint8_t *udst,
144  uint8_t *vdst, int width, int height, int lumStride,
145  int chromStride, int srcStride, int32_t *rgb2yuv);
146 
148 
149  for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) {
150  int input_size = input_sizes[isi];
151  int negstride = input_size < 0;
152  const char *negstride_str = negstride ? "_negstride" : "";
153  int width = FFABS(input_size);
154  int linesize = width + 32;
155  /* calculate height based on specified width to use the entire buffer. */
156  int height = (BUFSIZE / linesize) & ~1;
157  uint8_t *src0 = src;
158  uint8_t *src1 = src;
159  uint8_t *dst_y_0 = buf_y_0;
160  uint8_t *dst_y_1 = buf_y_1;
161  uint8_t *dst_u_0 = buf_u_0;
162  uint8_t *dst_u_1 = buf_u_1;
163  uint8_t *dst_v_0 = buf_v_0;
164  uint8_t *dst_v_1 = buf_v_1;
165 
166  if (negstride) {
167  src0 += (height - 1) * (linesize * 3);
168  src1 += (height - 1) * (linesize * 3);
169  dst_y_0 += (height - 1) * linesize;
170  dst_y_1 += (height - 1) * linesize;
171  dst_u_0 += ((height / 2) - 1) * (linesize / 2);
172  dst_u_1 += ((height / 2) - 1) * (linesize / 2);
173  dst_v_0 += ((height / 2) - 1) * (linesize / 2);
174  dst_v_1 += ((height / 2) - 1) * (linesize / 2);
175  linesize *= -1;
176  }
177 
178  if (check_func(ff_rgb24toyv12, "rgb24toyv12_%d_%d%s", width, height, negstride_str)) {
179  memset(buf_y_0, 0xFF, BUFSIZE);
180  memset(buf_y_1, 0xFF, BUFSIZE);
181  memset(buf_u_0, 0xFF, BUFSIZE / 4);
182  memset(buf_u_1, 0xFF, BUFSIZE / 4);
183  memset(buf_v_0, 0xFF, BUFSIZE / 4);
184  memset(buf_v_1, 0xFF, BUFSIZE / 4);
185 
186  call_ref(src0, dst_y_0, dst_u_0, dst_v_0, width, height,
187  linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
188  call_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height,
189  linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
190  if (cmp_off_by_n(buf_y_0, buf_y_1, BUFSIZE, 1) ||
191  cmp_off_by_n(buf_u_0, buf_u_1, BUFSIZE / 4, 1) ||
192  cmp_off_by_n(buf_v_0, buf_v_1, BUFSIZE / 4, 1))
193  fail();
194  bench_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height,
195  linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
196  }
197  }
198 }
199 
200 #undef NUM_LINES
201 #undef MAX_LINE_SIZE
202 #undef BUFSIZE
203 
204 static void check_interleave_bytes(void)
205 {
206  LOCAL_ALIGNED_16(uint8_t, src0_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
207  LOCAL_ALIGNED_16(uint8_t, src1_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
208  LOCAL_ALIGNED_16(uint8_t, dst0_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
209  LOCAL_ALIGNED_16(uint8_t, dst1_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
210  // Intentionally using unaligned buffers, as this function doesn't have
211  // any alignment requirements.
212  uint8_t *src0 = src0_buf + 1;
213  uint8_t *src1 = src1_buf + 1;
214  uint8_t *dst0 = dst0_buf + 2;
215  uint8_t *dst1 = dst1_buf + 2;
216 
217  declare_func(void, const uint8_t *, const uint8_t *,
218  uint8_t *, int, int, int, int, int);
219 
222 
223  if (check_func(interleaveBytes, "interleave_bytes")) {
224  for (int i = 0; i <= 16; i++) {
225  // Try all widths [1,16], and try one random width.
226 
227  int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
228  int h = 1 + (rnd() % (MAX_HEIGHT-2));
229 
230  int src0_offset = 0, src0_stride = MAX_STRIDE;
231  int src1_offset = 0, src1_stride = MAX_STRIDE;
232  int dst_offset = 0, dst_stride = 2 * MAX_STRIDE;
233 
234  memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
235  memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
236 
237  // Try different combinations of negative strides
238  if (i & 1) {
239  src0_offset = (h-1)*src0_stride;
240  src0_stride = -src0_stride;
241  }
242  if (i & 2) {
243  src1_offset = (h-1)*src1_stride;
244  src1_stride = -src1_stride;
245  }
246  if (i & 4) {
247  dst_offset = (h-1)*dst_stride;
248  dst_stride = -dst_stride;
249  }
250 
251  call_ref(src0 + src0_offset, src1 + src1_offset, dst0 + dst_offset,
252  w, h, src0_stride, src1_stride, dst_stride);
253  call_new(src0 + src0_offset, src1 + src1_offset, dst1 + dst_offset,
254  w, h, src0_stride, src1_stride, dst_stride);
255  // Check a one pixel-pair edge around the destination area,
256  // to catch overwrites past the end.
257  checkasm_check(uint8_t, dst0, 2*MAX_STRIDE, dst1, 2*MAX_STRIDE,
258  2 * w + 2, h + 1, "dst");
259  }
260 
261  bench_new(src0, src1, dst1, 127, MAX_HEIGHT,
263  }
264  if (check_func(interleaveBytes, "interleave_bytes_aligned")) {
265  // Bench the function in a more typical case, with aligned
266  // buffers and widths.
267  bench_new(src0_buf, src1_buf, dst1_buf, 128, MAX_HEIGHT,
269  }
270 }
271 
272 static void check_deinterleave_bytes(void)
273 {
274  LOCAL_ALIGNED_16(uint8_t, src_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
275  LOCAL_ALIGNED_16(uint8_t, dst0_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
276  LOCAL_ALIGNED_16(uint8_t, dst0_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
277  LOCAL_ALIGNED_16(uint8_t, dst1_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
278  LOCAL_ALIGNED_16(uint8_t, dst1_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
279  // Intentionally using unaligned buffers, as this function doesn't have
280  // any alignment requirements.
281  uint8_t *src = src_buf + 2;
282  uint8_t *dst0_u = dst0_u_buf + 1;
283  uint8_t *dst0_v = dst0_v_buf + 1;
284  uint8_t *dst1_u = dst1_u_buf + 1;
285  uint8_t *dst1_v = dst1_v_buf + 1;
286 
287  declare_func(void, const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
288  int width, int height, int srcStride,
289  int dst1Stride, int dst2Stride);
290 
292 
293  if (check_func(deinterleaveBytes, "deinterleave_bytes")) {
294  for (int i = 0; i <= 16; i++) {
295  // Try all widths [1,16], and try one random width.
296 
297  int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
298  int h = 1 + (rnd() % (MAX_HEIGHT-2));
299 
300  int src_offset = 0, src_stride = 2 * MAX_STRIDE;
301  int dst_u_offset = 0, dst_u_stride = MAX_STRIDE;
302  int dst_v_offset = 0, dst_v_stride = MAX_STRIDE;
303 
304  memset(dst0_u, 0, MAX_STRIDE * MAX_HEIGHT);
305  memset(dst0_v, 0, MAX_STRIDE * MAX_HEIGHT);
306  memset(dst1_u, 0, MAX_STRIDE * MAX_HEIGHT);
307  memset(dst1_v, 0, MAX_STRIDE * MAX_HEIGHT);
308 
309  // Try different combinations of negative strides
310  if (i & 1) {
311  src_offset = (h-1)*src_stride;
312  src_stride = -src_stride;
313  }
314  if (i & 2) {
315  dst_u_offset = (h-1)*dst_u_stride;
316  dst_u_stride = -dst_u_stride;
317  }
318  if (i & 4) {
319  dst_v_offset = (h-1)*dst_v_stride;
320  dst_v_stride = -dst_v_stride;
321  }
322 
323  call_ref(src + src_offset, dst0_u + dst_u_offset, dst0_v + dst_v_offset,
324  w, h, src_stride, dst_u_stride, dst_v_stride);
325  call_new(src + src_offset, dst1_u + dst_u_offset, dst1_v + dst_v_offset,
326  w, h, src_stride, dst_u_stride, dst_v_stride);
327  // Check a one pixel-pair edge around the destination area,
328  // to catch overwrites past the end.
329  checkasm_check(uint8_t, dst0_u, MAX_STRIDE, dst1_u, MAX_STRIDE,
330  w + 1, h + 1, "dst_u");
331  checkasm_check(uint8_t, dst0_v, MAX_STRIDE, dst1_v, MAX_STRIDE,
332  w + 1, h + 1, "dst_v");
333  }
334 
335  bench_new(src, dst1_u, dst1_v, 127, MAX_HEIGHT,
337  }
338  if (check_func(deinterleaveBytes, "deinterleave_bytes_aligned")) {
339  // Bench the function in a more typical case, with aligned
340  // buffers and widths.
341  bench_new(src_buf, dst1_u_buf, dst1_v_buf, 128, MAX_HEIGHT,
343  }
344 }
345 
346 #define MAX_LINE_SIZE 1920
347 static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE};
348 static const enum AVPixelFormat rgb_formats[] = {
355 };
356 
358 {
360 
361  LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]);
362  LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]);
363  LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]);
364  LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]);
365 
366  declare_func(void, uint8_t *dst, const uint8_t *src,
367  const uint8_t *unused1, const uint8_t *unused2, int width,
368  uint32_t *rgb2yuv, void *opq);
369 
370  randomize_buffers(src24, MAX_LINE_SIZE * 3);
371  randomize_buffers(src32, MAX_LINE_SIZE * 4);
372 
373  for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {
375 
378 
379  for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
380  int w = input_sizes[j];
381 
382  if (check_func(ctx->lumToYV12, "%s_to_y_%d", desc->name, w)) {
383  const uint8_t *src = desc->nb_components == 3 ? src24 : src32;
384  memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2);
385  memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2);
386 
387  call_ref(dst0_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
388  call_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
389 
390  if (memcmp(dst0_y, dst1_y, w * 2))
391  fail();
392 
393  if (desc->nb_components == 3 ||
394  // only bench native endian formats
396  bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
397  }
398  }
399  }
400 }
401 
403 {
405 
406  LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]);
407  LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]);
408  LOCAL_ALIGNED_16(uint8_t, dst0_u, [MAX_LINE_SIZE * 2]);
409  LOCAL_ALIGNED_16(uint8_t, dst0_v, [MAX_LINE_SIZE * 2]);
410  LOCAL_ALIGNED_16(uint8_t, dst1_u, [MAX_LINE_SIZE * 2]);
411  LOCAL_ALIGNED_16(uint8_t, dst1_v, [MAX_LINE_SIZE * 2]);
412 
413  declare_func(void, uint8_t *dstU, uint8_t *dstV,
414  const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
415  int width, uint32_t *pal, void *opq);
416 
417  randomize_buffers(src24, MAX_LINE_SIZE * 3);
418  randomize_buffers(src32, MAX_LINE_SIZE * 4);
419 
420  for (int i = 0; i < 2 * FF_ARRAY_ELEMS(rgb_formats); i++) {
421  enum AVPixelFormat src_fmt = rgb_formats[i / 2];
422  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt);
423 
424  ctx->chrSrcHSubSample = (i % 2) ? 0 : 1;
425  sws->src_format = src_fmt;
426  sws->dst_format = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;
428 
429  for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
430  int w = input_sizes[j] >> ctx->chrSrcHSubSample;
431 
432  if (check_func(ctx->chrToYV12, "%s_to_uv%s_%d", desc->name,
433  ctx->chrSrcHSubSample ? "_half" : "",
434  input_sizes[j])) {
435  const uint8_t *src = desc->nb_components == 3 ? src24 : src32;
436  memset(dst0_u, 0xFF, MAX_LINE_SIZE * 2);
437  memset(dst0_v, 0xFF, MAX_LINE_SIZE * 2);
438  memset(dst1_u, 0xFF, MAX_LINE_SIZE * 2);
439  memset(dst1_v, 0xFF, MAX_LINE_SIZE * 2);
440 
441  call_ref(dst0_u, dst0_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
442  call_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
443 
444  if (memcmp(dst0_u, dst1_u, w * 2) || memcmp(dst0_v, dst1_v, w * 2))
445  fail();
446 
447  if (desc->nb_components == 3 ||
448  // only bench native endian formats
450  bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
451  }
452  }
453  }
454 }
455 
457 {
458  SwsContext *sws;
459 
461 
462  check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103");
463  report("shuffle_bytes_2103");
464 
465  check_shuffle_bytes(shuffle_bytes_0321, "shuffle_bytes_0321");
466  report("shuffle_bytes_0321");
467 
468  check_shuffle_bytes(shuffle_bytes_1230, "shuffle_bytes_1230");
469  report("shuffle_bytes_1230");
470 
471  check_shuffle_bytes(shuffle_bytes_3012, "shuffle_bytes_3012");
472  report("shuffle_bytes_3012");
473 
474  check_shuffle_bytes(shuffle_bytes_3210, "shuffle_bytes_3210");
475  report("shuffle_bytes_3210");
476 
478  report("uyvytoyuv422");
479 
481  report("interleave_bytes");
482 
484  report("deinterleave_bytes");
485 
489  if (!sws)
490  fail();
491 
493  report("rgb_to_y");
494 
496  report("rgb_to_uv");
497 
499  report("rgb24toyv12");
500 
502 }
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
shuffle_bytes_3012
void(* shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:57
mem_internal.h
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3170
MAX_STRIDE
#define MAX_STRIDE
Definition: sw_rgb.c:45
src1
const pixel * src1
Definition: h264pred_template.c:421
rgb_formats
static enum AVPixelFormat rgb_formats[]
Definition: sw_rgb.c:348
h
uint8_t h
Definition: sw_rgb.c:41
sws_freeContext
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
Definition: utils.c:2447
pixdesc.h
SWS_BITEXACT
@ SWS_BITEXACT
Definition: swscale.h:156
check_func
#define check_func(func,...)
Definition: checkasm.h:184
shuffle_bytes_3210
void(* shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:58
test
Definition: idctdsp.c:35
rgb2yuv
static const char rgb2yuv[]
Definition: vf_scale_vulkan.c:69
AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_RGB32_1
Definition: pixfmt.h:476
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
call_ref
#define call_ref(...)
Definition: checkasm.h:199
BUFSIZE
#define BUFSIZE
Definition: sw_rgb.c:119
check_shuffle_bytes
static void check_shuffle_bytes(void *func, const char *report)
Definition: sw_rgb.c:48
s
uint8_t s
Definition: sw_rgb.c:41
fail
#define fail()
Definition: checkasm.h:193
checkasm.h
cmp_off_by_n
static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy)
Definition: sw_rgb.c:121
randomize_buffers
#define randomize_buffers(buf, size)
Definition: sw_rgb.c:33
rnd
#define rnd()
Definition: checkasm.h:177
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
check_rgb_to_y
static void check_rgb_to_y(SwsContext *sws)
Definition: sw_rgb.c:357
intreadwrite.h
planes
static const struct @468 planes[]
check_uyvy_to_422p
static void check_uyvy_to_422p(void)
Definition: sw_rgb.c:74
input_sizes
static const int input_sizes[]
Definition: sw_rgb.c:347
shuffle_bytes_1230
void(* shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:56
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition: mem_internal.h:128
ctx
AVFormatContext * ctx
Definition: movenc.c:49
shuffle_bytes_2103
void(* shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:55
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:74
interleaveBytes
void(* interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, int width, int height, int src1Stride, int src2Stride, int dstStride)
Definition: rgb2rgb.c:92
checkasm_check_sw_rgb
void checkasm_check_sw_rgb(void)
Definition: sw_rgb.c:456
call_new
#define call_new(...)
Definition: checkasm.h:302
NULL
#define NULL
Definition: coverity.c:32
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:130
check_rgb24toyv12
static void check_rgb24toyv12(SwsContext *sws)
Definition: sw_rgb.c:130
ff_sws_rgb2rgb_init
av_cold void ff_sws_rgb2rgb_init(void)
Definition: rgb2rgb.c:141
abs
#define abs(x)
Definition: cuda_runtime.h:35
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:101
MAX_HEIGHT
#define MAX_HEIGHT
Definition: sw_rgb.c:46
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
height
#define height
Definition: dsp.h:85
check_interleave_bytes
static void check_interleave_bytes(void)
Definition: sw_rgb.c:204
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
MAX_LINE_SIZE
#define MAX_LINE_SIZE
Definition: sw_rgb.c:346
shuffle_bytes_0321
void(* shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size)
Definition: rgb2rgb.c:54
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:475
SwsContext::dst_format
int dst_format
Destination pixel format.
Definition: swscale.h:223
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
uyvytoyuv422
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)
Definition: rgb2rgb.c:111
sws
static SwsContext * sws[3]
Definition: swscale.c:69
report
#define report
Definition: checkasm.h:196
ff_rgb24toyv12
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.
Definition: rgb2rgb.c:85
bench_new
#define bench_new(...)
Definition: checkasm.h:373
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
ff_sws_init_scale
void ff_sws_init_scale(SwsInternal *c)
Definition: swscale.c:691
src2
const pixel * src2
Definition: h264pred_template.c:422
common.h
swscale_internal.h
width
static const uint8_t width[]
Definition: sw_rgb.c:40
w
uint8_t w
Definition: sw_rgb.c:41
SwsInternal
Definition: swscale_internal.h:317
check_rgb_to_uv
static void check_rgb_to_uv(SwsContext *sws)
Definition: sw_rgb.c:402
deinterleaveBytes
void(* deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
Definition: rgb2rgb.c:95
sws_getContext
SwsContext * sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Allocate and return an SwsContext.
Definition: utils.c:2116
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
src0
const pixel *const src0
Definition: h264pred_template.c:420
desc
const char * desc
Definition: libsvtav1.c:79
SwsContext::src_format
int src_format
Source pixel format.
Definition: swscale.h:222
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
declare_func
#define declare_func(ret,...)
Definition: checkasm.h:188
int32_t
int32_t
Definition: audioconvert.c:56
sws_internal
static SwsInternal * sws_internal(const SwsContext *sws)
Definition: swscale_internal.h:74
SWS_ACCURATE_RND
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition: swscale.h:155
checkasm_check
#define checkasm_check(prefix,...)
Definition: checkasm.h:393
check_deinterleave_bytes
static void check_deinterleave_bytes(void)
Definition: sw_rgb.c:272
SwsContext
Main external API structure.
Definition: swscale.h:174
rgb2rgb.h
src
#define src
Definition: vp8dsp.c:248
swscale.h