ref: 06e6d56fa138d84759e8bdfd4c721ead000051b4
parent: e516a42527098a26798dbb3663a5bcdd38793839
author: Frank Galligan <[email protected]>
date: Wed May 7 12:19:20 EDT 2014
Revert "Remove struct params from vp8_denoiser_filter" This reverts commit e516a42527098a26798dbb3663a5bcdd38793839 Change-Id: I7c78712acc737ad5f580181cdab3aa76b23f3ca5
--- 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/, "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";
+ 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";
specialize qw/vp8_denoiser_filter sse2 neon/;
}
--- a/vp8/encoder/arm/neon/denoising_neon.c
+++ b/vp8/encoder/arm/neon/denoising_neon.c
@@ -45,12 +45,10 @@
* [16, 255] 3 6 7
*/
-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) {
+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) {
/* 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.
@@ -62,6 +60,14 @@
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,13 +51,17 @@
* [16, 255] 6 7
*/
-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)
+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)
{
- unsigned char *running_avg_y_start = running_avg_y;
- unsigned char *sig_start = sig;
+ 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;
int r, c, i;
int sum_diff = 0;
int adj_val[3] = {3, 4, 6};
@@ -126,7 +130,8 @@
if (abs(sum_diff) > SUM_DIFF_THRESHOLD)
return COPY_BLOCK;
- vp8_copy_mem16x16(running_avg_y_start, avg_y_stride, sig_start, sig_stride);
+ vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride,
+ signal->thismb, sig_stride);
return FILTER_BLOCK;
}
@@ -280,17 +285,12 @@
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(mc_running_avg_y, mc_avg_y_stride,
- running_avg_y, avg_y_stride,
- x->thismb, 16, motion_magnitude2);
+ decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,
+ &denoiser->yv12_running_avg[INTRA_FRAME],
+ x,
+ motion_magnitude2,
+ recon_yoffset, recon_uvoffset);
}
if (decision == COPY_BLOCK)
{
--- a/vp8/encoder/x86/denoising_sse2.c
+++ b/vp8/encoder/x86/denoising_sse2.c
@@ -22,14 +22,17 @@
signed char e[16];
};
-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)
+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)
{
- unsigned char *running_avg_y_start = running_avg_y;
- unsigned char *sig_start = sig;
+ 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;
int r;
__m128i acc_diff = _mm_setzero_si128();
const __m128i k_0 = _mm_setzero_si128();
@@ -111,6 +114,7 @@
}
}
- vp8_copy_mem16x16(running_avg_y_start, avg_y_stride, sig_start, sig_stride);
+ vp8_copy_mem16x16(running_avg->y_buffer + y_offset, avg_y_stride,
+ signal->thismb, sig_stride);
return FILTER_BLOCK;
}