?? createrh264avcdecoder.cpp
字號(hào):
m_pcControlMng ) );
RNOK( m_pcMbParser ->init( m_pcTransform ) );
RNOK( m_pcLoopFilter ->init( m_pcControlMng , m_pcReconstructionBypass ) );
RNOK( m_pcIntraPrediction ->init() );
RNOK( m_pcMotionCompensation ->init( m_pcQuarterPelFilter,
m_pcTransform,
m_pcSampleWeighting ) );
RNOK( m_pcMbDecoder ->init( m_pcTransform,
m_pcIntraPrediction,
m_pcMotionCompensation,
m_pcFrameMng ) );
RNOK( m_pcH264AVCDecoder ->init( //m_apcMCTFDecoder,
m_pcSliceReader,
m_pcSliceDecoder,
m_pcRQFGSDecoder,
m_pcFrameMng,
m_pcNalUnitParser,
m_pcControlMng,
m_pcLoopFilter,
m_pcUvlcReader,
m_pcParameterSetMng,
m_apcPocCalculator[0],
m_pcMotionCompensation) );
RNOK( m_pcRQFGSDecoder ->init( m_apcYuvFullPelBufferCtrl,
m_pcTransform,
m_pcMbParser,
m_pcMbDecoder,
m_pcUvlcReader,
m_pcCabacReader) );
RNOK( m_pcReconstructionBypass ->init() );
for( UInt uiLayer = 0; uiLayer < MAX_LAYERS; uiLayer++ )
{
/*RNOK( m_apcDecodedPicBuffer[uiLayer]->init ( m_apcYuvFullPelBufferCtrl [uiLayer],
uiLayer ) );*/
/*RNOK( m_apcMCTFDecoder [uiLayer]->init ( m_pcH264AVCDecoder,
m_pcSliceReader,
m_pcSliceDecoder,
m_pcRQFGSDecoder,
m_pcNalUnitParser,
m_pcControlMng,
m_pcLoopFilter,
m_pcUvlcReader,
m_pcParameterSetMng,
m_apcPocCalculator [uiLayer],
m_apcYuvFullPelBufferCtrl [uiLayer],
m_apcDecodedPicBuffer [uiLayer],
m_pcMotionCompensation,
m_pcQuarterPelFilter ) );*/
}
RNOK( m_pcControlMng ->init( m_pcFrameMng,
m_pcParameterSetMng,
m_apcPocCalculator,
m_pcSliceReader,
m_pcNalUnitParser,
m_pcSliceDecoder,
m_pcBitReadBuffer,
m_pcUvlcReader,
m_pcMbParser,
m_pcLoopFilter,
m_pcMbDecoder,
m_pcTransform,
m_pcIntraPrediction,
m_pcMotionCompensation,
m_apcYuvFullPelBufferCtrl,
m_pcQuarterPelFilter,
m_pcCabacReader,
m_pcSampleWeighting,
//m_apcMCTFDecoder,
m_pcH264AVCDecoder ) );
return Err::m_nOK;
}
ErrVal CreaterH264AVCDecoder::uninit( Bool bCloseTrace )
{
RNOK( m_pcSampleWeighting ->uninit() );
RNOK( m_pcQuarterPelFilter ->uninit() );
RNOK( m_pcFrameMng ->uninit() );
RNOK( m_pcParameterSetMng ->uninit() );
RNOK( m_pcSliceDecoder ->uninit() );
RNOK( m_pcSliceReader ->uninit() );
RNOK( m_pcBitReadBuffer ->uninit() );
RNOK( m_pcUvlcReader ->uninit() );
RNOK( m_pcMbParser ->uninit() );
RNOK( m_pcLoopFilter ->uninit() );
RNOK( m_pcMbDecoder ->uninit() );
RNOK( m_pcIntraPrediction ->uninit() );
RNOK( m_pcMotionCompensation ->uninit() );
RNOK( m_pcCabacReader ->uninit() );
RNOK( m_pcH264AVCDecoder ->uninit() );
RNOK( m_pcRQFGSDecoder ->uninit() );
RNOK( m_pcControlMng ->uninit() );
RNOK( m_pcReconstructionBypass ->uninit() );
for( UInt uiLayer = 0; uiLayer < MAX_LAYERS; uiLayer++ )
{
//RNOK( m_apcDecodedPicBuffer [uiLayer] ->uninit() );
//RNOK( m_apcMCTFDecoder [uiLayer] ->uninit() );
RNOK( m_apcYuvFullPelBufferCtrl[uiLayer] ->uninit() );
}
if( bCloseTrace )
{
CLOSE_DTRACE;
}
return Err::m_nOK;
}
H264AVCPacketAnalyzer::H264AVCPacketAnalyzer()
: m_pcBitReadBuffer ( NULL )
, m_pcUvlcReader ( NULL )
, m_pcNalUnitParser ( NULL )
, m_pcNonRequiredSEI ( NULL )
, m_uiStdAVCOffset ( 0 )
, m_bAVCCompatible (false)//BUG FIX Kai Zhang
{
for(int iLayer=0;iLayer<MAX_SCALABLE_LAYERS;iLayer++)
{
m_silceIDOfSubPicLayer[iLayer] = -1;
}
}
H264AVCPacketAnalyzer::~H264AVCPacketAnalyzer()
{
}
ErrVal
H264AVCPacketAnalyzer::process( BinData* pcBinData,
PacketDescription& rcPacketDescription,
SEI::SEIMessage*& pcScalableSEIMessage )
{
pcScalableSEIMessage = 0;
UChar ucByte = (pcBinData->data())[0];
NalUnitType eNalUnitType = NalUnitType ( ucByte & 0x1F );
NalRefIdc eNalRefIdc = NalRefIdc ( ucByte >> 5 );
UInt uiLayer = 0;
UInt uiLevel = 0;
UInt uiFGSLayer = 0;
Bool bApplyToNext = false;
//{{Variable Lengh NAL unit header data with priority and dead substream flag
//France Telecom R&D- (nathalie.cammas@francetelecom.com)
UInt uiSimplePriorityId = 0;
Bool bDiscardableFlag = false;
Bool bReservedZeroBit = false; //JVT-S036
//SEI {
Bool bSvcMvcFlag = false;
Bool bAnchorPicFlag = false;
UInt uiViewId = 0;
//SEI
Bool bFragmentedFlag = false; //JVT-P031
UInt uiFragmentOrder = 0; //JVT-P031
Bool bLastFragmentFlag = false; //JVT-P031
rcPacketDescription.uiNumLevelsQL = 0;
for(UInt ui = 0; ui < MAX_NUM_RD_LEVELS; ui++)
{
rcPacketDescription.auiDeltaBytesRateOfLevelQL[ui] = 0;
rcPacketDescription.auiQualityLevelQL[ui] = 0;
}
//}}Quality level estimation and modified truncation- JVTO044 and m12007
Bool bScalable = ( eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_SCALABLE ||
eNalUnitType == NAL_UNIT_CODED_SLICE_SCALABLE );
UInt uiSPSid = 0;
UInt uiPPSid = 0;
Bool bParameterSet = ( eNalUnitType == NAL_UNIT_SPS ||
eNalUnitType == NAL_UNIT_PPS );
if( eNalUnitType == NAL_UNIT_CODED_SLICE_SCALABLE ||
eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_SCALABLE )
{
//{{Variable Lengh NAL unit header data with priority and dead substream flag
//France Telecom R&D- (nathalie.cammas@francetelecom.com)
ucByte = (pcBinData->data())[1];
uiSimplePriorityId = ( ucByte >> 2);
bDiscardableFlag = ( ucByte >> 1) & 1;
//JVT-S036 start
//SEI {
bSvcMvcFlag = ( ( ucByte >> 7 ) !=0);
if( bSvcMvcFlag )
{
uiSimplePriorityId = ( ucByte >> 1 ) & 63;
uiLevel = ( ucByte ) & 1;
ucByte = pcBinData->data()[2];
uiLevel = uiLevel*4 + (ucByte >> 6);
bAnchorPicFlag = ( ucByte >> 5 ) & 1;
uiViewId = ( ucByte ) & 31;
ucByte = pcBinData->data()[3];
uiViewId = uiViewId * (2^5) + ( ucByte >> 3 );
}
else
{
uiSimplePriorityId = ( ucByte >> 1) & 63;
bDiscardableFlag = ( ucByte ) & 1;
ucByte = pcBinData->data()[2];
bReservedZeroBit = ( ucByte ) & 1;
uiLevel = ( ucByte >> 4 ) & 7;
uiLayer = ( ucByte >> 1 ) & 7;
uiFGSLayer = ( ucByte ) & 1;
ucByte = pcBinData->data()[3];
uiFGSLayer = uiFGSLayer*2 + ( ucByte >> 7);
}
/* bReservedZeroBit = ( ucByte ) & 1;
ucByte = pcBinData->data()[2];
uiLevel = ( ucByte >> 5 );
uiLayer = ( ucByte >> 2 ) & 7;
uiFGSLayer = ( ucByte ) & 3;*/
//SEI }
/* }
else
{
// Look up simple priority ID in mapping table (J. Ridge, Y-K. Wang @ Nokia)
uiLevel = m_uiTemporalLevelList[uiSimplePriorityId];
uiLayer = m_uiDependencyIdList [uiSimplePriorityId];
uiFGSLayer = m_uiQualityLevelList [uiSimplePriorityId];
}*/
//JVT-S036 end
//}}Variable Lengh NAL unit header data with priority and dead substream flag
}
else if( eNalUnitType == NAL_UNIT_CODED_SLICE ||
eNalUnitType == NAL_UNIT_CODED_SLICE_IDR )
{
uiLevel = ( eNalRefIdc > 0 ? 0 : 1+m_uiStdAVCOffset);
m_bAVCCompatible=true;//BUG FIX Kai Zhang
}
else if( eNalUnitType == NAL_UNIT_SEI )
{
ULong* pulData = (ULong*)( pcBinData->data() + 1 );
UInt uiSize = 8 * ( pcBinData->size() - 1 ) - 1;
RNOK( m_pcBitReadBuffer->initPacket( pulData, uiSize ) );
uiSize = pcBinData->byteSize();
BinData cBinData( new UChar[uiSize], uiSize );
memcpy( cBinData.data(), pcBinData->data(), uiSize );
BinDataAccessor cBinDataAccessor;
cBinData.setMemAccessor( cBinDataAccessor );
UInt uiNumBytesRemoved; //FIX_FRAG_CAVLC
RNOK( m_pcNalUnitParser->initNalUnit( &cBinDataAccessor, NULL, uiNumBytesRemoved ) ); //FIX_FRAG_CAVLC
SEI::MessageList cMessageList;
//RNOK( SEI::read( m_pcUvlcReader, cMessageList ) );
/* SEI JVT-W060 */
RNOK( SEI::read( m_pcUvlcReader, cMessageList /*, Save_NumViewsMinus1*/ ) ); // Nov. 30
/* ~SEI JVT-W060 */
SEI::MessageList::iterator iter = cMessageList.begin();
while( ! cMessageList.empty() )
{
SEI::SEIMessage* pcSEIMessage = cMessageList.popBack();
switch( pcSEIMessage->getMessageType() )
{
case SEI::VIEW_SCALABILITY_INFO_SEI:
{
pcScalableSEIMessage = pcSEIMessage;
bApplyToNext = true;
break;
}
case SEI::SUB_SEQ_INFO:
{
SEI::SubSeqInfo* pcSubSeqInfo = (SEI::SubSeqInfo*) pcSEIMessage;
uiLevel = pcSubSeqInfo->getSubSeqLayerNum();
uiLayer = 0;
bApplyToNext = true;
delete pcSEIMessage;
break;
}
case SEI::SCALABLE_SEI:
{
uiLevel = 0;
uiLayer = 0;
pcScalableSEIMessage = pcSEIMessage;
{
//====set parameters used for further parsing =====
SEI::ScalableSei* pcSEI = (SEI::ScalableSei*)pcSEIMessage;
UInt uiNumScalableLayers = pcSEI->getNumLayersMinus1() + 1;
for(UInt uiIndex = 0; uiIndex < uiNumScalableLayers; uiIndex++ )
{
if( pcSEI->getDependencyId( uiIndex ) == 0 )
{
// BUG_FIX liuhui{
m_uiStdAVCOffset = pcSEI->getTemporalLevel( uiIndex );
pcSEI->setStdAVCOffset( m_uiStdAVCOffset );
break;
// BUG_FIX liuhui}
}
else
break;
}
}
SEI::ScalableSei* pcSEI = (SEI::ScalableSei*)pcSEIMessage;
m_uiNum_layers = pcSEI->getNumLayersMinus1() + 1;
for(int i=0; i< m_uiNum_layers; i++)
{
m_ID_ROI[i] = pcSEI->getRoiId(i);
m_ID_Dependency[i] = pcSEI->getDependencyId(i);
}
break;
}
case SEI::MOTION_SEI:
{
SEI::MotionSEI* pcSEI = (SEI::MotionSEI*)pcSEIMessage;
m_silceIDOfSubPicLayer[m_layer_id] = pcSEI->m_slice_group_id[0];
break;
}
// JVT-S080 LMI {
case SEI::SCALABLE_SEI_LAYERS_NOT_PRESENT:
case SEI::SCALABLE_SEI_DEPENDENCY_CHANGE:
{
pcScalableSEIMessage = pcSEIMessage;
break;
}
// JVT-S080 LMI }
case SEI::SUB_PIC_SEI:
{
SEI::SubPicSei* pcSEI = (SEI::SubPicSei*)pcSEIMessage;
m_layer_id = pcSEI->getLayerId();
bApplyToNext = true;
break;
}
//{{Quality level estimation and modified truncation- JVTO044 and m12007
//France Telecom R&D-(nathalie.cammas@francetelecom.com)
case SEI::QUALITYLEVEL_SEI:
{
UInt uiNum = 0;
UInt uiDeltaBytesRateOfLevel = 0;
UInt uiQualityLevel = 0;
SEI::QualityLevelSEI* pcSEI = (SEI::QualityLevelSEI*)pcSEIMessage;
uiNum = pcSEI->getNumLevel();
rcPacketDescription.uiNumLevelsQL = uiNum;
for(UInt ui = 0; ui < uiNum; ui++)
{
uiQualityLevel = pcSEI->getQualityLevel(ui);
uiDeltaBytesRateOfLevel = pcSEI->getDeltaBytesRateOfLevel(ui);
rcPacketDescription.auiQualityLevelQL[ui] = uiQualityLevel;
rcPacketDescription.auiDeltaBytesRateOfLevelQL[ui] = uiDeltaBytesRateOfLevel;
}
uiLayer = pcSEI->getDependencyId();
bApplyToNext = true;
break;
}
//}}Quality level estimation and modified truncation- JVTO044 and m12007
case SEI::NON_REQUIRED_SEI:
{
m_pcNonRequiredSEI = (SEI::NonRequiredSei*) pcSEIMessage;
m_uiNonRequiredSeiFlag = 1;
break;
}
//SEI {
case SEI::SCALABLE_NESTING_SEI:
{
Bool bAllPicturesInAuFlag;
UInt uiNumPicturesMinus1;
UInt *puiPicId, uiTemporalId;
SEI::ScalableNestingSei* pcSEI = (SEI::ScalableNestingSei*)pcSEIMessage;
bAllPicturesInAuFlag = pcSEI->getAllPicturesInAuFlag();
if( bAllPicturesInAuFlag == 0 )
{
uiNumPicturesMinus1 = pcSEI->getNumPicturesMinus1();
puiPicId = new UInt[uiNumPicturesMinus1+1];
for( UInt uiIndex = 0; uiIndex <= uiNumPicturesMinus1; uiIndex++ )
{
puiPicId[uiIndex] = pcSEI->getPicId(uiIndex);
}
uiTemporalId = pcSEI->getTemporalId();
delete puiPicId;
}
bApplyToNext = true;
break;
}
case SEI::ACTIVE_VIEWINFO_SEI:
{
Bool bOpPresentFlag;
UInt uiOperationPointId;
UInt uiNumActiveViewsMinus1;
UInt *uiViewId;
SEI::ActiveViewInfoSei* pcSEI = (SEI::ActiveViewInfoSei*)pcSEIMessage;
bOpPresentFlag = pcSEI->getOpPresentFlag();
if( bOpPresentFlag )
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -