From bb0e75463cf7ac1fd58711f0c54724261011f9aa Mon Sep 17 00:00:00 2001 From: Angie Chiang Date: Wed, 19 Sep 2018 15:37:49 -0700 Subject: [PATCH] Correct mv rows/cols bug in read_frame_dpl_stats When the frame size is not multiples of mv search bsize, the fractional part will increment the mv rows/cols by 1 Change-Id: I4333a207406610c540059a9356a82084832ca85b --- tools/non_greedy_mv/non_greedy_mv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/non_greedy_mv/non_greedy_mv.py b/tools/non_greedy_mv/non_greedy_mv.py index cd99027e3..87b46e065 100644 --- a/tools/non_greedy_mv/non_greedy_mv.py +++ b/tools/non_greedy_mv/non_greedy_mv.py @@ -3,6 +3,7 @@ import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from matplotlib import colors as mcolors import numpy as np +import math def draw_mv_ls(axis, mv_ls, mode=0): @@ -92,7 +93,9 @@ def read_frame_dpl_stats(fp): bs = int(word_ls[7]) mi_size = bs / 8 mv_ls = [] - for i in range((mi_rows / mi_size) * (mi_cols / mi_size)): + mv_rows = int((math.ceil(mi_rows * 1. / mi_size))) + mv_cols = int((math.ceil(mi_cols * 1. / mi_size))) + for i in range(mv_rows * mv_cols): line = fp.readline() word_ls = line.split() row = int(word_ls[0]) * 8. -- 2.40.0