printf("JMVC %s Encoder\n\n",_JMVC_VERSION_);
定义H264AVCEncoderTest类的对象指针
H264AVCEncoderTest* pcH264AVCEncoderTest = NULL;
创建对象
RNOK( H264AVCEncoderTest::create( pcH264AVCEncoderTest ) );
ErrVal H264AVCEncoderTest::create( H264AVCEncoderTest*& rpcH264AVCEncoderTest )
**********************************************************************************
RNOKS( pcH264AVCEncoderTest->init ( argc, argv ) );
ErrVal H264AVCEncoderTest::init( Int argc, Char** argv )
EncoderCodingParameter::create( m_pcEncoderCodingParameter )
m_pcEncoderCodingParameter->init( argc, argv, m_cEncoderIoParameter.cBitstreamFilename )
if( equals( pcCom, "-vf", 4) ) //-vf是什么意思?
{
ROTS( NULL == argv[n] );
ROTS( NULL == argv[n+1] );
std::string cFilename = argv[n++]; //输入测试序列名
UInt uiViewid = atoi(argv[n]); //多视点的视点id
RNOKS( xReadFromFile( cFilename, uiViewid, rcBitstreamFile ) ); // Read-in SPS parameters
continue;
}
fopen( rcFilename.c_str(), "r"); //打开文件encoderMVC.cfg
m_pEncoderLines[MAX_CONFIG_PARAMS] //保存encoderMVC.cfg中各种数据
EncoderCodingParameter::xReadFromFile() //读入 序列参数集 信息 View_2的参数集
A
printf( "SPS: num_views_minus_1: %d\n",CodingParameter::SpsMVC.m_num_views_minus_1 ); // ue(v)
B
for (i=0;i<= CodingParameter::SpsMVC.m_num_views_minus_1; i++)
{
//vcOrder = CodingParameter::SpsMVC.m_uiViewCodingOrder[i];
printf("SPS: num_anchor_refs_l0[%d]: %d\n", i, CodingParameter::SpsMVC.m_num_anchor_refs_list0[i]);
for (j=0; j<CodingParameter::SpsMVC.m_num_anchor_refs_list0[i]; j++)
printf("SPS: anchor_ref_l0[%d][%d]: %d\n", i, j, odingParameter::SpsMVC.m_anchor_ref_list0[i][j] );
printf("SPS: num_anchor_refs_l1[%d]: %d\n", i, CodingParameter::SpsMVC.m_num_anchor_refs_list1[i]);
for (j=0; j<CodingParameter::SpsMVC.m_num_anchor_refs_list1[i]; j++)
printf("SPS: anchor_ref_l1[%d][%d]: %d\n", i, j, odingParameter::SpsMVC.m_anchor_ref_list1[i][j] );
}
C
for (i=0;i<= CodingParameter::SpsMVC.m_num_views_minus_1; i++)
{
//vcOrder = CodingParameter::SpsMVC.m_uiViewCodingOrder[i];
printf("SPS: num_non_anchor_refs_l0[%d]: %d\n", i, CodingParameter::SpsMVC.m_num_non_anchor_refs_list0[i] );
for (j=0; j<CodingParameter::SpsMVC.m_num_non_anchor_refs_list0[i]; j++)
printf("SPS: non_anchor_ref_l0[%d][%d]: %d\n",i,j, CodingParameter::SpsMVC.m_non_anchor_ref_list0[i][j]);
printf("SPS: num_non_anchor_refs_l1[%d]: %d\n", i, CodingParameter::SpsMVC.m_num_non_anchor_refs_list1[i] );
for (j=0; j<CodingParameter::SpsMVC.m_num_non_anchor_refs_list1[i]; j++)
printf("SPS: non_anchor_ref_l1[%d][%d]: %d\n", i,j,CodingParameter::SpsMVC.m_non_anchor_ref_list1[i][j]);
}
//层数 = 1
uiNumberOfLayers = 1
//读入YUV文件
m_apcReadYuv[uiLayer]->init( rcLayer.getInputFilename(),rcLayer.getFrameHeight(),rcLayer.getFrameWidth() )
//创建类WriteBitstreamToFile的对象m_pcWriteBitstreamToFile
WriteBitstreamToFile::create ( m_pcWriteBitstreamToFile )
//输出文件名
m_pcWriteBitstreamToFile->init ( m_cEncoderIoParameter.cBitstreamFilename )
RNOK( h264::CreaterH264AVCEncoder::create( m_pcH264AVCEncoder ) );
rpcCreaterH264AVCEncoder->xCreateEncoder()
**********************************************************************************
RNOK ( pcH264AVCEncoderTest->go() );
ErrVal H264AVCEncoderTest::go()
RNOK( m_pcH264AVCEncoder->init( m_pcEncoderCodingParameter ) );
-> ErrVal CreaterH264AVCEncoder::init( CodingParameter* pcCodingParameter )
{
m_pcPicEncoder->m_MultiviewRefPicManager.AddVectorOfFilesToUseAsReference(m_pcCodingParameter->m_MultiviewReferenceFileParams); //dcl:多视点编码中参考帧设置
}
RNOK( m_pcH264AVCEncoder->writeParameterSets( &cExtBinDataAccessor, bMoreSets) );
循环执行第一次:
循环执行第二次:
--//write SEI message
--// Multiview scene information sei message
--// Multiview acquisition information sei message
--// add nesting sei message for view0
for( uiLayer = 0; uiLayer < uiNumLayers; uiLayer++ )
{
}
for( uiFrame = 0; uiFrame < uiMaxFrame; uiFrame++ )
{
//===== get picture buffers and read original pictures =====
m_apcReadYuv[uiLayer]->readFrame ()
//===== call encoder =====
m_pcH264AVCEncoder->process
//===== write and release NAL unit buffers =====
//===== write and release reconstructed pictures =====
}
m_pcH264AVCEncoder->finish()
**********************************************************************************
RNOK ( pcH264AVCEncoderTest->destroy() );
ErrVal H264AVCEncoderTest::destroy()