summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2012-12-05 19:09:05 -0800
committerScott LaVarnway <slavarnway@google.com>2012-12-05 19:09:05 -0800
commitef2248a2a376131f69e25aecdd2b839d71ece1e4 (patch)
treec2522557a87aea6e2b21d24129e6299dd490e73a /vp8
parentf2b36a4de7baa5c1f5166c5a532c147eb08d4e8a (diff)
downloadlibvpx-ef2248a2a376131f69e25aecdd2b839d71ece1e4.tar
libvpx-ef2248a2a376131f69e25aecdd2b839d71ece1e4.tar.gz
libvpx-ef2248a2a376131f69e25aecdd2b839d71ece1e4.tar.bz2
libvpx-ef2248a2a376131f69e25aecdd2b839d71ece1e4.zip
added work buffer for denoiser
The denoiser was writing to LAST_FRAME buffer. If LAST_FRAME isn't being updated, the reference frame buffers were out of sync between the encoder and the denoised raw buffers. This patch resolves the discrepancy by always writing to a work buffer (INTRA_FRAME) and then copying from that buffer to any buffers that needs to be updated. Change-Id: I6dd855b9749978b542bc3d515914d5f16faf25df
Diffstat (limited to 'vp8')
-rw-r--r--vp8/encoder/denoising.c12
-rw-r--r--vp8/encoder/onyx_if.c16
2 files changed, 15 insertions, 13 deletions
diff --git a/vp8/encoder/denoising.c b/vp8/encoder/denoising.c
index c0dd7c106..f3faa227f 100644
--- a/vp8/encoder/denoising.c
+++ b/vp8/encoder/denoising.c
@@ -140,8 +140,7 @@ int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height)
int i;
assert(denoiser);
- /* don't need one for intra start at 1 */
- for (i = 1; i < MAX_REF_FRAMES; i++)
+ for (i = 0; i < MAX_REF_FRAMES; i++)
{
denoiser->yv12_running_avg[i].flags = 0;
@@ -175,8 +174,7 @@ void vp8_denoiser_free(VP8_DENOISER *denoiser)
int i;
assert(denoiser);
- /* we don't have one for intra ref frame */
- for (i = 1; i < MAX_REF_FRAMES ; i++)
+ for (i = 0; i < MAX_REF_FRAMES ; i++)
{
vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]);
}
@@ -291,7 +289,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
{
/* Filter. */
decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,
- &denoiser->yv12_running_avg[LAST_FRAME],
+ &denoiser->yv12_running_avg[INTRA_FRAME],
x,
motion_magnitude2,
recon_yoffset, recon_uvoffset);
@@ -303,7 +301,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
*/
vp8_copy_mem16x16(
x->thismb, 16,
- denoiser->yv12_running_avg[LAST_FRAME].y_buffer + recon_yoffset,
- denoiser->yv12_running_avg[LAST_FRAME].y_stride);
+ denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset,
+ denoiser->yv12_running_avg[INTRA_FRAME].y_stride);
}
}
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index f0e0da0fe..3847c1e12 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3177,8 +3177,6 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
#if CONFIG_TEMPORAL_DENOISING
if (cpi->oxcf.noise_sensitivity)
{
-
-
/* we shouldn't have to keep multiple copies as we know in advance which
* buffer we should start - for now to get something up and running
* I've chosen to copy the buffers
@@ -3195,26 +3193,32 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
for (i = 2; i < MAX_REF_FRAMES - 1; i++)
vp8_yv12_copy_frame(
- cpi->Source,
+ &cpi->denoiser.yv12_running_avg[LAST_FRAME],
&cpi->denoiser.yv12_running_avg[i]);
}
else /* For non key frames */
{
vp8_yv12_extend_frame_borders(
- &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME]);
if (cm->refresh_alt_ref_frame || cm->copy_buffer_to_arf)
{
vp8_yv12_copy_frame(
- &cpi->denoiser.yv12_running_avg[LAST_FRAME],
+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
&cpi->denoiser.yv12_running_avg[ALTREF_FRAME]);
}
if (cm->refresh_golden_frame || cm->copy_buffer_to_gf)
{
vp8_yv12_copy_frame(
- &cpi->denoiser.yv12_running_avg[LAST_FRAME],
+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
&cpi->denoiser.yv12_running_avg[GOLDEN_FRAME]);
}
+ if(cm->refresh_last_frame)
+ {
+ vp8_yv12_copy_frame(
+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
+ &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
+ }
}
}