summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2016-03-22 14:13:18 -0700
committerYunqing Wang <yunqingwang@google.com>2016-03-22 14:13:18 -0700
commitb198bcd528ef53b5b292255449f791d3f787496f (patch)
tree57a9aab87c55b57a9ca150222a4f1fdc44a2872b /vp8/encoder
parent627a3ddcbef521fb85b1980e701d4d71fb177f40 (diff)
downloadlibvpx-b198bcd528ef53b5b292255449f791d3f787496f.tar
libvpx-b198bcd528ef53b5b292255449f791d3f787496f.tar.gz
libvpx-b198bcd528ef53b5b292255449f791d3f787496f.tar.bz2
libvpx-b198bcd528ef53b5b292255449f791d3f787496f.zip
Simplify the loopfilter synchronization logic in VP8 encoder
This patch was to fix a reported Hangouts deadlock/freezing issue in VP8 encoder(issue 27232610). The original encoder loopfilter synchronization happened in the following frame, which was prone to causing problems in some complex use cases. This patch simplified the synchronization logic. More testing needs to be done. Change-Id: I38fd3f35d11f98fae1e44546aa5e4c6d6e19c4be
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/ethreading.c1
-rw-r--r--vp8/encoder/onyx_if.c34
-rw-r--r--vp8/encoder/onyx_int.h1
3 files changed, 2 insertions, 34 deletions
diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c
index 4f689c4bc..2a0c2987b 100644
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -518,7 +518,6 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi)
cpi->b_multi_threaded = 0;
cpi->encoding_thread_count = 0;
- cpi->b_lpf_running = 0;
pthread_mutex_init(&cpi->mt_mutex, NULL);
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 93c457008..88c191e94 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1531,15 +1531,6 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
if (!oxcf)
return;
-#if CONFIG_MULTITHREAD
- /* wait for the last picture loopfilter thread done */
- if (cpi->b_lpf_running)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
if (cm->version != oxcf->Version)
{
cm->version = oxcf->Version;
@@ -3638,15 +3629,6 @@ static void encode_frame_to_data_rate
/* Clear down mmx registers to allow floating point in what follows */
vp8_clear_system_state();
-#if CONFIG_MULTITHREAD
- /* wait for the last picture loopfilter thread done */
- if (cpi->b_lpf_running)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
if(cpi->force_next_frame_intra)
{
cm->frame_type = KEY_FRAME; /* delayed intra frame */
@@ -4375,8 +4357,6 @@ static void encode_frame_to_data_rate
vp8_setup_key_frame(cpi);
}
-
-
#if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
{
if(cpi->oxcf.error_resilient_mode)
@@ -4842,7 +4822,6 @@ static void encode_frame_to_data_rate
{
/* start loopfilter in separate thread */
sem_post(&cpi->h_event_start_lpf);
- cpi->b_lpf_running = 1;
}
else
#endif
@@ -4874,11 +4853,10 @@ static void encode_frame_to_data_rate
vp8_pack_bitstream(cpi, dest, dest_end, size);
#if CONFIG_MULTITHREAD
- /* if PSNR packets are generated we have to wait for the lpf */
- if (cpi->b_lpf_running && cpi->b_calculate_psnr)
+ /* wait for the lpf thread done */
+ if (cpi->b_multi_threaded)
{
sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
}
#endif
@@ -5838,14 +5816,6 @@ int vp8_get_preview_raw_frame(VP8_COMP *cpi, YV12_BUFFER_CONFIG *dest, vp8_ppfla
{
int ret;
-#if CONFIG_MULTITHREAD
- if(cpi->b_lpf_running)
- {
- sem_wait(&cpi->h_event_end_lpf);
- cpi->b_lpf_running = 0;
- }
-#endif
-
#if CONFIG_POSTPROC
cpi->common.show_frame_mi = cpi->common.mi;
ret = vp8_post_proc_frame(&cpi->common, dest, flags);
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 2b2f7a0a9..6ede9b95a 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -536,7 +536,6 @@ typedef struct VP8_COMP
int mt_sync_range;
int b_multi_threaded;
int encoding_thread_count;
- int b_lpf_running;
pthread_t *h_encoding_thread;
pthread_t h_filter_thread;