summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encoder.c
diff options
context:
space:
mode:
authorRanjit Kumar Tulabandu <ranjit.tulabandu@ittiam.com>2016-12-27 18:45:43 +0530
committerYunqing Wang <yunqingwang@google.com>2017-01-24 15:48:02 -0800
commit8b0c11c3588963fa02be0cad36a6a23cdb748cf9 (patch)
treea9dbfb4cc4adbfaea38f73ec4e73099642e58c25 /vp9/encoder/vp9_encoder.c
parent91aa1fae2a88e0a125161dc1ec3f8f73c3508707 (diff)
downloadlibvpx-8b0c11c3588963fa02be0cad36a6a23cdb748cf9.tar
libvpx-8b0c11c3588963fa02be0cad36a6a23cdb748cf9.tar.gz
libvpx-8b0c11c3588963fa02be0cad36a6a23cdb748cf9.tar.bz2
libvpx-8b0c11c3588963fa02be0cad36a6a23cdb748cf9.zip
Multi-threading of first pass stats collection
(yunqingwang) 1. Rebased the patch. Incorporated recent first pass changes. 2. Turned on the first pass unit test. Change-Id: Ia2f7ba8152d0b6dd6bf8efb9dfaf505ba7d8edee
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r--vp9/encoder/vp9_encoder.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 26326fcf0..5dbe62db5 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -50,6 +50,7 @@
#include "vp9/encoder/vp9_ethread.h"
#include "vp9/encoder/vp9_firstpass.h"
#include "vp9/encoder/vp9_mbgraph.h"
+#include "vp9/encoder/vp9_multi_thread.h"
#include "vp9/encoder/vp9_noise_estimate.h"
#include "vp9/encoder/vp9_picklpf.h"
#include "vp9/encoder/vp9_ratectrl.h"
@@ -1563,6 +1564,13 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
#if CONFIG_VP9_HIGHBITDEPTH
highbd_set_var_fns(cpi);
#endif
+
+ // Enable multi-threading for first pass.
+ cpi->new_mt = 0;
+ if (((cpi->oxcf.mode == GOOD || cpi->oxcf.mode == BEST) &&
+ cpi->oxcf.speed < 5 && cpi->oxcf.pass == 1) &&
+ cpi->oxcf.new_mt)
+ cpi->new_mt = 1;
}
#ifndef M_LOG2_E
@@ -1719,6 +1727,12 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf,
}
#endif
+#if ENABLE_MT_BIT_MATCH
+ CHECK_MEM_ERROR(
+ cm, cpi->twopass.fp_mb_float_stats,
+ vpx_calloc(cm->MBs * sizeof(*cpi->twopass.fp_mb_float_stats), 1));
+#endif
+
cpi->refresh_alt_ref_frame = 0;
cpi->multi_arf_last_grp_enabled = 0;
@@ -2076,6 +2090,7 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
}
vpx_free(cpi->tile_thr_data);
vpx_free(cpi->workers);
+ vp9_row_mt_mem_dealloc(cpi);
if (cpi->num_workers > 1) {
vp9_loop_filter_dealloc(&cpi->lf_row_sync);
@@ -2098,6 +2113,11 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
}
#endif
+#if ENABLE_MT_BIT_MATCH
+ vpx_free(cpi->twopass.fp_mb_float_stats);
+ cpi->twopass.fp_mb_float_stats = NULL;
+#endif
+
vp9_remove_common(cm);
vp9_free_ref_frame_buffers(cm->buffer_pool);
#if CONFIG_VP9_POSTPROC
@@ -4802,6 +4822,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
for (i = 0; i < MAX_REF_FRAMES; ++i) cpi->scaled_ref_idx[i] = INVALID_IDX;
}
+ cpi->td.mb.fp_src_pred = 0;
if (oxcf->pass == 1 && (!cpi->use_svc || is_two_pass_svc(cpi))) {
const int lossless = is_lossless_requested(oxcf);
#if CONFIG_VP9_HIGHBITDEPTH