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,
45 for (
i = 0;
i < dstW;
i++) {
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;
107 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,
135 for (osi = 0; osi < OFFSET_SIZES; osi++) {
143 if (
cmp_off_by_n(dst0, dst1, dstW *
sizeof(dst0[0]), accurate ? 0 : 2)) {
145 printf(
"failed: yuv2yuv1_%d_%di_%s\n",
offset, dstW, accurate_str);
147 printf(
"failing values: src: 0x%04x dither: 0x%02x dst-c: %02x dst-asm: %02x\n",
148 (
int) src_pixels[fail_offset],
149 (
int)
dither[(fail_offset + fail_offset) & 7],
150 (
int) dst0[fail_offset],
151 (
int) dst1[fail_offset]);
165 int fsi, osi, isi,
i, j;
167 #define LARGEST_FILTER 16
169 const int filter_sizes[] = {2, 4, 8, 16};
170 const int FILTER_SIZES =
sizeof(filter_sizes)/
sizeof(filter_sizes[0]);
171 #define LARGEST_INPUT_SIZE 512
172 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
173 const char *accurate_str = (accurate) ?
"accurate" :
"approximate";
176 int filterSize,
const int16_t **
src, uint8_t *dest,
189 uint8_t d_val =
rnd();
202 for(osi = 0; osi < 64; osi += 16){
217 for (
i = 0;
i < filter_sizes[fsi]; ++
i)
218 filter_coeff[
i] = -((1 << 12) / (filter_sizes[fsi] - 1));
219 filter_coeff[
rnd() % filter_sizes[fsi]] = (1 << 13) - 1;
222 vFilterData =
av_malloc((filter_sizes[fsi] + 2) *
sizeof(
union VFilterData));
223 memset(vFilterData, 0, (filter_sizes[fsi] + 2) *
sizeof(
union VFilterData));
224 for (
i = 0;
i < filter_sizes[fsi]; ++
i) {
226 vFilterData[
i].src =
src[
i] - osi;
227 for(j = 0; j < 4; ++j)
228 vFilterData[
i].
coeff[j + 4] = filter_coeff[
i];
230 if (
check_func(
c->yuv2planeX,
"yuv2yuvX_%d_%d_%d_%s", filter_sizes[fsi], osi, dstW, accurate_str)){
232 const int16_t *
filter =
c->use_mmx_vfilter ? (
const int16_t*)vFilterData : &filter_coeff[0];
243 printf(
"failed: yuv2yuvX_%d_%d_%d_%s\n", filter_sizes[fsi], osi, dstW, accurate_str);
247 bench_new((
const int16_t*)vFilterData, filter_sizes[fsi],
src, dst1, dstW - osi,
dither, osi);
260 #define SRC_PIXELS 512
264 #define MAX_FILTER_WIDTH 40
265 #define FILTER_SIZES 6
266 static const int filter_sizes[
FILTER_SIZES] = { 4, 8, 12, 16, 32, 40 };
268 #define HSCALE_PAIRS 2
274 #define LARGEST_INPUT_SIZE 512
275 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
277 int i, j, fsi, hpi,
width, dstWi;
295 const uint8_t *
src,
const int16_t *
filter,
296 const int32_t *filterPos,
int filterSize);
308 width = filter_sizes[fsi];
310 c->srcBpc = hscale_pairs[hpi][0];
311 c->dstBpc = hscale_pairs[hpi][1];
312 c->hLumFilterSize =
c->hChrFilterSize =
width;
331 for (j = 0; j <
width; j++) {
350 memset(dst0, 0,
SRC_PIXELS *
sizeof(dst0[0]));
351 memset(dst1, 0,
SRC_PIXELS *
sizeof(dst1[0]));
355 if (memcmp(dst0, dst1,
sws->
dst_w *
sizeof(dst0[0])))
#define declare_func_emms(cpu_flags, ret,...)
static void check_yuv2yuv1(int accurate)
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
#define check_func(func,...)
unsigned flags
Bitmask of SWS_*.
void(* filter)(uint8_t *src, int stride, int qscale)
static void print_data(uint8_t *p, size_t len, size_t offset)
av_warn_unused_result int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter)
Initialize the swscaler context sws_context.
static double val(void *priv, double ch)
static void check_hscale(void)
#define FF_ARRAY_ELEMS(a)
int ff_shuffle_filter_coefficients(SwsInternal *c, int *filterPos, int filterSize, int16_t *filter, int dstW)
static const int offsets[]
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,...)
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
SwsContext * sws_alloc_context(void)
Allocate an empty SwsContext and set its fields to default values.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
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)
static SwsContext * sws[3]
#define i(width, name, range_min, range_max)
void ff_sws_init_scale(SwsInternal *c)
#define LARGEST_INPUT_SIZE
#define randomize_buffers(buf, size)
#define AV_CPU_FLAG_MMX
standard MMX
static int ref[MAX_W *MAX_W]
#define declare_func(ret,...)
static const double coeff[2][5]
static SwsInternal * sws_internal(const SwsContext *sws)
@ SWS_ACCURATE_RND
Force bit-exact output.
void checkasm_check_sw_scale(void)
Main external API structure.
static const uint8_t dither[8][8]