ref: 7381e3330f1fb8becb9d83f1e4085d7109c7d47e
parent: 3d3f51262c64767ffb5502ca5fe2fcbd4366d879
parent: 0fff2fb34c7924aa59322518db41ee1953d813f9
author: James Bankoski <[email protected]>
date: Fri Jul 22 20:51:37 EDT 2016
Merge "vp8:fix threading issues"
--- a/vp8/decoder/decodeframe.c
+++ b/vp8/decoder/decodeframe.c
@@ -798,6 +798,9 @@
if (pbi->decoding_thread_count > num_token_partitions - 1) {
pbi->decoding_thread_count = num_token_partitions - 1;
}
+ if (pbi->decoding_thread_count > pbi->common.mb_rows - 1) {
+ pbi->decoding_thread_count = pbi->common.mb_rows - 1;
+ }
#endif
}
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -331,7 +331,6 @@
if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0) {
cm->fb_idx_ref_cnt[cm->new_fb_idx]--;
}
-
goto decode_exit;
}
@@ -464,9 +463,6 @@
if (!pbi) return VPX_CODEC_ERROR;
#if CONFIG_MULTITHREAD
- if (pbi->b_multithreaded_rd) {
- vp8mt_de_alloc_temp_buffers(pbi, pbi->common.mb_rows);
- }
vp8_decoder_remove_threads(pbi);
#endif
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -631,65 +631,63 @@
void vp8mt_de_alloc_temp_buffers(VP8D_COMP *pbi, int mb_rows) {
int i;
- if (pbi->b_multithreaded_rd) {
- vpx_free(pbi->mt_current_mb_col);
- pbi->mt_current_mb_col = NULL;
+ vpx_free(pbi->mt_current_mb_col);
+ pbi->mt_current_mb_col = NULL;
- /* Free above_row buffers. */
- if (pbi->mt_yabove_row) {
- for (i = 0; i < mb_rows; ++i) {
- vpx_free(pbi->mt_yabove_row[i]);
- pbi->mt_yabove_row[i] = NULL;
- }
- vpx_free(pbi->mt_yabove_row);
- pbi->mt_yabove_row = NULL;
+ /* Free above_row buffers. */
+ if (pbi->mt_yabove_row) {
+ for (i = 0; i < mb_rows; ++i) {
+ vpx_free(pbi->mt_yabove_row[i]);
+ pbi->mt_yabove_row[i] = NULL;
}
+ vpx_free(pbi->mt_yabove_row);
+ pbi->mt_yabove_row = NULL;
+ }
- if (pbi->mt_uabove_row) {
- for (i = 0; i < mb_rows; ++i) {
- vpx_free(pbi->mt_uabove_row[i]);
- pbi->mt_uabove_row[i] = NULL;
- }
- vpx_free(pbi->mt_uabove_row);
- pbi->mt_uabove_row = NULL;
+ if (pbi->mt_uabove_row) {
+ for (i = 0; i < mb_rows; ++i) {
+ vpx_free(pbi->mt_uabove_row[i]);
+ pbi->mt_uabove_row[i] = NULL;
}
+ vpx_free(pbi->mt_uabove_row);
+ pbi->mt_uabove_row = NULL;
+ }
- if (pbi->mt_vabove_row) {
- for (i = 0; i < mb_rows; ++i) {
- vpx_free(pbi->mt_vabove_row[i]);
- pbi->mt_vabove_row[i] = NULL;
- }
- vpx_free(pbi->mt_vabove_row);
- pbi->mt_vabove_row = NULL;
+ if (pbi->mt_vabove_row) {
+ for (i = 0; i < mb_rows; ++i) {
+ vpx_free(pbi->mt_vabove_row[i]);
+ pbi->mt_vabove_row[i] = NULL;
}
+ vpx_free(pbi->mt_vabove_row);
+ pbi->mt_vabove_row = NULL;
+ }
- /* Free left_col buffers. */
- if (pbi->mt_yleft_col) {
- for (i = 0; i < mb_rows; ++i) {
- vpx_free(pbi->mt_yleft_col[i]);
- pbi->mt_yleft_col[i] = NULL;
- }
- vpx_free(pbi->mt_yleft_col);
- pbi->mt_yleft_col = NULL;
+ /* Free left_col buffers. */
+ if (pbi->mt_yleft_col) {
+ for (i = 0; i < mb_rows; ++i) {
+ vpx_free(pbi->mt_yleft_col[i]);
+ pbi->mt_yleft_col[i] = NULL;
}
+ vpx_free(pbi->mt_yleft_col);
+ pbi->mt_yleft_col = NULL;
+ }
- if (pbi->mt_uleft_col) {
- for (i = 0; i < mb_rows; ++i) {
- vpx_free(pbi->mt_uleft_col[i]);
- pbi->mt_uleft_col[i] = NULL;
- }
- vpx_free(pbi->mt_uleft_col);
- pbi->mt_uleft_col = NULL;
+ if (pbi->mt_uleft_col) {
+ for (i = 0; i < mb_rows; ++i) {
+ vpx_free(pbi->mt_uleft_col[i]);
+ pbi->mt_uleft_col[i] = NULL;
}
+ vpx_free(pbi->mt_uleft_col);
+ pbi->mt_uleft_col = NULL;
+ }
- if (pbi->mt_vleft_col) {
- for (i = 0; i < mb_rows; ++i) {
- vpx_free(pbi->mt_vleft_col[i]);
- pbi->mt_vleft_col[i] = NULL;
- }
- vpx_free(pbi->mt_vleft_col);
- pbi->mt_vleft_col = NULL;
+ if (pbi->mt_vleft_col) {
+ for (i = 0; i < mb_rows; ++i) {
+ vpx_free(pbi->mt_vleft_col[i]);
+ pbi->mt_vleft_col[i] = NULL;
}
+ vpx_free(pbi->mt_vleft_col);
+ pbi->mt_vleft_col = NULL;
}
}
@@ -760,7 +758,6 @@
/* shutdown MB Decoding thread; */
if (pbi->b_multithreaded_rd) {
int i;
-
pbi->b_multithreaded_rd = 0;
/* allow all threads to exit */
@@ -786,6 +783,8 @@
vpx_free(pbi->de_thread_data);
pbi->de_thread_data = NULL;
+
+ vp8mt_de_alloc_temp_buffers(pbi, pbi->common.mb_rows);
}
}