summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp8/decoder/threading.c14
-rw-r--r--vp9/encoder/vp9_encoder.c6
-rw-r--r--vp9/encoder/vp9_firstpass.c5
-rw-r--r--vp9/encoder/vp9_rd.c45
-rw-r--r--vpx_scale/generic/yv12config.c8
5 files changed, 35 insertions, 43 deletions
diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c
index 90e0f4d86..561922de3 100644
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -15,8 +15,8 @@
#endif
#include "onyxd_int.h"
#include "vpx_mem/vpx_mem.h"
+#include "vp8/common/common.h"
#include "vp8/common/threading.h"
-
#include "vp8/common/loopfilter.h"
#include "vp8/common/extend.h"
#include "vpx_ports/vpx_timer.h"
@@ -761,22 +761,28 @@ void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows) {
/* Allocate memory for above_row buffers. */
CALLOC_ARRAY(pbi->mt_yabove_row, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; ++i)
+ for (i = 0; i < pc->mb_rows; ++i) {
CHECK_MEM_ERROR(pbi->mt_yabove_row[i],
vpx_memalign(16, sizeof(unsigned char) *
(width + (VP8BORDERINPIXELS << 1))));
+ vp8_zero_array(pbi->mt_yabove_row[i], width + (VP8BORDERINPIXELS << 1));
+ }
CALLOC_ARRAY(pbi->mt_uabove_row, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; ++i)
+ for (i = 0; i < pc->mb_rows; ++i) {
CHECK_MEM_ERROR(pbi->mt_uabove_row[i],
vpx_memalign(16, sizeof(unsigned char) *
(uv_width + VP8BORDERINPIXELS)));
+ vp8_zero_array(pbi->mt_uabove_row[i], uv_width + VP8BORDERINPIXELS);
+ }
CALLOC_ARRAY(pbi->mt_vabove_row, pc->mb_rows);
- for (i = 0; i < pc->mb_rows; ++i)
+ for (i = 0; i < pc->mb_rows; ++i) {
CHECK_MEM_ERROR(pbi->mt_vabove_row[i],
vpx_memalign(16, sizeof(unsigned char) *
(uv_width + VP8BORDERINPIXELS)));
+ vp8_zero_array(pbi->mt_vabove_row[i], uv_width + VP8BORDERINPIXELS);
+ }
/* Allocate memory for left_col buffers. */
CALLOC_ARRAY(pbi->mt_yleft_col, pc->mb_rows);
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index b0ad5e334..e269955c1 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4013,9 +4013,9 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size,
set_size_independent_vars(cpi);
- enable_acl = cpi->sf.allow_acl
- ? (cm->frame_type == KEY_FRAME) || (cm->show_frame == 0)
- : 0;
+ enable_acl = cpi->sf.allow_acl ? (cm->frame_type == KEY_FRAME) ||
+ (cpi->twopass.gf_group.index == 1)
+ : 0;
do {
vpx_clear_system_state();
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index a8b410f5e..8400b090d 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2301,8 +2301,9 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
for (idx = 2; idx < MAX_ARF_LAYERS; ++idx) {
if (arf_depth_boost[idx] == 0) break;
- arf_depth_bits[idx] = calculate_boost_bits(
- rc->baseline_gf_interval, arf_depth_boost[idx], total_group_bits);
+ arf_depth_bits[idx] =
+ calculate_boost_bits(rc->baseline_gf_interval - total_arfs,
+ arf_depth_boost[idx], total_group_bits);
total_group_bits -= arf_depth_bits[idx];
total_arfs += arf_depth_count[idx];
diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c
index e65cf42d8..dca12feba 100644
--- a/vp9/encoder/vp9_rd.c
+++ b/vp9/encoder/vp9_rd.c
@@ -188,8 +188,7 @@ int vp9_compute_rd_mult_based_on_qindex(const VP9_COMP *cpi, int qindex) {
return rdmult > 0 ? rdmult : 1;
}
-int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
- int64_t rdmult = vp9_compute_rd_mult_based_on_qindex(cpi, qindex);
+static int modulate_rdmult(const VP9_COMP *cpi, int64_t rdmult) {
if (cpi->oxcf.pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
@@ -204,39 +203,17 @@ int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
return (int)rdmult;
}
-int vp9_get_adaptive_rdmult(const VP9_COMP *cpi, double beta) {
- const VP9_COMMON *cm = &cpi->common;
- int64_t q = vp9_dc_quant(cm->base_qindex, 0, cpi->common.bit_depth);
-
-#if CONFIG_VP9_HIGHBITDEPTH
- int64_t rdmult = 0;
- switch (cpi->common.bit_depth) {
- case VPX_BITS_8: rdmult = (int)((88 * q * q / beta) / 24); break;
- case VPX_BITS_10:
- rdmult = ROUND_POWER_OF_TWO((int)((88 * q * q / beta) / 24), 4);
- break;
- default:
- assert(cpi->common.bit_depth == VPX_BITS_12);
- rdmult = ROUND_POWER_OF_TWO((int)((88 * q * q / beta) / 24), 8);
- break;
- }
-#else
- int64_t rdmult = (int)((88 * q * q / beta) / 24);
-#endif // CONFIG_VP9_HIGHBITDEPTH
-
- if (cpi->oxcf.pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
- const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
- const FRAME_UPDATE_TYPE frame_type = gf_group->update_type[gf_group->index];
- const int gfu_boost = cpi->multi_layer_arf
- ? gf_group->gfu_boost[gf_group->index]
- : cpi->rc.gfu_boost;
- const int boost_index = VPXMIN(15, (gfu_boost / 100));
+int vp9_compute_rd_mult(const VP9_COMP *cpi, int qindex) {
+ int64_t rdmult = vp9_compute_rd_mult_based_on_qindex(cpi, qindex);
+ return modulate_rdmult(cpi, rdmult);
+}
- rdmult = (rdmult * rd_frame_type_factor[frame_type]) >> 7;
- rdmult += ((rdmult * rd_boost_factor[boost_index]) >> 7);
- }
- if (rdmult < 1) rdmult = 1;
- return (int)rdmult;
+int vp9_get_adaptive_rdmult(const VP9_COMP *cpi, double beta) {
+ int64_t rdmult =
+ vp9_compute_rd_mult_based_on_qindex(cpi, cpi->common.base_qindex);
+ rdmult = (int64_t)((double)rdmult / beta);
+ rdmult = rdmult > 0 ? rdmult : 1;
+ return modulate_rdmult(cpi, rdmult);
}
static int compute_rd_thresh_factor(int qindex, vpx_bit_depth_t bit_depth) {
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
index db1db37ce..287a5a098 100644
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -61,6 +61,14 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
if (!ybf->buffer_alloc) {
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, frame_size);
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+ // This memset is needed for fixing the issue of using uninitialized
+ // value in msan test. It will cause a perf loss, so only do this for
+ // msan test.
+ memset(ybf->buffer_alloc, 0, frame_size);
+#endif
+#endif
ybf->buffer_alloc_sz = frame_size;
}