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};
133 
134  LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
135  LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);
136  LOCAL_ALIGNED_32(uint8_t, buf_y_1, [BUFSIZE]);
137  LOCAL_ALIGNED_32(uint8_t, buf_u_0, [BUFSIZE / 4]);
138  LOCAL_ALIGNED_32(uint8_t, buf_u_1, [BUFSIZE / 4]);
139  LOCAL_ALIGNED_32(uint8_t, buf_v_0, [BUFSIZE / 4]);
140  LOCAL_ALIGNED_32(uint8_t, buf_v_1, [BUFSIZE / 4]);
141 
142  declare_func(void, const uint8_t *src, uint8_t *ydst, uint8_t *udst,
143  uint8_t *vdst, int width, int height, int lumStride,
144  int chromStride, int srcStride, int32_t *rgb2yuv);
145 
147 
148  for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) {
149  int input_size = input_sizes[isi];
150  int negstride = input_size < 0;
151  const char *negstride_str = negstride ? "_negstride" : "";
152  int width = FFABS(input_size);
153  int linesize = width + 32;
154  /* calculate height based on specified width to use the entire buffer. */
155  int height = (BUFSIZE / linesize) & ~1;
156  uint8_t *src0 = src;
157  uint8_t *src1 = src;
158  uint8_t *dst_y_0 = buf_y_0;
159  uint8_t *dst_y_1 = buf_y_1;
160  uint8_t *dst_u_0 = buf_u_0;
161  uint8_t *dst_u_1 = buf_u_1;
162  uint8_t *dst_v_0 = buf_v_0;
163  uint8_t *dst_v_1 = buf_v_1;
164 
165  if (negstride) {
166  src0 += (height - 1) * (linesize * 3);
167  src1 += (height - 1) * (linesize * 3);
168  dst_y_0 += (height - 1) * linesize;
169  dst_y_1 += (height - 1) * linesize;
170  dst_u_0 += ((height / 2) - 1) * (linesize / 2);
171  dst_u_1 += ((height / 2) - 1) * (linesize / 2);
172  dst_v_0 += ((height / 2) - 1) * (linesize / 2);
173  dst_v_1 += ((height / 2) - 1) * (linesize / 2);
174  linesize *= -1;
175  }
176 
177  if (check_func(ff_rgb24toyv12, "rgb24toyv12_%d_%d%s", width, height, negstride_str)) {
178  memset(buf_y_0, 0xFF, BUFSIZE);
179  memset(buf_y_1, 0xFF, BUFSIZE);
180  memset(buf_u_0, 0xFF, BUFSIZE / 4);
181  memset(buf_u_1, 0xFF, BUFSIZE / 4);
182  memset(buf_v_0, 0xFF, BUFSIZE / 4);
183  memset(buf_v_1, 0xFF, BUFSIZE / 4);
184 
185  call_ref(src0, dst_y_0, dst_u_0, dst_v_0, width, height,
186  linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
187  call_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height,
188  linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
189  if (cmp_off_by_n(buf_y_0, buf_y_1, BUFSIZE, 1) ||
190  cmp_off_by_n(buf_u_0, buf_u_1, BUFSIZE / 4, 1) ||
191  cmp_off_by_n(buf_v_0, buf_v_1, BUFSIZE / 4, 1))
192  fail();
193  bench_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height,
194  linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
195  }
196  }
197 }
198 
199 #undef NUM_LINES
200 #undef MAX_LINE_SIZE
201 #undef BUFSIZE
202 
203 static void check_interleave_bytes(void)
204 {
205  LOCAL_ALIGNED_16(uint8_t, src0_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
206  LOCAL_ALIGNED_16(uint8_t, src1_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
207  LOCAL_ALIGNED_16(uint8_t, dst0_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
208  LOCAL_ALIGNED_16(uint8_t, dst1_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
209  // Intentionally using unaligned buffers, as this function doesn't have
210  // any alignment requirements.
211  uint8_t *src0 = src0_buf + 1;
212  uint8_t *src1 = src1_buf + 1;
213  uint8_t *dst0 = dst0_buf + 2;
214  uint8_t *dst1 = dst1_buf + 2;
215 
216  declare_func(void, const uint8_t *, const uint8_t *,
217  uint8_t *, int, int, int, int, int);
218 
221 
222  if (check_func(interleaveBytes, "interleave_bytes")) {
223  for (int i = 0; i <= 16; i++) {
224  // Try all widths [1,16], and try one random width.
225 
226  int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
227  int h = 1 + (rnd() % (MAX_HEIGHT-2));
228 
229  int src0_offset = 0, src0_stride = MAX_STRIDE;
230  int src1_offset = 0, src1_stride = MAX_STRIDE;
231  int dst_offset = 0, dst_stride = 2 * MAX_STRIDE;
232 
233  memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
234  memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
235 
236  // Try different combinations of negative strides
237  if (i & 1) {
238  src0_offset = (h-1)*src0_stride;
239  src0_stride = -src0_stride;
240  }
241  if (i & 2) {
242  src1_offset = (h-1)*src1_stride;
243  src1_stride = -src1_stride;
244  }
245  if (i & 4) {
246  dst_offset = (h-1)*dst_stride;
247  dst_stride = -dst_stride;
248  }
249 
250  call_ref(src0 + src0_offset, src1 + src1_offset, dst0 + dst_offset,
251  w, h, src0_stride, src1_stride, dst_stride);
252  call_new(src0 + src0_offset, src1 + src1_offset, dst1 + dst_offset,
253  w, h, src0_stride, src1_stride, dst_stride);
254  // Check a one pixel-pair edge around the destination area,
255  // to catch overwrites past the end.
256  checkasm_check(uint8_t, dst0, 2*MAX_STRIDE, dst1, 2*MAX_STRIDE,
257  2 * w + 2, h + 1, "dst");
258  }
259 
260  bench_new(src0, src1, dst1, 127, MAX_HEIGHT,
262  }
263  if (check_func(interleaveBytes, "interleave_bytes_aligned")) {
264  // Bench the function in a more typical case, with aligned
265  // buffers and widths.
266  bench_new(src0_buf, src1_buf, dst1_buf, 128, MAX_HEIGHT,
268  }
269 }
270 
271 static void check_deinterleave_bytes(void)
272 {
273  LOCAL_ALIGNED_16(uint8_t, src_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
274  LOCAL_ALIGNED_16(uint8_t, dst0_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
275  LOCAL_ALIGNED_16(uint8_t, dst0_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
276  LOCAL_ALIGNED_16(uint8_t, dst1_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
277  LOCAL_ALIGNED_16(uint8_t, dst1_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
278  // Intentionally using unaligned buffers, as this function doesn't have
279  // any alignment requirements.
280  uint8_t *src = src_buf + 2;
281  uint8_t *dst0_u = dst0_u_buf + 1;
282  uint8_t *dst0_v = dst0_v_buf + 1;
283  uint8_t *dst1_u = dst1_u_buf + 1;
284  uint8_t *dst1_v = dst1_v_buf + 1;
285 
286  declare_func(void, const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
287  int width, int height, int srcStride,
288  int dst1Stride, int dst2Stride);
289 
291 
292  if (check_func(deinterleaveBytes, "deinterleave_bytes")) {
293  for (int i = 0; i <= 16; i++) {
294  // Try all widths [1,16], and try one random width.
295 
296  int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
297  int h = 1 + (rnd() % (MAX_HEIGHT-2));
298 
299  int src_offset = 0, src_stride = 2 * MAX_STRIDE;
300  int dst_u_offset = 0, dst_u_stride = MAX_STRIDE;
301  int dst_v_offset = 0, dst_v_stride = MAX_STRIDE;
302 
303  memset(dst0_u, 0, MAX_STRIDE * MAX_HEIGHT);
304  memset(dst0_v, 0, MAX_STRIDE * MAX_HEIGHT);
305  memset(dst1_u, 0, MAX_STRIDE * MAX_HEIGHT);
306  memset(dst1_v, 0, MAX_STRIDE * MAX_HEIGHT);
307 
308  // Try different combinations of negative strides
309  if (i & 1) {
310  src_offset = (h-1)*src_stride;
311  src_stride = -src_stride;
312  }
313  if (i & 2) {
314  dst_u_offset = (h-1)*dst_u_stride;
315  dst_u_stride = -dst_u_stride;
316  }
317  if (i & 4) {
318  dst_v_offset = (h-1)*dst_v_stride;
319  dst_v_stride = -dst_v_stride;
320  }
321 
322  call_ref(src + src_offset, dst0_u + dst_u_offset, dst0_v + dst_v_offset,
323  w, h, src_stride, dst_u_stride, dst_v_stride);
324  call_new(src + src_offset, dst1_u + dst_u_offset, dst1_v + dst_v_offset,
325  w, h, src_stride, dst_u_stride, dst_v_stride);
326  // Check a one pixel-pair edge around the destination area,
327  // to catch overwrites past the end.
328  checkasm_check(uint8_t, dst0_u, MAX_STRIDE, dst1_u, MAX_STRIDE,
329  w + 1, h + 1, "dst_u");
330  checkasm_check(uint8_t, dst0_v, MAX_STRIDE, dst1_v, MAX_STRIDE,
331  w + 1, h + 1, "dst_v");
332  }
333 
334  bench_new(src, dst1_u, dst1_v, 127, MAX_HEIGHT,
336  }
337  if (check_func(deinterleaveBytes, "deinterleave_bytes_aligned")) {
338  // Bench the function in a more typical case, with aligned
339  // buffers and widths.
340  bench_new(src_buf, dst1_u_buf, dst1_v_buf, 128, MAX_HEIGHT,
342  }
343 }
344 
345 #define MAX_LINE_SIZE 1920
346 static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE};
347 static const enum AVPixelFormat rgb_formats[] = {
354 };
355 
357 {
358  LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]);
359  LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]);
360  LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]);
361  LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]);
362 
363  declare_func(void, uint8_t *dst, const uint8_t *src,
364  const uint8_t *unused1, const uint8_t *unused2, int width,
365  uint32_t *rgb2yuv, void *opq);
366 
367  randomize_buffers(src24, MAX_LINE_SIZE * 3);
368  randomize_buffers(src32, MAX_LINE_SIZE * 4);
369 
370  for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {
372 
373  ctx->srcFormat = rgb_formats[i];
375 
376  for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
377  int w = input_sizes[j];
378 
379  if (check_func(ctx->lumToYV12, "%s_to_y_%d", desc->name, w)) {
380  const uint8_t *src = desc->nb_components == 3 ? src24 : src32;
381  memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2);
382  memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2);
383 
384  call_ref(dst0_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
385  call_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
386 
387  if (memcmp(dst0_y, dst1_y, w * 2))
388  fail();
389 
390  if (desc->nb_components == 3 ||
391  // only bench native endian formats
392  (ctx->srcFormat == AV_PIX_FMT_RGB32 || ctx->srcFormat == AV_PIX_FMT_RGB32_1))
393  bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
394  }
395  }
396  }
397 }
398 
400 {
401  LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]);
402  LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]);
403  LOCAL_ALIGNED_16(uint8_t, dst0_u, [MAX_LINE_SIZE * 2]);
404  LOCAL_ALIGNED_16(uint8_t, dst0_v, [MAX_LINE_SIZE * 2]);
405  LOCAL_ALIGNED_16(uint8_t, dst1_u, [MAX_LINE_SIZE * 2]);
406  LOCAL_ALIGNED_16(uint8_t, dst1_v, [MAX_LINE_SIZE * 2]);
407 
408  declare_func(void, uint8_t *dstU, uint8_t *dstV,
409  const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
410  int width, uint32_t *pal, void *opq);
411 
412  randomize_buffers(src24, MAX_LINE_SIZE * 3);
413  randomize_buffers(src32, MAX_LINE_SIZE * 4);
414 
415  for (int i = 0; i < 2 * FF_ARRAY_ELEMS(rgb_formats); i++) {
416  enum AVPixelFormat src_fmt = rgb_formats[i / 2];
417  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt);
418 
419  ctx->chrSrcHSubSample = (i % 2) ? 0 : 1;
420  ctx->srcFormat = src_fmt;
421  ctx->dstFormat = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;
423 
424  for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
425  int w = input_sizes[j] >> ctx->chrSrcHSubSample;
426 
427  if (check_func(ctx->chrToYV12, "%s_to_uv%s_%d", desc->name,
428  ctx->chrSrcHSubSample ? "_half" : "",
429  input_sizes[j])) {
430  const uint8_t *src = desc->nb_components == 3 ? src24 : src32;
431  memset(dst0_u, 0xFF, MAX_LINE_SIZE * 2);
432  memset(dst0_v, 0xFF, MAX_LINE_SIZE * 2);
433  memset(dst1_u, 0xFF, MAX_LINE_SIZE * 2);
434  memset(dst1_v, 0xFF, MAX_LINE_SIZE * 2);
435 
436  call_ref(dst0_u, dst0_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
437  call_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
438 
439  if (memcmp(dst0_u, dst1_u, w * 2) || memcmp(dst0_v, dst1_v, w * 2))
440  fail();
441 
442  if (desc->nb_components == 3 ||
443  // only bench native endian formats
444  (ctx->srcFormat == AV_PIX_FMT_RGB32 || ctx->srcFormat == AV_PIX_FMT_RGB32_1))
445  bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
446  }
447  }
448  }
449 }
450 
452 {
453  SwsContext *sws;
454  SwsInternal *c;
455 
457 
458  check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103");
459  report("shuffle_bytes_2103");
460 
461  check_shuffle_bytes(shuffle_bytes_0321, "shuffle_bytes_0321");
462  report("shuffle_bytes_0321");
463 
464  check_shuffle_bytes(shuffle_bytes_1230, "shuffle_bytes_1230");
465  report("shuffle_bytes_1230");
466 
467  check_shuffle_bytes(shuffle_bytes_3012, "shuffle_bytes_3012");
468  report("shuffle_bytes_3012");
469 
470  check_shuffle_bytes(shuffle_bytes_3210, "shuffle_bytes_3210");
471  report("shuffle_bytes_3210");
472 
474  report("uyvytoyuv422");
475 
477  report("interleave_bytes");
478 
480  report("deinterleave_bytes");
481 
485  if (!sws)
486  fail();
487 
488  c = sws_internal(sws);
489  check_rgb_to_y(c);
490  report("rgb_to_y");
491 
493  report("rgb_to_uv");
494 
496  report("rgb24toyv12");
497 
498  sws_freeContext(sws);
499 }
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:347
h
uint8_t h
Definition: sw_rgb.c:41
sws_freeContext
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
Definition: utils.c:2446
pixdesc.h
check_rgb_to_y
static void check_rgb_to_y(SwsInternal *ctx)
Definition: sw_rgb.c:356
check_rgb_to_uv
static void check_rgb_to_uv(SwsInternal *ctx)
Definition: sw_rgb.c:399
check_func
#define check_func(func,...)
Definition: checkasm.h:179
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:194
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
SWS_BITEXACT
#define SWS_BITEXACT
Definition: swscale.h:200
fail
#define fail()
Definition: checkasm.h:188
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
SwsContext
struct SwsContext SwsContext
Definition: swscale.h:45
rnd
#define rnd()
Definition: checkasm.h:172
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
intreadwrite.h
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:346
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:150
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:451
call_new
#define call_new(...)
Definition: checkasm.h:297
NULL
#define NULL
Definition: coverity.c:32
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:156
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
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
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:203
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:345
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
SWS_ACCURATE_RND
#define SWS_ACCURATE_RND
Definition: swscale.h:199
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
report
#define report
Definition: checkasm.h:191
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:368
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:611
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:330
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:2115
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:112
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
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:183
check_rgb24toyv12
static void check_rgb24toyv12(SwsInternal *ctx)
Definition: sw_rgb.c:130
int32_t
int32_t
Definition: audioconvert.c:56
planes
static const struct @466 planes[]
sws_internal
static SwsInternal * sws_internal(const SwsContext *sws)
Definition: swscale_internal.h:70
checkasm_check
#define checkasm_check(prefix,...)
Definition: checkasm.h:388
check_deinterleave_bytes
static void check_deinterleave_bytes(void)
Definition: sw_rgb.c:271
rgb2rgb.h
src
#define src
Definition: vp8dsp.c:248
swscale.h