History

Merge pull request #1657 from mstorsjo/clip-bitrate

Make sure the random test bitrate is high enough

sijchen committed 11 years ago

Commit 9a602ca2 parents 397c7ca 887b4f416 files · +705 −79Browse files

Showing the changes to codec/decoder (11 of 16 files). Show all

Unified · Split

11 files
  1. codec/decoder/core/inc/au_parser.h +16 −1
  2. codec/decoder/core/inc/decode_slice.h +1 −1
  3. codec/decoder/core/inc/decoder_context.h +9 −0
  4. codec/decoder/core/inc/error_code.h +2 −0
  5. codec/decoder/core/inc/parameter_sets.h +11 −2
  6. codec/decoder/core/inc/wels_common_basis.h +59 −0
  7. codec/decoder/core/src/au_parser.cpp +135 −6
  8. codec/decoder/core/src/decode_slice.cpp +108 −23
  9. codec/decoder/core/src/decoder.cpp +2 −0
  10. codec/decoder/core/src/parse_mb_syn_cabac.cpp +9 −3
  11. codec/decoder/core/src/parse_mb_syn_cavlc.cpp +48 −43
codec/decoder/core/inc/au_parser.h+16−1
@@ -131,11 +131,26 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 130 unmodified lines
131 */131 */
132int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal, const int32_t kSrcNalLen);132int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal, const int32_t kSrcNalLen);
133 133
134/*!
135 *************************************************************************************
136 * \brief to parse scaling list message payload
137 *
138 * \param PPS SPS scaling list matrix message to be parsed output
139 * \param pBsAux bitstream reader auxiliary
140 *
141 * \return 0 - successed
142 * 1 - failed
143 *
144 * \note Call it in case scaling matrix present at sps or pps
145 *************************************************************************************
146*/
147int32_t SetScalingListValue (uint8_t *pScalingList,int iScalingListNum,bool* bUseDefaultScalingMatrixFlag,PBitStringAux pBsAux);
148int32_t ParseScalingList(PSps pSps,PBitStringAux pBs,bool bPPS,bool *bScalingListPresentFlag,uint8_t(*iScalingList4x4)[16],uint8_t(*iScalingList8x8)[64]);
134/*!149/*!
135 *************************************************************************************150 *************************************************************************************
136 * \brief to parse SEI message payload151 * \brief to parse SEI message payload
137 *152 *
138 * \param pSei sei message to be parsed output153 * \param pSei sei message to be parsed output
139 * \param pBsAux bitstream reader auxiliary154 * \param pBsAux bitstream reader auxiliary
140 *155 *
141 * \return 0 - successed156 * \return 0 - successed
codec/decoder/core/inc/decode_slice.h+1−1
@@ -59,7 +59,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC · 58 unmodified lines
59int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer,59int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer,
60 uint8_t* pDstY, uint8_t* pDstU, uint8_t* pDstV, int32_t iStrideL, int32_t iStrideC);60 uint8_t* pDstY, uint8_t* pDstU, uint8_t* pDstV, int32_t iStrideL, int32_t iStrideC);
61int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer);61int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer);
62void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp);62void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp,PWelsDecoderContext pCtx);
63int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer);63int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer);
64void WelsChromaDcIdct (int16_t* pBlock);64void WelsChromaDcIdct (int16_t* pBlock);
65 65
codec/decoder/core/inc/decoder_context.h+9−0
@@ -409,6 +409,15 @@ bool bRPLRError; · 408 unmodified lines
409int32_t iECMVs[16][2];409int32_t iECMVs[16][2];
410PPicture pECRefPic[16];410PPicture pECRefPic[16];
411unsigned long long uiTimeStamp;411unsigned long long uiTimeStamp;
412// To support scaling list HP
413uint16_t pDequant_coeff_buffer4x4[6][52][16];
414uint16_t pDequant_coeff_buffer8x8[6][52][64];
415uint16_t (*pDequant_coeff4x4[6])[16];// 4x4 sclaing list value pointer
416uint16_t (*pDequant_coeff8x8[6])[64];//64 residual coeff ,with 6 kinds of residual type, 52 qp level
417int iDequantCoeffPpsid;//When a new pps actived, reinitialised the scaling list value
418bool bDequantCoeff4x4Init;
419bool bSpsLatePps;
420bool bUseScalingList;
412} SWelsDecoderContext, *PWelsDecoderContext;421} SWelsDecoderContext, *PWelsDecoderContext;
413 422
414static inline void ResetActiveSPSForEachLayer (PWelsDecoderContext pCtx) {423static inline void ResetActiveSPSForEachLayer (PWelsDecoderContext pCtx) {
codec/decoder/core/inc/error_code.h+2−0
@@ -185,6 +185,8 @@ ERR_INFO_INVALID_MMCO_REF_NUM_NOT_ENOUGH, · 184 unmodified lines
185ERR_INFO_INVALID_MMCO_LONG_TERM_IDX_EXCEED_MAX,185ERR_INFO_INVALID_MMCO_LONG_TERM_IDX_EXCEED_MAX,
186//for CABAC186//for CABAC
187ERR_CABAC_NO_BS_TO_READ,187ERR_CABAC_NO_BS_TO_READ,
188//for scaling list
189ERR_SCALING_LIST_DELTA_SCALE,
188};190};
189//-----------------------------------------------------------------------------------------------------------191//-----------------------------------------------------------------------------------------------------------
190 192
codec/decoder/core/inc/parameter_sets.h+11−2
@@ -88,7 +88,11 @@ typedef struct TagSps { · 87 unmodified lines
88 bool bQpPrimeYZeroTransfBypassFlag;88 bool bQpPrimeYZeroTransfBypassFlag;
89 bool bSeqScalingMatrixPresentFlag;89 bool bSeqScalingMatrixPresentFlag;
90 bool bSeqScalingListPresentFlag[12];90 bool bSeqScalingListPresentFlag[12];
91 const SLevelLimits* pSLevelLimits;91 //Add scaling list supporting
92 uint8_t iScalingList4x4[6][16];
93 uint8_t iScalingList8x8[6][64];
94
95const SLevelLimits* pSLevelLimits;
92} SSps, *PSps;96} SSps, *PSps;
93 97
94 98
@@ -163,7 +167,12 @@ typedef struct TagPps { · 68 unmodified lines
163 bool bRedundantPicCntPresentFlag;167 bool bRedundantPicCntPresentFlag;
164 bool bWeightedPredFlag;168 bool bWeightedPredFlag;
165 uint8_t uiWeightedBipredIdc;169 uint8_t uiWeightedBipredIdc;
166 170 bool bTransform_8x8_mode_flag;
171 //Add for scalinglist support
172 bool bPicScalingMatrixPresentFlag;
173 bool bPicScalingListPresentFlag[12];
174 uint8_t iScalingList4x4[6][16];
175 uint8_t iScalingList8x8[6][64];
167} SPps, *PPps;176} SPps, *PPps;
168 177
169} // namespace WelsDec178} // namespace WelsDec
codec/decoder/core/inc/wels_common_basis.h+59−0
@@ -132,6 +132,12 @@ typedef int32_t SubMbType; · 131 unmodified lines
132#define CHROMA_DC_V 7132#define CHROMA_DC_V 7
133#define CHROMA_AC_U 8133#define CHROMA_AC_U 8
134#define CHROMA_AC_V 9134#define CHROMA_AC_V 9
135#define LUMA_DC_AC_INTRA 10
136#define LUMA_DC_AC_INTER 11
137#define CHROMA_DC_U_INTER 12
138#define CHROMA_DC_V_INTER 13
139#define CHROMA_AC_U_INTER 14
140#define CHROMA_AC_V_INTER 15
135 141
136typedef struct TagReadBitsCache {142typedef struct TagReadBitsCache {
137 uint32_t uiCache32Bit;143 uint32_t uiCache32Bit;
@@ -150,6 +156,59 @@ static const uint8_t g_kuiZigzagScan[16] = { //4*4block residual zig-zag scan or · 12 unmodified lines
150};156};
151 157
152 158
159static inline void GetMbResProperty(int32_t * pMBproperty,int32_t* pResidualProperty,bool bCavlc)
160{
161 switch(*pResidualProperty)
162 {
163 case CHROMA_AC_U:
164 *pMBproperty = 1;
165 *pResidualProperty = bCavlc ? CHROMA_AC : CHROMA_AC_U;
166 break;
167 case CHROMA_AC_V:
168 *pMBproperty = 2;
169 *pResidualProperty = bCavlc ? CHROMA_AC : CHROMA_AC_V;
170 break;
171 case LUMA_DC_AC_INTRA:
172 *pMBproperty = 0;
173 *pResidualProperty = LUMA_DC_AC;
174 break;
175 case CHROMA_DC_U:
176 *pMBproperty = 1;
177 *pResidualProperty = bCavlc ? CHROMA_DC : CHROMA_DC_U;
178 break;
179 case CHROMA_DC_V:
180 *pMBproperty = 2;
181 *pResidualProperty = bCavlc ? CHROMA_DC : CHROMA_DC_V;
182 break;
183 case I16_LUMA_AC:
184 *pMBproperty = 0;
185 break;
186 case I16_LUMA_DC:
187 *pMBproperty = 0;
188 break;
189 case LUMA_DC_AC_INTER:
190 *pMBproperty = 3;
191 *pResidualProperty = LUMA_DC_AC;
192 break;
193 case CHROMA_DC_U_INTER:
194 *pMBproperty = 4;
195 *pResidualProperty = bCavlc ? CHROMA_DC : CHROMA_DC_U;
196 break;
197 case CHROMA_DC_V_INTER:
198 *pMBproperty = 5;
199 *pResidualProperty = bCavlc ? CHROMA_DC : CHROMA_DC_V;
200 break;
201 case CHROMA_AC_U_INTER:
202 *pMBproperty = 4;
203 *pResidualProperty = bCavlc ? CHROMA_AC : CHROMA_AC_U;
204 break;
205 case CHROMA_AC_V_INTER:
206 *pMBproperty = 5;
207 *pResidualProperty = bCavlc ?CHROMA_AC:CHROMA_AC_V;
208 break;
209 }
210 }
211
153typedef struct TagI16PredInfo {212typedef struct TagI16PredInfo {
154 int8_t iPredMode;213 int8_t iPredMode;
155 int8_t iLeftAvail;214 int8_t iLeftAvail;
codec/decoder/core/src/au_parser.cpp+135−6
@@ -833,6 +833,8 @@ bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) { · 832 unmodified lines
833#define PPS_PIC_INIT_QP_QS_MAX 51833#define PPS_PIC_INIT_QP_QS_MAX 51
834#define PPS_CHROMA_QP_INDEX_OFFSET_MIN -12834#define PPS_CHROMA_QP_INDEX_OFFSET_MIN -12
835#define PPS_CHROMA_QP_INDEX_OFFSET_MAX 12835#define PPS_CHROMA_QP_INDEX_OFFSET_MAX 12
836#define SCALING_LIST_DELTA_SCALE_MAX 127
837#define SCALING_LIST_DELTA_SCALE_MIN -128
836 838
837/*!839/*!
838 *************************************************************************************840 *************************************************************************************
@@ -935,12 +937,16 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 96 unmodified lines
935 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag937 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag
936 pSps->bSeqScalingMatrixPresentFlag = !!uiCode;938 pSps->bSeqScalingMatrixPresentFlag = !!uiCode;
937 939
938 if (pSps->bSeqScalingMatrixPresentFlag) { // For high profile, it is not used in current application. FIXME940 if (pSps->bSeqScalingMatrixPresentFlag)// For high profile, it is not used in current application. FIXME
939 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,941
940 "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.",942 WELS_READ_VERIFY (ParseScalingList (pSps, pBs, 0, pSps->bSeqScalingListPresentFlag, pSps->iScalingList4x4,
941 pSps->bSeqScalingMatrixPresentFlag);943 pSps->iScalingList8x8));
942 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);944 //if exist, to parse scalinglist matrix value
943 }945
946 // WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
947 // "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.",
948 // pSps->bSeqScalingMatrixPresentFlag);
949 //return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
944 }950 }
945 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_frame_num_minus4951 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_frame_num_minus4
946 WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX, "log2_max_frame_num_minus4",952 WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX, "log2_max_frame_num_minus4",
@@ -1307,6 +1313,22 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 360 unmodified lines
1307 pPps->bConstainedIntraPredFlag = !!uiCode;1313 pPps->bConstainedIntraPredFlag = !!uiCode;
1308 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag1314 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag
1309 pPps->bRedundantPicCntPresentFlag = !!uiCode;1315 pPps->bRedundantPicCntPresentFlag = !!uiCode;
1316//going on to parse high profile syntax, need fix me
1317 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode));
1318 pPps->bTransform_8x8_mode_flag = !!uiCode;
1319 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode));
1320 pPps->bPicScalingMatrixPresentFlag = !!uiCode;
1321 if (pPps->bPicScalingMatrixPresentFlag) {
1322 if (pCtx->bSpsAvailFlags[pPps->iSpsId])
1323 WELS_READ_VERIFY (ParseScalingList (&pCtx->sSpsBuffer[pPps->iSpsId], pBsAux, 1, pPps->bPicScalingListPresentFlag,
1324 pPps->iScalingList4x4, pPps->iScalingList8x8));
1325 else {
1326 pCtx->bSpsLatePps = true;
1327 WELS_READ_VERIFY (ParseScalingList (NULL, pBsAux, 1, pPps->bPicScalingListPresentFlag, pPps->iScalingList4x4,
1328 pPps->iScalingList8x8));
1329 }
1330 }
1331
1310 if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) {1332 if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) {
1311 PNalUnit pLastNalUnit = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];1333 PNalUnit pLastNalUnit = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];
1312 PPps pLastPps = pLastNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pPps;1334 PPps pLastPps = pLastNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pPps;
@@ -1355,6 +1377,113 @@ int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type · 42 unmodified lines
1355 1377
1356 return ERR_NONE;1378 return ERR_NONE;
1357}1379}
1380/*
1381 *************************************************************************************
1382 * \brief to parse scalinglist message payload
1383 *
1384 * \param pps sps scaling list matrix message to be parsed output
1385 * \param pBsAux bitstream reader auxiliary
1386 *
1387 * \return 0 - successed
1388 * 1 - failed
1389 *
1390 * \note Call it in case scaling list matrix present at sps or pps level
1391 *************************************************************************************
1392 */
1393int32_t SetScalingListValue (uint8_t* pScalingList, int iScalingListNum, bool* bUseDefaultScalingMatrixFlag,
1394 PBitStringAux pBsAux) { // reserved Sei_Msg type
1395 int iLastScale = 8;
1396 int iNextScale = 8;
1397 int iDeltaScale;
1398 int32_t iCode;
1399 for (int j = 0; j < iScalingListNum; j++) {
1400 if (iNextScale != 0) {
1401 WELS_READ_VERIFY (BsGetSe (pBsAux, &iCode));
1402 WELS_CHECK_SE_BOTH_ERROR_NOLOG (iCode, SCALING_LIST_DELTA_SCALE_MIN, SCALING_LIST_DELTA_SCALE_MAX, "DeltaScale",
1403 ERR_SCALING_LIST_DELTA_SCALE);
1404 iDeltaScale = iCode;
1405 iNextScale = (iLastScale + iDeltaScale + 256) % 256;
1406 *bUseDefaultScalingMatrixFlag = (j == 0 && iNextScale == 0);
1407 if (*bUseDefaultScalingMatrixFlag)
1408 break;
1409 }
1410 pScalingList[g_kuiZigzagScan[j]] = (iNextScale == 0) ? iLastScale : iNextScale;
1411 iLastScale = pScalingList[g_kuiZigzagScan[j]];
1412 }
1413
1414
1415 return ERR_NONE;
1416}
1417
1418int32_t ParseScalingList (PSps pSps, PBitStringAux pBs, bool bPPS, bool* pScalingListPresentFlag,
1419 uint8_t (*iScalingList4x4)[16], uint8_t (*iScalingList8x8)[64]) {
1420 uint32_t uiScalingListNum;
1421 uint32_t uiCode;
1422 int32_t iRetTmp;
1423 bool bUseDefaultScalingMatrixFlag4x4 = false;
1424 bool bUseDefaultScalingMatrixFlag8x8 = false;
1425 bool bInit = false;
1426 const uint8_t* defaultScaling[4];
1427
1428 if (pSps != NULL) {
1429 uiScalingListNum = (pSps->uiChromaFormatIdc != 3) ? 8 : 12;
1430 bInit = bPPS && pSps->bSeqScalingMatrixPresentFlag;
1431 } else
1432 uiScalingListNum = 12;
1433
1434//Init default_scaling_list value for sps or pps
1435 defaultScaling[0] = bInit ? pSps->iScalingList4x4[0] : g_kuiDequantScaling4x4Default[0];
1436 defaultScaling[1] = bInit ? pSps->iScalingList4x4[3] : g_kuiDequantScaling4x4Default[1];
1437 defaultScaling[2] = bInit ? pSps->iScalingList8x8[0] : g_kuiDequantScaling8x8Default[0];
1438 defaultScaling[3] = bInit ? pSps->iScalingList8x8[1] : g_kuiDequantScaling8x8Default[1];
1439
1440 for (int i = 0; i < uiScalingListNum; i++) {
1441 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode));
1442 pScalingListPresentFlag[i] = !!uiCode;
1443 if (!!uiCode) {
1444 if (i < 6) {
1445 iRetTmp = SetScalingListValue (iScalingList4x4[i], 16, &bUseDefaultScalingMatrixFlag4x4, pBs);
1446 if (iRetTmp == ERR_NONE) {
1447 if (bUseDefaultScalingMatrixFlag4x4) {
1448 bUseDefaultScalingMatrixFlag4x4 = false;
1449 memcpy (iScalingList4x4[i], g_kuiDequantScaling4x4Default[i / 3], sizeof (uint8_t) * 16);
1450 }
1451 } else
1452 return iRetTmp;
1453
1454 } else {
1455 SetScalingListValue (iScalingList8x8[i - 6], 64, &bUseDefaultScalingMatrixFlag8x8, pBs);
1456 //if(iRetTmp == ERR_NONE)
1457 //{
1458 if (bUseDefaultScalingMatrixFlag8x8) {
1459 bUseDefaultScalingMatrixFlag8x8 = false;
1460 memcpy (iScalingList8x8[i - 6], g_kuiDequantScaling8x8Default[ (i - 6) & 1], sizeof (uint8_t) * 64);
1461 }
1462 // }
1463
1464 //else
1465 // return iRetTmp;
1466 }
1467
1468 } else {
1469 if (i < 6) {
1470 if ((i != 0) && (i != 3))
1471 memcpy (iScalingList4x4[i], iScalingList4x4[i - 1], sizeof (uint8_t) * 16);
1472 else
1473 memcpy (iScalingList4x4[i], defaultScaling[i / 3], sizeof (uint8_t) * 16);
1474
1475 } else {
1476 if ((i == 6) || (i == 7))
1477 memcpy (iScalingList8x8[i - 6], defaultScaling[ (i & 1) + 2], sizeof (uint8_t) * 64);
1478 else
1479 memcpy (iScalingList8x8[i - 6], iScalingList8x8[ (i - 6) / 3], sizeof (uint8_t) * 64);
1480
1481 }
1482 }
1483 }
1484 return ERR_NONE;
1485
1486}
1358 1487
1359/*!1488/*!
1360 *************************************************************************************1489 *************************************************************************************
codec/decoder/core/src/decode_slice.cpp+108−23
@@ -197,8 +197,8 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 196 unmodified lines
197 return 0;197 return 0;
198}198}
199 199
200void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp) {200void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pCtx) {
201 const int32_t kiQMul = g_kuiDequantCoeff[iQp][0];201 const int32_t kiQMul = pCtx->bUseScalingList ? pCtx->pDequant_coeff4x4[0][iQp][0] >> 4 : g_kuiDequantCoeff[iQp][0];
202#define STRIDE 16202#define STRIDE 16
203 int32_t i;203 int32_t i;
204 int32_t iTemp[16]; //FIXME check if this is a good idea204 int32_t iTemp[16]; //FIXME check if this is a good idea
@@ -246,7 +246,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC · 41 unmodified lines
246 WelsFillRecNeededMbInfo (pCtx, bOutput, pCurLayer);246 WelsFillRecNeededMbInfo (pCtx, bOutput, pCurLayer);
247 247
248 if (IS_INTRA16x16 (pCurLayer->pMbType[iMbXy])) {248 if (IS_INTRA16x16 (pCurLayer->pMbType[iMbXy])) {
249 WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy]);249 WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx);
250 RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);250 RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);
251 251
252 return 0;252 return 0;
@@ -596,7 +596,8 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 343 unmodified lines
596 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {596 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
597 //Luma (DC and AC decoding together)597 //Luma (DC and AC decoding together)
598 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,598 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,
599 g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pLumaQp[iMbXy],599 g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4),
600 pCurLayer->pLumaQp[iMbXy],
600 pCtx));601 pCtx));
601 iIdx++;602 iIdx++;
602 }603 }
@@ -610,25 +611,26 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 7 unmodified lines
610 ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3]));611 ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3]));
611 ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4]));612 ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4]));
612 }613 }
613 614 int32_t iMbResProperty;
614 //chroma615 //chroma
615 //step1: DC616 //step1: DC
616 if (1 == uiCbpChroma || 2 == uiCbpChroma) {617 if (1 == uiCbpChroma || 2 == uiCbpChroma) {
617 //Cb Cr618 //Cb Cr
618 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (0 << 2), 4, g_kuiChromaDcScan,619 for (i = 0; i < 2; i++) {
619 CHROMA_DC_V, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (0 << 6), pCurLayer->pChromaQp[iMbXy], pCtx));620 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
620 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (1 << 2), 4, g_kuiChromaDcScan,621 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan,
621 CHROMA_DC_U, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (1 << 6), pCurLayer->pChromaQp[iMbXy], pCtx));622 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy], pCtx));
623 }
622 }624 }
623 625
624 //step2: AC626 //step2: AC
625 if (2 == uiCbpChroma) {627 if (2 == uiCbpChroma) {
626 for (i = 0; i < 2; i++) { //Cb Cr628 for (i = 0; i < 2; i++) { //Cb Cr
627 int32_t iResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;629 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
628 int32_t iIdx = 16 + (i << 2);630 int32_t iIdx = 16 + (i << 2);
629 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {631 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
630 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx,632 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx,
631 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iResProperty,633 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty,
632 pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pChromaQp[iMbXy], pCtx));634 pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pChromaQp[iMbXy], pCtx));
633 iIdx++;635 iIdx++;
634 }636 }
@@ -673,7 +675,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 38 unmodified lines
673 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;675 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
674 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;676 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
675 int32_t iMbXy = pCurLayer->iMbXyIndex;677 int32_t iMbXy = pCurLayer->iMbXyIndex;
676 678 int32_t iMbResProperty;
677 int32_t i;679 int32_t i;
678 uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0;680 uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0;
679 681
@@ -723,6 +725,21 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 43 unmodified lines
723 }725 }
724 }726 }
725 727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
726 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);743 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
727 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);744 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
728 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);745 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
@@ -774,13 +791,15 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 45 unmodified lines
774 ST32 (&pCurLayer->pNzc[iMbXy][12], 0);791 ST32 (&pCurLayer->pNzc[iMbXy][12], 0);
775 }792 }
776 } else { //non-MB_TYPE_INTRA16x16793 } else { //non-MB_TYPE_INTRA16x16
794 iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER;
777 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {795 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {
778 if (uiCbpLuma & (1 << iId8x8)) {796 if (uiCbpLuma & (1 << iId8x8)) {
779 int32_t iIdx = (iId8x8 << 2);797 int32_t iIdx = (iId8x8 << 2);
780 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {798 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
781 //Luma (DC and AC decoding together)799 //Luma (DC and AC decoding together)
782 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,800 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,
783 g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pLumaQp[iMbXy],801 g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4),
802 pCurLayer->pLumaQp[iMbXy],
784 pCtx));803 pCtx));
785 iIdx++;804 iIdx++;
786 }805 }
@@ -799,20 +818,27 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 12 unmodified lines
799 //step1: DC818 //step1: DC
800 if (1 == uiCbpChroma || 2 == uiCbpChroma) {819 if (1 == uiCbpChroma || 2 == uiCbpChroma) {
801 for (i = 0; i < 2; i++) {820 for (i = 0; i < 2; i++) {
802 int32_t iResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;821 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
822 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
823 else
824 iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER;
825
803 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan,826 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan,
804 iResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy], pCtx));827 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy], pCtx));
805 }828 }
806 }829 }
807 //step2: AC830 //step2: AC
808 if (2 == uiCbpChroma) {831 if (2 == uiCbpChroma) {
809 for (i = 0; i < 2; i++) {832 for (i = 0; i < 2; i++) {
810 int32_t iResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;833 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
834 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
835 else
836 iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER;
811 int32_t index = 16 + (i << 2);837 int32_t index = 16 + (i << 2);
812 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {838 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
813 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, index,839 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, index,
814 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),840 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
815 iResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurLayer->pChromaQp[iMbXy], pCtx));841 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurLayer->pChromaQp[iMbXy], pCtx));
816 index++;842 index++;
817 }843 }
818 }844 }
@@ -893,6 +919,46 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 74 unmodified lines
893 WELS_READ_VERIFY (WelsDecodeMbCabacPSliceBaseMode0 (pCtx, &uiNeighAvail, uiEosFlag));919 WELS_READ_VERIFY (WelsDecodeMbCabacPSliceBaseMode0 (pCtx, &uiNeighAvail, uiEosFlag));
894 return ERR_NONE;920 return ERR_NONE;
895}921}
922// Calculate deqaunt coeff scaling list value
923int32_t WelsCalcDeqCoeffScalingList (PWelsDecoderContext pCtx) {
924 int32_t iScalingListNum = 0;
925 if (pCtx->pSps->bSeqScalingMatrixPresentFlag || pCtx->pPps->bPicScalingMatrixPresentFlag) {
926 pCtx->bUseScalingList = true;
927 iScalingListNum = (pCtx->pSps->uiChromaFormatIdc != 3) ? 8 : 12;
928
929 if (!pCtx->bDequantCoeff4x4Init || (pCtx->iDequantCoeffPpsid != pCtx->pPps->iPpsId)) {
930 int i, q, x;
931 // Rewrite pps scaling list for scalingList present flag=0
932 if (pCtx->bSpsLatePps) {
933 for (i = 0; i < 6; i++) {
934 if (!pCtx->pSps->bSeqScalingListPresentFlag[i]) {
935 if (i == 0 || i == 3)
936 memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pSps->iScalingList4x4[i], 16 * sizeof (uint8_t));
937 else
938 memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pPps->iScalingList4x4[i - 1], 16 * sizeof (uint8_t));
939
940 }
941 }
942 //TO DO, SUPPORT 8x8 SCALINGlist
943
944 }
945 //Init dequant coeff value for different QP
946 for (i = 0; i < 6; i++) {
947 pCtx->pDequant_coeff4x4[i] = pCtx->pDequant_coeff_buffer4x4[i];
948 for (q = 0; q < 51; q++) {
949 for (x = 0; x < 16; x++) {
950 pCtx->pDequant_coeff4x4[i][q][x] = pCtx->pPps->bPicScalingMatrixPresentFlag ? pCtx->pPps->iScalingList4x4[i][x] *
951 g_kuiDequantCoeff[q][x & 0x07] : pCtx->pSps->iScalingList4x4[i][x] * g_kuiDequantCoeff[q][x & 0x07];
952 }
953 }
954 }
955
956 pCtx->bDequantCoeff4x4Init = true;
957 }
958 } else
959 pCtx->bUseScalingList = false;
960 return ERR_NONE;
961}
896 962
897int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) {963int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) {
898 PDqLayer pCurLayer = pCtx->pCurDqLayer;964 PDqLayer pCurLayer = pCtx->pCurDqLayer;
@@ -950,6 +1016,8 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 51 unmodified lines
950 pSlice->iLastDeltaQp = 0;1016 pSlice->iLastDeltaQp = 0;
951 WELS_READ_VERIFY (InitCabacDecEngineFromBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux));1017 WELS_READ_VERIFY (InitCabacDecEngineFromBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux));
952 }1018 }
1019 //try to calculate the dequant_coeff
1020 WelsCalcDeqCoeffScalingList (pCtx);
953 1021
954 iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;1022 iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;
955 iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;1023 iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;
@@ -1001,6 +1069,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 45 unmodified lines
1001 PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;1069 PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
1002 1070
1003 SWelsNeighAvail sNeighAvail;1071 SWelsNeighAvail sNeighAvail;
1072 int32_t iMbResProperty;
1004 1073
1005 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;1074 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
1006 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;1075 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
@@ -1038,6 +1107,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 31 unmodified lines
1038 1107
1039 uint8_t* pTmpBsBuf;1108 uint8_t* pTmpBsBuf;
1040 1109
1110
1041 int32_t i;1111 int32_t i;
1042 int32_t iCopySizeY = (sizeof (uint8_t) << 4);1112 int32_t iCopySizeY = (sizeof (uint8_t) << 4);
1043 int32_t iCopySizeUV = (sizeof (uint8_t) << 3);1113 int32_t iCopySizeUV = (sizeof (uint8_t) << 3);
@@ -1165,7 +1235,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 121 unmodified lines
1165 //Luma (DC and AC decoding together)1235 //Luma (DC and AC decoding together)
1166 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1236 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1167 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,1237 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,
1168 LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {1238 LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
1169 return -1;//abnormal1239 return -1;//abnormal
1170 }1240 }
1171 iIndex++;1241 iIndex++;
@@ -1185,8 +1255,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 13 unmodified lines
1185 //step1: DC1255 //step1: DC
1186 if (1 == uiCbpC || 2 == uiCbpC) {1256 if (1 == uiCbpC || 2 == uiCbpC) {
1187 for (i = 0; i < 2; i++) { //Cb Cr1257 for (i = 0; i < 2; i++) { //Cb Cr
1258 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
1188 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,1259 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
1189 16 + (i << 2), 4, g_kuiChromaDcScan, CHROMA_DC, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),1260 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
1190 pCurLayer->pChromaQp[iMbXy], pCtx)) {1261 pCurLayer->pChromaQp[iMbXy], pCtx)) {
1191 return -1;//abnormal1262 return -1;//abnormal
1192 }1263 }
@@ -1196,11 +1267,12 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 3 unmodified lines
1196 //step2: AC1267 //step2: AC
1197 if (2 == uiCbpC) {1268 if (2 == uiCbpC) {
1198 for (i = 0; i < 2; i++) { //Cb Cr1269 for (i = 0; i < 2; i++) { //Cb Cr
1270 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
1199 int32_t iIndex = 16 + (i << 2);1271 int32_t iIndex = 16 + (i << 2);
1200 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {1272 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
1201 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1273 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1202 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),1274 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
1203 CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {1275 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {
1204 return -1;//abnormal1276 return -1;//abnormal
1205 }1277 }
1206 iIndex++;1278 iIndex++;
@@ -1277,6 +1349,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 70 unmodified lines
1277 uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;1349 uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
1278 uint32_t uiCode;1350 uint32_t uiCode;
1279 int32_t iCode;1351 int32_t iCode;
1352 int32_t iMbResProperty;
1353
1280 GetNeighborAvailMbType (&sNeighAvail, pCurLayer);1354 GetNeighborAvailMbType (&sNeighAvail, pCurLayer);
1281 ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16);1355 ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16);
1282 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.231356 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23
@@ -1461,12 +1535,13 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 178 unmodified lines
1461 }1535 }
1462 } else { //non-MB_TYPE_INTRA16x161536 } else { //non-MB_TYPE_INTRA16x16
1463 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {1537 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {
1538 iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER;
1464 if (uiCbpL & (1 << iId8x8)) {1539 if (uiCbpL & (1 << iId8x8)) {
1465 int32_t iIndex = (iId8x8 << 2);1540 int32_t iIndex = (iId8x8 << 2);
1466 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {1541 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
1467 //Luma (DC and AC decoding together)1542 //Luma (DC and AC decoding together)
1468 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1543 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1469 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC,1544 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, iMbResProperty,
1470 pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {1545 pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
1471 return -1;//abnormal1546 return -1;//abnormal
1472 }1547 }
@@ -1488,8 +1563,13 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 15 unmodified lines
1488 //step1: DC1563 //step1: DC
1489 if (1 == uiCbpC || 2 == uiCbpC) {1564 if (1 == uiCbpC || 2 == uiCbpC) {
1490 for (i = 0; i < 2; i++) { //Cb Cr1565 for (i = 0; i < 2; i++) { //Cb Cr
1566 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
1567 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
1568 else
1569 iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER;
1570
1491 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,1571 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
1492 16 + (i << 2), 4, g_kuiChromaDcScan, CHROMA_DC, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),1572 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
1493 pCurLayer->pChromaQp[iMbXy], pCtx)) {1573 pCurLayer->pChromaQp[iMbXy], pCtx)) {
1494 return -1;//abnormal1574 return -1;//abnormal
1495 }1575 }
@@ -1499,11 +1579,16 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines
1499 //step2: AC1579 //step2: AC
1500 if (2 == uiCbpC) {1580 if (2 == uiCbpC) {
1501 for (i = 0; i < 2; i++) { //Cb Cr1581 for (i = 0; i < 2; i++) { //Cb Cr
1582 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
1583 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
1584 else
1585 iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER;
1586
1502 int32_t iIndex = 16 + (i << 2);1587 int32_t iIndex = 16 + (i << 2);
1503 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {1588 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
1504 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1589 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1505 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),1590 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
1506 CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {1591 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {
1507 return -1;//abnormal1592 return -1;//abnormal
1508 }1593 }
1509 iIndex++;1594 iIndex++;
codec/decoder/core/src/decoder.cpp+2−0
@@ -309,6 +309,8 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 308 unmodified lines
309 pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE;309 pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
310 pCtx->pPreviousDecodedPictureInDpb = NULL;310 pCtx->pPreviousDecodedPictureInDpb = NULL;
311 pCtx->sDecoderStatistics.iAvgLumaQp = -1;311 pCtx->sDecoderStatistics.iAvgLumaQp = -1;
312 pCtx->bSpsLatePps = false;
313 pCtx->bUseScalingList = false;
312 314
313}315}
314 316
codec/decoder/core/src/parse_mb_syn_cabac.cpp+9−3
@@ -821,11 +821,15 @@ int32_t ParseResidualBlockCabac (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroC · 820 unmodified lines
821 const uint8_t* pScanTable, int32_t iResProperty, short* sTCoeff, /*int mb_mode*/ uint8_t uiQp,821 const uint8_t* pScanTable, int32_t iResProperty, short* sTCoeff, /*int mb_mode*/ uint8_t uiQp,
822 PWelsDecoderContext pCtx) {822 PWelsDecoderContext pCtx) {
823 int32_t iCurNzCacheIdx;823 int32_t iCurNzCacheIdx;
824 const uint16_t* pDeQuantMul = g_kuiDequantCoeff[uiQp];
825 uint32_t uiTotalCoeffNum = 0;824 uint32_t uiTotalCoeffNum = 0;
826 uint32_t uiCbpBit;825 uint32_t uiCbpBit;
827 int32_t pSignificantMap[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};826 int32_t pSignificantMap[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
828 827
828 int32_t iMbResProperty;
829 GetMbResProperty (&iMbResProperty, &iResProperty, false);
830 const uint16_t* pDeQuantMul = (pCtx->bUseScalingList) ? pCtx->pDequant_coeff4x4[iMbResProperty][uiQp] :
831 g_kuiDequantCoeff[uiQp];
832
829 WELS_READ_VERIFY (ParseCbfInfoCabac (pNeighAvail, pNonZeroCountCache, iIndex, iResProperty, pCtx, uiCbpBit));833 WELS_READ_VERIFY (ParseCbfInfoCabac (pNeighAvail, pNonZeroCountCache, iIndex, iResProperty, pCtx, uiCbpBit));
830 if (uiCbpBit) { //has coeff834 if (uiCbpBit) { //has coeff
831 WELS_READ_VERIFY (ParseSignificantMapCabac (pSignificantMap, iResProperty, pCtx, uiTotalCoeffNum));835 WELS_READ_VERIFY (ParseSignificantMapCabac (pSignificantMap, iResProperty, pCtx, uiTotalCoeffNum));
@@ -847,13 +851,15 @@ int32_t ParseResidualBlockCabac (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroC · 15 unmodified lines
847 } else if (iResProperty == CHROMA_DC_U || iResProperty == CHROMA_DC_V) {851 } else if (iResProperty == CHROMA_DC_U || iResProperty == CHROMA_DC_V) {
848 do {852 do {
849 if (pSignificantMap[j] != 0)853 if (pSignificantMap[j] != 0)
850 sTCoeff[pScanTable[j]] = pSignificantMap[j] * pDeQuantMul[0];854 sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (pSignificantMap[j] * pDeQuantMul[0]) >> 4 :
855 (pSignificantMap[j] * pDeQuantMul[0]);
851 ++j;856 ++j;
852 } while (j < 16);857 } while (j < 16);
853 } else { //luma ac, chroma ac858 } else { //luma ac, chroma ac
854 do {859 do {
855 if (pSignificantMap[j] != 0)860 if (pSignificantMap[j] != 0)
856 sTCoeff[pScanTable[j]] = pSignificantMap[j] * pDeQuantMul[pScanTable[j] & 0x07];861 sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (pSignificantMap[j] * pDeQuantMul[pScanTable[j]] >> 4) :
862 pSignificantMap[j] * pDeQuantMul[pScanTable[j] & 0x07];
857 ++j;863 ++j;
858 } while (j < 16);864 } while (j < 16);
859 }865 }
codec/decoder/core/src/parse_mb_syn_cavlc.cpp+48−43
@@ -236,8 +236,8 @@ void WelsFillCacheConstrain0Intra4x4 (PWelsNeighAvail pNeighAvail, uint8_t* pNon · 235 unmodified lines
236 }236 }
237}237}
238 238
239void WelsFillCacheInterCabac(PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount, int16_t iMvArray[LIST_A][30][MV_A], int16_t iMvdCache[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30], PDqLayer pCurLayer)239void WelsFillCacheInterCabac (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount, int16_t iMvArray[LIST_A][30][MV_A],
240{240 int16_t iMvdCache[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30], PDqLayer pCurLayer) {
241 int32_t iCurXy = pCurLayer->iMbXyIndex;241 int32_t iCurXy = pCurLayer->iMbXyIndex;
242 int32_t iTopXy = 0;242 int32_t iTopXy = 0;
243 int32_t iLeftXy = 0;243 int32_t iLeftXy = 0;
@@ -267,10 +267,10 @@ void WelsFillCacheInterCabac(PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount · 23 unmodified lines
267 ST32 (iMvArray[0][18], LD32 (pCurLayer->pMv[0][iLeftXy][11]));267 ST32 (iMvArray[0][18], LD32 (pCurLayer->pMv[0][iLeftXy][11]));
268 ST32 (iMvArray[0][24], LD32 (pCurLayer->pMv[0][iLeftXy][15]));268 ST32 (iMvArray[0][24], LD32 (pCurLayer->pMv[0][iLeftXy][15]));
269 269
270 ST32(iMvdCache[0][ 6], LD32(pCurLayer->pMvd[0][iLeftXy][ 3]));270 ST32 (iMvdCache[0][ 6], LD32 (pCurLayer->pMvd[0][iLeftXy][ 3]));
271 ST32(iMvdCache[0][12], LD32(pCurLayer->pMvd[0][iLeftXy][ 7]));271 ST32 (iMvdCache[0][12], LD32 (pCurLayer->pMvd[0][iLeftXy][ 7]));
272 ST32(iMvdCache[0][18], LD32(pCurLayer->pMvd[0][iLeftXy][11]));272 ST32 (iMvdCache[0][18], LD32 (pCurLayer->pMvd[0][iLeftXy][11]));
273 ST32(iMvdCache[0][24], LD32(pCurLayer->pMvd[0][iLeftXy][15]));273 ST32 (iMvdCache[0][24], LD32 (pCurLayer->pMvd[0][iLeftXy][15]));
274 274
275 iRefIdxArray[0][ 6] = pCurLayer->pRefIndex[0][iLeftXy][ 3];275 iRefIdxArray[0][ 6] = pCurLayer->pRefIndex[0][iLeftXy][ 3];
276 iRefIdxArray[0][12] = pCurLayer->pRefIndex[0][iLeftXy][ 7];276 iRefIdxArray[0][12] = pCurLayer->pRefIndex[0][iLeftXy][ 7];
@@ -282,31 +282,31 @@ void WelsFillCacheInterCabac(PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount · 5 unmodified lines
282 ST32 (iMvArray[0][18], 0);282 ST32 (iMvArray[0][18], 0);
283 ST32 (iMvArray[0][24], 0);283 ST32 (iMvArray[0][24], 0);
284 284
285 ST32(iMvdCache[0][ 6], 0);285 ST32 (iMvdCache[0][ 6], 0);
286 ST32(iMvdCache[0][12], 0);286 ST32 (iMvdCache[0][12], 0);
287 ST32(iMvdCache[0][18], 0);287 ST32 (iMvdCache[0][18], 0);
288 ST32(iMvdCache[0][24], 0);288 ST32 (iMvdCache[0][24], 0);
289 289
290 290
291 if (0 == pNeighAvail->iLeftAvail) { //not available291 if (0 == pNeighAvail->iLeftAvail) { //not available
292 iRefIdxArray[0][ 6] =292 iRefIdxArray[0][ 6] =
293 iRefIdxArray[0][12] =293 iRefIdxArray[0][12] =
294 iRefIdxArray[0][18] =294 iRefIdxArray[0][18] =
295 iRefIdxArray[0][24] = REF_NOT_AVAIL;295 iRefIdxArray[0][24] = REF_NOT_AVAIL;
296 } else { //available but is intra mb type296 } else { //available but is intra mb type
297 iRefIdxArray[0][ 6] =297 iRefIdxArray[0][ 6] =
298 iRefIdxArray[0][12] =298 iRefIdxArray[0][12] =
299 iRefIdxArray[0][18] =299 iRefIdxArray[0][18] =
300 iRefIdxArray[0][24] = REF_NOT_IN_LIST;300 iRefIdxArray[0][24] = REF_NOT_IN_LIST;
301 }301 }
302 }302 }
303 if (pNeighAvail->iLeftTopAvail && IS_INTER (pNeighAvail->iLeftTopType)) {303 if (pNeighAvail->iLeftTopAvail && IS_INTER (pNeighAvail->iLeftTopType)) {
304 ST32 (iMvArray[0][0], LD32 (pCurLayer->pMv[0][iLeftTopXy][15]));304 ST32 (iMvArray[0][0], LD32 (pCurLayer->pMv[0][iLeftTopXy][15]));
305 ST32(iMvdCache[0][0], LD32(pCurLayer->pMvd[0][iLeftTopXy][15]));305 ST32 (iMvdCache[0][0], LD32 (pCurLayer->pMvd[0][iLeftTopXy][15]));
306 iRefIdxArray[0][0] = pCurLayer->pRefIndex[0][iLeftTopXy][15];306 iRefIdxArray[0][0] = pCurLayer->pRefIndex[0][iLeftTopXy][15];
307 } else {307 } else {
308 ST32 (iMvArray[0][0], 0);308 ST32 (iMvArray[0][0], 0);
309 ST32(iMvdCache[0][0], 0);309 ST32 (iMvdCache[0][0], 0);
310 if (0 == pNeighAvail->iLeftTopAvail) { //not available310 if (0 == pNeighAvail->iLeftTopAvail) { //not available
311 iRefIdxArray[0][0] = REF_NOT_AVAIL;311 iRefIdxArray[0][0] = REF_NOT_AVAIL;
312 } else { //available but is intra mb type312 } else { //available but is intra mb type
@@ -317,30 +317,30 @@ void WelsFillCacheInterCabac(PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount · 4 unmodified lines
317 if (pNeighAvail->iTopAvail && IS_INTER (pNeighAvail->iTopType)) {317 if (pNeighAvail->iTopAvail && IS_INTER (pNeighAvail->iTopType)) {
318 ST64 (iMvArray[0][1], LD64 (pCurLayer->pMv[0][iTopXy][12]));318 ST64 (iMvArray[0][1], LD64 (pCurLayer->pMv[0][iTopXy][12]));
319 ST64 (iMvArray[0][3], LD64 (pCurLayer->pMv[0][iTopXy][14]));319 ST64 (iMvArray[0][3], LD64 (pCurLayer->pMv[0][iTopXy][14]));
320 ST64(iMvdCache[0][1], LD64(pCurLayer->pMvd[0][iTopXy][12]));320 ST64 (iMvdCache[0][1], LD64 (pCurLayer->pMvd[0][iTopXy][12]));
321 ST64(iMvdCache[0][3], LD64(pCurLayer->pMvd[0][iTopXy][14]));321 ST64 (iMvdCache[0][3], LD64 (pCurLayer->pMvd[0][iTopXy][14]));
322 ST32 (&iRefIdxArray[0][1], LD32 (&pCurLayer->pRefIndex[0][iTopXy][12]));322 ST32 (&iRefIdxArray[0][1], LD32 (&pCurLayer->pRefIndex[0][iTopXy][12]));
323 } else {323 } else {
324 ST64 (iMvArray[0][1], 0);324 ST64 (iMvArray[0][1], 0);
325 ST64 (iMvArray[0][3], 0);325 ST64 (iMvArray[0][3], 0);
326 ST64(iMvdCache[0][1], 0);326 ST64 (iMvdCache[0][1], 0);
327 ST64(iMvdCache[0][3], 0);327 ST64 (iMvdCache[0][3], 0);
328 if (0 == pNeighAvail->iTopAvail) { //not available328 if (0 == pNeighAvail->iTopAvail) { //not available
329 iRefIdxArray[0][1] =329 iRefIdxArray[0][1] =
330 iRefIdxArray[0][2] =330 iRefIdxArray[0][2] =
331 iRefIdxArray[0][3] =331 iRefIdxArray[0][3] =
332 iRefIdxArray[0][4] = REF_NOT_AVAIL;332 iRefIdxArray[0][4] = REF_NOT_AVAIL;
333 } else { //available but is intra mb type333 } else { //available but is intra mb type
334 iRefIdxArray[0][1] =334 iRefIdxArray[0][1] =
335 iRefIdxArray[0][2] =335 iRefIdxArray[0][2] =
336 iRefIdxArray[0][3] =336 iRefIdxArray[0][3] =
337 iRefIdxArray[0][4] = REF_NOT_IN_LIST;337 iRefIdxArray[0][4] = REF_NOT_IN_LIST;
338 }338 }
339 }339 }
340 340
341 if (pNeighAvail->iRightTopAvail && IS_INTER (pNeighAvail->iRightTopType)) {341 if (pNeighAvail->iRightTopAvail && IS_INTER (pNeighAvail->iRightTopType)) {
342 ST32 (iMvArray[0][5], LD32 (pCurLayer->pMv[0][iRightTopXy][12]));342 ST32 (iMvArray[0][5], LD32 (pCurLayer->pMv[0][iRightTopXy][12]));
343 ST32(iMvdCache[0][5], LD32(pCurLayer->pMvd[0][iRightTopXy][12]));343 ST32 (iMvdCache[0][5], LD32 (pCurLayer->pMvd[0][iRightTopXy][12]));
344 iRefIdxArray[0][5] = pCurLayer->pRefIndex[0][iRightTopXy][12];344 iRefIdxArray[0][5] = pCurLayer->pRefIndex[0][iRightTopXy][12];
345 } else {345 } else {
346 ST32 (iMvArray[0][5], 0);346 ST32 (iMvArray[0][5], 0);
@@ -357,21 +357,20 @@ void WelsFillCacheInterCabac(PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount · 10 unmodified lines
357 ST32 (iMvArray[0][11], 0);357 ST32 (iMvArray[0][11], 0);
358 ST32 (iMvArray[0][17], 0);358 ST32 (iMvArray[0][17], 0);
359 ST32 (iMvArray[0][23], 0);359 ST32 (iMvArray[0][23], 0);
360 ST32(iMvdCache[0][ 9], 0);360 ST32 (iMvdCache[0][ 9], 0);
361 ST32(iMvdCache[0][21], 0);361 ST32 (iMvdCache[0][21], 0);
362 ST32(iMvdCache[0][11], 0);362 ST32 (iMvdCache[0][11], 0);
363 ST32(iMvdCache[0][17], 0);363 ST32 (iMvdCache[0][17], 0);
364 ST32(iMvdCache[0][23], 0);364 ST32 (iMvdCache[0][23], 0);
365 iRefIdxArray[0][ 9] =365 iRefIdxArray[0][ 9] =
366 iRefIdxArray[0][21] =366 iRefIdxArray[0][21] =
367 iRefIdxArray[0][11] =367 iRefIdxArray[0][11] =
368 iRefIdxArray[0][17] =368 iRefIdxArray[0][17] =
369 iRefIdxArray[0][23] = REF_NOT_AVAIL;369 iRefIdxArray[0][23] = REF_NOT_AVAIL;
370}370}
371 371
372void WelsFillCacheInter (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount,372void WelsFillCacheInter (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount,
373 int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30], PDqLayer pCurLayer)373 int16_t iMvArray[LIST_A][30][MV_A], int8_t iRefIdxArray[LIST_A][30], PDqLayer pCurLayer) {
374{
375 int32_t iCurXy = pCurLayer->iMbXyIndex;374 int32_t iCurXy = pCurLayer->iMbXyIndex;
376 int32_t iTopXy = 0;375 int32_t iTopXy = 0;
377 int32_t iLeftXy = 0;376 int32_t iLeftXy = 0;
@@ -798,7 +797,13 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach · 420 unmodified lines
798 int32_t iLevel[16], iZerosLeft, iCoeffNum;797 int32_t iLevel[16], iZerosLeft, iCoeffNum;
799 int32_t iRun[16];798 int32_t iRun[16];
800 int32_t iCurNonZeroCacheIdx, i;799 int32_t iCurNonZeroCacheIdx, i;
801 const uint16_t* kpDequantCoeff = g_kuiDequantCoeff[uiQp];800
801
802 int32_t iMbResProperty = 0;
803 GetMbResProperty (&iMbResProperty, &iResidualProperty, 1);
804 const uint16_t* kpDequantCoeff = pCtx->bUseScalingList ? pCtx->pDequant_coeff4x4[iMbResProperty][uiQp] :
805 g_kuiDequantCoeff[uiQp];
806
802 int8_t nA, nB, nC;807 int8_t nA, nB, nC;
803 uint8_t uiTotalCoeff, uiTrailingOnes;808 uint8_t uiTotalCoeff, uiTrailingOnes;
804 int32_t iUsedBits = 0;809 int32_t iUsedBits = 0;
@@ -867,7 +872,7 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach · 62 unmodified lines
867 int32_t j;872 int32_t j;
868 iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?873 iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?
869 j = kpZigzagTable[ iCoeffNum ];874 j = kpZigzagTable[ iCoeffNum ];
870 pTCoeff[j] = iLevel[i] * kpDequantCoeff[0];875 pTCoeff[j] = pCtx->bUseScalingList ? (iLevel[i] * kpDequantCoeff[0]) >> 4 : (iLevel[i] * kpDequantCoeff[0]);
871 }876 }
872 } else if (iResidualProperty == I16_LUMA_DC) { //DC coefficent, only call in Intra_16x16, base_mode_flag = 0877 } else if (iResidualProperty == I16_LUMA_DC) { //DC coefficent, only call in Intra_16x16, base_mode_flag = 0
873 for (i = uiTotalCoeff - 1; i >= 0; --i) { //FIXME merge into rundecode?878 for (i = uiTotalCoeff - 1; i >= 0; --i) { //FIXME merge into rundecode?
@@ -881,7 +886,7 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach · 7 unmodified lines
881 int32_t j;886 int32_t j;
882 iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?887 iCoeffNum += iRun[i] + 1; //FIXME add 1 earlier ?
883 j = kpZigzagTable[ iCoeffNum ];888 j = kpZigzagTable[ iCoeffNum ];
884 pTCoeff[j] = iLevel[i] * kpDequantCoeff[j & 0x07];889 pTCoeff[j] = pCtx->bUseScalingList ? (iLevel[i] * kpDequantCoeff[j]) >> 4 : (iLevel[i] * kpDequantCoeff[j & 0x07]);
885 }890 }
886 }891 }
887 892

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t