History

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.

Scott LaVarnway committed 13 years ago

Commit ef2248a1 parent f2b36a42 files · +15 −13Browse files

Unified · Split

2 files
  1. vp8/encoder/denoising.c +5 −7
  2. vp8/encoder/onyx_if.c +10 −6
vp8/encoder/denoising.c+5−7
@@ -140,8 +140,7 @@ int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height) · 139 unmodified lines
140140 int i;
141141 assert(denoiser);
142142
143− /* don't need one for intra start at 1 */
144− for (i = 1; i < MAX_REF_FRAMES; i++)
143+ for (i = 0; i < MAX_REF_FRAMES; i++)
145144 {
146145 denoiser->yv12_running_avg[i].flags = 0;
147146
@@ -175,8 +174,7 @@ void vp8_denoiser_free(VP8_DENOISER *denoiser) · 27 unmodified lines
175174 int i;
176175 assert(denoiser);
177176
178− /* we don't have one for intra ref frame */
179− for (i = 1; i < MAX_REF_FRAMES ; i++)
177+ for (i = 0; i < MAX_REF_FRAMES ; i++)
180178 {
181179 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]);
182180 }
@@ -291,7 +289,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, · 108 unmodified lines
291289 {
292290 /* Filter. */
293291 decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,
294− &denoiser->yv12_running_avg[LAST_FRAME],
292+ &denoiser->yv12_running_avg[INTRA_FRAME],
295293 x,
296294 motion_magnitude2,
297295 recon_yoffset, recon_uvoffset);
@@ -303,7 +301,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, · 5 unmodified lines
303301 */
304302 vp8_copy_mem16x16(
305303 x->thismb, 16,
306− denoiser->yv12_running_avg[LAST_FRAME].y_buffer + recon_yoffset,
307− denoiser->yv12_running_avg[LAST_FRAME].y_stride);
304+ denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset,
305+ denoiser->yv12_running_avg[INTRA_FRAME].y_stride);
308306 }
309307 }
vp8/encoder/onyx_if.c+10−6
@@ -3177,8 +3177,6 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) · 3176 unmodified lines
31773177 #if CONFIG_TEMPORAL_DENOISING
31783178 if (cpi->oxcf.noise_sensitivity)
31793179 {
3180−
3181−
31823180 /* we shouldn't have to keep multiple copies as we know in advance which
31833181 * buffer we should start - for now to get something up and running
31843182 * I've chosen to copy the buffers
@@ -3195,26 +3193,32 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) · 10 unmodified lines
31953193
31963194 for (i = 2; i < MAX_REF_FRAMES - 1; i++)
31973195 vp8_yv12_copy_frame(
3198− cpi->Source,
3196+ &cpi->denoiser.yv12_running_avg[LAST_FRAME],
31993197 &cpi->denoiser.yv12_running_avg[i]);
32003198 }
32013199 else /* For non key frames */
32023200 {
32033201 vp8_yv12_extend_frame_borders(
3204− &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
3202+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME]);
32053203
32063204 if (cm->refresh_alt_ref_frame || cm->copy_buffer_to_arf)
32073205 {
32083206 vp8_yv12_copy_frame(
3209− &cpi->denoiser.yv12_running_avg[LAST_FRAME],
3207+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
32103208 &cpi->denoiser.yv12_running_avg[ALTREF_FRAME]);
32113209 }
32123210 if (cm->refresh_golden_frame || cm->copy_buffer_to_gf)
32133211 {
32143212 vp8_yv12_copy_frame(
3215− &cpi->denoiser.yv12_running_avg[LAST_FRAME],
3213+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
32163214 &cpi->denoiser.yv12_running_avg[GOLDEN_FRAME]);
32173215 }
3216+ if(cm->refresh_last_frame)
3217+ {
3218+ vp8_yv12_copy_frame(
3219+ &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
3220+ &cpi->denoiser.yv12_running_avg[LAST_FRAME]);
3221+ }
32183222 }
32193223
32203224 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t