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
140 int i;140 int i;
141 assert(denoiser);141 assert(denoiser);
142 142
143 /* don't need one for intra start at 1 */143 for (i = 0; i < MAX_REF_FRAMES; i++)
144 for (i = 1; i < MAX_REF_FRAMES; i++)
145 {144 {
146 denoiser->yv12_running_avg[i].flags = 0;145 denoiser->yv12_running_avg[i].flags = 0;
147 146
@@ -175,8 +174,7 @@ void vp8_denoiser_free(VP8_DENOISER *denoiser) · 27 unmodified lines
175 int i;174 int i;
176 assert(denoiser);175 assert(denoiser);
177 176
178 /* we don't have one for intra ref frame */177 for (i = 0; i < MAX_REF_FRAMES ; i++)
179 for (i = 1; i < MAX_REF_FRAMES ; i++)
180 {178 {
181 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]);179 vp8_yv12_de_alloc_frame_buffer(&denoiser->yv12_running_avg[i]);
182 }180 }
@@ -291,7 +289,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, · 108 unmodified lines
291 {289 {
292 /* Filter. */290 /* Filter. */
293 decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,291 decision = vp8_denoiser_filter(&denoiser->yv12_mc_running_avg,
294 &denoiser->yv12_running_avg[LAST_FRAME],292 &denoiser->yv12_running_avg[INTRA_FRAME],
295 x,293 x,
296 motion_magnitude2,294 motion_magnitude2,
297 recon_yoffset, recon_uvoffset);295 recon_yoffset, recon_uvoffset);
@@ -303,7 +301,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, · 5 unmodified lines
303 */301 */
304 vp8_copy_mem16x16(302 vp8_copy_mem16x16(
305 x->thismb, 16,303 x->thismb, 16,
306 denoiser->yv12_running_avg[LAST_FRAME].y_buffer + recon_yoffset,304 denoiser->yv12_running_avg[INTRA_FRAME].y_buffer + recon_yoffset,
307 denoiser->yv12_running_avg[LAST_FRAME].y_stride);305 denoiser->yv12_running_avg[INTRA_FRAME].y_stride);
308 }306 }
309}307}
vp8/encoder/onyx_if.c+10−6
@@ -3177,8 +3177,6 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) · 3176 unmodified lines
3177#if CONFIG_TEMPORAL_DENOISING3177#if CONFIG_TEMPORAL_DENOISING
3178 if (cpi->oxcf.noise_sensitivity)3178 if (cpi->oxcf.noise_sensitivity)
3179 {3179 {
3180
3181
3182 /* we shouldn't have to keep multiple copies as we know in advance which3180 /* we shouldn't have to keep multiple copies as we know in advance which
3183 * buffer we should start - for now to get something up and running3181 * buffer we should start - for now to get something up and running
3184 * I've chosen to copy the buffers3182 * I've chosen to copy the buffers
@@ -3195,26 +3193,32 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) · 10 unmodified lines
3195 3193
3196 for (i = 2; i < MAX_REF_FRAMES - 1; i++)3194 for (i = 2; i < MAX_REF_FRAMES - 1; i++)
3197 vp8_yv12_copy_frame(3195 vp8_yv12_copy_frame(
3198 cpi->Source,3196 &cpi->denoiser.yv12_running_avg[LAST_FRAME],
3199 &cpi->denoiser.yv12_running_avg[i]);3197 &cpi->denoiser.yv12_running_avg[i]);
3200 }3198 }
3201 else /* For non key frames */3199 else /* For non key frames */
3202 {3200 {
3203 vp8_yv12_extend_frame_borders(3201 vp8_yv12_extend_frame_borders(
3204 &cpi->denoiser.yv12_running_avg[LAST_FRAME]);3202 &cpi->denoiser.yv12_running_avg[INTRA_FRAME]);
3205 3203
3206 if (cm->refresh_alt_ref_frame || cm->copy_buffer_to_arf)3204 if (cm->refresh_alt_ref_frame || cm->copy_buffer_to_arf)
3207 {3205 {
3208 vp8_yv12_copy_frame(3206 vp8_yv12_copy_frame(
3209 &cpi->denoiser.yv12_running_avg[LAST_FRAME],3207 &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
3210 &cpi->denoiser.yv12_running_avg[ALTREF_FRAME]);3208 &cpi->denoiser.yv12_running_avg[ALTREF_FRAME]);
3211 }3209 }
3212 if (cm->refresh_golden_frame || cm->copy_buffer_to_gf)3210 if (cm->refresh_golden_frame || cm->copy_buffer_to_gf)
3213 {3211 {
3214 vp8_yv12_copy_frame(3212 vp8_yv12_copy_frame(
3215 &cpi->denoiser.yv12_running_avg[LAST_FRAME],3213 &cpi->denoiser.yv12_running_avg[INTRA_FRAME],
3216 &cpi->denoiser.yv12_running_avg[GOLDEN_FRAME]);3214 &cpi->denoiser.yv12_running_avg[GOLDEN_FRAME]);
3217 }3215 }
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 }
3218 }3222 }
3219 3223
3220 }3224 }

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