diff --git a/source/Lib/CommonLib/AffineGradientSearch.cpp b/source/Lib/CommonLib/AffineGradientSearch.cpp index 17746c1e62b1e3e86b94cafac24e023f7433af7b..2056901894edc4c66561c3f02cef309e18677670 100644 --- a/source/Lib/CommonLib/AffineGradientSearch.cpp +++ b/source/Lib/CommonLib/AffineGradientSearch.cpp @@ -64,7 +64,7 @@ AffineGradientSearch::AffineGradientSearch() } void AffineGradientSearch::xHorizontalSobelFilter(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height) + const ptrdiff_t derivateBufStride, const int width, const int height) { for ( int j = 1; j < height - 1; j++ ) { @@ -98,7 +98,7 @@ void AffineGradientSearch::xHorizontalSobelFilter(Pel *const pPred, const ptrdif } void AffineGradientSearch::xVerticalSobelFilter(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height) + const ptrdiff_t derivateBufStride, const int width, const int height) { for ( int k = 1; k < width - 1; k++ ) { @@ -131,7 +131,9 @@ void AffineGradientSearch::xVerticalSobelFilter(Pel *const pPred, const ptrdiff_ } } -void AffineGradientSearch::xEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t( *pEqualCoeff )[7], int width, int height, bool b6Param ) +void AffineGradientSearch::xEqualCoeffComputer(Pel *pResidue, ptrdiff_t residueStride, int **ppDerivate, + ptrdiff_t derivateBufStride, int64_t (*pEqualCoeff)[7], int width, + int height, bool b6Param) { int affineParamNum = b6Param ? 6 : 4; @@ -142,7 +144,7 @@ void AffineGradientSearch::xEqualCoeffComputer( Pel *pResidue, int residueStride { int iC[6]; - int idx = j * derivateBufStride + k; + ptrdiff_t idx = j * derivateBufStride + k; int cx = ((k >> 2) << 2) + 2; if ( !b6Param ) { diff --git a/source/Lib/CommonLib/AffineGradientSearch.h b/source/Lib/CommonLib/AffineGradientSearch.h index 36ba4929c7d9cc4a0f70cd0ebf1db6a805957564..f1b80d935bccbb9080787064281edf9e9e0a5797 100644 --- a/source/Lib/CommonLib/AffineGradientSearch.h +++ b/source/Lib/CommonLib/AffineGradientSearch.h @@ -48,20 +48,22 @@ class AffineGradientSearch { public: void (*m_HorizontalSobelFilter)(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height); + const ptrdiff_t derivateBufStride, const int width, const int height); void (*m_VerticalSobelFilter)(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height); + const ptrdiff_t derivateBufStride, const int width, const int height); - void( *m_EqualCoeffComputer ) (Pel *pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t( *pEqualCoeff )[7], int width, int height, bool b6Param); + void (*m_EqualCoeffComputer)(Pel *pResidue, ptrdiff_t residueStride, int **ppDerivate, ptrdiff_t derivateBufStride, + int64_t (*pEqualCoeff)[7], int width, int height, bool b6Param); static void xHorizontalSobelFilter(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height); + const ptrdiff_t derivateBufStride, const int width, const int height); static void xVerticalSobelFilter(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height); + const ptrdiff_t derivateBufStride, const int width, const int height); - static void xEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t( *pEqualCoeff )[7], int width, int height, bool b6Param ); + static void xEqualCoeffComputer(Pel *pResidue, ptrdiff_t residueStride, int **ppDerivate, ptrdiff_t derivateBufStride, + int64_t (*pEqualCoeff)[7], int width, int height, bool b6Param); AffineGradientSearch(); ~AffineGradientSearch() {} diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 34c071a608dfaed96daf6c1d3a1b86e8326f9500..1f1340506946bc097c4dc36469a5bb7db3567e03 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -1282,8 +1282,8 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf void InterPrediction::xAddBIOAvg4(const Pel *src0, ptrdiff_t src0Stride, const Pel *src1, ptrdiff_t src1Stride, Pel *dst, ptrdiff_t dstStride, const Pel *gradX0, const Pel *gradX1, - const Pel *gradY0, const Pel *gradY1, int gradStride, int width, int height, int tmpx, - int tmpy, int shift, int offset, const ClpRng &clpRng) + const Pel *gradY0, const Pel *gradY1, ptrdiff_t gradStride, int width, int height, + int tmpx, int tmpy, int shift, int offset, const ClpRng &clpRng) { g_pelBufOP.addBIOAvg4(src0, src0Stride, src1, src1Stride, dst, dstStride, gradX0, gradX1, gradY0, gradY1, gradStride, width, height, tmpx, tmpy, shift, offset, clpRng); } diff --git a/source/Lib/CommonLib/InterPrediction.h b/source/Lib/CommonLib/InterPrediction.h index 410155f46a4c4f7165fb55b83ddc98060c047e91..367b94f0edb277dd030fda104ae3e33495f7d257 100644 --- a/source/Lib/CommonLib/InterPrediction.h +++ b/source/Lib/CommonLib/InterPrediction.h @@ -136,7 +136,7 @@ protected: void xAddBIOAvg4(const Pel *src0, ptrdiff_t src0Stride, const Pel *src1, ptrdiff_t src1Stride, Pel *dst, ptrdiff_t dstStride, const Pel *gradX0, const Pel *gradX1, const Pel *gradY0, const Pel *gradY1, - int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, + ptrdiff_t gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng &clpRng); void xBioGradFilter(Pel *pSrc, ptrdiff_t srcStride, int width, int height, ptrdiff_t gradStride, Pel *gradX, Pel *gradY, int bitDepth); diff --git a/source/Lib/CommonLib/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index 9dadaa22cef0edc2dcc692e386def6cd8b7f2a00..7a7c37a421037f3a78c39de3b785b1f8fc72f2c0 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -3899,7 +3899,7 @@ Distortion RdCost::xGetMRHADs( const DistParam &rcDtParam ) } void RdCost::setDistParam(DistParam &rcDP, const CPelBuf &org, const Pel *piRefY, ptrdiff_t iRefStride, const Pel *mask, - int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID) + ptrdiff_t iMaskStride, int stepX, ptrdiff_t iMaskStride2, int bitDepth, ComponentID compID) { rcDP.bitDepth = bitDepth; rcDP.compID = compID; @@ -3940,9 +3940,9 @@ Distortion RdCost::xGetSADwMask( const DistParam& rcDtParam ) const int subStep = ( 1 << subShift); const ptrdiff_t strideCur = rcDtParam.cur.stride * subStep; const ptrdiff_t strideOrg = rcDtParam.org.stride * subStep; - const int strideMask = rcDtParam.maskStride * subStep; + const ptrdiff_t strideMask = rcDtParam.maskStride * subStep; const int stepX = rcDtParam.stepX; - const int strideMask2 = rcDtParam.maskStride2; + const ptrdiff_t strideMask2 = rcDtParam.maskStride2; const uint32_t distortionShift = DISTORTION_PRECISION_ADJUSTMENT(rcDtParam.bitDepth); Distortion sum = 0; diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index d5bb740a005c086be92271aba00b82f61054b04b..f3bc21cf9b495d943bfce55ff61bab77b18384c6 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -73,9 +73,9 @@ public: CPelBuf orgLuma; #endif const Pel* mask; - int maskStride; + ptrdiff_t maskStride; int stepX; - int maskStride2; + ptrdiff_t maskStride2; int step; FpDistFunc distFunc; int bitDepth; @@ -186,7 +186,7 @@ public: int bitDepth, ComponentID compID, int width, int height, int subShiftMode = 0, int step = 1, bool useHadamard = false, bool bioApplied = false); void setDistParam(DistParam &rcDP, const CPelBuf &org, const Pel *piRefY, ptrdiff_t iRefStride, const Pel *mask, - int iMaskStride, int stepX, int iMaskStride2, int bitDepth, ComponentID compID); + ptrdiff_t iMaskStride, int stepX, ptrdiff_t iMaskStride2, int bitDepth, ComponentID compID); double getMotionLambda ( ) { return m_dLambdaMotionSAD; } void selectMotionLambda ( ) { m_motionLambda = getMotionLambda( ); } diff --git a/source/Lib/CommonLib/x86/AffineGradientSearchX86.h b/source/Lib/CommonLib/x86/AffineGradientSearchX86.h index 8d4ca30292906af1a2cbedf44924fb9d140966c7..0243a3dc980cace7486f8006187ef589572e5aaf 100644 --- a/source/Lib/CommonLib/x86/AffineGradientSearchX86.h +++ b/source/Lib/CommonLib/x86/AffineGradientSearchX86.h @@ -71,7 +71,7 @@ inter3 = _mm_add_epi64(inter0, inter3); template<X86_VEXT vext> static void simdHorizontalSobelFilter(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height) + const ptrdiff_t derivateBufStride, const int width, const int height) { __m128i mmPred[4]; __m128i mm2xPred[2]; @@ -135,7 +135,7 @@ static void simdHorizontalSobelFilter(Pel *const pPred, const ptrdiff_t predStri template<X86_VEXT vext> static void simdVerticalSobelFilter(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int derivateBufStride, const int width, const int height) + const ptrdiff_t derivateBufStride, const int width, const int height) { __m128i mmPred[4]; __m128i mmIntermediates[6]; @@ -198,7 +198,9 @@ static void simdVerticalSobelFilter(Pel *const pPred, const ptrdiff_t predStride } template<X86_VEXT vext> -static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t( *pEqualCoeff )[7], int width, int height, bool b6Param ) +static void simdEqualCoeffComputer(Pel *pResidue, ptrdiff_t residueStride, int **ppDerivate, + ptrdiff_t derivateBufStride, int64_t (*pEqualCoeff)[7], int width, int height, + bool b6Param) { __m128i mmFour; __m128i mmTmp[4]; @@ -213,7 +215,7 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe int n = b6Param ? 6 : 4; - int idx1 = 0, idx2 = 0; + ptrdiff_t idx1 = 0, idx2 = 0; idx1 = -2 * derivateBufStride - 4; idx2 = -derivateBufStride - 4; @@ -311,7 +313,7 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe #if RExt__HIGH_BIT_DEPTH_SUPPORT template<X86_VEXT vext> static void simdHorizontalSobelFilter_HBD_SIMD(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int32_t derivateBufStride, const int width, const int height) + const ptrdiff_t derivateBufStride, const int width, const int height) { __m128i pred[4]; __m128i pred2x[2]; @@ -417,7 +419,7 @@ static void simdHorizontalSobelFilter_HBD_SIMD(Pel *const pPred, const ptrdiff_t template<X86_VEXT vext> static void simdVerticalSobelFilter_HBD_SIMD(Pel *const pPred, const ptrdiff_t predStride, int *const pDerivate, - const int32_t derivateBufStride, const int width, const int height) + const ptrdiff_t derivateBufStride, const int width, const int height) { __m128i pred[4]; __m128i intermediates[6]; @@ -540,7 +542,9 @@ inter3 = _mm256_add_epi64(inter0, inter3); } template<X86_VEXT vext> -static void simdEqualCoeffComputer_HBD_SIMD(Pel *pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t(*pEqualCoeff)[7], int width, int height, bool b6Param) +static void simdEqualCoeffComputer_HBD_SIMD(Pel *pResidue, ptrdiff_t residueStride, int **ppDerivate, + ptrdiff_t derivateBufStride, int64_t (*pEqualCoeff)[7], int width, + int height, bool b6Param) { int n = b6Param ? 6 : 4; CHECK((width & 8), "width of affine block should be multiple of 8"); @@ -548,8 +552,8 @@ static void simdEqualCoeffComputer_HBD_SIMD(Pel *pResidue, int residueStride, in #if USE_AVX2 if (vext >= AVX2) { - int idx1 = -2 * derivateBufStride - 8; - int idx2 = -derivateBufStride - 8; + ptrdiff_t idx1 = -2 * derivateBufStride - 8; + ptrdiff_t idx2 = -derivateBufStride - 8; __m256i tmp[4]; __m256i intermediate[4]; @@ -654,8 +658,8 @@ static void simdEqualCoeffComputer_HBD_SIMD(Pel *pResidue, int residueStride, in else #endif { - int idx1 = -2 * derivateBufStride - 4; - int idx2 = -derivateBufStride - 4; + ptrdiff_t idx1 = -2 * derivateBufStride - 4; + ptrdiff_t idx2 = -derivateBufStride - 4; __m128i four; __m128i tmp[4]; diff --git a/source/Lib/CommonLib/x86/RdCostX86.h b/source/Lib/CommonLib/x86/RdCostX86.h index fbd3631e1f3c1b55d36020fb1d0b4b639bc5b1a8..34bcf8ceecb47d1c86b8027fc80935d86c466490 100644 --- a/source/Lib/CommonLib/x86/RdCostX86.h +++ b/source/Lib/CommonLib/x86/RdCostX86.h @@ -3867,7 +3867,7 @@ Distortion RdCost::xGetSADwMask_SIMD( const DistParam &rcDtParam ) int subStep = ( 1 << subShift); const ptrdiff_t strideSrc1 = rcDtParam.org.stride * subStep; const ptrdiff_t strideSrc2 = rcDtParam.cur.stride * subStep; - const int strideMask = rcDtParam.maskStride * subStep; + const ptrdiff_t strideMask = rcDtParam.maskStride * subStep; Distortion sum = 0; if( vext >= AVX2 && (cols & 15 ) == 0 )