ref: b0a2ba2ffa8f66b41dca402f17ef2ae7724569b9
parent: 780ada18aaf072bb46fd26d05f0075ed8514026d
author: jackychen <[email protected]>
date: Wed Oct 7 09:21:25 EDT 2015
VP9_denoiser: pass address in copy_frame to make it faster. Change-Id: I65269ddb3ea5f911d5be38614b93c97be7e1ba76
--- a/vp9/encoder/vp9_denoiser.c
+++ b/vp9/encoder/vp9_denoiser.c
@@ -346,23 +346,24 @@
}
}
-static void copy_frame(YV12_BUFFER_CONFIG dest, const YV12_BUFFER_CONFIG src) {
+static void copy_frame(YV12_BUFFER_CONFIG * const dest,
+ const YV12_BUFFER_CONFIG * const src) {
int r;
- const uint8_t *srcbuf = src.y_buffer;
- uint8_t *destbuf = dest.y_buffer;
+ const uint8_t *srcbuf = src->y_buffer;
+ uint8_t *destbuf = dest->y_buffer;
- assert(dest.y_width == src.y_width);
- assert(dest.y_height == src.y_height);
+ assert(dest->y_width == src->y_width);
+ assert(dest->y_height == src->y_height);
- for (r = 0; r < dest.y_height; ++r) {
- memcpy(destbuf, srcbuf, dest.y_width);
- destbuf += dest.y_stride;
- srcbuf += src.y_stride;
+ for (r = 0; r < dest->y_height; ++r) {
+ memcpy(destbuf, srcbuf, dest->y_width);
+ destbuf += dest->y_stride;
+ srcbuf += src->y_stride;
}
}
-static void swap_frame_buffer(YV12_BUFFER_CONFIG *dest,
- YV12_BUFFER_CONFIG *src) {
+static void swap_frame_buffer(YV12_BUFFER_CONFIG * const dest,
+ YV12_BUFFER_CONFIG * const src) {
uint8_t *tmp_buf = dest->y_buffer;
assert(dest->y_width == src->y_width);
assert(dest->y_height == src->y_height);
@@ -383,7 +384,7 @@
int i;
// Start at 1 so as not to overwrite the INTRA_FRAME
for (i = 1; i < MAX_REF_FRAMES; ++i)
- copy_frame(denoiser->running_avg_y[i], src);
+ copy_frame(&denoiser->running_avg_y[i], &src);
return;
}
@@ -391,16 +392,16 @@
if ((refresh_alt_ref_frame + refresh_golden_frame + refresh_last_frame)
> 1) {
if (refresh_alt_ref_frame) {
- copy_frame(denoiser->running_avg_y[ALTREF_FRAME],
- denoiser->running_avg_y[INTRA_FRAME]);
+ copy_frame(&denoiser->running_avg_y[ALTREF_FRAME],
+ &denoiser->running_avg_y[INTRA_FRAME]);
}
if (refresh_golden_frame) {
- copy_frame(denoiser->running_avg_y[GOLDEN_FRAME],
- denoiser->running_avg_y[INTRA_FRAME]);
+ copy_frame(&denoiser->running_avg_y[GOLDEN_FRAME],
+ &denoiser->running_avg_y[INTRA_FRAME]);
}
if (refresh_last_frame) {
- copy_frame(denoiser->running_avg_y[LAST_FRAME],
- denoiser->running_avg_y[INTRA_FRAME]);
+ copy_frame(&denoiser->running_avg_y[LAST_FRAME],
+ &denoiser->running_avg_y[INTRA_FRAME]);
}
} else {
if (refresh_alt_ref_frame) {