Remove struct params from vp8_denoiser_filter

This eliminates the asm_offsets dependency for future
all-assembly versions of this function.

Change-Id: I3227073ecfcb8ee6e593934fab941e9081abdda0
This commit is contained in:
Scott LaVarnway 2014-05-02 10:31:52 -07:00
parent dea687f733
commit e516a42527
4 changed files with 32 additions and 42 deletions

View File

@ -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/;
}

View File

@ -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. */

View File

@ -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)
{

View File

@ -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;
}