how to set the parameters of framesurface

how to set the parameters of framesurface

the functions MFXVideoENCODE_EncodeFrameAsync() "5", namelyMFX_WRN_INCOMPATIBLE_VIDEO_PARAM , why?
my code :

mfxSession *sSession= new mfxSession(); mfxVersion vVersion={MFX_VERSION_MINOR, MFX_VERSION_MAJOR}; if(MFX_ERR_NONE!= MFXInit(MFX_IMPL_AUTO,&vVersion,sSession)) return -1; mfxIMPL implStyle = MFX_IMPL_AUTO; MFXQueryIMPL( *sSession, &implStyle ); switch(implStyle) { case MFX_IMPL_SOFTWARE: std::cout<<"software"; break; case MFX_IMPL_HARDWARE: std::cout<<"hardware"; break; default: std::cout<<"wrong"; break; } mfxVideoParam *par=new mfxVideoParam(); par->AsyncDepth=0; par->Protected=0; par->IOPattern=MFX_IOPATTERN_IN_SYSTEM_MEMORY; par->mfx.CodecId=MFX_CODEC_AVC; par->mfx.TargetKbps=100; par->mfx.EncodedOrder=0; par->mfx.FrameInfo.Height=480; par->mfx.FrameInfo.Width=704; par->mfx.FrameInfo.FrameRateExtD=2; par->mfx.FrameInfo.FrameRateExtN=200; par->mfx.FrameInfo.FourCC=MFX_FOURCC_NV12; par->mfx.FrameInfo.ChromaFormat=MFX_CHROMAFORMAT_YUV420; par->mfx.FrameInfo.PicStruct=MFX_PICSTRUCT_FIELD_TFF; par->mfx.FrameInfo.CropX=0; par->mfx.FrameInfo.CropY=0; par->mfx.FrameInfo.CropW=704; par->mfx.FrameInfo.CropH=480; mfxStatus retOfInit=MFXVideoENCODE_Init(*sSession,par);//here retOfInit equals 0, which means no error; mfxFrameSurface1 *frsf=new mfxFrameSurface1();// memcpy(&frsf->Info,&par->mfx.FrameInfo,sizeof(mfxFrameInfo)); frsf->Info.Height=480; frsf->Info.Width =704; frsf->Info.FourCC=MFX_FOURCC_NV12; frsf->Info.ChromaFormat=MFX_CHROMAFORMAT_YUV420; frsf->Info.PicStruct=MFX_PICSTRUCT_FIELD_TFF;//I don't understand this parameter. mfxU8* Y=new mfxU8[704*480]; mfxU8* UV= new mfxU8[704*240]; for(int i=0;i<704*480;i++) Y[i]=80; for(int i=0;i<704*240;i++) UV[i]=150; frsf->Data.Y=Y; frsf->Data.UV=UV; frsf->Data.Locked=0; frsf->Data.Pitch=704; mfxBitstream *bs=new mfxBitstream(); bs->Data=new mfxU8[1000000]; bs->MaxLength=1000000;mfxSyncPoint syn; int r= MFXVideoENCODE_EncodeFrameAsync(*sSession,NULL,frsf,bs,&syn);
//r equals 5 and there is no data in bs. I wanna know if some parameters are not correct.

I am a new guy in programming and h.264, and english, :(. Right here hoping for answers. thx.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.