vpp: set default aspect when the ratecontrol is zero [1/1]
authorBrian Zhu <brian.zhu@amlogic.com>
Wed, 22 May 2019 14:03:43 +0000 (22:03 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 23 May 2019 05:49:42 +0000 (22:49 -0700)
PD#TV-5266

Problem:
Vpp used the wrong aspect ratio in 3D, screen mode = normal
and aspect ratio is 0 in ratecontrol variable.

Solution:
When the aspect ratio is 0, set the default value as
(height << 8) / width

Verify:
Verified by x301

Change-Id: I34f7cd3ce5ed1818d3090ebb4be934225038625e
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
drivers/amlogic/media/video_sink/vpp.c

index be2e0e8..63ef98a 100644 (file)
@@ -3068,6 +3068,18 @@ int vpp_set_filters(
        aspect_ratio = (vf->ratio_control & DISP_RATIO_ASPECT_RATIO_MASK)
                                   >> DISP_RATIO_ASPECT_RATIO_BIT;
 
+       if (!aspect_ratio) {
+               u32 sar_width, sar_height;
+
+               if (vf->type & VIDTYPE_COMPRESS) {
+                       sar_width = vf->compWidth;
+                       sar_height = vf->compHeight;
+               } else {
+                       sar_width = vf->width;
+                       sar_height = vf->height;
+               }
+               aspect_ratio = (sar_height << 8) / sar_width;
+       }
        /* the height from vdin afbc will be half */
        /* so need no interlace in */
        if ((vf->type & VIDTYPE_INTERLACE)