This blog is mainly recorded in the pre-research quick sync involves some of the performance quality related key parameter settings.
1. VPP process Pseudo-code:
Mfxvideovpp_queryiosurf (Session, &Init_param, response); Allocate_pool_of_surfaces (In_pool, response[0]. numframesuggested); Allocate_pool_of_surfaces (Out_pool, response[1]. numframesuggested); Mfxvideovpp_init (Session,&Init_param); inch=find_unlocked_surface_and_fill_content (in_pool); out=Find_unlocked_surface_from_the_pool (out_pool); for (;;) {STS=mfxvideovpp_runframevppasync (Session,inch, out,aux,&SYNCP); if(Sts==mfx_err_more_surface | | sts==Mfx_err_none) {mfxvideocore_syncoperation (session,syncp,infinite); Process_output_frame ( out); out=Find_unlocked_surface_from_the_pool (Out_pool); }if(Sts==mfx_err_more_data &&inch==null) Break; if(Sts==mfx_err_none | | sts==mfx_err_more_data) {inch=Find_unlocked_surface (In_pool); Fill_content_for_video_processing (inch); if(End_of_input_sequence ())inch=NULL; }} mfxvideovpp_close (session); Free_pool_of_surfaces (In_pool); Free_pool_of_surfaces (Out_pool);
2.Encoder process Pseudo-code:
Mfxvideoencode_queryiosurf (Session, &init_param, &request); Allocate_pool_of_frame_surfaces (Request. numframesuggested); Mfxvideoencode_init (Session,&init_param); STS=Mfx_err_more_data; for (;;) {if(Sts==mfx_err_more_data &&!)End_of_stream ()) {Find_unlocked_surface_from_the_pool (&surface); Fill_content_for_encoding (surface); } Surface2=end_of_stream ()?Null:surface; STS=mfxvideoencode_encodeframeasync (session,null,surface2,bits,&SYNCP); if(End_of_stream () && sts==mfx_err_more_data) Break; ... ..//Other error handling if(sts==Mfx_err_none) {Mfxvideocore_syncoperation (Session, SYNCP, INFINITE); Do_something_with_encoded_bits (BITS); }}
Mfxvideoencode_close (); free_pool_of_frame_surfaces ();
3. lowlatency Low delay parameter setting:
// encoder parameter settings: 1;
11; // VPP parameter settings: 1;
4. Quality encoding Quality related parameters:
m_mfxEncParams.mfx.TargetKbps // code rate is higher, the better the quality, the greater the flow m_mfxEncParams.mfx.TargetUsage // 1~7 quality from high to low, flow almost unchanged, quality change is not obvious
5.SPS PPS information (start a new encoding sequence)
//get current parameter settingsMfxvideoparam Par;memset (&par,0,sizeof(P ar)); STS= M_pmfxenc->getvideoparam (&par); Msdk_check_result (STS, Mfx_err_none, STS);//Set encoder extension options to start a new sequencemfxextencoderresetoption Resetoption;memset (&resetoption,0,sizeof(resetoption)); ResetOption.Header.BufferId=Mfx_extbuff_encoder_reset_option;resetoption.header.buffersz=sizeof(resetoption); Resetoption.startnewsequence=Mfx_codingoption_on;mfxextbuffer* extendedbuffers[1];extendedbuffers[0] = (mfxextbuffer*) &Resetoption;par. Numextparam=1;p ar. Extparam=extendedbuffers;sts= M_pmfxenc->reset (&par); Msdk_check_result (sts,mfx_err_none,sts);//setting encoding parameters manuallyMfxencodectrl Curencctrl;memset (&curencctrl,0,sizeof(Curencctrl)); Curencctrl.frametype= Mfx_frametype_i | Mfx_frametype_ref |mfx_frametype_idr;sts= M_pmfxenc->encodeframeasync (&curencctrl, &m_pvppsurfacesvppoutenc[nencsurfidx], &m_mfxBS, & SYNCPENC);
6. Operating environment-dependent rpm
LIBDRM, Libdrm-devel, LIBVA, Intel-linux-media, KMOD-UKMD (kernel module), libippcc.so, libippcore.so, (libippcc.so Depending on the CPU model depends on the different dynamic libraries, such as E3 1275 dependent libippccl9.so, i5 6400 dependent libippccy8.so)
7. The rest of the details refer to the source code on GitHub and later put the code on GitHub to manage it.
Intel Quick Sync Video Encoder 2