From 000c8414b510dcaeb1ab7a52bec78c4a6b97cafd Mon Sep 17 00:00:00 2001 From: Scott LaVarnway Date: Fri, 7 Dec 2012 12:19:52 -0800 Subject: [PATCH] Moved denoiser frame copy/updates out of loopfilter thread The loopfilter thread from the previous frame can be running while starting the current frame. cpi->Source will change during this time causing the wrong data to be copied. The refresh_x_frame flags also change, which will cause incorrect updates of the denoised buffers. Change-Id: I7d982b4fcb40a0610801332aa85f3b792c64e4c3 --- vp8/encoder/onyx_if.c | 86 ++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 3847c1e12..3421e6f81 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -3131,49 +3131,7 @@ static void update_reference_frames(VP8_COMP *cpi) cpi->current_ref_frames[LAST_FRAME] = cm->current_video_frame; #endif } -} - -void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) -{ - const FRAME_TYPE frame_type = cm->frame_type; - - if (cm->no_lpf) - { - cm->filter_level = 0; - } - else - { - struct vpx_usec_timer timer; - - vp8_clear_system_state(); - - vpx_usec_timer_start(&timer); - if (cpi->sf.auto_filter == 0) - vp8cx_pick_filter_level_fast(cpi->Source, cpi); - - else - vp8cx_pick_filter_level(cpi->Source, cpi); - if (cm->filter_level > 0) - { - vp8cx_set_alt_lf_level(cpi, cm->filter_level); - } - - vpx_usec_timer_mark(&timer); - cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); - } - -#if CONFIG_MULTITHREAD - if (cpi->b_multi_threaded) - sem_post(&cpi->h_event_end_lpf); /* signal that we have set filter_level */ -#endif - - if (cm->filter_level > 0) - { - vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, frame_type); - } - - vp8_yv12_extend_frame_borders(cm->frame_to_show); #if CONFIG_TEMPORAL_DENOISING if (cpi->oxcf.noise_sensitivity) { @@ -3226,6 +3184,50 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) } +void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) +{ + const FRAME_TYPE frame_type = cm->frame_type; + + if (cm->no_lpf) + { + cm->filter_level = 0; + } + else + { + struct vpx_usec_timer timer; + + vp8_clear_system_state(); + + vpx_usec_timer_start(&timer); + if (cpi->sf.auto_filter == 0) + vp8cx_pick_filter_level_fast(cpi->Source, cpi); + + else + vp8cx_pick_filter_level(cpi->Source, cpi); + + if (cm->filter_level > 0) + { + vp8cx_set_alt_lf_level(cpi, cm->filter_level); + } + + vpx_usec_timer_mark(&timer); + cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); + } + +#if CONFIG_MULTITHREAD + if (cpi->b_multi_threaded) + sem_post(&cpi->h_event_end_lpf); /* signal that we have set filter_level */ +#endif + + if (cm->filter_level > 0) + { + vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, frame_type); + } + + vp8_yv12_extend_frame_borders(cm->frame_to_show); + +} + static void encode_frame_to_data_rate ( VP8_COMP *cpi, -- 2.40.0