From d4bcab228e644b4fcf56ffab268171c503d590b9 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Mon, 27 May 2019 22:00:15 +0800 Subject: [PATCH] vpp: fix out of one pixel between video and the red frame [1/1] PD#TV-5764 Problem: Goto the wrong case when using ext_sar Solution: Using the correct case when using ext_sar Verify: verified on r311 Change-Id: I181b9e8d21917840729f2e487b3dae3f41cd2c5a Signed-off-by: Peng Yixin --- drivers/amlogic/media/video_sink/vpp.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/amlogic/media/video_sink/vpp.c b/drivers/amlogic/media/video_sink/vpp.c index c1c4ef2..f5c3f3d 100644 --- a/drivers/amlogic/media/video_sink/vpp.c +++ b/drivers/amlogic/media/video_sink/vpp.c @@ -1004,6 +1004,11 @@ RESTART: ext_sar = false; } + /* speical mode did not use ext sar mode */ + if ((wide_mode == VIDEO_WIDEOPTION_NONLINEAR) || + (wide_mode == VIDEO_WIDEOPTION_NORMAL_NOSCALEUP)) + ext_sar = false; + /* keep 8 bits resolution for aspect conversion */ if (wide_mode == VIDEO_WIDEOPTION_4_3) { if (vpp_flags & VPP_FLAG_PORTRAIT_MODE) @@ -1056,8 +1061,6 @@ RESTART: width_out, h_in, aspect_ratio_out >> 2); if ((aspect_factor == 0) - || (aspect_factor == - (VPP_FLAG_AR_MASK >> VPP_FLAG_AR_BITS)) || (wide_mode == VIDEO_WIDEOPTION_FULL_STRETCH) || (wide_mode == VIDEO_WIDEOPTION_NONLINEAR)) { aspect_factor = 0x100; @@ -1074,8 +1077,13 @@ RESTART: (u64)sar_height * (u64)height_in, (u32)tmp); - height_after_ratio /= sar_height; + height_after_ratio /= sar_width; aspect_factor = (height_after_ratio << 8) / h_in; + if (super_debug) + pr_info("ext_sar: aspect_factor=%d, %d,%d,%d,%d,%d\n", + aspect_factor, w_in, h_in, + height_after_ratio, + sar_width, sar_height); } else { /* avoid the bit length overflow */ u64 tmp = (u64)((u64)(width_out * h_in) * aspect_ratio_out); @@ -1192,7 +1200,10 @@ RESTART: if (wide_mode == VIDEO_WIDEOPTION_NORMAL) { ratio_x = ratio_y = max(ratio_x, ratio_y); - ratio_y = (ratio_y << 8) / aspect_factor; + if (ext_sar) + ratio_y = (ratio_y * h_in) / height_after_ratio; + else + ratio_y = (ratio_y << 8) / aspect_factor; } else if (wide_mode == VIDEO_WIDEOPTION_NORMAL_NOSCALEUP) { u32 r1, r2; -- 2.7.4