negative data with left shift, use cast or multiplication instead

This commit is contained in:
Licai Guo 2014-02-17 19:13:41 -08:00
parent 136931c265
commit a810408cdc
3 changed files with 7 additions and 6 deletions

View File

@ -698,8 +698,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
return ERR_INFO_INVALID_DBLOCKING_IDC;
}
if (pSliceHead->uiDisableDeblockingFilterIdc != 1) {
pSliceHead->iSliceAlphaC0Offset = BsGetSe (pBs) << 1; // slice_alpha_c0_offset_div2
pSliceHead->iSliceBetaOffset = BsGetSe (pBs) << 1; // iSliceBetaOffset
pSliceHead->iSliceAlphaC0Offset = BsGetSe (pBs) * 2; // slice_alpha_c0_offset_div2
pSliceHead->iSliceBetaOffset = BsGetSe (pBs) * 2; // iSliceBetaOffset
}
}

View File

@ -138,7 +138,7 @@ static inline int32_t HorFilterInput16bit_c (int16_t* pSrc) {
int32_t iPix14 = pSrc[-1] + pSrc[2];
int32_t iPix23 = pSrc[ 0] + pSrc[1];
return (iPix05 - ((iPix14 << 2) + iPix14) + (iPix23 << 4) + (iPix23 << 2));
return (iPix05 - ((iPix14 * 4) + iPix14) + (iPix23 * 16) + (iPix23 * 4));
}
// h: iOffset=1 / v: iOffset=iSrcStride
static inline int32_t FilterInput8bitWithStride_c (uint8_t* pSrc, const int32_t kiOffset) {

View File

@ -477,8 +477,8 @@ void BsStartCavlc (PBitStringAux pBs) {
}
void BsEndCavlc (PBitStringAux pBs) {
pBs->pCurBuf = pBs->pStartBuf + (pBs->iIndex >> 3);
pBs->uiCurBits = ((((pBs->pCurBuf[0] << 8) | pBs->pCurBuf[1]) << 16) | (pBs->pCurBuf[2] << 8) | pBs->pCurBuf[3]) <<
(pBs->iIndex & 0x07);
uint32_t uiCache32Bit = (uint32_t)((((pBs->pCurBuf[0] << 8) | pBs->pCurBuf[1]) << 16) | (pBs->pCurBuf[2] << 8) | pBs->pCurBuf[3]);
pBs->uiCurBits = uiCache32Bit << (pBs->iIndex & 0x07);
pBs->pCurBuf += 4;
pBs->iLeftBits = -16 + (pBs->iIndex & 0x07);
}
@ -677,7 +677,8 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
uint8_t bChroma = (bChromaDc || CHROMA_AC == iResidualProperty);
SReadBitsCache sReadBitsCache;
sReadBitsCache.uiCache32Bit = ((((pBuf[0] << 8) | pBuf[1]) << 16) | (pBuf[2] << 8) | pBuf[3]) << (iCurIdx & 0x07);
uint32_t uiCache32Bit = (uint32_t)((((pBuf[0] << 8) | pBuf[1]) << 16) | (pBuf[2] << 8) | pBuf[3]);
sReadBitsCache.uiCache32Bit = uiCache32Bit << (iCurIdx & 0x07);
sReadBitsCache.uiRemainBits = 32 - (iCurIdx & 0x07);
sReadBitsCache.pBuf = pBuf;
//////////////////////////////////////////////////////////////////////////