summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_encodeframe.c4
-rw-r--r--vp9/encoder/vp9_multi_thread.c27
-rw-r--r--vp9/encoder/vp9_multi_thread.h3
3 files changed, 26 insertions, 8 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index a450ae752..674fce9cc 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -42,6 +42,7 @@
#include "vp9/encoder/vp9_encodemv.h"
#include "vp9/encoder/vp9_ethread.h"
#include "vp9/encoder/vp9_extend.h"
+#include "vp9/encoder/vp9_multi_thread.h"
#include "vp9/encoder/vp9_pickmode.h"
#include "vp9/encoder/vp9_rd.h"
#include "vp9/encoder/vp9_rdopt.h"
@@ -5362,6 +5363,9 @@ void vp9_init_tile_data(VP9_COMP *cpi) {
for (tile_col = 0; tile_col < tile_cols; ++tile_col) {
TileDataEnc *this_tile = &cpi->tile_data[tile_row * tile_cols + tile_col];
TileInfo *tile_info = &this_tile->tile_info;
+ if (cpi->sf.adaptive_rd_thresh_row_mt &&
+ this_tile->row_base_thresh_freq_fact == NULL)
+ vp9_row_mt_alloc_rd_thresh(cpi, this_tile);
vp9_tile_init(tile_info, cm, tile_row, tile_col);
cpi->tile_tok[tile_row][tile_col] = pre_tok + tile_tok;
diff --git a/vp9/encoder/vp9_multi_thread.c b/vp9/encoder/vp9_multi_thread.c
index 381edca99..c8a80563a 100644
--- a/vp9/encoder/vp9_multi_thread.c
+++ b/vp9/encoder/vp9_multi_thread.c
@@ -50,6 +50,20 @@ void *vp9_enc_grp_get_next_job(MultiThreadHandle *multi_thread_ctxt,
return job_info;
}
+void vp9_row_mt_alloc_rd_thresh(VP9_COMP *const cpi,
+ TileDataEnc *const this_tile) {
+ VP9_COMMON *const cm = &cpi->common;
+ const int sb_rows =
+ (mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2) + 1;
+ int i;
+
+ this_tile->row_base_thresh_freq_fact =
+ (int *)vpx_calloc(sb_rows * BLOCK_SIZES * MAX_MODES,
+ sizeof(*(this_tile->row_base_thresh_freq_fact)));
+ for (i = 0; i < sb_rows * BLOCK_SIZES * MAX_MODES; i++)
+ this_tile->row_base_thresh_freq_fact[i] = RD_THRESH_INIT_FACT;
+}
+
void vp9_row_mt_mem_alloc(VP9_COMP *cpi) {
struct VP9Common *cm = &cpi->common;
MultiThreadHandle *multi_thread_ctxt = &cpi->multi_thread_ctxt;
@@ -83,14 +97,11 @@ void vp9_row_mt_mem_alloc(VP9_COMP *cpi) {
TileDataEnc *this_tile = &cpi->tile_data[tile_col];
vp9_row_mt_sync_mem_alloc(&this_tile->row_mt_sync, cm, jobs_per_tile_col);
if (cpi->sf.adaptive_rd_thresh_row_mt) {
- const int sb_rows =
- (mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2) + 1;
- int i;
- this_tile->row_base_thresh_freq_fact =
- (int *)vpx_calloc(sb_rows * BLOCK_SIZES * MAX_MODES,
- sizeof(*(this_tile->row_base_thresh_freq_fact)));
- for (i = 0; i < sb_rows * BLOCK_SIZES * MAX_MODES; i++)
- this_tile->row_base_thresh_freq_fact[i] = RD_THRESH_INIT_FACT;
+ if (this_tile->row_base_thresh_freq_fact != NULL) {
+ vpx_free(this_tile->row_base_thresh_freq_fact);
+ this_tile->row_base_thresh_freq_fact = NULL;
+ }
+ vp9_row_mt_alloc_rd_thresh(cpi, this_tile);
}
}
diff --git a/vp9/encoder/vp9_multi_thread.h b/vp9/encoder/vp9_multi_thread.h
index bfc0c0ae4..f59ad1833 100644
--- a/vp9/encoder/vp9_multi_thread.h
+++ b/vp9/encoder/vp9_multi_thread.h
@@ -29,6 +29,9 @@ void vp9_multi_thread_tile_init(VP9_COMP *cpi);
void vp9_row_mt_mem_alloc(VP9_COMP *cpi);
+void vp9_row_mt_alloc_rd_thresh(VP9_COMP *const cpi,
+ TileDataEnc *const this_tile);
+
void vp9_row_mt_mem_dealloc(VP9_COMP *cpi);
int vp9_get_tiles_proc_status(MultiThreadHandle *multi_thread_ctxt,