I have been upgrading an H264 encoder to support Intel QuickSync Video by using the encoder and video conference samples as tutorials. I think I've got everything working correctly, initialisation, allocation and encoding frames without any errors or warnings. However when trying to extract the H264 CIF encoded bitstream, it doesn't appear to be in a linear format, it's split into blocks of 384 bytes, some data and then zero padded. I've run the Intel sample encoder and it outputs the bitstream as I would expect, in a linear format, with headers followed by frame NALs.
I've tried replicating all the initialisation and set up from the tutorials but I can't seem to find whats causing the problem. I've attached a data file of the raw H264 elementary stream that is output for the first 5 encoded frames. Viewing in a hex editor should show what I mean about data blocks of 384 bytes. The size of the data blocks changes based on encoded picture size, for example it is 256 bytes for QCIF.
Does anybody have any idea whats going on?
I initialise the encoder as follows:
memset(&mfxVideoParam, 0, sizeof(mfxVideoParam))
mfxVideoParam.AsyncDepth = 1
mfxVideoParam.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY
mfxVideoParam.mfx.CodecId = MFX_CODEC_AVC
mfxVideoParam.mfx.CodecProfile = MFX_PROFILE_AVC_BASELINE
mfxVideoParam.mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED
mfxVideoParam.mfx.GopPicSize = 30
mfxVideoParam.mfx.GopOptFlag = MFX_GOP_STRICT
mfxVideoParam.mfx.GopRefDist = 1
mfxVideoParam.mfx.RateControlMethod = MFX_RATECONTROL_CBR
mfxVideoParam.mfx.TargetKbps = 384
mfxVideoParam.mfx.NumSlice = 1
mfxVideoParam.mfx.NumRefFrame = 1
mfxVideoParam.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12
mfxVideoParam.mfx.FrameInfo.Width = 352
mfxVideoParam.mfx.FrameInfo.Height = 288
mfxVideoParam.mfx.FrameInfo.CropW = 352
mfxVideoParam.mfx.FrameInfo.CropH = 288
mfxVideoParam.mfx.FrameInfo.FrameRateExtN = 30
mfxVideoParam.mfx.FrameInfo.FrameRateExtD = 1
mfxVideoParam.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE
mfxVideoParam.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420
mfxExtCodingOption.MaxDecFrameBuffering = 1
I've also tried many different configuration of the above to no effect.
The problem is observed with both MediaSDK 2013 and 2013 R2.
Any help would be greatly appreciated.
Thanks,
Robert.