提交 dc0cf4cf 编写于 作者: P Prashant Laddha 提交者: Mauro Carvalho Chehab

[media] v4l2-dv-timing: avoid rounding twice in gtf hblank calc

Currently, in gtf hblank calculations, the rounding is used twice,
one at intermediate division and one at final state where hblank
is rounded to nearest multiple of twice cell granularity. This
error got introduced in 'commit d7ed5a3d ("[media]
v4l2-dv-timings: fix rounding in hblank and hsync calculation"),
where it missed combining the rounding step. Correcting the same
in this patch.
Signed-off-by: NPrashant Laddha <prladdha@cisco.com>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
上级 7a5d99e7
......@@ -561,20 +561,22 @@ bool v4l2_detect_gtf(unsigned frame_height,
num = ((image_width * GTF_D_C_PRIME * (u64)hfreq) -
((u64)image_width * GTF_D_M_PRIME * 1000));
den = hfreq * (100 - GTF_D_C_PRIME) + GTF_D_M_PRIME * 1000;
den = (hfreq * (100 - GTF_D_C_PRIME) + GTF_D_M_PRIME * 1000) *
(2 * GTF_CELL_GRAN);
h_blank = div_u64((num + (den >> 1)), den);
h_blank *= (2 * GTF_CELL_GRAN);
} else {
u64 num;
u32 den;
num = ((image_width * GTF_S_C_PRIME * (u64)hfreq) -
((u64)image_width * GTF_S_M_PRIME * 1000));
den = hfreq * (100 - GTF_S_C_PRIME) + GTF_S_M_PRIME * 1000;
den = (hfreq * (100 - GTF_S_C_PRIME) + GTF_S_M_PRIME * 1000) *
(2 * GTF_CELL_GRAN);
h_blank = div_u64((num + (den >> 1)), den);
h_blank *= (2 * GTF_CELL_GRAN);
}
h_blank = ((h_blank + GTF_CELL_GRAN) / (2 * GTF_CELL_GRAN)) *
(2 * GTF_CELL_GRAN);
frame_width = image_width + h_blank;
pix_clk = (image_width + h_blank) * hfreq;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册