Reset dst_buf in av1_choose_var_based_partitioning() for kf
Avoided populating dst_buf for key frame since it is
not required. The function av1_var_offs() is made static.
Change-Id: If3e34e1da5b560aa3e6610119adca9233e8228e9
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 588d058..ae9dbaa 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -149,7 +149,10 @@
#endif // CONFIG_AV1_HIGHBITDEPTH
/*!\endcond */
-const uint8_t *av1_var_offs(int use_hbd, int bd) {
+// For the given bit depth, returns a constant array used to assist the
+// calculation of source block variance, which will then be used to decide
+// adaptive quantizers.
+static const uint8_t *get_var_offs(int use_hbd, int bd) {
#if CONFIG_AV1_HIGHBITDEPTH
if (use_hbd) {
assert(bd == 8 || bd == 10 || bd == 12);
@@ -190,7 +193,7 @@
get_plane_block_size(bsize, subsampling_x, subsampling_y);
unsigned int sse;
const unsigned int var = cpi->ppi->fn_ptr[plane_bsize].vf(
- ref->buf, ref->stride, av1_var_offs(use_hbd, xd->bd), 0, &sse);
+ ref->buf, ref->stride, get_var_offs(use_hbd, xd->bd), 0, &sse);
return ROUND_POWER_OF_TWO(var, num_pels_log2_lookup[plane_bsize]);
}
diff --git a/av1/encoder/encodeframe.h b/av1/encoder/encodeframe.h
index 0f3511d..ce32fb4 100644
--- a/av1/encoder/encodeframe.h
+++ b/av1/encoder/encodeframe.h
@@ -31,11 +31,6 @@
struct AV1_COMP;
struct ThreadData;
-// For the given bit depth, returns a constant array used to assist the
-// calculation of source block variance, which will then be used to decide
-// adaptive quantizers.
-const uint8_t *av1_var_offs(int use_hbd, int bd);
-
void av1_init_rtc_counters(struct macroblock *const x);
void av1_accumulate_rtc_counters(struct AV1_COMP *cpi,
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index 4a1186f..05e0383 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -1113,6 +1113,8 @@
int pixels_wide = 128, pixels_high = 128;
int border_offset_4x4 = 0;
int temporal_denoising = cpi->sf.rt_sf.use_rtc_tf;
+ // dst_buf pointer is not used for is_key_frame, so it should be NULL.
+ assert(IMPLIES(is_key_frame, dst_buf == NULL));
if (is_small_sb) {
pixels_wide = 64;
pixels_high = 64;
@@ -1646,7 +1648,7 @@
dst_stride = xd->plane[AOM_PLANE_Y].pre[0].stride;
}
} else {
- dst_buf = av1_var_offs(is_cur_buf_hbd(xd), xd->bd);
+ dst_buf = NULL;
dst_stride = 0;
}