Merge "vp8: Move loopfilter synchronization to end of encode_frame call."

This commit is contained in:
Marco Paniconi 2016-08-29 05:52:39 +00:00 committed by Gerrit Code Review
commit e66cd132f0
3 changed files with 11 additions and 7 deletions

View File

@ -492,6 +492,7 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi) {
cpi->b_multi_threaded = 0;
cpi->encoding_thread_count = 0;
cpi->b_lpf_running = 0;
if (cm->processor_core_count > 1 && cpi->oxcf.multi_threaded > 1) {
int ithread;

View File

@ -4349,6 +4349,7 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
if (cpi->b_multi_threaded) {
/* start loopfilter in separate thread */
sem_post(&cpi->h_event_start_lpf);
cpi->b_lpf_running = 1;
} else
#endif
{
@ -4377,13 +4378,6 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
/* build the bitstream */
vp8_pack_bitstream(cpi, dest, dest_end, size);
#if CONFIG_MULTITHREAD
/* wait for the lpf thread done */
if (cpi->b_multi_threaded) {
sem_wait(&cpi->h_event_end_lpf);
}
#endif
/* Move storing frame_type out of the above loop since it is also
* needed in motion search besides loopfilter */
cm->last_frame_type = cm->frame_type;
@ -5220,6 +5214,14 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags,
cpi->common.error.setjmp = 0;
#if CONFIG_MULTITHREAD
/* wait for the lpf thread done */
if (cpi->b_multi_threaded && cpi->b_lpf_running) {
sem_wait(&cpi->h_event_end_lpf);
cpi->b_lpf_running = 0;
}
#endif
return 0;
}

View File

@ -509,6 +509,7 @@ 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;