Showing the changes to codec/decoder (5 of 14 files). Show all
Unified · Split
| @@ -46,7 +46,7 @@ typedef struct TagBitStringAux { · 45 unmodified lines | |||
| 46 | uint8_t* pEndBuf; // buffer + length | 46 | uint8_t* pEndBuf; // buffer + length |
| 47 | int32_t iBits; // count bits of overall bitstreaming input | 47 | int32_t iBits; // count bits of overall bitstreaming input |
| 48 | 48 | ||
| 49 | int32_t iIndex; //only for cavlc usage | 49 | intX_t iIndex; //only for cavlc usage |
| 50 | uint8_t* pCurBuf; // current reading position | 50 | uint8_t* pCurBuf; // current reading position |
| 51 | uint32_t uiCurBits; | 51 | uint32_t uiCurBits; |
| 52 | int32_t iLeftBits; // count number of available bits left ([1, 8]), | 52 | int32_t iLeftBits; // count number of available bits left ([1, 8]), |
| @@ -75,11 +75,11 @@ namespace WelsDec { · 74 unmodified lines | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static inline int32_t BsGetBits (PBitStringAux pBs, int32_t iNumBits, uint32_t* pCode) { | 77 | static inline int32_t BsGetBits (PBitStringAux pBs, int32_t iNumBits, uint32_t* pCode) { |
| 78 | int32_t iRc = UBITS (pBs->uiCurBits, iNumBits); | 78 | intX_t iRc = UBITS (pBs->uiCurBits, iNumBits); |
| 79 | int32_t iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes | 79 | intX_t iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes |
| 80 | int32_t iReadBytes = pBs->pCurBuf - pBs->pStartBuf; | 80 | intX_t iReadBytes = pBs->pCurBuf - pBs->pStartBuf; |
| 81 | DUMP_BITS (pBs->uiCurBits, pBs->pCurBuf, pBs->iLeftBits, iNumBits, iAllowedBytes, iReadBytes); | 81 | DUMP_BITS (pBs->uiCurBits, pBs->pCurBuf, pBs->iLeftBits, iNumBits, iAllowedBytes, iReadBytes); |
| 82 | *pCode = iRc; | 82 | *pCode = (uint32_t)iRc; |
| 83 | return ERR_NONE; | 83 | return ERR_NONE; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| @@ -155,7 +155,7 @@ static inline int32_t GetLeadingZeroBits (uint32_t iCurBits) { //<=32 bits · 69 unmodified lines | |||
| 155 | static inline uint32_t BsGetUe (PBitStringAux pBs, uint32_t* pCode) { | 155 | static inline uint32_t BsGetUe (PBitStringAux pBs, uint32_t* pCode) { |
| 156 | uint32_t iValue = 0; | 156 | uint32_t iValue = 0; |
| 157 | int32_t iLeadingZeroBits = GetLeadingZeroBits (pBs->uiCurBits); | 157 | int32_t iLeadingZeroBits = GetLeadingZeroBits (pBs->uiCurBits); |
| 158 | int32_t iAllowedBytes, iReadBytes; | 158 | intX_t iAllowedBytes, iReadBytes; |
| 159 | iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes | 159 | iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes |
| 160 | 160 | ||
| 161 | if (iLeadingZeroBits == -1) { //bistream error | 161 | if (iLeadingZeroBits == -1) { //bistream error |
| @@ -75,7 +75,7 @@ uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t · 74 unmodified lines | |||
| 75 | ++ pBits; | 75 | ++ pBits; |
| 76 | 76 | ||
| 77 | if ((iIdx >= 3) && ((* (pBits - 1)) == 0x1)) { | 77 | if ((iIdx >= 3) && ((* (pBits - 1)) == 0x1)) { |
| 78 | *pOffset = ((uintptr_t)pBits) - ((uintptr_t)kpBuf); | 78 | *pOffset = (int32_t) (((uintptr_t)pBits) - ((uintptr_t)kpBuf)); |
| 79 | return pBits; | 79 | return pBits; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -183,7 +183,8 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 182 unmodified lines | |||
| 183 | GetInterPred (pDstY, pDstCb, pDstCr, pCtx); | 183 | GetInterPred (pDstY, pDstCb, pDstCr, pCtx); |
| 184 | WelsMbInterSampleConstruction (pCtx, pCurLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride); | 184 | WelsMbInterSampleConstruction (pCtx, pCurLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride); |
| 185 | 185 | ||
| 186 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! | 186 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( |
| 187 | pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! | ||
| 187 | return 0; | 188 | return 0; |
| 188 | } | 189 | } |
| 189 | 190 | ||
| @@ -322,7 +323,7 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 132 unmodified lines | |||
| 322 | int32_t iMbX, iMbY; | 323 | int32_t iMbX, iMbY; |
| 323 | const int32_t kiCountNumMb = pSliceHeader->pSps->uiTotalMbCount; //need to be correct when fmo or multi slice | 324 | const int32_t kiCountNumMb = pSliceHeader->pSps->uiTotalMbCount; //need to be correct when fmo or multi slice |
| 324 | PBitStringAux pBs = pCurLayer->pBitStringAux; | 325 | PBitStringAux pBs = pCurLayer->pBitStringAux; |
| 325 | int32_t iUsedBits = 0; | 326 | intX_t iUsedBits = 0; |
| 326 | 327 | ||
| 327 | PWelsDecMbCavlcFunc pDecMbCavlcFunc; | 328 | PWelsDecMbCavlcFunc pDecMbCavlcFunc; |
| 328 | 329 | ||
| @@ -674,7 +674,7 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach · 673 unmodified lines | |||
| 674 | int8_t nA, nB, nC; | 674 | int8_t nA, nB, nC; |
| 675 | uint8_t uiTotalCoeff, uiTrailingOnes; | 675 | uint8_t uiTotalCoeff, uiTrailingOnes; |
| 676 | int32_t iUsedBits = 0; | 676 | int32_t iUsedBits = 0; |
| 677 | int32_t iCurIdx = pBs->iIndex; | 677 | intX_t iCurIdx = pBs->iIndex; |
| 678 | uint8_t* pBuf = ((uint8_t*)pBs->pStartBuf) + (iCurIdx >> 3); | 678 | uint8_t* pBuf = ((uint8_t*)pBs->pStartBuf) + (iCurIdx >> 3); |
| 679 | bool bChromaDc = (CHROMA_DC == iResidualProperty); | 679 | bool bChromaDc = (CHROMA_DC == iResidualProperty); |
| 680 | uint8_t bChroma = (bChromaDc || CHROMA_AC == iResidualProperty); | 680 | uint8_t bChroma = (bChromaDc || CHROMA_AC == iResidualProperty); |