support scalinglist8x8
fix issue update according to wayne's suggestiong
This commit is contained in:
parent
698ba11bb6
commit
17e5ea95c0
@ -1504,7 +1504,7 @@ int32_t ParseScalingList (PSps pSps, PBitStringAux pBs, bool bPPS, bool* pScalin
|
||||
uint8_t (*iScalingList4x4)[16], uint8_t (*iScalingList8x8)[64]) {
|
||||
uint32_t uiScalingListNum;
|
||||
uint32_t uiCode;
|
||||
int32_t iRetTmp;
|
||||
|
||||
bool bUseDefaultScalingMatrixFlag4x4 = false;
|
||||
bool bUseDefaultScalingMatrixFlag8x8 = false;
|
||||
bool bInit = false;
|
||||
@ -1526,28 +1526,21 @@ int32_t ParseScalingList (PSps pSps, PBitStringAux pBs, bool bPPS, bool* pScalin
|
||||
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode));
|
||||
pScalingListPresentFlag[i] = !!uiCode;
|
||||
if (!!uiCode) {
|
||||
if (i < 6) {
|
||||
iRetTmp = SetScalingListValue (iScalingList4x4[i], 16, &bUseDefaultScalingMatrixFlag4x4, pBs);
|
||||
if (iRetTmp == ERR_NONE) {
|
||||
if (bUseDefaultScalingMatrixFlag4x4) {
|
||||
bUseDefaultScalingMatrixFlag4x4 = false;
|
||||
memcpy (iScalingList4x4[i], g_kuiDequantScaling4x4Default[i / 3], sizeof (uint8_t) * 16);
|
||||
}
|
||||
} else
|
||||
return iRetTmp;
|
||||
if (i < 6) {//4x4 scaling list
|
||||
WELS_READ_VERIFY (SetScalingListValue (iScalingList4x4[i], 16, &bUseDefaultScalingMatrixFlag4x4, pBs));
|
||||
if (bUseDefaultScalingMatrixFlag4x4) {
|
||||
bUseDefaultScalingMatrixFlag4x4 = false;
|
||||
memcpy (iScalingList4x4[i], g_kuiDequantScaling4x4Default[i / 3], sizeof (uint8_t) * 16);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
SetScalingListValue (iScalingList8x8[i - 6], 64, &bUseDefaultScalingMatrixFlag8x8, pBs);
|
||||
//if(iRetTmp == ERR_NONE)
|
||||
//{
|
||||
WELS_READ_VERIFY (SetScalingListValue (iScalingList8x8[i - 6], 64, &bUseDefaultScalingMatrixFlag8x8, pBs));
|
||||
|
||||
if (bUseDefaultScalingMatrixFlag8x8) {
|
||||
bUseDefaultScalingMatrixFlag8x8 = false;
|
||||
memcpy (iScalingList8x8[i - 6], g_kuiDequantScaling8x8Default[ (i - 6) & 1], sizeof (uint8_t) * 64);
|
||||
}
|
||||
// }
|
||||
|
||||
//else
|
||||
// return iRetTmp;
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -1561,7 +1554,7 @@ int32_t ParseScalingList (PSps pSps, PBitStringAux pBs, bool bPPS, bool* pScalin
|
||||
if ((i == 6) || (i == 7))
|
||||
memcpy (iScalingList8x8[i - 6], defaultScaling[ (i & 1) + 2], sizeof (uint8_t) * 64);
|
||||
else
|
||||
memcpy (iScalingList8x8[i - 6], iScalingList8x8[ (i - 6) / 3], sizeof (uint8_t) * 64);
|
||||
memcpy (iScalingList8x8[i - 6], iScalingList8x8[i - 8], sizeof (uint8_t) * 64);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -936,19 +936,32 @@ int32_t WelsCalcDeqCoeffScalingList (PWelsDecoderContext pCtx) {
|
||||
pCtx->bUseScalingList = true;
|
||||
|
||||
if (!pCtx->bDequantCoeff4x4Init || (pCtx->iDequantCoeffPpsid != pCtx->pPps->iPpsId)) {
|
||||
int i, q, x;
|
||||
int i, q, x, y;
|
||||
// Rewrite pps scaling list for scalingList present flag=0
|
||||
if (pCtx->bSpsLatePps) {
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (!pCtx->pSps->bSeqScalingListPresentFlag[i]) {
|
||||
if (i == 0 || i == 3)
|
||||
memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pSps->iScalingList4x4[i], 16 * sizeof (uint8_t));
|
||||
else
|
||||
memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pPps->iScalingList4x4[i - 1], 16 * sizeof (uint8_t));
|
||||
for (i = 0; i < 12; i++) {
|
||||
//if (!pCtx->pSps->bSeqScalingListPresentFlag[i]) {
|
||||
if (!pCtx->pPps->bPicScalingListPresentFlag[i]) {
|
||||
if (i < 6) {
|
||||
|
||||
|
||||
if (i == 0 || i == 3)
|
||||
memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pSps->iScalingList4x4[i], 16 * sizeof (uint8_t));
|
||||
else
|
||||
memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pPps->iScalingList4x4[i - 1], 16 * sizeof (uint8_t));
|
||||
} else {
|
||||
|
||||
if (i == 6 || i == 7)
|
||||
memcpy (pCtx->pPps->iScalingList8x8[ i - 6 ], pCtx->pSps->iScalingList8x8[ i - 6 ], 64 * sizeof (uint8_t));
|
||||
else
|
||||
memcpy (pCtx->pPps->iScalingList8x8[ i - 6 ], pCtx->pPps->iScalingList8x8[i - 8], 64 * sizeof (uint8_t));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//TO DO, SUPPORT 8x8 SCALINGlist
|
||||
|
||||
|
||||
}
|
||||
//Init dequant coeff value for different QP
|
||||
@ -959,10 +972,17 @@ int32_t WelsCalcDeqCoeffScalingList (PWelsDecoderContext pCtx) {
|
||||
pCtx->pDequant_coeff4x4[i][q][x] = pCtx->pPps->bPicScalingMatrixPresentFlag ? pCtx->pPps->iScalingList4x4[i][x] *
|
||||
g_kuiDequantCoeff[q][x & 0x07] : pCtx->pSps->iScalingList4x4[i][x] * g_kuiDequantCoeff[q][x & 0x07];
|
||||
}
|
||||
for (y = 0; y < 64; y++) {
|
||||
pCtx->pDequant_coeff8x8[i][q][y] = pCtx->pPps->bPicScalingMatrixPresentFlag ? pCtx->pPps->iScalingList8x8[i][y] *
|
||||
g_kuiDequantCoeff[q][x & 0x07] : pCtx->pSps->iScalingList8x8[i][y] * g_kuiDequantCoeff[q][x &
|
||||
0x07];//pseudo-code ,holding for 8x8transform into
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pCtx->bDequantCoeff4x4Init = true;
|
||||
pCtx->iDequantCoeffPpsid = pCtx->pPps->iPpsId;
|
||||
}
|
||||
} else
|
||||
pCtx->bUseScalingList = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user