ref: 006dc3a224c8cad4be18d25ca1e282a8d6bb6bbd
parent: 9364fc04f1e4e46e3e4c51560b532aab6e1649bc
author: Jingning Han <jingning@google.com>
date: Tue Jul 10 10:25:03 EDT 2018
Properly set the is_valid flag in tpl_frame Use this flag to indicate the temporal dependency model for the given frame is properly set up. Use the pointer address to decide if the tpl_stats_ptr array needs to be released. Change-Id: I541fe098f51981010011ae0af2535d8a5762d254
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -3629,6 +3629,8 @@
int count = 0;
double r0, rk, beta;
+ if (tpl_frame->is_valid == 0) return orig_rdmult;
+
r0 = cpi->rd.r0;
for (row = mi_row; row < mi_row + mi_high; ++row) {
@@ -5455,7 +5457,9 @@
}
}
- cpi->rd.r0 = (double)intra_cost_base / (intra_cost_base + mc_dep_cost_base);
+ if (tpl_frame->is_valid)
+ cpi->rd.r0 =
+ (double)intra_cost_base / (intra_cost_base + mc_dep_cost_base);
}
{
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2350,7 +2350,7 @@
CHECK_MEM_ERROR(cm, cpi->tpl_stats[frame].tpl_stats_ptr,
vpx_calloc(mi_rows * mi_cols,
sizeof(*cpi->tpl_stats[frame].tpl_stats_ptr)));
- cpi->tpl_stats[frame].is_valid = 1;
+ cpi->tpl_stats[frame].is_valid = 0;
cpi->tpl_stats[frame].width = mi_cols;
cpi->tpl_stats[frame].height = mi_rows;
cpi->tpl_stats[frame].stride = mi_cols;
@@ -2543,8 +2543,7 @@
#endif
for (frame = 0; frame < MAX_LAG_BUFFERS; ++frame) {
- if (cpi->tpl_stats[frame].is_valid)
- vpx_free(cpi->tpl_stats[frame].tpl_stats_ptr);
+ vpx_free(cpi->tpl_stats[frame].tpl_stats_ptr);
cpi->tpl_stats[frame].is_valid = 0;
}
@@ -5567,6 +5566,7 @@
memset(tpl_frame->tpl_stats_ptr, 0,
tpl_frame->height * tpl_frame->width *
sizeof(*tpl_frame->tpl_stats_ptr));
+ tpl_frame->is_valid = 0;
}
}