From e516a42527098a26798dbb3663a5bcdd38793839 Mon Sep 17 00:00:00 2001 From: Scott LaVarnway Date: Fri, 2 May 2014 10:31:52 -0700 Subject: [PATCH] Remove struct params from vp8_denoiser_filter This eliminates the asm_offsets dependency for future all-assembly versions of this function. Change-Id: I3227073ecfcb8ee6e593934fab941e9081abdda0 --- vp8/common/rtcd_defs.pl | 2 +- vp8/encoder/arm/neon/denoising_neon.c | 18 +++++--------- vp8/encoder/denoising.c | 34 +++++++++++++-------------- vp8/encoder/x86/denoising_sse2.c | 20 +++++++--------- 4 files changed, 32 insertions(+), 42 deletions(-) diff --git a/vp8/common/rtcd_defs.pl b/vp8/common/rtcd_defs.pl index 130d96535..789b0de54 100644 --- a/vp8/common/rtcd_defs.pl +++ b/vp8/common/rtcd_defs.pl @@ -532,7 +532,7 @@ specialize qw/vp8_yv12_copy_partial_frame neon/; # Denoiser filter # if (vpx_config("CONFIG_TEMPORAL_DENOISING") eq "yes") { - add_proto qw/int vp8_denoiser_filter/, "struct yv12_buffer_config* mc_running_avg, struct yv12_buffer_config* running_avg, struct macroblock* signal, unsigned int motion_magnitude2, int y_offset, int uv_offset"; + add_proto qw/int vp8_denoiser_filter/, "unsigned char *mc_running_avg_y, int mc_avg_y_stride, unsigned char *running_avg_y, int avg_y_stride, unsigned char *sig, int sig_stride, unsigned int motion_magnitude"; specialize qw/vp8_denoiser_filter sse2 neon/; } diff --git a/vp8/encoder/arm/neon/denoising_neon.c b/vp8/encoder/arm/neon/denoising_neon.c index 23dc0a967..1bebe8fba 100644 --- a/vp8/encoder/arm/neon/denoising_neon.c +++ b/vp8/encoder/arm/neon/denoising_neon.c @@ -45,10 +45,12 @@ * [16, 255] 3 6 7 */ -int vp8_denoiser_filter_neon(YV12_BUFFER_CONFIG *mc_running_avg, - YV12_BUFFER_CONFIG *running_avg, - MACROBLOCK *signal, unsigned int motion_magnitude, - int y_offset, int uv_offset) { +int vp8_denoiser_filter_neon(unsigned char *mc_running_avg_y, + int mc_running_avg_y_stride, + unsigned char *running_avg_y, + int running_avg_y_stride, + unsigned char *sig, int sig_stride, + unsigned int motion_magnitude) { /* If motion_magnitude is small, making the denoiser more aggressive by * increasing the adjustment for each level, level1 adjustment is * increased, the deltas stay the same. @@ -60,14 +62,6 @@ int vp8_denoiser_filter_neon(YV12_BUFFER_CONFIG *mc_running_avg, const uint8x16_t v_level1_threshold = vdupq_n_u8(4); const uint8x16_t v_level2_threshold = vdupq_n_u8(8); const uint8x16_t v_level3_threshold = vdupq_n_u8(16); - - /* Local variables for array pointers and strides. */ - unsigned char *sig = signal->thismb; - int sig_stride = 16; - unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset; - int mc_running_avg_y_stride = mc_running_avg->y_stride; - unsigned char *running_avg_y = running_avg->y_buffer + y_offset; - int running_avg_y_stride = running_avg->y_stride; int64x2_t v_sum_diff_total = vdupq_n_s64(0); /* Go over lines. */ diff --git a/vp8/encoder/denoising.c b/vp8/encoder/denoising.c index 781926547..bfce28052 100644 --- a/vp8/encoder/denoising.c +++ b/vp8/encoder/denoising.c @@ -51,17 +51,13 @@ static const unsigned int SSE_THRESHOLD = 16 * 16 * 40; * [16, 255] 6 7 */ -int vp8_denoiser_filter_c(YV12_BUFFER_CONFIG *mc_running_avg, - YV12_BUFFER_CONFIG *running_avg, MACROBLOCK *signal, - unsigned int motion_magnitude, int y_offset, - int uv_offset) +int vp8_denoiser_filter_c(unsigned char *mc_running_avg_y, int mc_avg_y_stride, + unsigned char *running_avg_y, int avg_y_stride, + unsigned char *sig, int sig_stride, + unsigned int motion_magnitude) { - unsigned char *sig = signal->thismb; - int sig_stride = 16; - unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset; - int mc_avg_y_stride = mc_running_avg->y_stride; - unsigned char *running_avg_y = running_avg->y_buffer + y_offset; - int avg_y_stride = running_avg->y_stride; + unsigned char *running_avg_y_start = running_avg_y; + unsigned char *sig_start = sig; int r, c, i; int sum_diff = 0; int adj_val[3] = {3, 4, 6}; @@ -130,8 +126,7 @@ int vp8_denoiser_filter_c(YV12_BUFFER_CONFIG *mc_running_avg, if (abs(sum_diff) > SUM_DIFF_THRESHOLD) return COPY_BLOCK; - vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride, - signal->thismb, sig_stride); + vp8_copy_mem16x16(running_avg_y_start, avg_y_stride, sig_start, sig_stride); return FILTER_BLOCK; } @@ -285,12 +280,17 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, if (decision == FILTER_BLOCK) { + unsigned char *mc_running_avg_y = + denoiser->yv12_mc_running_avg.y_buffer + recon_yoffset; + int mc_avg_y_stride = denoiser->yv12_mc_running_avg.y_stride; + unsigned char *running_avg_y = + denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset; + int avg_y_stride = denoiser->yv12_running_avg[INTRA_FRAME].y_stride; + /* Filter. */ - decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg, - &denoiser->yv12_running_avg[INTRA_FRAME], - x, - motion_magnitude2, - recon_yoffset, recon_uvoffset); + decision = vp8_denoiser_filter(mc_running_avg_y, mc_avg_y_stride, + running_avg_y, avg_y_stride, + x->thismb, 16, motion_magnitude2); } if (decision == COPY_BLOCK) { diff --git a/vp8/encoder/x86/denoising_sse2.c b/vp8/encoder/x86/denoising_sse2.c index cceb8263f..d1f76b2cb 100644 --- a/vp8/encoder/x86/denoising_sse2.c +++ b/vp8/encoder/x86/denoising_sse2.c @@ -22,17 +22,14 @@ union sum_union { signed char e[16]; }; -int vp8_denoiser_filter_sse2(YV12_BUFFER_CONFIG *mc_running_avg, - YV12_BUFFER_CONFIG *running_avg, - MACROBLOCK *signal, unsigned int motion_magnitude, - int y_offset, int uv_offset) +int vp8_denoiser_filter_sse2(unsigned char *mc_running_avg_y, + int mc_avg_y_stride, + unsigned char *running_avg_y, int avg_y_stride, + unsigned char *sig, int sig_stride, + unsigned int motion_magnitude) { - unsigned char *sig = signal->thismb; - int sig_stride = 16; - unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset; - int mc_avg_y_stride = mc_running_avg->y_stride; - unsigned char *running_avg_y = running_avg->y_buffer + y_offset; - int avg_y_stride = running_avg->y_stride; + unsigned char *running_avg_y_start = running_avg_y; + unsigned char *sig_start = sig; int r; __m128i acc_diff = _mm_setzero_si128(); const __m128i k_0 = _mm_setzero_si128(); @@ -114,7 +111,6 @@ int vp8_denoiser_filter_sse2(YV12_BUFFER_CONFIG *mc_running_avg, } } - vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride, - signal->thismb, sig_stride); + vp8_copy_mem16x16(running_avg_y_start, avg_y_stride, sig_start, sig_stride); return FILTER_BLOCK; } -- 2.40.0