Skip to content

Commit 3ae164f

Browse files
Brian Zhukongsuozt
authored andcommitted
vpp: including crop info when AFBC switch to normal frame [1/1]
PD#SWPL-6347 Problem: When AFBC switch to normal frame, excluding the crop information, the pps parameters are calculated with wrong input size. Solution: 1.Add the crop information, when afbc swicth to normal frame. 2.check ratio of compress_width/width, sync to crop value Verify: verified on x301 Change-Id: Ib943f8a11263ce577952e589bc172d8b7bafd954 Signed-off-by: Brian Zhu <[email protected]>
1 parent a7b67ba commit 3ae164f

File tree

1 file changed

+56
-38
lines changed
  • drivers/amlogic/media/video_sink

1 file changed

+56
-38
lines changed

drivers/amlogic/media/video_sink/vpp.c

Lines changed: 56 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,8 @@ static int vpp_set_filters_internal(
884884
u32 vert_chroma_filter;
885885
struct filter_info_s *cur_filter;
886886
s32 vpp_zoom_center_x, vpp_zoom_center_y;
887+
u32 crop_ratio = 1;
888+
u32 crop_left, crop_right, crop_top, crop_bottom;
887889

888890
if (!input)
889891
return VppFilter_Fail;
@@ -919,20 +921,6 @@ static int vpp_set_filters_internal(
919921
video_source_crop_bottom = input->crop_bottom;
920922
}
921923

922-
if (likely(w_in >
923-
(video_source_crop_left + video_source_crop_right))) {
924-
w_in -= video_source_crop_left;
925-
w_in -= video_source_crop_right;
926-
h_crop_enable = true;
927-
}
928-
929-
if (likely(h_in >
930-
(video_source_crop_top + video_source_crop_bottom))) {
931-
h_in -= video_source_crop_top;
932-
h_in -= video_source_crop_bottom;
933-
v_crop_enable = true;
934-
}
935-
936924
#ifndef TV_3D_FUNCTION_OPEN
937925
next_frame_par->vscale_skip_count = 0;
938926
next_frame_par->hscale_skip_count = 0;
@@ -954,6 +942,26 @@ static int vpp_set_filters_internal(
954942
else
955943
vskip_step = 1;
956944

945+
RESTART_ALL:
946+
crop_left = video_source_crop_left / crop_ratio;
947+
crop_right = video_source_crop_right / crop_ratio;
948+
crop_top = video_source_crop_top / crop_ratio;
949+
crop_bottom = video_source_crop_bottom / crop_ratio;
950+
951+
if (likely(w_in >
952+
(crop_left + crop_right))) {
953+
w_in -= crop_left;
954+
w_in -= crop_right;
955+
h_crop_enable = true;
956+
}
957+
958+
if (likely(h_in >
959+
(crop_top + crop_bottom))) {
960+
h_in -= crop_top;
961+
h_in -= crop_bottom;
962+
v_crop_enable = true;
963+
}
964+
957965
RESTART:
958966
aspect_factor = (vpp_flags & VPP_FLAG_AR_MASK) >> VPP_FLAG_AR_BITS;
959967
/* don't use input->wide_mode */
@@ -1215,8 +1223,8 @@ static int vpp_set_filters_internal(
12151223
}
12161224

12171225
if (v_crop_enable) {
1218-
next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
1219-
next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
1226+
next_frame_par->VPP_vd_start_lines_ += crop_top;
1227+
next_frame_par->VPP_vd_end_lines_ += crop_top;
12201228
}
12211229

12221230
if (vpp_flags & VPP_FLAG_INTERLACE_IN)
@@ -1333,8 +1341,8 @@ static int vpp_set_filters_internal(
13331341
}
13341342

13351343
if (h_crop_enable) {
1336-
next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
1337-
next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
1344+
next_frame_par->VPP_hd_start_lines_ += crop_left;
1345+
next_frame_par->VPP_hd_end_lines_ += crop_left;
13381346
}
13391347

13401348
next_frame_par->VPP_line_in_length_ =
@@ -1430,7 +1438,8 @@ static int vpp_set_filters_internal(
14301438
h_in = height_in = vf->height;
14311439
next_frame_par->hscale_skip_count = 0;
14321440
next_frame_par->vscale_skip_count = 0;
1433-
goto RESTART;
1441+
crop_ratio = vf->compWidth / vf->width;
1442+
goto RESTART_ALL;
14341443
}
14351444

14361445
if ((skip_policy & 0xf0) && (skip_policy_check == true)) {
@@ -2482,6 +2491,8 @@ static int vpp_set_filters_no_scaler_internal(
24822491
bool reverse = false;
24832492
#endif
24842493
int ret = VppFilter_Success;
2494+
u32 crop_ratio = 1;
2495+
u32 crop_left, crop_right, crop_top, crop_bottom;
24852496

24862497
if (!input)
24872498
return VppFilter_Fail;
@@ -2509,20 +2520,6 @@ static int vpp_set_filters_no_scaler_internal(
25092520
video_source_crop_bottom = input->crop_bottom;
25102521
}
25112522

2512-
if (likely(w_in >
2513-
(video_source_crop_left + video_source_crop_right))) {
2514-
w_in -= video_source_crop_left;
2515-
w_in -= video_source_crop_right;
2516-
h_crop_enable = true;
2517-
}
2518-
2519-
if (likely(h_in >
2520-
(video_source_crop_top + video_source_crop_bottom))) {
2521-
h_in -= video_source_crop_top;
2522-
h_in -= video_source_crop_bottom;
2523-
v_crop_enable = true;
2524-
}
2525-
25262523
next_frame_par->vscale_skip_count = 0;
25272524
next_frame_par->hscale_skip_count = 0;
25282525
next_frame_par->nocomp = false;
@@ -2536,6 +2533,26 @@ static int vpp_set_filters_no_scaler_internal(
25362533
else
25372534
vskip_step = 1;
25382535

2536+
RESTART_ALL:
2537+
crop_left = video_source_crop_left / crop_ratio;
2538+
crop_right = video_source_crop_right / crop_ratio;
2539+
crop_top = video_source_crop_top / crop_ratio;
2540+
crop_bottom = video_source_crop_bottom / crop_ratio;
2541+
2542+
if (likely(w_in >
2543+
(crop_left + crop_right))) {
2544+
w_in -= crop_left;
2545+
w_in -= crop_right;
2546+
h_crop_enable = true;
2547+
}
2548+
2549+
if (likely(h_in >
2550+
(crop_top + crop_bottom))) {
2551+
h_in -= crop_top;
2552+
h_in -= crop_bottom;
2553+
v_crop_enable = true;
2554+
}
2555+
25392556
RESTART:
25402557
/* don't use input->wide_mode */
25412558
wide_mode = vpp_flags & VPP_FLAG_WIDEMODE_MASK;
@@ -2622,8 +2639,8 @@ static int vpp_set_filters_no_scaler_internal(
26222639
}
26232640

26242641
if (v_crop_enable) {
2625-
next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
2626-
next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
2642+
next_frame_par->VPP_vd_start_lines_ += crop_top;
2643+
next_frame_par->VPP_vd_end_lines_ += crop_top;
26272644
}
26282645

26292646
if (vpp_flags & VPP_FLAG_INTERLACE_IN)
@@ -2735,8 +2752,8 @@ static int vpp_set_filters_no_scaler_internal(
27352752
}
27362753

27372754
if (h_crop_enable) {
2738-
next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
2739-
next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
2755+
next_frame_par->VPP_hd_start_lines_ += crop_left;
2756+
next_frame_par->VPP_hd_end_lines_ += crop_left;
27402757
}
27412758

27422759
next_frame_par->VPP_line_in_length_ =
@@ -2806,7 +2823,8 @@ static int vpp_set_filters_no_scaler_internal(
28062823
h_in = height_in = vf->height;
28072824
next_frame_par->hscale_skip_count = 0;
28082825
next_frame_par->vscale_skip_count = 0;
2809-
goto RESTART;
2826+
crop_ratio = vf->compWidth / vf->width;
2827+
goto RESTART_ALL;
28102828
}
28112829

28122830
if ((skip_policy & 0xf0) && (skip_policy_check == true)) {

0 commit comments

Comments
 (0)