Go to the documentation of this file.
32 #define randomize_buffers(buf, size) \
35 for (j = 0; j < size; j+=4) \
36 AV_WN32(buf + j, rnd()); \
40 const int16_t **
src, uint8_t *dest,
int dstW,
48 for (j = 0; j < filterSize; j++)
57 for (
size_t i = 0;
i < n;
i++) {
67 for (;
i <
len;
i++) {
71 printf(
"0x%02x ", (uint32_t) p[
i]);
83 for (
size_t i = 0;
i <
len;
i++) {
85 size_t offset_of_mismatch =
i;
94 return offset_of_mismatch;
106 const int input_sizes[] = {8, 24, 128, 144, 256, 512};
108 #define LARGEST_INPUT_SIZE 512
110 const int offsets[] = {0, 3, 8, 11, 16, 19};
112 const char *accurate_str = (accurate) ?
"accurate" :
"approximate";
115 const int16_t *
src, uint8_t *dest,
134 for (osi = 0; osi < OFFSET_SIZES; osi++) {
146 printf(
"failing values: src: 0x%04x dither: 0x%02x dst-c: %02x dst-asm: %02x\n",
147 (
int) src_pixels[fail_offset],
148 (
int)
dither[(fail_offset + fail_offset) & 7],
149 (
int) dst0[fail_offset],
150 (
int) dst1[fail_offset]);
163 int fsi, osi, isi,
i, j;
165 #define LARGEST_FILTER 16
167 const int filter_sizes[] = {2, 4, 8, 16};
168 const int FILTER_SIZES =
sizeof(filter_sizes)/
sizeof(filter_sizes[0]);
169 #define LARGEST_INPUT_SIZE 512
170 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
172 const char *accurate_str = (accurate) ?
"accurate" :
"approximate";
175 int filterSize,
const int16_t **
src, uint8_t *dest,
188 uint8_t d_val =
rnd();
200 for(osi = 0; osi < 64; osi += 16){
215 for (
i = 0;
i < filter_sizes[fsi]; ++
i)
216 filter_coeff[
i] = -((1 << 12) / (filter_sizes[fsi] - 1));
217 filter_coeff[
rnd() % filter_sizes[fsi]] = (1 << 13) - 1;
220 vFilterData =
av_malloc((filter_sizes[fsi] + 2) *
sizeof(
union VFilterData));
221 memset(vFilterData, 0, (filter_sizes[fsi] + 2) *
sizeof(
union VFilterData));
222 for (
i = 0;
i < filter_sizes[fsi]; ++
i) {
224 vFilterData[
i].src =
src[
i] - osi;
225 for(j = 0; j < 4; ++j)
226 vFilterData[
i].
coeff[j + 4] = filter_coeff[
i];
228 if (
check_func(
ctx->yuv2planeX,
"yuv2yuvX_%d_%d_%d_%s", filter_sizes[fsi], osi, dstW, accurate_str)){
230 const int16_t *
filter =
ctx->use_mmx_vfilter ? (
const int16_t*)vFilterData : &filter_coeff[0];
241 printf(
"failed: yuv2yuvX_%d_%d_%d_%s\n", filter_sizes[fsi], osi, dstW, accurate_str);
245 bench_new((
const int16_t*)vFilterData, filter_sizes[fsi],
src, dst1, dstW - osi,
dither, osi);
258 #define SRC_PIXELS 512
262 #define MAX_FILTER_WIDTH 40
263 #define FILTER_SIZES 6
264 static const int filter_sizes[
FILTER_SIZES] = { 4, 8, 12, 16, 32, 40 };
266 #define HSCALE_PAIRS 2
272 #define LARGEST_INPUT_SIZE 512
273 #define INPUT_SIZES 6
276 int i, j, fsi, hpi,
width, dstWi;
293 const uint8_t *
src,
const int16_t *
filter,
294 const int32_t *filterPos,
int filterSize);
305 width = filter_sizes[fsi];
307 ctx->srcBpc = hscale_pairs[hpi][0];
308 ctx->dstBpc = hscale_pairs[hpi][1];
328 for (j = 0; j <
width; j++) {
347 memset(dst0, 0,
SRC_PIXELS *
sizeof(dst0[0]));
348 memset(dst1, 0,
SRC_PIXELS *
sizeof(dst1[0]));
352 if (memcmp(dst0, dst1,
ctx->dstW *
sizeof(dst0[0])))
#define declare_func_emms(cpu_flags, ret,...)
static void check_yuv2yuv1(int accurate)
int dstW
Width of destination luma/alpha planes.
#define check_func(func,...)
void(* filter)(uint8_t *src, int stride, int qscale)
static void print_data(uint8_t *p, size_t len, size_t offset)
static double val(void *priv, double ch)
static void check_hscale(void)
static const int offsets[]
int flags
Flags modifying the (de)muxer behaviour.
static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy)
static const int input_sizes[]
#define LOCAL_ALIGNED_16(t, v,...)
static void yuv2planeX_8_ref(const int16_t *filter, int filterSize, const int16_t **src, uint8_t *dest, int dstW, const uint8_t *dither, int offset)
#define LOCAL_ALIGNED_8(t, v,...)
#define LOCAL_ALIGNED_32(t, v,...)
struct SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext.
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
void ff_sws_init_scale(SwsContext *c)
int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, int filterSize, int16_t *filter, int dstW)
static void check_yuv2yuvX(int accurate)
printf("static const uint8_t my_array[100] = {\n")
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static size_t show_differences(uint8_t *a, uint8_t *b, size_t len)
#define i(width, name, range_min, range_max)
#define LARGEST_INPUT_SIZE
#define randomize_buffers(buf, size)
av_warn_unused_result int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
#define AV_CPU_FLAG_MMX
standard MMX
void sws_freeContext(struct SwsContext *swsContext)
Free the swscaler context swsContext.
static int ref[MAX_W *MAX_W]
#define declare_func(ret,...)
static const double coeff[2][5]
void checkasm_check_sw_scale(void)
static const uint8_t dither[8][8]