Merge pull request #532 from huili2/WELS_CLIP1
Modify MACRO WELS_CLIP1 as inline functions
This commit is contained in:
commit
d897d362ab
@ -28,8 +28,8 @@ void DeblockLumaLt4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_
|
||||
iTc++;
|
||||
}
|
||||
int32_t iDeta = WELS_CLIP3 ((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -iTc, iTc);
|
||||
pPix[-iStrideX] = WELS_CLIP1 (p0 + iDeta); /* p0' */
|
||||
pPix[0] = WELS_CLIP1 (q0 - iDeta); /* q0' */
|
||||
pPix[-iStrideX] = WelsClip1 (p0 + iDeta); /* p0' */
|
||||
pPix[0] = WelsClip1 (q0 - iDeta); /* q0' */
|
||||
}
|
||||
}
|
||||
pPix += iStrideY;
|
||||
@ -107,8 +107,8 @@ void DeblockChromaLt4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int
|
||||
bDetaQ1Q0 = WELS_ABS (q1 - q0) < iBeta;
|
||||
if (bDetaP0Q0 && bDetaP1P0 && bDetaQ1Q0) {
|
||||
iDeta = WELS_CLIP3 ((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -iTc0, iTc0);
|
||||
pPixCb[-iStrideX] = WELS_CLIP1 (p0 + iDeta); /* p0' */
|
||||
pPixCb[0] = WELS_CLIP1 (q0 - iDeta); /* q0' */
|
||||
pPixCb[-iStrideX] = WelsClip1 (p0 + iDeta); /* p0' */
|
||||
pPixCb[0] = WelsClip1 (q0 - iDeta); /* q0' */
|
||||
}
|
||||
|
||||
|
||||
@ -123,8 +123,8 @@ void DeblockChromaLt4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int
|
||||
|
||||
if (bDetaP0Q0 && bDetaP1P0 && bDetaQ1Q0) {
|
||||
iDeta = WELS_CLIP3 ((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3, -iTc0, iTc0);
|
||||
pPixCr[-iStrideX] = WELS_CLIP1 (p0 + iDeta); /* p0' */
|
||||
pPixCr[0] = WELS_CLIP1 (q0 - iDeta); /* q0' */
|
||||
pPixCr[-iStrideX] = WelsClip1 (p0 + iDeta); /* p0' */
|
||||
pPixCr[0] = WelsClip1 (q0 - iDeta); /* q0' */
|
||||
}
|
||||
}
|
||||
pPixCb += iStrideY;
|
||||
|
@ -176,11 +176,10 @@ return iY;
|
||||
#define NEG_NUM(iX) (1+(~(iX)))
|
||||
#endif// NEG_NUM
|
||||
|
||||
#ifndef WELS_CLIP1
|
||||
//#define WELS_CLIP1(x) (x & ~255) ? (-x >> 31) : x
|
||||
#define WELS_CLIP1(iX) (((iX) & ~255) ? (-(iX) >> 31) : (iX)) //iX not only a value but also can be an expression
|
||||
#endif//WELS_CLIP1
|
||||
|
||||
static inline uint8_t WelsClip1(int32_t iX) {
|
||||
uint8_t uiTmp = (uint8_t)(((iX) & ~255) ? (-(iX) >> 31) : (iX));
|
||||
return uiTmp;
|
||||
}
|
||||
|
||||
#ifndef WELS_SIGN
|
||||
#define WELS_SIGN(iX) ((int32_t)(iX) >> 31)
|
||||
|
@ -92,13 +92,13 @@ void IdctResAddPred_c (uint8_t* pPred, const int32_t kiStride, int16_t* pRs) {
|
||||
int32_t kT3 = (32 + kT1 + kT2) >> 6;
|
||||
int32_t kT4 = (32 + kT1 - kT2) >> 6;
|
||||
|
||||
pDst[i] = WELS_CLIP1( kT3 + pPred[i] );
|
||||
pDst[i + kiStride3] = WELS_CLIP1( kT4 + pPred[i + kiStride3] );
|
||||
pDst[i] = WelsClip1( kT3 + pPred[i] );
|
||||
pDst[i + kiStride3] = WelsClip1( kT4 + pPred[i + kiStride3] );
|
||||
|
||||
kT1 = iSrc[i] - iSrc[i + 8];
|
||||
kT2 = (iSrc[i + 4] >> 1) - iSrc[i + 12];
|
||||
pDst[i + kiStride] = WELS_CLIP1( ((32 + kT1 + kT2) >> 6) + pDst[i + kiStride] );
|
||||
pDst[i + kiStride2] = WELS_CLIP1( ((32 + kT1 - kT2) >> 6) + pDst[i + kiStride2] );
|
||||
pDst[i + kiStride] = WelsClip1( ((32 + kT1 + kT2) >> 6) + pDst[i + kiStride] );
|
||||
pDst[i + kiStride2] = WelsClip1( ((32 + kT1 - kT2) >> 6) + pDst[i + kiStride2] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ void WelsIChromaPredPlane_c (uint8_t* pPred, const int32_t kiStride) {
|
||||
for (i = 0 ; i < 8 ; i ++) {
|
||||
for (j = 0 ; j < 8 ; j ++) {
|
||||
int32_t iTmp = (a + b * (j - 3) + c * (i - 3) + 16) >> 5;
|
||||
iTmp = WELS_CLIP1 (iTmp);
|
||||
iTmp = WelsClip1 (iTmp);
|
||||
pPred[j] = iTmp;
|
||||
}
|
||||
pPred += kiStride;
|
||||
@ -567,7 +567,7 @@ void WelsI16x16LumaPredPlane_c (uint8_t* pPred, const int32_t kiStride) {
|
||||
for (i = 0 ; i < 16 ; i ++) {
|
||||
for (j = 0 ; j < 16 ; j ++) {
|
||||
int32_t iTmp = (a + b * (j - 7) + c * (i - 7) + 16) >> 5;
|
||||
iTmp = WELS_CLIP1 (iTmp);
|
||||
iTmp = WelsClip1 (iTmp);
|
||||
pPred[j] = iTmp;
|
||||
}
|
||||
pPred += kiStride;
|
||||
|
@ -181,7 +181,7 @@ static inline void McHorVer20_c (const uint8_t* pSrc, int32_t iSrcStride, uint8_
|
||||
int32_t i, j;
|
||||
for (i = 0; i < iHeight; i++) {
|
||||
for (j = 0; j < iWidth; j++) {
|
||||
pDst[j] = WELS_CLIP1 ((FilterInput8bitWithStride_c (pSrc + j, 1) + 16) >> 5);
|
||||
pDst[j] = WelsClip1 ((FilterInput8bitWithStride_c (pSrc + j, 1) + 16) >> 5);
|
||||
}
|
||||
pDst += iDstStride;
|
||||
pSrc += iSrcStride;
|
||||
@ -193,7 +193,7 @@ static inline void McHorVer02_c (const uint8_t* pSrc, int32_t iSrcStride, uint8_
|
||||
int32_t i, j;
|
||||
for (i = 0; i < iHeight; i++) {
|
||||
for (j = 0; j < iWidth; j++) {
|
||||
pDst[j] = WELS_CLIP1 ((FilterInput8bitWithStride_c (pSrc + j, iSrcStride) + 16) >> 5);
|
||||
pDst[j] = WelsClip1 ((FilterInput8bitWithStride_c (pSrc + j, iSrcStride) + 16) >> 5);
|
||||
}
|
||||
pDst += iDstStride;
|
||||
pSrc += iSrcStride;
|
||||
@ -210,7 +210,7 @@ static inline void McHorVer22_c (const uint8_t* pSrc, int32_t iSrcStride, uint8_
|
||||
iTmp[j] = FilterInput8bitWithStride_c (pSrc - 2 + j, iSrcStride);
|
||||
}
|
||||
for (k = 0; k < iWidth; k++) {
|
||||
pDst[k] = WELS_CLIP1 ((HorFilterInput16bit_c (&iTmp[2 + k]) + 512) >> 10);
|
||||
pDst[k] = WelsClip1 ((HorFilterInput16bit_c (&iTmp[2 + k]) + 512) >> 10);
|
||||
}
|
||||
pSrc += iSrcStride;
|
||||
pDst += iDstStride;
|
||||
|
@ -189,10 +189,10 @@ void WelsIDctT4Rec_c (uint8_t* pRec, int32_t iStride, uint8_t* pPred, int32_t iP
|
||||
const int32_t kiVerDelR = (iTemp[4 + i] >> 1) - iTemp[12 + i];
|
||||
const int32_t kiVerSumR = iTemp[4 + i] + (iTemp[12 + i] >> 1);
|
||||
|
||||
pRec[i ] = WELS_CLIP1 (pPred[i ] + ((kiVerSumL + kiVerSumR + 32) >> 6));
|
||||
pRec[iStride + i ] = WELS_CLIP1 (pPred[iPredStride + i ] + ((kiVerDelL + kiVerDelR + 32) >> 6));
|
||||
pRec[iDstStridex2 + i] = WELS_CLIP1 (pPred[iPredStridex2 + i] + ((kiVerDelL - kiVerDelR + 32) >> 6));
|
||||
pRec[iDstStridex3 + i] = WELS_CLIP1 (pPred[iPredStridex3 + i] + ((kiVerSumL - kiVerSumR + 32) >> 6));
|
||||
pRec[i ] = WelsClip1 (pPred[i ] + ((kiVerSumL + kiVerSumR + 32) >> 6));
|
||||
pRec[iStride + i ] = WelsClip1 (pPred[iPredStride + i ] + ((kiVerDelL + kiVerDelR + 32) >> 6));
|
||||
pRec[iDstStridex2 + i] = WelsClip1 (pPred[iPredStridex2 + i] + ((kiVerDelL - kiVerDelR + 32) >> 6));
|
||||
pRec[iDstStridex3 + i] = WelsClip1 (pPred[iPredStridex3 + i] + ((kiVerSumL - kiVerSumR + 32) >> 6));
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ void WelsIDctRecI16x16Dc_c (uint8_t* pRec, int32_t iStride, uint8_t* pPred, int3
|
||||
|
||||
for (i = 0; i < 16; i ++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
pRec[j] = WELS_CLIP1 (pPred[j] + ((pDctDc[ (i & 0x0C) + (j >> 2)] + 32) >> 6));
|
||||
pRec[j] = WelsClip1 (pPred[j] + ((pDctDc[ (i & 0x0C) + (j >> 2)] + 32) >> 6));
|
||||
}
|
||||
pRec += iStride;
|
||||
pPred += iPredStride;
|
||||
|
@ -468,7 +468,7 @@ void WelsIChormaPredPlane_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiStri
|
||||
|
||||
for (i = 0 ; i < 8 ; i ++) {
|
||||
for (j = 0 ; j < 8 ; j ++) {
|
||||
pPred[j] = (uint8_t)WELS_CLIP1 ((iLTshift + iTopshift * (j - 3) + iLeftshift * (i - 3) + 16) >> 5);
|
||||
pPred[j] = WelsClip1 ((iLTshift + iTopshift * (j - 3) + iLeftshift * (i - 3) + 16) >> 5);
|
||||
}
|
||||
pPred += I8x8_PRED_STRIDE;
|
||||
}
|
||||
@ -622,7 +622,7 @@ void WelsI16x16LumaPredPlane_c (uint8_t* pPred, uint8_t* pRef, const int32_t kiS
|
||||
|
||||
for (i = 0 ; i < 16 ; i ++) {
|
||||
for (j = 0 ; j < 16 ; j ++) {
|
||||
pPred[j] = (uint8_t)WELS_CLIP1 ((iLTshift + iTopshift * (j - 7) + iLeftshift * (i - 7) + 16) >> 5);
|
||||
pPred[j] = WelsClip1 ((iLTshift + iTopshift * (j - 7) + iLeftshift * (i - 7) + 16) >> 5);
|
||||
}
|
||||
pPred += iPredStride;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ static inline void McHorVer20WidthEq16_c (const uint8_t* pSrc, int32_t iSrcStrid
|
||||
int32_t i, j;
|
||||
for (i = 0; i < iHeight; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
pDst[j] = WELS_CLIP1 ((fpHorFilter (pSrc + j) + 16) >> 5);
|
||||
pDst[j] = WelsClip1 ((fpHorFilter (pSrc + j) + 16) >> 5);
|
||||
}
|
||||
pDst += iDstStride;
|
||||
pSrc += iSrcStride;
|
||||
@ -204,7 +204,7 @@ static inline void McHorVer02WidthEq16_c (const uint8_t* pSrc, int32_t iSrcStrid
|
||||
int32_t i, j;
|
||||
for (i = 0; i < iHeight; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
pDst[j] = WELS_CLIP1 ((fpVerFilter (pSrc + j, iSrcStride) + 16) >> 5);
|
||||
pDst[j] = WelsClip1 ((fpVerFilter (pSrc + j, iSrcStride) + 16) >> 5);
|
||||
}
|
||||
pDst += iDstStride;
|
||||
pSrc += iSrcStride;
|
||||
@ -221,7 +221,7 @@ static inline void McHorVer22WidthEq16_c (const uint8_t* pSrc, int32_t iSrcStrid
|
||||
pTmp[j] = fpVerFilter (pSrc - 2 + j, iSrcStride);
|
||||
}
|
||||
for (k = 0; k < 16; k++) {
|
||||
pDst[k] = WELS_CLIP1 ((fpHorFilterInput16Bits (&pTmp[2 + k]) + 512) >> 10);
|
||||
pDst[k] = WelsClip1 ((fpHorFilterInput16Bits (&pTmp[2 + k]) + 512) >> 10);
|
||||
}
|
||||
pSrc += iSrcStride;
|
||||
pDst += iDstStride;
|
||||
@ -328,7 +328,7 @@ static inline void McHorVer20_c (const uint8_t* pSrc, int32_t iSrcStride, uint8_
|
||||
int32_t i, j;
|
||||
for (i = 0; i < iHeight; i++) {
|
||||
for (j = 0; j < iWidth; j++) {
|
||||
pDst[j] = WELS_CLIP1 ((fpHorFilter (pSrc + j) + 16) >> 5);
|
||||
pDst[j] = WelsClip1 ((fpHorFilter (pSrc + j) + 16) >> 5);
|
||||
}
|
||||
pDst += iDstStride;
|
||||
pSrc += iSrcStride;
|
||||
@ -340,7 +340,7 @@ static inline void McHorVer02_c (const uint8_t* pSrc, int32_t iSrcStride, uint8_
|
||||
int32_t i, j;
|
||||
for (i = 0; i < iHeight; i++) {
|
||||
for (j = 0; j < iWidth; j++) {
|
||||
pDst[j] = WELS_CLIP1 ((fpVerFilter (pSrc + j, iSrcStride) + 16) >> 5);
|
||||
pDst[j] = WelsClip1 ((fpVerFilter (pSrc + j, iSrcStride) + 16) >> 5);
|
||||
}
|
||||
pDst += iDstStride;
|
||||
pSrc += iSrcStride;
|
||||
@ -357,7 +357,7 @@ static inline void McHorVer22_c (const uint8_t* pSrc, int32_t iSrcStride, uint8_
|
||||
pTmp[j] = fpVerFilter (pSrc - 2 + j, iSrcStride);
|
||||
}
|
||||
for (k = 0; k < iWidth; k++) {
|
||||
pDst[k] = WELS_CLIP1 ((fpHorFilterInput16Bits (&pTmp[2 + k]) + 512) >> 10);
|
||||
pDst[k] = WelsClip1 ((fpHorFilterInput16Bits (&pTmp[2 + k]) + 512) >> 10);
|
||||
}
|
||||
pSrc += iSrcStride;
|
||||
pDst += iDstStride;
|
||||
|
@ -30,13 +30,13 @@ void IdctResAddPred_ref (uint8_t* pPred, const int32_t kiStride, int16_t* pRs) {
|
||||
int32_t kT3 = (32 + kT1 + kT2) >> 6;
|
||||
int32_t kT4 = (32 + kT1 - kT2) >> 6;
|
||||
|
||||
pDst[i] = WELS_CLIP1 (kT3 + pPred[i]);
|
||||
pDst[i + kiStride3] = WELS_CLIP1 (kT4 + pPred[i + kiStride3]);
|
||||
pDst[i] = WelsClip1 (kT3 + pPred[i]);
|
||||
pDst[i + kiStride3] = WelsClip1 (kT4 + pPred[i + kiStride3]);
|
||||
|
||||
kT1 = iSrc[i] - iSrc[i + 8];
|
||||
kT2 = (iSrc[i + 4] >> 1) - iSrc[i + 12];
|
||||
pDst[i + kiStride] = WELS_CLIP1 (((32 + kT1 + kT2) >> 6) + pDst[i + kiStride]);
|
||||
pDst[i + kiStride2] = WELS_CLIP1 (((32 + kT1 - kT2) >> 6) + pDst[i + kiStride2]);
|
||||
pDst[i + kiStride] = WelsClip1 (((32 + kT1 + kT2) >> 6) + pDst[i + kiStride]);
|
||||
pDst[i + kiStride2] = WelsClip1 (((32 + kT1 - kT2) >> 6) + pDst[i + kiStride2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user