Skip to content

Commit

Permalink
vpp: including crop info when AFBC switch to normal frame [1/1]
Browse files Browse the repository at this point in the history
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 <brian.zhu@amlogic.com>
  • Loading branch information
Brian Zhu authored and kongsuozt committed Mar 27, 2019
1 parent a7b67ba commit 3ae164f
Showing 1 changed file with 56 additions and 38 deletions.
94 changes: 56 additions & 38 deletions drivers/amlogic/media/video_sink/vpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ static int vpp_set_filters_internal(
u32 vert_chroma_filter;
struct filter_info_s *cur_filter;
s32 vpp_zoom_center_x, vpp_zoom_center_y;
u32 crop_ratio = 1;
u32 crop_left, crop_right, crop_top, crop_bottom;

if (!input)
return VppFilter_Fail;
Expand Down Expand Up @@ -919,20 +921,6 @@ static int vpp_set_filters_internal(
video_source_crop_bottom = input->crop_bottom;
}

if (likely(w_in >
(video_source_crop_left + video_source_crop_right))) {
w_in -= video_source_crop_left;
w_in -= video_source_crop_right;
h_crop_enable = true;
}

if (likely(h_in >
(video_source_crop_top + video_source_crop_bottom))) {
h_in -= video_source_crop_top;
h_in -= video_source_crop_bottom;
v_crop_enable = true;
}

#ifndef TV_3D_FUNCTION_OPEN
next_frame_par->vscale_skip_count = 0;
next_frame_par->hscale_skip_count = 0;
Expand All @@ -954,6 +942,26 @@ static int vpp_set_filters_internal(
else
vskip_step = 1;

RESTART_ALL:
crop_left = video_source_crop_left / crop_ratio;
crop_right = video_source_crop_right / crop_ratio;
crop_top = video_source_crop_top / crop_ratio;
crop_bottom = video_source_crop_bottom / crop_ratio;

if (likely(w_in >
(crop_left + crop_right))) {
w_in -= crop_left;
w_in -= crop_right;
h_crop_enable = true;
}

if (likely(h_in >
(crop_top + crop_bottom))) {
h_in -= crop_top;
h_in -= crop_bottom;
v_crop_enable = true;
}

RESTART:
aspect_factor = (vpp_flags & VPP_FLAG_AR_MASK) >> VPP_FLAG_AR_BITS;
/* don't use input->wide_mode */
Expand Down Expand Up @@ -1215,8 +1223,8 @@ static int vpp_set_filters_internal(
}

if (v_crop_enable) {
next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_start_lines_ += crop_top;
next_frame_par->VPP_vd_end_lines_ += crop_top;
}

if (vpp_flags & VPP_FLAG_INTERLACE_IN)
Expand Down Expand Up @@ -1333,8 +1341,8 @@ static int vpp_set_filters_internal(
}

if (h_crop_enable) {
next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_start_lines_ += crop_left;
next_frame_par->VPP_hd_end_lines_ += crop_left;
}

next_frame_par->VPP_line_in_length_ =
Expand Down Expand Up @@ -1430,7 +1438,8 @@ static int vpp_set_filters_internal(
h_in = height_in = vf->height;
next_frame_par->hscale_skip_count = 0;
next_frame_par->vscale_skip_count = 0;
goto RESTART;
crop_ratio = vf->compWidth / vf->width;
goto RESTART_ALL;
}

if ((skip_policy & 0xf0) && (skip_policy_check == true)) {
Expand Down Expand Up @@ -2482,6 +2491,8 @@ static int vpp_set_filters_no_scaler_internal(
bool reverse = false;
#endif
int ret = VppFilter_Success;
u32 crop_ratio = 1;
u32 crop_left, crop_right, crop_top, crop_bottom;

if (!input)
return VppFilter_Fail;
Expand Down Expand Up @@ -2509,20 +2520,6 @@ static int vpp_set_filters_no_scaler_internal(
video_source_crop_bottom = input->crop_bottom;
}

if (likely(w_in >
(video_source_crop_left + video_source_crop_right))) {
w_in -= video_source_crop_left;
w_in -= video_source_crop_right;
h_crop_enable = true;
}

if (likely(h_in >
(video_source_crop_top + video_source_crop_bottom))) {
h_in -= video_source_crop_top;
h_in -= video_source_crop_bottom;
v_crop_enable = true;
}

next_frame_par->vscale_skip_count = 0;
next_frame_par->hscale_skip_count = 0;
next_frame_par->nocomp = false;
Expand All @@ -2536,6 +2533,26 @@ static int vpp_set_filters_no_scaler_internal(
else
vskip_step = 1;

RESTART_ALL:
crop_left = video_source_crop_left / crop_ratio;
crop_right = video_source_crop_right / crop_ratio;
crop_top = video_source_crop_top / crop_ratio;
crop_bottom = video_source_crop_bottom / crop_ratio;

if (likely(w_in >
(crop_left + crop_right))) {
w_in -= crop_left;
w_in -= crop_right;
h_crop_enable = true;
}

if (likely(h_in >
(crop_top + crop_bottom))) {
h_in -= crop_top;
h_in -= crop_bottom;
v_crop_enable = true;
}

RESTART:
/* don't use input->wide_mode */
wide_mode = vpp_flags & VPP_FLAG_WIDEMODE_MASK;
Expand Down Expand Up @@ -2622,8 +2639,8 @@ static int vpp_set_filters_no_scaler_internal(
}

if (v_crop_enable) {
next_frame_par->VPP_vd_start_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_end_lines_ += video_source_crop_top;
next_frame_par->VPP_vd_start_lines_ += crop_top;
next_frame_par->VPP_vd_end_lines_ += crop_top;
}

if (vpp_flags & VPP_FLAG_INTERLACE_IN)
Expand Down Expand Up @@ -2735,8 +2752,8 @@ static int vpp_set_filters_no_scaler_internal(
}

if (h_crop_enable) {
next_frame_par->VPP_hd_start_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_end_lines_ += video_source_crop_left;
next_frame_par->VPP_hd_start_lines_ += crop_left;
next_frame_par->VPP_hd_end_lines_ += crop_left;
}

next_frame_par->VPP_line_in_length_ =
Expand Down Expand Up @@ -2806,7 +2823,8 @@ static int vpp_set_filters_no_scaler_internal(
h_in = height_in = vf->height;
next_frame_par->hscale_skip_count = 0;
next_frame_par->vscale_skip_count = 0;
goto RESTART;
crop_ratio = vf->compWidth / vf->width;
goto RESTART_ALL;
}

if ((skip_policy & 0xf0) && (skip_policy_check == true)) {
Expand Down

0 comments on commit 3ae164f

Please sign in to comment.