📄 umc_vc1_dec_blk_adv.cpp
字号:
IppiBitstream Bitsream;
Bitsream.pBitstream = pContext->m_bitstream.pBitstream;
Bitsream.bitOffset = pContext->m_bitstream.bitOffset;
#endif
ret = ippiDecodeHuffmanOne_1u32s(&pContext->m_bitstream.pBitstream,
&pContext->m_bitstream.bitOffset,
&DCCOEF,
pContext->m_picLayerHeader->m_pCurrChromaDCDiff);
//VM_ASSERT(ret == ippStsNoErr);
if (ret != ippStsNoErr)
throw vc1_exception(vld);
if(DCCOEF != 0)
{
Ipp32u quant = (CurrDC->DoubleQuant >> 1);
if(DCCOEF == IPPVC_ESCAPE)
{
if(quant == 1)
{
VC1_GET_BITS(10, DCCOEF);
}
else if(quant == 2)
{
VC1_GET_BITS(9, DCCOEF);
}
else // pContext->m_pCurrMB->MQUANT is > 2
{
VC1_GET_BITS(8, DCCOEF);
}
}
else
{ // DCCOEF is not IPPVC_ESCAPE
Ipp32s tmp;
if(quant == 1)
{
VC1_GET_BITS(2, tmp);
DCCOEF = DCCOEF*4 + tmp - 3;
}
else if(quant == 2)
{
VC1_GET_BITS(1, tmp);
DCCOEF = DCCOEF*2 + tmp - 1;
}
}
VC1_GET_BITS(1, DCSIGN);
DCCOEF = (1 - (DCSIGN<<1))* DCCOEF;
//if (DCSIGN == 1)
// DCCOEF = -DCCOEF;
}
CurrBlk->DC = (Ipp16s)DCCOEF;
pBlock->blkType = DCPredictionTable[ACPRED](CurrBlk, DCPred, blk_num, m_pBlock, pContext->m_picLayerHeader->FCM);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,VM_STRING("DC diff = %d\n"),DCCOEF);
#endif
if(pContext->m_pCurrMB->m_cbpBits & (1<<(5-blk_num)))
{
const Ipp8u* curr_scan = pContext->m_pSingleMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
DecodeBlockACIntra_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, pContext->m_picLayerHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo);
}
for(i = 1; i < 8; i++)
{
CurrBlk->ACLEFT[i] = m_pBlock[i*8];
CurrBlk->ACTOP[i] = m_pBlock[i];
}
STATISTICS_END_TIME(m_timeStatistics->decoding_Intra_StartTime,
m_timeStatistics->decoding_Intra_EndTime,
m_timeStatistics->decoding_Intra_TotalTime);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
VM_STRING("DC = %d\n"),
pContext->CurrDC->DCBlkPred[blk_num].DC);
//NEED!
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Block %d\n", blk_num);
for(Ipp32u k = 0; k<8; k++)
{
for (Ipp32u t = 0; t<8; t++)
{
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"%d ", m_pBlock[k*8 + t]);
}
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS, "\n");
}
#endif
#ifdef UMC_STREAM_ANALYZER
Ipp32u bit_shift = CalculateUsedBits(Bitsream,pContext->m_bitstream);
pContext->m_pCurrMB->pMbAnalyzInfo->dwNumBitsRes += bit_shift;
#endif
return VC1_OK;
}
VC1Status VC1ProcessDiffIntra(VC1Context* pContext, Ipp32s blk_num)
{
Ipp16s* m_pBlock = pContext->m_pBlock; //memory for 16s diffs
IppiSize roiSize;
roiSize.height = VC1_PIXEL_IN_BLOCK;
roiSize.width = VC1_PIXEL_IN_BLOCK;
Ipp16s bias = 128;
if ((pContext->m_seqLayerHeader->PROFILE != VC1_PROFILE_ADVANCED)&&
((pContext->m_picLayerHeader->PTYPE == VC1_I_FRAME)||
(pContext->m_picLayerHeader->PTYPE == VC1_BI_FRAME)))
bias = pContext->m_pCurrMB->bias;
STATISTICS_START_TIME(m_timeStatistics->reconstruction_StartTime);
*(pContext->m_pBlock+VC1_BlkStart[blk_num]) = *(pContext->m_pBlock+VC1_BlkStart[blk_num])
* (Ipp16s)pContext->CurrDC->DCStepSize;
if(pContext->m_picLayerHeader->QuantizationType == VC1_QUANTIZER_UNIFORM)
_own_ippiReconstructIntraUniform_VC1_16s_C1IR(pContext->m_pBlock+ VC1_BlkStart[blk_num],
VC1_pixel_table[blk_num]*2,
pContext->CurrDC->DoubleQuant);
else
_own_ippiReconstructIntraNonuniform_VC1_16s_C1IR(pContext->m_pBlock+ VC1_BlkStart[blk_num],
VC1_pixel_table[blk_num]*2,
pContext->CurrDC->DoubleQuant);
roiSize.height = VC1_PIXEL_IN_BLOCK;
roiSize.width = VC1_PIXEL_IN_BLOCK;
ippiAddC_16s_C1IRSfs(bias, m_pBlock + VC1_BlkStart[blk_num],
2*VC1_pixel_table[blk_num], roiSize, 0);
STATISTICS_END_TIME(m_timeStatistics->reconstruction_StartTime,
m_timeStatistics->reconstruction_EndTime,
m_timeStatistics->reconstruction_TotalTime);
return VC1_OK;
}
VC1Status BLKLayer_Inter_Luma_Adv(VC1Context* pContext, Ipp32s blk_num)
{
Ipp16s* m_pBlock = pContext->m_pBlock + VC1_BlkStart[blk_num];
VC1Block* pBlock = &pContext->m_pCurrMB->m_pBlocks[blk_num];
const Ipp8u* curr_scan = NULL;
Ipp8u numCoef = 0;
VC1SingletonMB* sMB = pContext->m_pSingleMB;
VC1PictureLayerHeader * picHeader = pContext->m_picLayerHeader;
STATISTICS_START_TIME(m_timeStatistics->decoding_Inter_StartTime);
#ifdef UMC_STREAM_ANALYZER
IppiBitstream Bitsream;
Bitsream.pBitstream = pContext->m_bitstream.pBitstream;
Bitsream.bitOffset = pContext->m_bitstream.bitOffset;
#endif
if(pContext->m_pCurrMB->m_cbpBits & (1<<(5-blk_num)))
{
switch (pBlock->blkType)
{
case VC1_BLK_INTER8X8:
{
curr_scan = sMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
sMB->m_pSingleBlock[blk_num].numCoef = VC1_SBP_0;
DecodeBlockInter8x8_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan,picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, VC1_SBP_0);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS, "Inter\n");
#endif
}
break;
case VC1_BLK_INTER8X4:
{
curr_scan = sMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
if (sMB->m_ubNumFirstCodedBlk < blk_num || picHeader->TTFRM == pBlock->blkType)
numCoef = GetSubBlockPattern_8x4_4x8(pContext, blk_num);
else
numCoef = sMB->m_pSingleBlock[blk_num].numCoef;
DecodeBlockInter8x4_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, numCoef);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS, "Inter 8x4\n");
#endif
}
break;
case VC1_BLK_INTER4X8:
{
curr_scan = sMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
if (sMB->m_ubNumFirstCodedBlk < blk_num || picHeader->TTFRM == pBlock->blkType)
numCoef = GetSubBlockPattern_8x4_4x8(pContext, blk_num);
else
numCoef = sMB->m_pSingleBlock[blk_num].numCoef;
DecodeBlockInter4x8_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, numCoef);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter 4x8\n");
#endif
}
break;
case VC1_BLK_INTER4X4:
{
curr_scan = sMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
numCoef = GetSubBlockPattern_4x4(pContext, blk_num);
DecodeBlockInter4x4_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, numCoef);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter 4x4\n");
#endif
}
break;
case VC1_BLK_INTER:
{
numCoef = GetTTBLK(pContext, blk_num);
curr_scan = sMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
switch (pBlock->blkType)
{
case VC1_BLK_INTER8X8:
{
DecodeBlockInter8x8_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, VC1_SBP_0);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter\n");
#endif
}
break;
case VC1_BLK_INTER8X4:
{
DecodeBlockInter8x4_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, numCoef);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter 8x4\n");
#endif
}
break;
case VC1_BLK_INTER4X8:
{
DecodeBlockInter4x8_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, numCoef);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter 4x8\n");
#endif
}
break;
case VC1_BLK_INTER4X4:
{
numCoef = GetSubBlockPattern_4x4(pContext, blk_num);
DecodeBlockInter4x4_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, numCoef);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter 4x4\n");
#endif
}
break;
}
}
break;
default:
VM_ASSERT(0);
}
STATISTICS_END_TIME(m_timeStatistics->decoding_Inter_StartTime,
m_timeStatistics->decoding_Inter_EndTime,
m_timeStatistics->decoding_Inter_TotalTime);
}
#ifdef VC1_DEBUG_ON
//NEED!
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Block %d\n", blk_num);
for(Ipp32u k = 0; k<8; k++)
{
for (Ipp32u t = 0; t<8; t++)
{
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"%d ", m_pBlock[k*16 + t]);
}
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS, "\n");
}
#endif
#ifdef UMC_STREAM_ANALYZER
Ipp32u bit_shift = CalculateUsedBits(Bitsream,pContext->m_bitstream);
pContext->m_pCurrMB->pMbAnalyzInfo->dwNumBitsRes += bit_shift;
#endif
return VC1_OK;
}
VC1Status BLKLayer_Inter_Chroma_Adv(VC1Context* pContext, Ipp32s blk_num)
{
Ipp16s* m_pBlock = pContext->m_pBlock + VC1_BlkStart[blk_num];
VC1Block* pBlock = &pContext->m_pCurrMB->m_pBlocks[blk_num];
const Ipp8u* curr_scan = NULL;
Ipp8u numCoef = 0;
VC1SingletonMB* sMB = pContext->m_pSingleMB;
VC1PictureLayerHeader * picHeader = pContext->m_picLayerHeader;
STATISTICS_START_TIME(m_timeStatistics->decoding_Inter_StartTime);
#ifdef UMC_STREAM_ANALYZER
IppiBitstream Bitsream;
Bitsream.pBitstream = pContext->m_bitstream.pBitstream;
Bitsream.bitOffset = pContext->m_bitstream.bitOffset;
#endif
if(pContext->m_pCurrMB->m_cbpBits & (1<<(5-blk_num)))
{
switch (pBlock->blkType)
{
case VC1_BLK_INTER8X8:
{
curr_scan = sMB->ZigzagTable[VC1_BlockTable[pBlock->blkType]];
if(curr_scan==NULL)
return VC1_FAIL;
sMB->m_pSingleBlock[blk_num].numCoef = VC1_SBP_0;
DecodeBlockInter8x8_VC1(&pContext->m_bitstream, m_pBlock,
curr_scan, picHeader->m_pCurrInterACDecSet,
&pContext->m_pSingleMB->EscInfo, VC1_SBP_0);
#ifdef VC1_DEBUG_ON
VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_COEFFS,
"Inter 8x8\n");
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -