Hello,
I'm implementing real time AVC/H264 encoding of game play using OpenVideo encode, everything is working as intended on resolutions up to 1920x1080 but anything higher than that results in an error at OVEncodeSEndConfig function.
Here's some sample code
Configuration
pConfig = &this->configCtrl; | ||
ZeroMemory(pConfig, sizeof(OvConfigCtrl)); |
pConfig->encodeMode = (OVE_ENCODE_MODE)1; | /**< encode mode */ | ||||
pConfig->width = lpbih->biWidth; | |||||
pConfig->height = lpbih->biHeight; |
/**************************************************************************/ | |||||||||||||
/* fill-in the profile and level */ | |||||||||||||
/**************************************************************************/ | |||||||||||||
pConfig->profileLevel.level | = 40; | /**< encode profile */ | |||||||||||
pConfig->profileLevel.profile | = 77; |
pConfig->pictFormat | = (OVE_PICTURE_FORMAT)1; | |||||||||
pConfig->priority | = (OVE_ENCODE_TASK_PRIORITY)2;//1; |
/**************************************************************************/ | |||||||||
/* fill-in the picture control structures */ | |||||||||
/**************************************************************************/ | |||||||||
pConfig->pictControl.size | = sizeof(OVE_CONFIG_PICTURE_CONTROL); | ||||||||
pConfig->pictControl.useConstrainedIntraPred | = 0; | ||||||||
pConfig->pictControl.cabacEnable | = 1; | ||||||||
pConfig->pictControl.cabacIDC | = 0; | ||||||||
pConfig->pictControl.loopFilterDisable | = 0; | ||||||||
pConfig->pictControl.encLFBetaOffset | = 0; | ||||||||
pConfig->pictControl.encLFAlphaC0Offset | = 0; | ||||||||
pConfig->pictControl.encIDRPeriod | = 0; | ||||||||
pConfig->pictControl.encIPicPeriod | = 0; | ||||||||
pConfig->pictControl.encHeaderInsertionSpacing | = 0; | ||||||||
pConfig->pictControl.encCropLeftOffset | = 0; | ||||||||
pConfig->pictControl.encCropRightOffset | = 0; | ||||||||
pConfig->pictControl.encCropTopOffset | = 0; | ||||||||
pConfig->pictControl.encCropBottomOffset | = 4; | ||||||||
pConfig->pictControl.encNumMBsPerSlice | = (unsigned int)(ceil((float)pConfig->width / 16.0f) * ceil((float)pConfig->height / 16.0f)); | ||||||||
pConfig->pictControl.encNumSlicesPerFrame | = 1; | ||||||||
pConfig->pictControl.encForceIntraRefresh | = 0; | ||||||||
pConfig->pictControl.encForceIMBPeriod | = 0; | ||||||||
pConfig->pictControl.encInsertVUIParam | = 0; | ||||||||
pConfig->pictControl.encInsertSEIMsg | = 0; |
/**************************************************************************/ | |||||||||
/* fill-in the rate control structures */ | |||||||||
/**************************************************************************/ | |||||||||
pConfig->rateControl.size | = sizeof(OVE_CONFIG_RATE_CONTROL); | ||||||||
pConfig->rateControl.encRateControlMethod | = 4; | ||||||||
pConfig->rateControl.encRateControlTargetBitRate | = 15000000; | ||||||||
pConfig->rateControl.encRateControlPeakBitRate | = 0; | ||||||||
pConfig->rateControl.encRateControlFrameRateNumerator = this->Framerate_; | |||||||||
pConfig->rateControl.encGOPSize | = 0; | ||||||||
pConfig->rateControl.encRCOptions | = 0; | ||||||||
pConfig->rateControl.encQP_I | = 22; | ||||||||
pConfig->rateControl.encQP_P | = 22; | ||||||||
pConfig->rateControl.encQP_B | = 0; | ||||||||
pConfig->rateControl.encVBVBufferSize | = pConfig->rateControl.encRateControlTargetBitRate / 2; | ||||||||
pConfig->rateControl.encRateControlFrameRateDenominator = 1; |
/**************************************************************************/ | ||||||||
/* fill-in the motion estimation control structures */ | ||||||||
/**************************************************************************/ | ||||||||
pConfig->meControl.size = sizeof(OVE_CONFIG_MOTION_ESTIMATION); | ||||||||
pConfig->meControl.imeDecimationSearch | = 1; | |||||||
pConfig->meControl.motionEstHalfPixel | = 1; | |||||||
pConfig->meControl.motionEstQuarterPixel | = 1; | |||||||
pConfig->meControl.disableFavorPMVPoint | = 0; | |||||||
pConfig->meControl.forceZeroPointCenter | = 1; | |||||||
pConfig->meControl.lsmVert | = 0; | |||||||
pConfig->meControl.encSearchRangeX | = 36; | |||||||
pConfig->meControl.encSearchRangeY | = 36; | |||||||
pConfig->meControl.encSearch1RangeX | = 0; | |||||||
pConfig->meControl.encSearch1RangeY | = 0; | |||||||
pConfig->meControl.disable16x16Frame1 | = 0; | |||||||
pConfig->meControl.disableSATD | = 0; | |||||||
pConfig->meControl.enableAMD | = 1; | |||||||
pConfig->meControl.encDisableSubMode | = 0; | |||||||
pConfig->meControl.encIMESkipX | = 0; | |||||||
pConfig->meControl.encIMESkipY | = 0; | |||||||
pConfig->meControl.encEnImeOverwDisSubm | = 0; | |||||||
pConfig->meControl.encImeOverwDisSubmNo | = 0; | |||||||
pConfig->meControl.encIME2SearchRangeX | = 4; | |||||||
pConfig->meControl.encIME2SearchRangeY | = 4; |
/**************************************************************************/ | ||||||
/* fill-in the RDO control structures */ | ||||||
/**************************************************************************/ | ||||||
pConfig->rdoControl.size = sizeof(OVE_CONFIG_RDO); | ||||||
pConfig->rdoControl.encDisableTbePredIFrame | = 0; | |||||
pConfig->rdoControl.encDisableTbePredPFrame | = 0; | |||||
pConfig->rdoControl.useFmeInterpolY | = 0; | |||||
pConfig->rdoControl.useFmeInterpolUV | = 0; | |||||
pConfig->rdoControl.enc16x16CostAdj | = 0; | |||||
pConfig->rdoControl.encSkipCostAdj | = 0; | |||||
pConfig->rdoControl.encForce16x16skip | = (uint8)0; |
The code is failing here when I try resolutions higher than 1920x1080 (1920x1200 is enough to trigger the error)
/**************************************************************************/ |
/* send configuration values for this session */
/**************************************************************************/ |
configBuffers[0].config.pPictureControl = &(pConfig->pictControl);
configBuffers[0].configType = OVE_CONFIG_TYPE_PICTURE_CONTROL;
configBuffers[1].config.pRateControl = &(pConfig->rateControl);
configBuffers[1].configType = OVE_CONFIG_TYPE_RATE_CONTROL;
configBuffers[2].config.pMotionEstimation = &(pConfig->meControl);
configBuffers[2].configType = OVE_CONFIG_TYPE_MOTION_ESTIMATION;
configBuffers[3].config.pRDO = &(pConfig->rdoControl);
configBuffers[3].configType = OVE_CONFIG_TYPE_RDO;
// At this point everything is already set, session and configuration is valid
// and the code works fine with resolutions up to 1920x1080
res = OVEncodeSendConfig (session, numOfConfigBuffers, configBuffers); <====== FAIL
Is that a known error or limitation?