Go to the documentation of this file.
   33 #define randomize_buffers(buf, size)      \ 
   36         for (j = 0; j < size; j+=4)       \ 
   37             AV_WN32(buf + j, rnd());      \ 
   40 static const uint8_t 
width[] = {12, 16, 20, 32, 36, 128};
 
   42     {12,16,12}, {16,16,16}, {20,23,25}, {32,18,48}, {8,128,16}, {128,128,128}
 
   45 #define MAX_STRIDE 128 
   46 #define MAX_HEIGHT 128 
   64         for (
i = 0; 
i < 6; 
i ++) {
 
   87     declare_func(
void, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
 
   89                  int lumStride, 
int chromStride, 
int srcStride);
 
   95         for (
i = 0; 
i < 6; 
i ++) {
 
  118 #define MAX_LINE_SIZE 1920 
  119 #define BUFSIZE (NUM_LINES * MAX_LINE_SIZE) 
  123     for (
size_t i = 0; 
i < n; 
i++) {
 
  144                        uint8_t *vdst, 
int width, 
int height, 
int lumStride,
 
  151         int negstride = input_size < 0;
 
  152         const char *negstride_str = negstride ? 
"_negstride" : 
"";
 
  154         int linesize = 
width + 32;
 
  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;
 
  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);
 
  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);
 
  187                      linesize, linesize / 2, linesize * 3, 
ctx->input_rgb2yuv_table);
 
  189                      linesize, linesize / 2, linesize * 3, 
ctx->input_rgb2yuv_table);
 
  195                       linesize, linesize / 2, linesize * 3, 
ctx->input_rgb2yuv_table);
 
  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;
 
  218                  uint8_t *, 
int, 
int, 
int, 
int, 
int);
 
  224         for (
int i = 0; 
i <= 16; 
i++) {
 
  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;
 
  239                 src0_offset = (
h-1)*src0_stride;
 
  240                 src0_stride = -src0_stride;
 
  243                 src1_offset = (
h-1)*src1_stride;
 
  244                 src1_stride = -src1_stride;
 
  247                 dst_offset = (
h-1)*dst_stride;
 
  248                 dst_stride = -dst_stride;
 
  252                      w, 
h, src0_stride, src1_stride, dst_stride);
 
  254                      w, 
h, src0_stride, src1_stride, dst_stride);
 
  258                            2 * 
w + 2, 
h + 1, 
"dst");
 
  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;
 
  289                        int dst1Stride, 
int dst2Stride);
 
  294         for (
int i = 0; 
i <= 16; 
i++) {
 
  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;
 
  311                 src_offset = (
h-1)*src_stride;
 
  312                 src_stride = -src_stride;
 
  315                 dst_u_offset = (
h-1)*dst_u_stride;
 
  316                 dst_u_stride = -dst_u_stride;
 
  319                 dst_v_offset = (
h-1)*dst_v_stride;
 
  320                 dst_v_stride = -dst_v_stride;
 
  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);
 
  330                            w + 1, 
h + 1, 
"dst_u");
 
  332                            w + 1, 
h + 1, 
"dst_v");
 
  346 #define MAX_LINE_SIZE 1920 
  367                  const uint8_t *unused1, 
const uint8_t *unused2, 
int width,
 
  383                 const uint8_t *
src = 
desc->nb_components == 3 ? src24 : src32;
 
  390                 if (memcmp(dst0_y, dst1_y, 
w * 2))
 
  393                 if (
desc->nb_components == 3 ||
 
  414                  const uint8_t *
src1, 
const uint8_t *
src2, 
const uint8_t *src3,
 
  415                  int width, uint32_t *pal, 
void *opq);
 
  424         ctx->chrSrcHSubSample = (
i % 2) ? 0 : 1;
 
  433                            ctx->chrSrcHSubSample ? 
"_half" : 
"",
 
  435                 const uint8_t *
src = 
desc->nb_components == 3 ? src24 : src32;
 
  444                 if (memcmp(dst0_u, dst1_u, 
w * 2) || memcmp(dst0_v, dst1_v, 
w * 2))
 
  447                 if (
desc->nb_components == 3 ||
 
  465                  const uint8_t *
src2, 
const uint8_t *src3, 
int width,
 
  472         if (
desc->nb_components < 4)
 
  488                 if (memcmp(dst0_y, dst1_y, 
w * 2))
 
  535 #define INPUT_SIZE 512 
  539     static const int alpha_values[] = {0, 2048, 4096};
 
  543                       const int16_t *chrUSrc[2], 
const int16_t *chrVSrc[2],
 
  544                       const int16_t *alpSrc, uint8_t *dest,
 
  545                       int dstW, 
int uvalpha, 
int y);
 
  548     const int16_t *chru[2];
 
  549     const int16_t *chrv[2];
 
  550     const int16_t *
alpha;
 
  567         src_y[
i] &= 0x3FFF3FFF;
 
  568         src_a[
i] &= 0x3FFF3FFF;
 
  569         src_u[
i] &= 0x3FFF3FFF;
 
  570         src_v[
i] &= 0x3FFF3FFF;
 
  573     luma  = (int16_t *)src_y;
 
  574     alpha = (int16_t *)src_a;
 
  575     for (
int i = 0; 
i < 2; 
i++) {
 
  598             const int chr_alpha = alpha_values[ai];
 
  606                 if (memcmp(dst0, dst1, line_size))
 
  619     static const int alpha_values[] = {0, 2048, 4096};
 
  623                       const int16_t *chrUSrc[2], 
const int16_t *chrVSrc[2],
 
  624                       const int16_t *alpSrc[2], uint8_t *dest,
 
  625                       int dstW, 
int yalpha, 
int uvalpha, 
int y);
 
  627     const int16_t *luma[2];
 
  628     const int16_t *chru[2];
 
  629     const int16_t *chrv[2];
 
  630     const int16_t *
alpha[2];
 
  647         src_y[
i] &= 0x3FFF3FFF;
 
  648         src_u[
i] &= 0x3FFF3FFF;
 
  649         src_v[
i] &= 0x3FFF3FFF;
 
  650         src_a[
i] &= 0x3FFF3FFF;
 
  653     for (
int i = 0; 
i < 2; 
i++) {
 
  678             const int lum_alpha = alpha_values[ai];
 
  679             const int chr_alpha  = alpha_values[ai];
 
  687                 if (memcmp(dst0, dst1, line_size))
 
  700 #define LARGEST_FILTER 16 
  701     static const int filter_sizes[] = {2, 16};
 
  705                       const int16_t **lumSrcx, 
int lumFilterSize,
 
  706                       const int16_t *chrFilter, 
const int16_t **chrUSrcx,
 
  707                       const int16_t **chrVSrcx, 
int chrFilterSize,
 
  708                       const int16_t **alpSrcx, uint8_t *dest,
 
  734         src_y[
i] &= 0x3FFF3FFF;
 
  735         src_u[
i] &= 0x3FFF3FFF;
 
  736         src_v[
i] &= 0x3FFF3FFF;
 
  737         src_a[
i] &= 0x3FFF3FFF;
 
  765             const int luma_filter_size = filter_sizes[fsi];
 
  766             const int chr_filter_size = filter_sizes[fsi];
 
  768             for (
int i = 0; 
i < luma_filter_size; 
i++)
 
  769                 luma_filter[
i] = -((1 << 12) / (luma_filter_size - 1));
 
  770             luma_filter[
rnd() % luma_filter_size] = (1 << 13) - 1;
 
  772             for (
int i = 0; 
i < chr_filter_size; 
i++)
 
  773                 chr_filter[
i] = -((1 << 12) / (chr_filter_size - 1));
 
  774             chr_filter[
rnd() % chr_filter_size] = (1 << 13) - 1;
 
  780                 call_ref(
c, luma_filter, luma, luma_filter_size,
 
  781                             chr_filter, chru, chrv, chr_filter_size,
 
  784                 call_new(
c, luma_filter, luma, luma_filter_size,
 
  785                             chr_filter, chru, chrv, chr_filter_size,
 
  788                 if (memcmp(dst0, dst1, line_size))
 
  791                 bench_new(
c, luma_filter, luma, luma_filter_size,
 
  792                             chr_filter, chru, chrv, chr_filter_size,
 
  802 #undef LARGEST_FILTER 
  811     report(
"shuffle_bytes_2103");
 
  814     report(
"shuffle_bytes_0321");
 
  817     report(
"shuffle_bytes_1230");
 
  820     report(
"shuffle_bytes_3012");
 
  823     report(
"shuffle_bytes_3210");
 
  826     report(
"shuffle_bytes_3102");
 
  829     report(
"shuffle_bytes_2013");
 
  832     report(
"shuffle_bytes_1203");
 
  835     report(
"shuffle_bytes_2130");
 
  841     report(
"interleave_bytes");
 
  844     report(
"deinterleave_bytes");
 
  
int(* func)(AVBPrint *dst, const char *in, const char *arg)
 
#define declare_func_emms(cpu_flags, ret,...)
 
AVPixelFormat
Pixel format.
 
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
 
void(* shuffle_bytes_3012)(const uint8_t *src, uint8_t *dst, int src_size)
 
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
 
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
 
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
 
static enum AVPixelFormat rgb_formats[]
 
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
 
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
 
#define check_func(func,...)
 
void(* shuffle_bytes_3210)(const uint8_t *src, uint8_t *dst, int src_size)
 
static const char rgb2yuv[]
 
#define AV_PIX_FMT_RGB32_1
 
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
 
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
 
static void check_shuffle_bytes(void *func, const char *report)
 
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
 
static void check_yuv2packedX(void)
 
void(* shuffle_bytes_2130)(const uint8_t *src, uint8_t *dst, int src_size)
 
static void check_yuv2packed1(void)
 
static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy)
 
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
 
#define randomize_buffers(buf, size)
 
#define FF_ARRAY_ELEMS(a)
 
static void check_rgb_to_y(SwsContext *sws)
 
#define AV_CEIL_RSHIFT(a, b)
 
static void check_uyvy_to_422p(void)
 
static const int input_sizes[]
 
void(* shuffle_bytes_1230)(const uint8_t *src, uint8_t *dst, int src_size)
 
#define LOCAL_ALIGNED_16(t, v,...)
 
@ AV_PIX_FMT_RGB4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
 
void(* shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size)
 
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
 
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
 
#define LOCAL_ALIGNED_8(t, v,...)
 
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
 
void(* interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, int width, int height, int src1Stride, int src2Stride, int dstStride)
 
void checkasm_check_sw_rgb(void)
 
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
 
void(* shuffle_bytes_3102)(const uint8_t *src, uint8_t *dst, int src_size)
 
#define LOCAL_ALIGNED_32(t, v,...)
 
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
 
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
 
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
 
static void check_rgb24toyv12(SwsContext *sws)
 
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
 
av_cold void ff_sws_rgb2rgb_init(void)
 
@ AV_PIX_FMT_BGR4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
 
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
 
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
 
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
 
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
 
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
 
static void check_interleave_bytes(void)
 
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
 
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
 
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
 
void(* shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size)
 
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
 
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
 
static void check_rgba_to_a(SwsContext *sws)
 
static const struct @545 planes[]
 
int dst_format
Destination pixel format.
 
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
 
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
 
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)
 
static SwsContext * sws[3]
 
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
 
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.
 
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
 
static const int packed_rgb_fmts[]
 
#define i(width, name, range_min, range_max)
 
void ff_sws_init_scale(SwsInternal *c)
 
static const uint8_t width[]
 
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
 
static void check_rgb_to_uv(SwsContext *sws)
 
void(* deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, int width, int height, int srcStride, int dst1Stride, int dst2Stride)
 
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.
 
static void check_yuv2packed2(void)
 
#define AV_CPU_FLAG_MMX
standard MMX
 
void(* shuffle_bytes_2013)(const uint8_t *src, uint8_t *dst, int src_size)
 
void(* shuffle_bytes_1203)(const uint8_t *src, uint8_t *dst, int src_size)
 
static int ref[MAX_W *MAX_W]
 
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
 
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
 
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
 
int src_format
Source pixel format.
 
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
 
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
 
#define declare_func(ret,...)
 
static const int16_t alpha[]
 
static SwsInternal * sws_internal(const SwsContext *sws)
 
@ SWS_ACCURATE_RND
Force bit-exact output.
 
#define checkasm_check(prefix,...)
 
static void check_deinterleave_bytes(void)
 
Main external API structure.
 
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
 
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...