Skip to content

Commit 574dedb

Browse files
peiyigu-intelintel-mediadev
authored andcommitted
[VP] Fix L0 FC Rotation
fix rotation
1 parent 91d12c4 commit 574dedb

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ MOS_STATUS VpL0FcFilter::ConvertRotationToKrnParam(VPHAL_ROTATION rotation, floa
798798
scaling.rotateIndices[1] = 0;
799799
scaling.src.startX = startLeft;
800800
scaling.src.startY = startBottom;
801-
scaling.src.strideX = strideY;
802-
scaling.src.strideY = -strideX;
801+
scaling.src.strideX = strideX;
802+
scaling.src.strideY = -strideY;
803803
break;
804804
case VPHAL_ROTATION_180:
805805
scaling.rotateIndices[0] = 0;
@@ -814,8 +814,8 @@ MOS_STATUS VpL0FcFilter::ConvertRotationToKrnParam(VPHAL_ROTATION rotation, floa
814814
scaling.rotateIndices[1] = 0;
815815
scaling.src.startX = startRight;
816816
scaling.src.startY = startTop;
817-
scaling.src.strideX = -strideY;
818-
scaling.src.strideY = strideX;
817+
scaling.src.strideX = -strideX;
818+
scaling.src.strideY = strideY;
819819
break;
820820
case VPHAL_MIRROR_HORIZONTAL:
821821
scaling.rotateIndices[0] = 0;
@@ -838,16 +838,16 @@ MOS_STATUS VpL0FcFilter::ConvertRotationToKrnParam(VPHAL_ROTATION rotation, floa
838838
scaling.rotateIndices[1] = 0;
839839
scaling.src.startX = startRight;
840840
scaling.src.startY = startBottom;
841-
scaling.src.strideX = -strideY;
842-
scaling.src.strideY = -strideX;
841+
scaling.src.strideX = -strideX;
842+
scaling.src.strideY = -strideY;
843843
break;
844844
case VPHAL_ROTATE_90_MIRROR_HORIZONTAL:
845845
scaling.rotateIndices[0] = 1;
846846
scaling.rotateIndices[1] = 0;
847847
scaling.src.startX = startLeft;
848848
scaling.src.startY = startTop;
849-
scaling.src.strideX = strideY;
850-
scaling.src.strideY = strideX;
849+
scaling.src.strideX = strideX;
850+
scaling.src.strideY = strideY;
851851
break;
852852
default:
853853
VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER);
@@ -913,12 +913,17 @@ MOS_STATUS VpL0FcFilter::ConvertScalingRotToKrnParam(
913913
scaling.trg.top = rcDst.top;
914914
scaling.trg.bottom = rcDst.bottom;
915915

916-
float strideX = (float)(rcSrc.right - rcSrc.left) / (rcDst.right - rcDst.left) / inputWidth;
917-
float strideY = (float)(rcSrc.bottom - rcSrc.top) / (rcDst.bottom - rcDst.top) / inputHeight;
918-
float startLeft = (float)rcSrc.left / inputWidth;
919-
float startRight = (float)(rcSrc.right - 1) / inputWidth;
920-
float startTop = (float)rcSrc.top / inputHeight;
921-
float startBottom = (float)(rcSrc.bottom - 1) / inputHeight;
916+
bool isVerticalRotate = VpUtils::IsVerticalRotation(rotation);
917+
float rcDstWidth = static_cast<float>(rcDst.right - rcDst.left);
918+
float rcDstHeight = static_cast<float>(rcDst.bottom - rcDst.top);
919+
float rcSrcWidth = static_cast<float>(rcSrc.right - rcSrc.left);
920+
float rcSrcHeight = static_cast<float>(rcSrc.bottom - rcSrc.top);
921+
float strideX = isVerticalRotate ? rcSrcWidth / rcDstHeight / inputWidth : rcSrcWidth / rcDstWidth / inputWidth;
922+
float strideY = isVerticalRotate ? rcSrcHeight / rcDstWidth / inputHeight : rcSrcHeight / rcDstHeight / inputHeight;
923+
float startLeft = (float)rcSrc.left / inputWidth;
924+
float startRight = (float)(rcSrc.right - 1) / inputWidth;
925+
float startTop = (float)rcSrc.top / inputHeight;
926+
float startBottom = (float)(rcSrc.bottom - 1) / inputHeight;
922927
VP_PUBLIC_CHK_STATUS_RETURN(ConvertRotationToKrnParam(rotation, strideX, strideY, startLeft, startRight, startTop, startBottom, scaling));
923928

924929
return MOS_STATUS_SUCCESS;

0 commit comments

Comments
 (0)