vpp: add threshold to omit irregular screen AR [1/1]

PD#TV-3602

Problem:
The irregular aspect ratio of screen will cause that video
position dose not match the axis even if the source aspect
ration matches the display windows's aspect ratio.

Solution:
Add threshold to omit the irregular screen aspect ratio.

Verify:
Verified on X301

Change-Id: Ie375de69e42fc168fb3b5a51d9ab2662789dc807
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
This commit is contained in:
Brian Zhu
2019-06-20 03:36:59 +08:00
committed by Jianxin Pan
parent 4c51828741
commit 15df568a37

View File

@@ -605,6 +605,8 @@ static unsigned int force_no_compress;
MODULE_PARM_DESC(force_no_compress, "force_no_compress");
module_param(force_no_compress, uint, 0664);
static unsigned int screen_ar_threshold = 3;
/*
*test on txlx:
*Time_out = (V_out/V_screen_total)/FPS_out;
@@ -897,9 +899,24 @@ static int vpp_set_filters_internal(
u32 sar_width = 0, sar_height = 0;
bool ext_sar = false;
bool no_compress = false;
u32 min_aspect_ratio_out, max_aspect_ratio_out;
if (!input)
return VppFilter_Fail;
/* min = 0.95 x 1024 * height / width */
min_aspect_ratio_out =
((100 - screen_ar_threshold) << 10) / 100;
min_aspect_ratio_out =
(vinfo->height * min_aspect_ratio_out) / vinfo->width;
/* max = 1.05 x 1024 * height / width */
max_aspect_ratio_out =
((100 + screen_ar_threshold) << 10) / 100;
max_aspect_ratio_out =
(vinfo->height * max_aspect_ratio_out) / vinfo->width;
if ((aspect_ratio_out <= max_aspect_ratio_out)
&& (aspect_ratio_out >= min_aspect_ratio_out))
aspect_ratio_out = (vinfo->height << 10) / vinfo->width;
cur_filter = &gfilter[input->layer_id];
cur_custom_ar = input->custom_ar;