Reduce memory footprint of Q Mode MotionVector
Remove subpel_bits, which is no longer used, and use 16 bits for row and col.
Bug: b/241589513
Change-Id: I1cc5ec8aee2b01017606e61088e75e6253186585
diff --git a/av1/qmode_rc/ducky_encode.cc b/av1/qmode_rc/ducky_encode.cc
index a48d9dd..7161a8d 100644
--- a/av1/qmode_rc/ducky_encode.cc
+++ b/av1/qmode_rc/ducky_encode.cc
@@ -530,8 +530,8 @@
ref_frame_index_mapping[tpl_stats_ptr->ref_frame_index[i] + 1];
const auto &mv =
tpl_stats_ptr->mv[tpl_stats_ptr->ref_frame_index[i]].as_mv;
- block_stats.mv[i] = { GET_MV_RAWPEL(mv.row), GET_MV_RAWPEL(mv.col),
- 0 };
+ block_stats.mv[i] = { static_cast<int16_t>(GET_MV_RAWPEL(mv.row)),
+ static_cast<int16_t>(GET_MV_RAWPEL(mv.col)) };
}
}
tpl_frame_stats.block_stats_list.push_back(block_stats);
diff --git a/av1/qmode_rc/ratectrl_qmode_interface.h b/av1/qmode_rc/ratectrl_qmode_interface.h
index 18beec1..dfb6d89 100644
--- a/av1/qmode_rc/ratectrl_qmode_interface.h
+++ b/av1/qmode_rc/ratectrl_qmode_interface.h
@@ -24,11 +24,8 @@
constexpr int kBlockRefCount = 2;
struct MotionVector {
- int row; // subpel row
- int col; // subpel col
- // TODO(b/241589513): Move this to TplFrameStats; it's wasteful to code it
- // separately for each block.
- int subpel_bits; // number of fractional bits used by row/col
+ int16_t row; // row offset in pixels
+ int16_t col; // column offset in pixels
};
enum class TplPassCount {
diff --git a/test/ratectrl_qmode_test.cc b/test/ratectrl_qmode_test.cc
index 39ce2be..f1fa5d8 100644
--- a/test/ratectrl_qmode_test.cc
+++ b/test/ratectrl_qmode_test.cc
@@ -370,8 +370,8 @@
return ref_frame_table;
}
-static MotionVector CreateFullpelMv(int row, int col) {
- return { row, col, 0 };
+static MotionVector CreateFullpelMv(int16_t row, int16_t col) {
+ return { row, col };
}
double TplFrameStatsAccumulateIntraCost(const TplFrameStats &frame_stats) {
@@ -546,13 +546,13 @@
TEST_F(RateControlQModeTest, TplFrameDepStatsPropagateSingleWithMotion) {
// cur frame with coding_idx 1 use ref frame with coding_idx 0
const std::array<int, kBlockRefCount> ref_frame_index = { 0, -1 };
- const int min_block_size = 8;
+ const int16_t min_block_size = 8;
TplFrameStats frame_stats =
CreateToyTplFrameStatsWithDiffSizes(min_block_size, min_block_size * 2);
AugmentTplFrameStatsWithRefFrames(&frame_stats, ref_frame_index);
- const int mv_row = min_block_size / 2;
- const int mv_col = min_block_size / 4;
+ const int16_t mv_row = min_block_size / 2;
+ const int16_t mv_col = min_block_size / 4;
const double r_ratio = 1.0 / 2;
const double c_ratio = 1.0 / 4;
std::array<MotionVector, kBlockRefCount> mv;