summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Nagy <attilanagy@google.com>2012-05-22 14:19:10 +0300
committerJohn Koleszar <jkoleszar@google.com>2012-05-23 13:50:59 -0700
commit4890853010847479bb88a43829824649a547c478 (patch)
tree88e4fbbeab2f8247ac6c12deee25a5148c207d92
parentcf0970157dd7be238a8e7cc4917b22b3834ebd56 (diff)
downloadlibvpx-4890853010847479bb88a43829824649a547c478.tar
libvpx-4890853010847479bb88a43829824649a547c478.tar.gz
libvpx-4890853010847479bb88a43829824649a547c478.tar.bz2
libvpx-4890853010847479bb88a43829824649a547c478.zip
Fix another multithreaded encoder loopfilter race condition
After a key frame encoding, the frame type could change while filtering is still going on. Pass the frame type as parameter to the loopfilter function and don't read it from common storage. vp8cx_set_alt_lf_level has to be done before packing the stream. Currently alt_lf_level is not used so there hasn't been any visible problem here. Change-Id: Ia114162158cd833c2b16e3b89303cc9c91f19165
-rw-r--r--vp8/common/loopfilter.c10
-rw-r--r--vp8/common/loopfilter.h3
-rw-r--r--vp8/decoder/onyxd_if.c2
-rw-r--r--vp8/encoder/onyx_if.c10
4 files changed, 14 insertions, 11 deletions
diff --git a/vp8/common/loopfilter.c b/vp8/common/loopfilter.c
index 3f05efe81..b9ac0ff3e 100644
--- a/vp8/common/loopfilter.c
+++ b/vp8/common/loopfilter.c
@@ -196,18 +196,14 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
}
}
-void vp8_loop_filter_frame
-(
- VP8_COMMON *cm,
- MACROBLOCKD *mbd
-)
+void vp8_loop_filter_frame(VP8_COMMON *cm,
+ MACROBLOCKD *mbd,
+ int frame_type)
{
YV12_BUFFER_CONFIG *post = cm->frame_to_show;
loop_filter_info_n *lfi_n = &cm->lf_info;
loop_filter_info lfi;
- FRAME_TYPE frame_type = cm->frame_type;
-
int mb_row;
int mb_col;
int mb_rows = cm->mb_rows;
diff --git a/vp8/common/loopfilter.h b/vp8/common/loopfilter.h
index 0fa83750b..0497271b0 100644
--- a/vp8/common/loopfilter.h
+++ b/vp8/common/loopfilter.h
@@ -76,7 +76,8 @@ void vp8_loop_filter_frame_init(struct VP8Common *cm,
struct macroblockd *mbd,
int default_filt_lvl);
-void vp8_loop_filter_frame(struct VP8Common *cm, struct macroblockd *mbd);
+void vp8_loop_filter_frame(struct VP8Common *cm, struct macroblockd *mbd,
+ int frame_type);
void vp8_loop_filter_partial_frame(struct VP8Common *cm,
struct macroblockd *mbd,
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index c59ce259f..2a9a11b4a 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -468,7 +468,7 @@ int vp8dx_receive_compressed_data(VP8D_COMP *pbi, unsigned long size, const unsi
if(cm->filter_level)
{
/* Apply the loop filter if appropriate. */
- vp8_loop_filter_frame(cm, &pbi->mb);
+ vp8_loop_filter_frame(cm, &pbi->mb, cm->frame_type);
}
vp8_yv12_extend_frame_borders(cm->frame_to_show);
}
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index b7699aeb7..0f4bc1d1a 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3114,6 +3114,8 @@ static void update_reference_frames(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;
@@ -3131,6 +3133,11 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
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);
}
@@ -3142,8 +3149,7 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
if (cm->filter_level > 0)
{
- vp8cx_set_alt_lf_level(cpi, cm->filter_level);
- vp8_loop_filter_frame(cm, &cpi->mb.e_mbd);
+ vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, frame_type);
}
vp8_yv12_extend_frame_borders(cm->frame_to_show);