?? createrh264avcdecoder.cpp
字號:
/*
********************************************************************************
NOTE - One of the two copyright statements below may be chosen
that applies for the software.
********************************************************************************
This software module was originally developed by
Heiko Schwarz (Fraunhofer HHI),
Tobias Hinz (Fraunhofer HHI),
Karsten Suehring (Fraunhofer HHI)
in the course of development of the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video
Coding) for reference purposes and its performance may not have been optimized.
This software module is an implementation of one or more tools as specified by
the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding).
Those intending to use this software module in products are advised that its
use may infringe existing patents. ISO/IEC have no liability for use of this
software module or modifications thereof.
Assurance that the originally developed software module can be used
(1) in the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding) once the
ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding) has been adopted; and
(2) to develop the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding):
To the extent that Fraunhofer HHI owns patent rights that would be required to
make, use, or sell the originally developed software module or portions thereof
included in the ISO/IEC 14496-10:2005 Amd.1 (Scalable Video Coding) in a
conforming product, Fraunhofer HHI will assure the ISO/IEC that it is willing
to negotiate licenses under reasonable and non-discriminatory terms and
conditions with applicants throughout the world.
Fraunhofer HHI retains full right to modify and use the code for its own
purpose, assign or donate the code to a third party and to inhibit third
parties from using the code for products that do not conform to MPEG-related
ITU Recommendations and/or ISO/IEC International Standards.
This copyright notice must be included in all copies or derivative works.
Copyright (c) ISO/IEC 2005.
********************************************************************************
COPYRIGHT AND WARRANTY INFORMATION
Copyright 2005, International Telecommunications Union, Geneva
The Fraunhofer HHI hereby donate this source code to the ITU, with the following
understanding:
1. Fraunhofer HHI retain the right to do whatever they wish with the
contributed source code, without limit.
2. Fraunhofer HHI retain full patent rights (if any exist) in the technical
content of techniques and algorithms herein.
3. The ITU shall make this code available to anyone, free of license or
royalty fees.
DISCLAIMER OF WARRANTY
These software programs are available to the user without any license fee or
royalty on an "as is" basis. The ITU disclaims any and all warranties, whether
express, implied, or statutory, including any implied warranties of
merchantability or of fitness for a particular purpose. In no event shall the
contributor or the ITU be liable for any incidental, punitive, or consequential
damages of any kind whatsoever arising from the use of these programs.
This disclaimer of warranty extends to the user of these programs and user's
customers, employees, agents, transferees, successors, and assigns.
The ITU does not represent or warrant that the programs furnished hereunder are
free of infringement of any third-party patents. Commercial implementations of
ITU-T Recommendations, including shareware, may be subject to royalty fees to
patent holders. Information regarding the ITU-T patent policy is available from
the ITU Web site at http://www.itu.int.
THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.
********************************************************************************
*/
#include "H264AVCDecoderLib.h"
#include "H264AVCDecoder.h"
#include "GOPDecoder.h"
#include "ControlMngH264AVCDecoder.h"
#include "SliceReader.h"
#include "SliceDecoder.h"
#include "UvlcReader.h"
#include "MbParser.h"
#include "MbDecoder.h"
#include "NalUnitParser.h"
#include "BitReadBuffer.h"
#include "CabacReader.h"
#include "CabaDecoder.h"
#include "FGSSubbandDecoder.h"
#include "H264AVCCommonLib/MbData.h"
#include "H264AVCCommonLib/Frame.h"
#include "H264AVCCommonLib/FrameMng.h"
#include "H264AVCCommonLib/LoopFilter.h"
#include "H264AVCCommonLib/Transform.h"
#include "H264AVCCommonLib/IntraPrediction.h"
#include "H264AVCCommonLib/MotionCompensation.h"
#include "H264AVCCommonLib/YuvBufferCtrl.h"
#include "H264AVCCommonLib/QuarterPelFilter.h"
#include "H264AVCCommonLib/SampleWeighting.h"
#include "H264AVCCommonLib/ParameterSetMng.h"
#include "H264AVCCommonLib/PocCalculator.h"
#include "CreaterH264AVCDecoder.h"
#include "H264AVCCommonLib/TraceFile.h"
#include "H264AVCCommonLib/ReconstructionBypass.h"
H264AVC_NAMESPACE_BEGIN
CreaterH264AVCDecoder::CreaterH264AVCDecoder():
m_pcH264AVCDecoder ( NULL ),
m_pcRQFGSDecoder ( NULL ),
m_pcFrameMng ( NULL ),
m_pcParameterSetMng ( NULL ),
m_pcSliceReader ( NULL ),
m_pcNalUnitParser ( NULL ),
m_pcSliceDecoder ( NULL ),
m_pcControlMng ( NULL ),
m_pcBitReadBuffer ( NULL ),
m_pcUvlcReader ( NULL ),
m_pcMbParser ( NULL ),
m_pcLoopFilter ( NULL ),
m_pcMbDecoder ( NULL ),
m_pcTransform ( NULL ),
m_pcIntraPrediction ( NULL ),
m_pcMotionCompensation ( NULL ),
m_pcQuarterPelFilter ( NULL ),
m_pcCabacReader ( NULL ),
m_pcSampleWeighting ( NULL )
{
//::memset( m_apcDecodedPicBuffer, 0x00, MAX_LAYERS * sizeof( Void* ) );
//::memset( m_apcMCTFDecoder, 0x00, MAX_LAYERS * sizeof( Void* ) );
::memset( m_apcPocCalculator, 0x00, MAX_LAYERS * sizeof( Void* ) );
::memset( m_apcYuvFullPelBufferCtrl, 0x00, MAX_LAYERS * sizeof( Void* ) );
}
CreaterH264AVCDecoder::~CreaterH264AVCDecoder()
{
}
//SEI {
Bool
CreaterH264AVCDecoder::DecideDecodeView()
{
return m_pcH264AVCDecoder->DecideDecodeView();
}
Bool
CreaterH264AVCDecoder::getActiveViewFlag(UInt ViewId)
{
return m_pcH264AVCDecoder->getActiveViewFlag( ViewId );
}
//SEI }
ErrVal
CreaterH264AVCDecoder::process( PicBuffer* pcPicBuffer,
PicBufferList& rcPicBufferOutputList,
PicBufferList& rcPicBufferUnusedList,
PicBufferList& rcPicBufferReleaseList )
{
return m_pcH264AVCDecoder->process( pcPicBuffer,
rcPicBufferOutputList,
rcPicBufferUnusedList,
rcPicBufferReleaseList );
}
ErrVal
CreaterH264AVCDecoder::initPacket( BinDataAccessor* pcBinDataAccessor,
UInt& ruiNalUnitType,
UInt& uiMbX,
UInt& uiMbY,
UInt& uiSize
//,UInt& uiNonRequiredPic //NonRequired JVT-Q066
//JVT-P031
,Bool bPreParseHeader //FRAG_FIX
, Bool bConcatenated //FRAG_FIX_3
,Bool& rbStartDecoding,
UInt& ruiStartPos,
UInt& ruiEndPos,
Bool& bFragmented,
Bool& bDiscardable
//~JVT-P031
)
{
return m_pcH264AVCDecoder->initPacket( pcBinDataAccessor,
ruiNalUnitType,
uiMbX,
uiMbY,
uiSize
//,uiNonRequiredPic //NonRequired JVT-Q066
//JVT-P031
, bPreParseHeader //FRAG_FIX
, bConcatenated //FRAG_FIX_3
,rbStartDecoding,
ruiStartPos,
ruiEndPos,
bFragmented,
bDiscardable
//~JVT-P031
,UnitAVCFlag //JVT-S036 lsj
);
}
//JVT-S036 start
ErrVal
CreaterH264AVCDecoder::initPacketSuffix( BinDataAccessor* pcBinDataAccessor,
UInt& ruiNalUnitType,
Bool bPreParseHeader, //FRAG_FIX
Bool bConcatenated, //FRAG_FIX_3
Bool& rbStarDecoding
,CreaterH264AVCDecoder* pcH264AVCDecoder
,Bool& SuffixEnable
)
{
return m_pcH264AVCDecoder->initPacketPrefix( pcBinDataAccessor,
ruiNalUnitType
, bPreParseHeader //FRAG_FIX
, bConcatenated,//FRAG_FIX_3
rbStarDecoding
,pcH264AVCDecoder->getH264AVCDecoder()->getSliceHeader()
,pcH264AVCDecoder->getNalUnitParser()
);
}
//JVT-S036 end
//JVT-P031
ErrVal
CreaterH264AVCDecoder::initPacket ( BinDataAccessor* pcBinDataAccessor)
{
return( m_pcH264AVCDecoder->initPacket(pcBinDataAccessor) );
}
Void
CreaterH264AVCDecoder::decreaseNumOfNALInAU()
{
m_pcH264AVCDecoder->decreaseNumOfNALInAU();
}
Void
CreaterH264AVCDecoder::setDependencyInitialized(Bool b)
{
m_pcH264AVCDecoder->setDependencyInitialized(b);
}
UInt
CreaterH264AVCDecoder::getNumOfNALInAU()
{
return m_pcH264AVCDecoder->getNumOfNALInAU();
}
Void CreaterH264AVCDecoder::initNumberOfFragment()
{
m_pcH264AVCDecoder->initNumberOfFragment();
}
//~JVT-P031
//JVT-T054{
Void
CreaterH264AVCDecoder::setFGSRefInAU(Bool &b)
{
m_pcH264AVCDecoder->setFGSRefInAU(b);
}
//JVT-T054}
ErrVal
CreaterH264AVCDecoder::checkSliceLayerDependency( BinDataAccessor* pcBinDataAccessor,
Bool& bFinishChecking )
{
return m_pcH264AVCDecoder->checkSliceLayerDependency( pcBinDataAccessor, bFinishChecking
,UnitAVCFlag //JVT-S036
);
}
//NonRequired JVT-Q066
UInt
CreaterH264AVCDecoder::isNonRequiredPic()
{
return m_pcH264AVCDecoder->isNonRequiredPic();
}
//TMM_EC {{
ErrVal
CreaterH264AVCDecoder::checkSliceGap( BinDataAccessor* pcBinDataAccessor,
MyList<BinData*>& cVirtualSliceList)
{
return m_pcH264AVCDecoder->checkSliceGap( pcBinDataAccessor, cVirtualSliceList
,UnitAVCFlag //JVT-S036
);
}
ErrVal
CreaterH264AVCDecoder::setec( UInt uiErrorConceal)
{
return m_pcH264AVCDecoder->setec( uiErrorConceal);
}
//TMM_EC }}
// FMO DECODE Init ICU/ETRI DS
Void
CreaterH264AVCDecoder::RoiDecodeInit()
{
m_pcH264AVCDecoder->RoiDecodeInit();
}
//JVT-V054
UInt*
CreaterH264AVCDecoder::getViewCodingOrder()
{
return m_pcH264AVCDecoder->getViewOrder();
// Dec. 1 fix
}
ErrVal CreaterH264AVCDecoder::create( CreaterH264AVCDecoder*& rpcCreaterH264AVCDecoder )
{
rpcCreaterH264AVCDecoder = new CreaterH264AVCDecoder;
ROT( NULL == rpcCreaterH264AVCDecoder );
RNOK( rpcCreaterH264AVCDecoder->xCreateDecoder() )
return Err::m_nOK;
}
ErrVal CreaterH264AVCDecoder::xCreateDecoder()
{
RNOK( ParameterSetMng ::create( m_pcParameterSetMng ) );
RNOK( FrameMng ::create( m_pcFrameMng ) );
RNOK( BitReadBuffer ::create( m_pcBitReadBuffer ) );
RNOK( NalUnitParser ::create( m_pcNalUnitParser) );
RNOK( SliceReader ::create( m_pcSliceReader ) );
RNOK( SliceDecoder ::create( m_pcSliceDecoder ) );
RNOK( UvlcReader ::create( m_pcUvlcReader ) );
RNOK( CabacReader ::create( m_pcCabacReader ) );
RNOK( MbParser ::create( m_pcMbParser ) );
RNOK( MbDecoder ::create( m_pcMbDecoder ) );
RNOK( LoopFilter ::create( m_pcLoopFilter ) );
RNOK( IntraPrediction ::create( m_pcIntraPrediction ) );
RNOK( MotionCompensation ::create( m_pcMotionCompensation ) );
RNOK( H264AVCDecoder ::create( m_pcH264AVCDecoder ) );
RNOK( RQFGSDecoder ::create( m_pcRQFGSDecoder ) );
RNOK( ControlMngH264AVCDecoder ::create( m_pcControlMng ) );
RNOK( ReconstructionBypass ::create(m_pcReconstructionBypass) );
for( UInt uiLayer = 0; uiLayer < MAX_LAYERS; uiLayer++ )
{
//RNOK( DecodedPicBuffer ::create( m_apcDecodedPicBuffer [uiLayer] ) );
// RNOK( MCTFDecoder ::create( m_apcMCTFDecoder [uiLayer] ) );
// save memory: ying
RNOK( PocCalculator ::create( m_apcPocCalculator [uiLayer] ) );
RNOK( YuvBufferCtrl ::create( m_apcYuvFullPelBufferCtrl [uiLayer] ) );
}
RNOK( SampleWeighting ::create( m_pcSampleWeighting ) );
RNOK( QuarterPelFilter ::create( m_pcQuarterPelFilter ) );
RNOK( Transform ::create( m_pcTransform ) );
return Err::m_nOK;
}
ErrVal CreaterH264AVCDecoder::destroy()
{
RNOK( m_pcFrameMng ->destroy() );
RNOK( m_pcSliceDecoder ->destroy() );
RNOK( m_pcSliceReader ->destroy() );
RNOK( m_pcBitReadBuffer ->destroy() );
RNOK( m_pcUvlcReader ->destroy() );
RNOK( m_pcMbParser ->destroy() );
RNOK( m_pcLoopFilter ->destroy() );
RNOK( m_pcMbDecoder ->destroy() );
RNOK( m_pcTransform ->destroy() );
RNOK( m_pcIntraPrediction ->destroy() );
RNOK( m_pcMotionCompensation ->destroy() );
RNOK( m_pcQuarterPelFilter ->destroy() );
RNOK( m_pcCabacReader ->destroy() );
RNOK( m_pcNalUnitParser ->destroy() );
RNOK( m_pcParameterSetMng ->destroy() );
RNOK( m_pcSampleWeighting ->destroy() );
RNOK( m_pcH264AVCDecoder ->destroy() );
RNOK( m_pcRQFGSDecoder ->destroy() );
RNOK( m_pcControlMng ->destroy() );
RNOK( m_pcReconstructionBypass ->destroy() );
for( UInt uiLayer = 0; uiLayer < MAX_LAYERS; uiLayer++ )
{
//RNOK( m_apcDecodedPicBuffer [uiLayer]->destroy() );
// RNOK( m_apcMCTFDecoder [uiLayer]->destroy() );
// save memory:
RNOK( m_apcPocCalculator [uiLayer]->destroy() );
RNOK( m_apcYuvFullPelBufferCtrl[uiLayer]->destroy() );
}
delete this;
return Err::m_nOK;
}
ErrVal CreaterH264AVCDecoder::init( Bool bOpenTrace, DecoderParameter *Dec_Param)
{
if( bOpenTrace )
{
INIT_DTRACE(0, Dec_Param->getNumOfViews());
OPEN_DTRACE;
}
UnitAVCFlag = false; //JVT-S036
RNOK( m_pcBitReadBuffer ->init() );
RNOK( m_pcNalUnitParser ->init( m_pcBitReadBuffer ));
RNOK( m_pcUvlcReader ->init( m_pcBitReadBuffer ) );
RNOK( m_pcCabacReader ->init( m_pcBitReadBuffer ) );
RNOK( m_pcQuarterPelFilter ->init() );
RNOK( m_pcParameterSetMng ->init() );
RNOK( m_pcSampleWeighting ->init() );
RNOK( m_pcFrameMng ->init( m_apcYuvFullPelBufferCtrl[0] ) );
RNOK( m_pcSliceDecoder ->init( m_pcMbDecoder,
m_pcControlMng,
m_pcTransform) );
RNOK( m_pcSliceReader ->init( m_pcUvlcReader,
m_pcParameterSetMng,
m_pcMbParser,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -