Commit 00d5868d authored by Jingning Han's avatar Jingning Han
Browse files

Use integer multiplier to replace division in mfmv

Use integer multipliciation to replace the division operation in
the linear projection in mfmv. The coding performance change is
around 0.01% level.

Change-Id: I901fd3a2b349f1babccb88dbf74f84091079b8d3
parent 3bbcedec
......@@ -1322,9 +1322,21 @@ void av1_setup_frame_buf_refs(AV1_COMMON *cm) {
#endif
}
// Although we assign 32 bit integers, all the values are strictly under 14
// bits.
static int div_mult[32] = {
0, 16384, 8192, 5461, 4096, 3276, 2730, 2340, 2048, 1820, 1638,
1489, 1365, 1260, 1170, 1092, 1024, 963, 910, 862, 819, 780,
744, 712, 682, 655, 630, 606, 585, 564, 546, 528,
};
// TODO(jingning): Consider the use of lookup table for (num / den)
// altogether.
static void get_mv_projection(MV *output, MV ref, int num, int den) {
output->row = (int16_t)(ref.row * (double)num / den);
output->col = (int16_t)(ref.col * (double)num / den);
output->row =
(int16_t)(ROUND_POWER_OF_TWO(ref.row * num * div_mult[den], 14));
output->col =
(int16_t)(ROUND_POWER_OF_TWO(ref.col * num * div_mult[den], 14));
}
#define MAX_OFFSET_WIDTH 64
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment