25 #define randomize_buffer(buf, size) do { \
27 for (i = 0; i < size / 4; i++) \
28 ((uint32_t *)buf)[i] = rnd(); \
46 const int ii_w = w + e*2;
47 const int ii_h = h + e*2;
48 const int ii_lz_32 =
FFALIGN(ii_w + 1, 4);
49 uint32_t *ii_orig_ref =
av_mallocz_array(ii_h + 1, ii_lz_32 *
sizeof(*ii_orig_ref));
50 uint32_t *ii_ref = ii_orig_ref + ii_lz_32 + 1;
51 uint32_t *ii_orig_new =
av_mallocz_array(ii_h + 1, ii_lz_32 *
sizeof(*ii_orig_new));
52 uint32_t *ii_new = ii_orig_new + ii_lz_32 + 1;
53 const int src_lz =
FFALIGN(w, 16);
56 declare_func(
void, uint32_t *dst, ptrdiff_t dst_linesize_32,
63 for (offy = -r; offy <=
r; offy++) {
64 for (offx = -r; offx <=
r; offx++) {
68 const int s2x = e + offx;
69 const int s2y = e + offy;
70 const int startx_safe =
FFMAX(s1x, s2x);
71 const int starty_safe =
FFMAX(s1y, s2y);
72 const int u_endx_safe =
FFMIN(s1x + w, s2x + w);
73 const int endy_safe =
FFMIN(s1y + h, s2y + h);
74 const int safe_pw = (u_endx_safe - startx_safe) & ~0
xf;
75 const int safe_ph = endy_safe - starty_safe;
83 memset(ii_ref, 0, (ii_lz_32 * ii_h - 1) *
sizeof(*ii_ref));
84 memset(ii_new, 0, (ii_lz_32 * ii_h - 1) *
sizeof(*ii_new));
86 call_ref(ii_ref + starty_safe*ii_lz_32 + startx_safe, ii_lz_32,
87 src + (starty_safe - s1y) * src_lz + (startx_safe - s1x), src_lz,
88 src + (starty_safe - s2y) * src_lz + (startx_safe - s2x), src_lz,
90 call_new(ii_new + starty_safe*ii_lz_32 + startx_safe, ii_lz_32,
91 src + (starty_safe - s1y) * src_lz + (startx_safe - s1x), src_lz,
92 src + (starty_safe - s2y) * src_lz + (startx_safe - s2x), src_lz,
95 if (memcmp(ii_ref, ii_new, (ii_lz_32 * ii_h - 1) *
sizeof(*ii_ref)))
98 memset(ii_new, 0, (ii_lz_32 * ii_h - 1) *
sizeof(*ii_new));
99 bench_new(ii_new + starty_safe*ii_lz_32 + startx_safe, ii_lz_32,
100 src + (starty_safe - s1y) * src_lz + (startx_safe - s1x), src_lz,
101 src + (starty_safe - s2y) * src_lz + (startx_safe - s2x), src_lz,
void(* compute_safe_ssd_integral_image)(uint32_t *dst, ptrdiff_t dst_linesize_32, const uint8_t *s1, ptrdiff_t linesize1, const uint8_t *s2, ptrdiff_t linesize2, int w, int h)
#define randomize_buffer(buf, size)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void checkasm_check_nlmeans(void)
#define declare_func(ret,...)
simple assert() macros that are a bit more flexible than ISO C assert().
#define check_func(func,...)
#define xf(width, name, var, range_min, range_max, subs,...)
void ff_nlmeans_init(NLMeansDSPContext *dsp)
void * av_mallocz_array(size_t nmemb, size_t size)