ref: e516a42527098a26798dbb3663a5bcdd38793839
parent: dea687f7337b6a68f4f79ef1fcd611cab53a67a6
author: Scott LaVarnway <[email protected]>
date: Fri May 2 06:31:52 EDT 2014
Remove struct params from vp8_denoiser_filter This eliminates the asm_offsets dependency for future all-assembly versions of this function. Change-Id: I3227073ecfcb8ee6e593934fab941e9081abdda0
--- a/vp8/common/rtcd_defs.pl
+++ b/vp8/common/rtcd_defs.pl
@@ -532,7 +532,7 @@
# 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/;
}
--- 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 @@
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. */
--- a/vp8/encoder/denoising.c
+++ b/vp8/encoder/denoising.c
@@ -51,17 +51,13 @@
* [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 @@
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 @@
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)
{
--- a/vp8/encoder/x86/denoising_sse2.c
+++ b/vp8/encoder/x86/denoising_sse2.c
@@ -22,17 +22,14 @@
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 @@
}
}
- 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;
}