The project name of the encoder in the entire HM solution is Tappencoder, and the entry point function is located in the Encmain.cpp file:
1 intMainintargcChar*argv[])2 {3 tappenctop ctappenctop;4 5 //Print Information6fprintf (stdout,"\ n" );7fprintf (stdout,"HM software:encoder Version [%s] (including REXT)", nv_version);8 fprintf (stdout, nvm_onos);9 fprintf (stdout, nvm_compiledby);Ten fprintf (stdout, nvm_bits); Onefprintf (stdout,"\ n" ); A - //Create application Encoder class - ctappenctop.create (); the - //Parse Configuration - Try - { + if(!ctappenctop.parsecfg (argc, argv)) - { + Ctappenctop.destroy (); A #ifEnvironment_variable_debug_and_test at Envvar::p rintenvvar (); - #endif - return 1; - } - } - Catch(DF::p rogram_options_lite::P arsefailure &e) in { -Std::cerr <<"Error parsing option \ ""<< E.arg <<"\ "with argument \""<< E.val <<"\"."<<Std::endl; to return 1; + } - the #ifPrint_macro_values * printmacrosettings (); $ #endifPanax Notoginseng - #ifEnvironment_variable_debug_and_test the Envvar::p rintenvvarinuse (); + #endif A the //Starting Time + Double Dresult; -clock_t Lbefore =clock (); $ $ //Call encoding function - Ctappenctop.encode (); - the //Ending time -Dresult = (Double) (Clock ()-lbefore)/clocks_per_sec;Wuyiprintf"\ n Total time:%12.3f sec.\n", Dresult); the - //Destroy Application Encoder class Wu Ctappenctop.destroy (); - About return 0; $}
Main
Mainly include:
- The entry point function main () "creates the Ctappenctop class, parses the input configuration function, sets the time-dependent parameters"
- Ctappenctop.encode () "Initializes several objects used by the encoder, allocates YUV data caches, and loops through the YUV file"
- M_ctenctop.encode (...) "Call M_CGOPENCODER.COMPRESSGOP () to implement the actual encoding of a GOP"
- M_CGOPENCODER.COMPRESSGOP () "Call Initgop to set the parameters of the GOP; call M_pcsliceencoder->initencslice () to create encoded slice objects with information from SPS and PPS ; Call M_pcsliceencoder->compressslice (Pcpic) to encode a slice. 】
- M_pcsliceencoder->compressslice (Pcpic) "Sets the parameters of the encoding slice and processes each cu in slice"
- Tenccu::compresscu () "Encode a CU"
Each of these functions is called in the previous function to form a structure similar to a reverse call stack.
"HEVC Learning and research" 1, the basic structure of HM-16.7 Encoder