7.3. API Reference

Video EncodingModulemainprovideVideo EncodingChannelCreateandDestroy, Video EncodingChannelbits, EnableandstopReceiveImage, SetandGetEncoding channelAttribute, GetandReleaseBitstreametc.Function.

providewithunder API:

7.3.1. CVI_VENC_CreateChn

Description

CreateEncoding channel

Syntax

CVI_S32 CVI_VENC_CreateChn(VENC_CHN VeChn, const VENC_CHN_ATTR_S *pstAttr); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstAttr

VENC_CHN_ATTR_S AttributePointer.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • Channel attributesisthreeitemstructure:

typedef struct _VENC_CHN_ATTR_S {  VENC_ATTR_S stVencAttr;  VENC_RC_ATTR_S stRcAttr;  VENC_GOP_ATTR_S stGopAttr; } VENC_CHN_ATTR_S; 
  • VENC_ATTR_S: determineEncodingAttribute, thisAttributedetermineEncodingProtocolandassignvalueSetforshouldwidth, High.

  • VENC_RC_ATTR_S: Rate Control: rate controlAttribute, thisAttributeEncodingSetandRate ControlMode (CBR, VBR, AVBR, FIXQP) notsameforshouldstructureperformSet.

  • VENC_GOP_ATTR_S: GOP TypeAttribute, Encoding GOP Type(EncodingsingleReferenceFrame, P Frame, GOP Type.)

  • recommendedEncodingwidth and heightis: 1920x1080 (1080P), 1280x720 (720P).

Example

userSee also sample_common_venc.c in SAMPLE_COMM_VENC_SetChnAttr ReferencecorrespondingAttributePointerSet.

Related Topics

7.3.2. CVI_VENC_DestroyChn

Description

DestroyEncoding channel

Syntax

CVI_S32 CVI_VENC_DestroyChn (VENC_CHN VeChn); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

Destroyanddoes not existChannel, willReturnFailure.

Example

See also sample_common_venc.c, DestroyChannelbeforemuststopsendframe.

CVI_S32 SAMPLE_COMM_VENC_Stop(VENC_CHN VencChn) {  CVI_S32 s32Ret;  //停止传送venc frame data Receive  s32Ret = CVI_VENC_StopRecvFrame(VencChn);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_StopRecvPic vechn[%d] failed with %#x!\n", VencChn, s32Ret);  return CVI_FAILURE;  }  //停止线程执行  if (gs_VencTask[VencChn] != 0) {  pthread_join(gs_VencTask[VencChn], CVI_NULL);  CVI_VENC_SYNC("GetVencStreamProc done\n");  gs_VencTask[VencChn] = 0;  }  //注销venc Channel  s32Ret = CVI_VENC_DestroyChn(VencChn);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_DestroyChn vechn[%d] failed with %#x!\n", VencChn, s32Ret);  return CVI_FAILURE;  }  return CVI_SUCCESS; } 

Related Topics

7.3.3. CVI_VENC_ResetChn

Description

Reset the channel.

Syntax

CVI_S32 CVI_VENC_ResetChn(VENC_CHN VeChn); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • Reset anddoes not existChannel, ReturnFailure CVI_FAILURE.

  • If aChannelnothasstopReceiveImagewhile reset Channel, thenReturnFailure.

Example

  • None

7.3.4. CVI_VENC_StartRecvFrame

Description

EnableEncoding channelReceiveInputImage, specifiedReceiveFramenumber, exceedspecifiedFramenumberafterautomaticstopReceiveImage.

Syntax

CVI_S32 CVI_VENC_StartRecvFrame(VENC_CHN VeChn, const VENC_RECV_PIC_PARAM_S *pstRecvParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Encoding channel number.

Input

pstRecvParam

ReceiveImageParameterStructurePointer, used to specifiedneed toReceiveImageFramenumber.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • If Channelnot created, thenReturnFailure

  • EnableEncodingdeviceReceiveofaftercanstartReceiveImageEncoding.

Example

  • See also sample_common_venc.c in SAMPLE_COMM_VENC_Start Function.

CVI_S32 s32Ret; VENC_RECV_PIC_PARAM_S stRecvParam; //Createvenc Channel s32Ret = SAMPLE_COMM_VENC_Create(  pIc, VencChn, enType, enSize, enRcMode,  u32Profile, bRcnRefShareBuf, pstGopAttr); if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("SAMPLE_COMM_VENC_Create failed with %d\n", s32Ret);  return CVI_FAILURE; } //Setvenc bindmode 与否 if (pIc->bind_mode == VENC_BIND_VI) {  VI_PIPE ViPipe = 0;  VI_CHN ViChn = 0;  SAMPLE_COMM_VI_Bind_VENC(ViPipe, ViChn, VencChn); } else if (pIc->bind_mode == VENC_BIND_VPSS) {  VPSS_GRP VpssGrp = 0;  VPSS_CHN VpssChn = 0;  SAMPLE_COMM_VPSS_Bind_VENC(VpssGrp, VpssChn, VencChn); } //specifiedReceiveframe 数,允许Receiveframe stRecvParam.s32RecvPicNum = pIc->num_frames; s32Ret = CVI_VENC_StartRecvFrame(VencChn, &stRecvParam); if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_StartRecvPic failed with %d\n", s32Ret);  return CVI_FAILURE; } return CVI_SUCCESS; 

Related Topics

7.3.5. CVI_VENC_StopRecvFrame

Description

stopEncoding channelReceiveInputImage.

Syntax

CVI_S32 CVI_VENC_StopRecvFrame(VENC_CHN VeChn); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Encoding channel number.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • ChannelDestroybefore, need toCallCVI_VENC_StopRecvFrame.

  • ifChannelnot createdorChannelalreadyDestroy, thenReturnFailure.

  • CallthisInterfaceonlystopReceiverawDataEncoding, Bitstream buffer andnotwillbeClear.

  • thisInterfaceused to Encoding channelstopReceiveImagetoEncoding, inEncoding channelDestroyorbitsbeforemuststopReceiveImage.

Example

  • See also sample_common_venc.c in SAMPLE_COMM_VENC_Stop Function.

Related Topics

7.3.6. CVI_VENC_QueryStatus

Description

QueryEncoding channelStatus.

Syntax

CVI_S32 CVI_VENC_QueryStatus(VENC_CHN VeChn, VENC_CHN_STATUS_S *pstStatus); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstStatus

Encoding channelStatusPointer.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • If the channel has not been created, failure is returned.

  • inEncoding channelStatusStructureMedium, u32CurPacks meanscurrentFrameBitstreampacketCount. inCall CVI_VENC_GetStream beforeshouldensure u32CurPacks greater than 0.

7.3.7. CVI_VENC_SetChnAttr

Description

SetEncoding channelAttribute.

Syntax

CVI_S32 CVI_VENC_SetChnAttr(VENC_CHN VeChn, const VENC_CHN_ATTR_S *pstChnAttr); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstChnAttr

Encoding channelAttributePointer.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

None

Example

None

7.3.8. CVI_VENC_GetChnAttr

Description

GetEncoding channelAttribute.

Syntax

CVI_S32 CVI_VENC_GetChnAttr(VENC_CHN VeChn, VENC_CHN_ATTR_S *pstChnAttr); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstChnAttr

Encoding channelAttributePointer.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • Getnot createdChannelAttribute, ReturnFailure.

Example

7.3.9. CVI_VENC_GetStream

Description

GetEncodingBitstream.

Syntax

CVI_S32 CVI_VENC_GetStream(VENC_CHN VeChn, VENC_STREAM_S *pstStream, CVI_S32 S32MilliSec); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstFrame

BitstreamStructurePointerVENC_STREAM_S

Output

S32MilliSec

SendImageTimeouttime.

Value Range: [-1, +∞)

-1: Blocking.

0: Non-blocking.

Greater than 0: timeout.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • venc Channelmust firstCreate, otherwisethisnumberwillError.

  • inbind mode statusunder, CVI_VENC_SendFramemusthasCall, otherwiseCVI_VENC_GetStreamwillNonemethodGetBitstreamstructure.

  • CVI_VENC_GetStreamCallbefore, canCVI_VENC_GetChnAttr, CVI_VENC_QueryStatusCallensureEncodingChannelWhen undercorrectness.

  • BitstreamStructure VENC_STREAM_S including 4 itempart:

    • BitstreampacketInformationPointer pstPack refers totoonegroup VENC_PACK_S Memoryspace, thisspacebyCalluserallocate.

    • Note: pstPackspacemustinCallCVI_VENC_GetStreambeforegiveforshouldspace, otherwisewillError.

Example

See alsosample_venc_lib.cinSAMPLE_VENC_GetVencStreamProc:

while (pVencChnCtx->chnStat == CHN_STAT_START) {  VENC_CHN_STATUS_S stStat;  //bind mode Mode检查  if (pVencChnCtx->chnIc.bind_mode == VENC_BIND_DISABLE) {  CVI_S32 s32SetFrameMilliSec = 20000;  s32Ret = cviReadSrcFrame(pVencChnCtx->pstVFrame, pVencChnCtx->fpSrc);  s32Ret = CVI_VENC_SendFrame(VencChn, pVencChnCtx->pstFrameInfo, s32SetFrameMilliSec);  if (s32Ret == CVI_ERR_VENC_FRC_NO_ENC) {  continue;  } else if (s32Ret != CVI_SUCCESS) {  break;  }  }  //According tovenc ChannelStatus,开始Getvenc stream  if (pVencChnCtx->chnIc.bsMode == BS_MODE_QUERY_STAT) {  if (vencFd < 0) {  vencFd = CVI_VENC_GetFd(vencChn);  if (vencFd < 0) {  SAMPLE_PRT("CVI_VENC_GetFd failed with%#x!\n", vencFd);  break;  }  }  FD_ZERO(&readFds);  FD_SET(vencFd, &readFds);  timeoutVal.tv_sec = 1;  timeoutVal.tv_usec = 0;  ret = select(vencFd + 1, &readFds, NULL, NULL, &timeoutVal);  if (ret < 0) {  if (errno == EINTR)  continue;  SAMPLE_PRT("select failed!\n");  break;  } else if (ret == 0) {  SAMPLE_PRT("select timeout\n");  continue;  }  VENC_CHN_ATTR_S stVencChnAttr;  VENC_STREAM_S stStream;  s32Ret = CVI_VENC_GetChnAttr(VencChn, &stVencChnAttr);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_GetChnAttr, VencChn = %d, s32Ret = %d\n", VencChn, s32Ret);  break;  }  s32Ret = CVI_VENC_QueryStatus(VencChn, &stStat);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_QueryStatus, Vench = %d, s32Ret = %d\n",VencChn, s32Ret);  break;  }  if (!stStat.u32CurPacks) {  CVI_VENC_ERR("u32CurPacks = NULL!\n");  break;  }  //需先行赋予pstPack空间  stStream.pstPack = (VENC_PACK_S *)malloc(sizeof(VENC_PACK_S) * stStat.u32CurPacks);  if (stStream.pstPack == NULL) {  CVI_VENC_ERR("malloc memory failed!\n");  break;  }  s32Ret = CVI_VENC_GetStream(VencChn, &stStream, -1);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_GetStream, VencChn = %d, s32Ret = %d\n", VencChn, s32Ret);  free(stStream.pstPack);  stStream.pstPack = NULL;  break;  }  //Use者可将取出的stStream存档或给予上层app  s32Ret = CVI_VENC_ReleaseStream(VencChn, &stStream);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_ReleaseStream, s32Ret = %d\n", s32Ret);  free(stStream.pstPack);  stStream.pstPack = NULL;  break;  }  free(stStream.pstPack);  stStream.pstPack = NULL;  } } 

7.3.10. CVI_VENC_ReleaseStream

Description

ReleaseBitstreamcache.

Syntax

CVI_S32 CVI_VENC_ReleaseStream(VENC_CHN VeChn, VENC_STREAM_S *pstStream); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstStream

VENC_STREAM_SAttributePointer.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • pleaseverifyvencChannelalready created.

  • pleaseverifyCVI_VENC_ReleaseStreaminCVI_VENC_GetStreamafter that,
    If provideCallCVI_VENC_ReleaseStream,
    thenCVI_VENC_GetStreamwillnotGetcorrectstream.
  • UserGetBitstreamaftermustandtimeReleasealreadyGetBitstreamcache, otherwisecancanwillcauseBitstream buffer full, affectEncodingdeviceEncoding.

Example

7.3.11. CVI_VENC_SendFrame

Description

sendimagewithprovideEncoding.

Syntax

CVI_S32 CVI_VENC_SendFrame(VENC_CHN VeChn, const VIDEO_FRAME_INFO_S *pstFrame, CVI_S32 S32MilliSec); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstFrame

VIDEO_FRAME_INFO_S AttributePointer.

Input

S32MilliSec

SendImageTimeouttime

InputValue Range: [-1,+∞)
-1: Blocking.
0: Non-blocking.
Greater than 0: timeout.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • thisInterfaceSupportUserSendImagetoEncodingChannel, withperform Encoding.

  • CallthisInterfaceSendImage, Userneed toEncoding channelalready createdandEnableReceiveInputImage.

Example

See also sample_venc_lib.c`in `SAMPLE_VENC_GetVencStreamProc:

while (pVencChnCtx->chnStat == CHN_STAT_START) {  VENC_CHN_STATUS_S stStat;  if (pVencChnCtx->chnIc.bind_mode == VENC_BIND_DISABLE) {  CVI_S32 s32SetFrameMilliSec = 20000;  s32Ret = cviReadSrcFrame(pVencChnCtx->pstVFrame, pVencChnCtx->fpSrc);  if (s32Ret < 0) {  CVI_VENC_ERR("(chn %d) cviReadSrcFrame fail\n", VencChn);  break;  }  s32Ret = CVI_VENC_SendFrame(VencChn, pVencChnCtx->pstFrameInfo, s32SetFrameMilliSec);  if (s32Ret == CVI_ERR_VENC_FRC_NO_ENC) {  CVI_VENC_FRC("no encode\n");  continue;  } else if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_SendFrame, VencChn = %d, s32Ret = %d\n", VencChn, s32Ret);  break;  }  }  if (pVencChnCtx->chnIc.bsMode == BS_MODE_QUERY_STAT) {  VENC_CHN_ATTR_S stVencChnAttr;  VENC_STREAM_S stStream;  s32Ret = CVI_VENC_GetChnAttr(VencChn, &stVencChnAttr);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_GetChnAttr, VencChn = %d, s32Ret = %d\n", VencChn, s32Ret);  break;  }  s32Ret = CVI_VENC_QueryStatus(VencChn, &stStat);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_QueryStatus, Vench = %d, s32Ret = %d\n", VencChn, s32Ret);  break;  }  if (!stStat.u32CurPacks) {  CVI_VENC_ERR("u32CurPacks = NULL!\n");  break;  }  stStream.pstPack = (VENC_PACK_S *)malloc(sizeof(VENC_PACK_S) * stStat.u32CurPacks);  if (stStream.pstPack == NULL) {  CVI_VENC_ERR("malloc memory failed!\n");  break;  }  s32Ret = CVI_VENC_GetStream(VencChn, &stStream, -1);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_GetStream, VencChn = %d, s32Ret = %d\n", VencChn, s32Ret);  free(stStream.pstPack);  stStream.pstPack = NULL;  break;  }  s32Ret = CVI_VENC_ReleaseStream(VencChn, &stStream);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_ReleaseStream, s32Ret = %d\n", s32Ret);  free(stStream.pstPack);  stStream.pstPack = NULL;  break;  }  free(stStream.pstPack);  stStream.pstPack = NULL;  }  if (pVencChnCtx->chnIc.bind_mode) {  if (pVencChnCtx->chnStat != pVencChnCtx->nextChnStat) {  s32Ret = CVI_VENC_QueryStatus(VencChn, &stStat);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_QueryStatus, Vench = %d, s32Ret = %d\n",  VencChn, s32Ret);  break;  }  CVI_VENC_TRACE("u32LeftStreamFrames = %d\n", stStat.u32LeftStreamFrames);  if (stStat.u32LeftStreamFrames <= 0) {  pVencChnCtx->chnStat = CHN_STAT_STOP;  CVI_VENC_SYNC("chnStat = CHN_STAT_STOP\n");  }  }  } else {  if (i >= pVencChnCtx->num_frames) {  pVencChnCtx->chnStat = CHN_STAT_STOP;  }  } } 

Related Topics

7.3.12. CVI_VENC_GetFd

Description

GetEncoding channelforshouldDeviceFilehandle.

Syntax

CVI_S32 CVI_VENC_GetFd(VENC_CHN VeChn); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

Return Value

Return Value

Description

0

Success

less thanoretc.to0

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • None

Example

  • None

Related Topics

7.3.13. CVI_VENC_CloseFd

Description

GetChannelhandle.

Syntax

CVI_S32 CVI_VENC_CloseFd(VENC_CHN VeChn); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • currentlyinUse selectMethod Streamtime, notcanClosefd, willcauseFunctionnotnormal.

Example

  • None

Related Topics

7.3.14. CVI_VENC_SetJpegParam

Description

Set JPEG ProtocolEncoding channeladvancedParameter.

Syntax

CVI_S32 CVI_VENC_SetJpegParam(VENC_CHN VeChn, const VENC_JPEG_PARAM_S *pstJpegParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstJpegParam

Pointer to the advanced parameter set of the JPEG protocol encoding channel.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • thisInterfaceused to Set JPEG ProtocolEncoding channeladvancedParameter.

  • thisInterfaceUsetovencChannelCreateafter.

  • advancedParametermainParametergroup

    • u32Qfactor: quantizationTableRangeis[1, 99],
      u32Qfactor larger, quantizationTableinquantizationnumbersmaller, toImagequalitywillmore,
      at the same time, EncodingCompressionmorelow.
      same u32Qfactor smaller, quantizationTableinquantizationnumberlarger, toImagequalitywillmore,
      at the same time, EncodingCompressionmoreheight.
    • whereu32Qfactor=50isReservedautoDefinitionSet, currentlyNot supportedSet

    • u32MCUPerECS: each Ecs inincludingmultiple Mcu.
      systemMode u32MCUPerECS = 0, meanscurrentFramethehas MCU beEncodingisa ECS.
      u32MCUPerECS Minimumvalueis 0, Maximumvaluenotexceeds(picwidth+15)>>4 * (picheight+15)>>4 * 2.
  • It is recommended to UserinCreateChannelafter that, bootEncodingbeforeCallthisInterface, reduceinEncodingprocessinCallcount. It is recommended to UserinCallthisInterfacebefore, firstCall CVI_VENC_GetJpegParam Interface, GetWhen beforeEncodingChannel JpegParam Configuration, Then, thenperform Set.

Example

  • pleaserefer to sample_common_venc.c in SAMPLE_COMM_VENC_SetJpegParam Function:

CVI_S32 SAMPLE_COMM_VENC_SetJpegParam(chnInputCfg *pIc, VENC_CHN VencChn) {  VENC_JPEG_PARAM_S stJpegParam, *pstJpegParam = &stJpegParam;  CVI_S32 s32Ret = CVI_SUCCESS;  s32Ret = CVI_VENC_GetJpegParam(VencChn, pstJpegParam);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_GetJpegParam\n");  return CVI_FAILURE;  }  pstJpegParam->u32Qfactor = pIc->quality;  s32Ret = CVI_VENC_SetJpegParam(VencChn, pstJpegParam);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("CVI_VENC_SetJpegParam\n");  return CVI_FAILURE;  }  return s32Ret; } 

7.3.15. CVI_VENC_GetJpegParam

Description

Get JPEG ProtocolEncoding channeladvancedParameterConfiguration.

Syntax

CVI_S32 CVI_VENC_GetJpegParam(VENC_CHN VeChn, VENC_JPEG_PARAM_S *pstJpegParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstJpegParam

Pointer to the advanced parameter set of the JPEG protocol encoding channel.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • Call this interface after creating the encoding channel and before destroying it.

  • It is recommended to UserinCreateChannelafter that, bootEncodingbeforeCallthisInterface, reduceinEncodingprocessinCallcount.

Example

7.3.16. CVI_VENC_SetRcParam

Description

SetEncoding channelRate Control: rate controladvancedParameter.

Syntax

CVI_S32 CVI_VENC_SetRcParam(VENC_CHN VeChn, const VENC_RC_PARAM_S *pstRcParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstRcParam

Encoding channelRate Control: rate controladvancedParameter.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • Call this interface after creating the encoding channel and before destroying it.

  • This function is called at CVI_VENC_CreateChn after that, CVI_VENC_SetChnParam before.

  • It is recommended to UserfirstCall CVI_VENC_GetRcParam Interface, Get RC advancedParameter, Then, modify shouldParameter, thenCallthisInterfaceforadvancedParameterperform Set.

Example

  • canReference inside sample_common_venc.c`` ``SAMPLE_COMM_VENC_SetRcParam Function:

static CVI_S32 SAMPLE_COMM_VENC_SetRcParam(  chnInputCfg * pIc,  VENC_CHN VencChn) {  CVI_S32 s32Ret;  VENC_RC_PARAM_S stRcParam, *pstRcParam = &stRcParam;  s32Ret = CVI_VENC_GetRcParam(VencChn, pstRcParam);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("GetRcParam failed!\n");  return CVI_FAILURE;  }  pstRcParam->s32FirstFrameStartQp = pIc->firstFrmstartQp;  if (!strcmp(pIc->codec, "264") && pIc->rcMode == 0) {  pstRcParam->stParamH264Cbr.u32MaxIQp = pIc->maxIqp;  pstRcParam->stParamH264Cbr.u32MinIQp = pIc->minIqp;  pstRcParam->stParamH264Cbr.u32MaxQp = pIc->maxQp;  pstRcParam->stParamH264Cbr.u32MinQp = pIc->minQp;  } else if (!strcmp(pIc->codec, "265") && pIc->rcMode == 0) {  pstRcParam->stParamH265Cbr.u32MaxIQp = pIc->maxIqp;  pstRcParam->stParamH265Cbr.u32MinIQp = pIc->minIqp;  pstRcParam->stParamH265Cbr.u32MaxQp = pIc->maxQp;  pstRcParam->stParamH265Cbr.u32MinQp = pIc->minQp;  } else if (!strcmp(pIc->codec, "264") && pIc->rcMode == 1) {  pstRcParam->stParamH264Vbr.u32MaxIQp = pIc->maxIqp;  pstRcParam->stParamH264Vbr.u32MinIQp = pIc->minIqp;  pstRcParam->stParamH264Vbr.u32MaxQp = pIc->maxQp;  pstRcParam->stParamH264Vbr.u32MinQp = pIc->minQp;  } else if (!strcmp(pIc->codec, "265") && pIc->rcMode == 1) {  pstRcParam->stParamH265Vbr.u32MaxIQp = pIc->maxIqp;  pstRcParam->stParamH265Vbr.u32MinIQp = pIc->minIqp;  pstRcParam->stParamH265Vbr.u32MaxQp = pIc->maxQp;  pstRcParam->stParamH265Vbr.u32MinQp = pIc->minQp;  }  CVI_VENC_TRACE("firstFrmstartQp = %d\n", pIc->firstFrmstartQp);  s32Ret = CVI_VENC_SetRcParam(VencChn, pstRcParam);  if (s32Ret != CVI_SUCCESS) {  CVI_VENC_ERR("SetRcParam failed!\n");  return CVI_FAILURE;  }  return s32Ret; } 

7.3.17. CVI_VENC_GetRcParam

Description

GetChannelRate ControladvancedParameter.

Syntax

CVI_S32 CVI_VENC_GetRcParam(VENC_CHN VeChn, VENC_RC_PARAM_S *pstRcParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstRcParam

ChannelRate ControlParameterPointer

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • Call this interface after creating the encoding channel and before destroying it.

  • It is recommended to UserinCallthisInterfacebefore, firstCall CVI_VENC_GetChnParam Interface, GetcurrentChannelParameterConfiguration, Then, thenperform Set.

Example

None.

7.3.18. CVI_VENC_SetChnParam

Description

SetChannelParameter.

Syntax

CVI_S32 CVI_VENC_SetChnParam(VENC_CHN VeChn, const VENC_CHN_PARAM_S *pstChnParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstChnParam

Venc ChannelParameter.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

Example - None

7.3.19. CVI_VENC_GetChnParam

Description

GetChannelParameter.

Syntax

CVI_S32 CVI_VENC_GetChnParam(VENC_CHN VeChn, VENC_CHN_PARAM_S *pstChnParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstChnParam

Venc ChannelParameterPointer.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • None

Example

  • None

7.3.20. CVI_VENC_RequestIDR

Description

Request an IDR frame.

Syntax

CVI_S32 CVI_VENC_RequestIDR(VENC_CHN VeChn, CVI_BOOL bInstant); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

bInstant

Whether to enablethat isEncoding IDR Frame

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • If the channel has not been created, failure is returned.

  • connect IDR Framepleaseafter, notbInstant =0 with, that isencoding IDR Frame, notFrame rateControl.

  • IDR Frameplease, onlySupport H.264/H.265 EncodingProtocol.

  • thisInterfacenotFrame rateControlaffect, eachCallonesecondarythat isencodinga IDR, Callwillaffectcode streamFrame rateandBitratestable.

  • inunderoneFrameEncodingbootbeforemultiplesecondaryInterfaceCallonlywillencodinga IDR. FramealreadyisIDR Frametimenoteffective.

  • When Advanced Frame Skippingcantime, Request an IDR framecancanwilltimeeffective.

Example

  • None

7.3.21. CVI_VENC_SetRoiAttr

Description

Set H.264/H.265 Channel ROI Attribute.

Syntax

CVI_S32 CVI_VENC_SetRoiAttr(VENC_CHN VeChn, const VENC_ROI_ATTR_S *pstRoiAttr); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstRoiAttr

ROI RegionParameter.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • u32Index: SupporteachChannelcanSet 8 item ROI Region, according to 0~7Indexnumberfor ROI Regionperform, u32Index meansUserSet ROI Indexnumber. repeatRegionaccording to 0~7 ROIIndexnumbersecondaryprovideheightfirstlevel.

  • bEnable: specifiedcurrent ROI RegionWhether to enable.

  • bAbsQp: specifiedcurrentROI RegionUseAbsolute QPorisRelative QPMode.

  • s32Qp: When bAbsQp is CVI_TRUE time, s32QpisforROI RegionSet Qp value, When bAbsQp is CVI_FALSEtime, s32QpmeansforROI RegioninternalRate Controlof Qp onSet Qp value.

  • stRect: specifiedcurrent ROI RegionPositionCoordinateandRegionSize. ROI RegionmustinImageRangein.

  • systemdefaultnothas ROI RegionEnable, UsermustinEncoding channelafter creation, Encoding channelDestroybeforeSetCallthisInterfaceboot ROI. thisInterfaceinEncodingprocessinbeCalltime, etc.tounderaFrametimeeffective.

  • It is recommended to UserinCreateChannelafter that, bootEncodingbeforeCallthisInterface, reduceinEncodingprocessinCallcount. It is recommended to UserinCallthisInterfacebefore, firstCall CVI_VENC_GetRoiAttr Interface, GetcurrentChannel ROI Configurationafterthenperform Set.

  • SetthisInterfaceafter, If currentFramedetermineEncodingis pskip Frame, with pskip Frameeffectivefirst.

  • When Rate ControlModenotis Fixed QPModetime, ROI RegioncanConfiguration.

  • H.264When ROIcantime, Macroblock-LevelRate Controleffective.

  • Absolute Qp ModebecauseRate Controltuningmacroblock QP, actualEncodingQPwithSetofQPcancanwillhas.

Example

  • None

7.3.22. CVI_VENC_GetRoiAttr

Description

GetH.264/H.265 Channel ROI Attribute.

Syntax

CVI_S32 CVI_VENC_GetRoiAttr(VENC_CHN VeChn, CVI_U32 u32Index, VENC_ROI_ATTR_S *pstRoiAttr); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

u32Index

ROI RegionIndex.

Input

pstRoiAttr

ROI RegionParameter.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • u32IndexIndexGetthisROI RegionConfiguration

  • UsermustinEncoding channelafter creation, Encoding channelDestroybeforeSetCallthisInterface

  • It is recommended to UserinCall CVI_VENC_SetRoiAttr Interfacebefore, firstCallthisInterface, GetcurrentChannel ROI Configurationafterthenperform Set.

Example

  • None

7.3.23. CVI_VENC_SetRefParam

Description

Set H.264/H.265 Encoding channelAdvanced Frame SkippingReferenceParameter.

Syntax

CVI_S32 CVI_VENC_SetRefParam(VENC_CHN VeChn, const VENC_REF_PARAM_S *pstRefParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstRefParam

H.264/H.265 Encoding channelAdvanced Frame SkippingReferenceParameter.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • H.264 and H.265Support1times, 2times, and4frame-skipping reference mode. defaultis1frame-skipping reference mode (notFrame).

  • need toinCreateChannelafter that, bootEncodingbeforeCallthisInterface, inEncodingprocessinCall.

  • 1 frame-skipping reference modeSetConfigurationis: bEnablePred = CVI_TRUE, u32Enhance = 0, u32Base = 1

  • 2 frame-skipping reference modeSetConfigurationis: bEnablePred = CVI_TRUE, u32Enhance = 1, u32Base = 1.

  • 4 frame-skipping reference modeSetConfigurationis: bEnablePred = CVI_TRUE, u32Enhance = 1, u32Base = 2

  • UserSetChannel Gop ModeisNormalPtime, 2 frame-skipping reference modeu32Gopneed tois2timesnumber; 4frame-skipping reference modeu32Gopneed tois4timesnumber

  • UserSetChannelGop ModeisSmartPtime, 2frame-skipping reference modeu32Gopwith u32BgInterval need tois2timesnumber; 4frame-skipping reference modeu32Gopwith u32BgInterval need tois4timesnumber

7.3.24. CVI_VENC_GetRefParam

Description

Get H.264/H.265 Encoding channelAdvanced Frame SkippingReferenceParameter.

Syntax

CVI_S32 CVI_VENC_GetRefParam(VENC_CHN VeChn, VENC_REF_PARAM_S *pstRefParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstRefParam

H.264/H.265 Encoding channelAdvanced Frame SkippingReferenceParameter.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • None

Example

  • None

7.3.25. CVI_VENC_SetFrameLostStrategy

Description

Set the frame-dropping policy when the instantaneous encoding-channel bitrate exceeds the threshold.

Syntax

CVI_S32 CVI_VENC_SetFrameLostStrategy(VENC_CHN VeChn, const VENC_FRAMELOST_S *pstFrmLostParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstFrmLostParam

Frame-dropping policy parameters for the encoding channel.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • FramestrategyonlySupport H.264/H.265 EncodingProtocol.

  • FramestrategyConfigurationbyfouritemParameterdetermine

    • bFrmLostOpen: When BitrateexceedsthresholdtimeEnableFrame, ensureregionBitratevaluenotwillheight.

    • enFrmLostMode: onlySupportEncodingis PSkipFrameofFrameMethod

    • u32FrmLostBpsThr: systemcapabilitySet, recommendtoSetBitrate1.2timeswithon

    • u32EncFrmGaps: limitMaximumcontinuousFrameCountcanmakeFrametimeofimage, regionBitratevaluecancanheight. Setis 0 timemeansisnotlimitcontinuousFramenumber, meanstimeBitrateexceedthresholdoneFrame, totimeBitratenotgreater thanthreshold

  • UsercanselectnessCall, defaultisnot enabledFramestrategy

  • thisInterfaceinEncoding channelafter creation, Encoding channelDestroybeforeSet.

  • pskip FrameonlySupportGOPModeisVENC_GOPMODE_NORMALPEncoding channel. ifcurrentFrameOSDEnableandOSDhasmore, notcanEncodingisPskipFrame.

  • EnableFrameReferenceModetime, notrecommendEnableFramestrategy

  • onlySupportH.264 / H.265CBR / VBRRate ControlMode

Example

  • None

7.3.26. CVI_VENC_GetFrameLostStrategy

Description

Set the frame-dropping policy when the instantaneous encoding-channel bitrate exceeds the threshold.

Syntax

CVI_S32 CVI_VENC_GetFrameLostStrategy(VENC_CHN VeChn, VENC_FRAMELOST_S *pstFrmLostParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

VENC Channel number.

Input

pstFrmLostParam

Frame-dropping policy parameters for the encoding channel.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • None

Example

  • None

7.3.27. CVI_VENC_SetModParam

Description

SetEncodingrelated moduleParameter.

Syntax

CVI_S32 CVI_VENC_SetModParam(const VENC_PARAM_MOD_S *pstModParam); 

Parameters

Parameter Name

Description

Input/Output

pstModParam

EncodingModuleParameterPointer.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • thisInterfacecaninChannelCreatebeforeafterCall.

  • thisInterfacemainused to SetcorrespondingEncodingVB poolGetMethod, UsercanthroughStructure VENC_PARAM_MOD_S in VB_SOURCE_E TypevariableSetVB mode.

Example

  • None

7.3.28. CVI_VENC_GetModParam

Description

GetEncodingrelated moduleParameter.

Syntax

CVI_S32 CVI_VENC_GetModParam(VENC_PARAM_MOD_S *pstModParam); 

Parameters

Parameter Name

Description

Input/Output

pstModParam

EncodingModuleParameterPointer.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

Example

  • None

7.3.29. CVI_VENC_AttachVbPool

Description

Bind the encoding channel to the video buffer VB pool.

Syntax

CVI_S32 CVI_VENC_AttachVbPool(VENC_CHN VeChn, const VENC_CHN_POOL_S *pstPool); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstPool

VideocacheVB pool Id number.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h, cvi_comm_vb.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • The user must call CVI_VB_CreatePool to create a video buffer VB pool, then call the interface CVI_VENC_AttachVbPool currentEncoding channelBindtofixedPoolIdVB poolin. canmultipleEncoding channelBindtosamea VB poolin, butisnotcansameaEncoding channelBindtomultipleVBpoolin.

  • pstPoolmustisalready createdVB poolValid PoolId, includingstorage Picture VB poolandstoragestorage Picture InformationVB pool.

  • onlyhasH.264 / H.265EncodingSupportUserVBpoolMethod. If currentEncodingFramestorageallocateMethodUsenotisEncodingUserVBpool, thenReturnCVI_FAILURE.

  • UserCallthisInterface, mustdeterminethrough CVI_VENC_SetModParam Setin VB_SOURCE_USER Mode.

Example

  • None

7.3.30. CVI_VENC_DetachVbPool

Description

willEncoding channelunbind from a video buffer VB unbind from the pool.

Syntax

CVI_S32 CVI_VENC_DetachVbPool(VENC_CHN VeChn); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h, cvi_comm_vb.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.31. CVI_VENC_GetH264Entropy

Description

GetH264entropyEncodingInformation

Syntax

CVI_S32 CVI_VENC_GetH264Entropy(VENC_CHN VeChn, VENC_H264_ENTROPY_S *pstH264EntropyEnc); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number

Input/Output

pstH264EntropyEnc

Entropy encoding structure pointer

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.32. CVI_VENC_SetH264Entropy

Description

SetH264entropyEncodingInformation

Syntax

CVI_S32 CVI_VENC_SetH264Entropy(VENC_CHN VeChn, const VENC_H264_ENTROPY_S *pstH264EntropyEnc); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264EntropyEnc

Entropy encoding structure pointer

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.33. CVI_VENC_InsertUserData

Description

inUserData

Syntax

CVI_S32 CVI_VENC_InsertUserData(VENC_CHN VeChn, CVI_U8 *pu8Data, CVI_U32 u32Len); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pu8Data

DataAddress

Input

u32Len

DataLength

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.34. CVI_VENC_GetCuPrediction

Description

GetCUsinglepredictionInformation

Syntax

CVI_S32 CVI_VENC_GetCuPrediction(VENC_CHN VeChn, VENC_CU_PREDICTION_S *pstCuPrediction); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number

Input

pstCuPrediction

predictionInformationStructurePointer

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.35. CVI_VENC_SetCuPrediction

Description

SetCUsinglepredictionInformation

Syntax

CVI_S32 CVI_VENC_SetCuPrediction(VENC_CHN VeChn, VENC_CU_PREDICTION_S *pstCuPrediction); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number

Input

pstCuPrediction

predictionStructurePointer

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

None

7.3.36. CVI_VENC_GetH264Trans

Description

Get H.264ProtocolEncoding channel, quantizationAttribute.

Syntax

CVI_S32 CVI_VENC_GetH264Trans(VENC_CHN VeChn, VENC_H264_TRANS_S *pstH264Trans); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264Trans

H.264 ProtocolEncoding channel, quantizationParameter.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.37. CVI_VENC_SetH264Trans

Description

SetH.264ProtocolEncoding channel, quantizationAttribute

Syntax

CVI_S32 CVI_VENC_SetH264Trans(VENC_CHN VeChn, const VENC_H264_TRANS_S *pstH264Trans); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264Trans

H.264ProtocolEncoding channel, quantizationParameter.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.38. CVI_VENC_GetH265Trans

Description

Get H.265ProtocolEncoding channel, quantizationAttribute

Syntax

CVI_S32 CVI_VENC_GetH265Trans(VENC_CHN VeChn, VENC_H265_TRANS_S *pstH265Trans); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH265Trans

Transform and quantization parameters of the H.265 protocol encoding channel.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.265 encoding

Example

  • None

7.3.39. CVI_VENC_SetH265Trans

Description

SetH.265ProtocolEncoding channel, quantizationAttribute

Syntax

CVI_S32 CVI_VENC_SetH265Trans(VENC_CHN VeChn, const VENC_H265_TRANS_S *pstH265Trans); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH265Trans

Transform and quantization parameters of the H.265 protocol encoding channel.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.265 encoding

Example

  • None


7.3.40. cviGetMask

Description

Set log etc.level

Syntax

CVI_VOID cviGetMask(void); 

Parameters

NoneParameter

Return Value

NoneReturn Value

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

7.3.41. CVI_VENC_SetH264IntraPred

Description

Set h264 FrameinpredictionParameter

Syntax

CVI_S32 CVI_VENC_SetH264IntraPred(VENC_CHN VeChn, const VENC_H264_INTRA_PRED_S *pstH264IntraPred); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264IntraPred

Intra-frame prediction parameters.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.42. CVI_VENC_GetH264IntraPred

Description

Get h264 FrameinpredictionParameter

Syntax

CVI_S32 CVI_VENC_GetH264IntraPred(VENC_CHN VeChn, VENC_H264_INTRA_PRED_S *pstH264IntraPred); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264IntraPred

Intra-frame prediction parameters.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.43. CVI_VENC_SetH264Dblk

Description

Set h264 goblockeffectiveshouldParameter

Syntax

CVI_S32 CVI_VENC_SetH264Dblk(VENC_CHN VeChn, const VENC_H264_DBLK_S *pstH264Dblk); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264Dblk

H.264 deblocking parameters.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.44. CVI_VENC_GetH264Dblk

Description

Get h264 goblockeffectiveshouldParameter

Syntax

CVI_S32 CVI_VENC_GetH264Dblk(VENC_CHN VeChn, VENC_H264_DBLK_S *pstH264Dblk); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264Dblk

H.264 deblocking parameters.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.45. CVI_VENC_SetH264Vui

Description

Set h264 vui Parameter

Syntax

CVI_S32 CVI_VENC_SetH264Vui(VENC_CHN VeChn, const VENC_H264_VUI_S *pstH264Vui); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264Vui

h264 vui Parameter.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.46. CVI_VENC_GetH264Vui

Description

Get h264 vui Parameter

Syntax

CVI_S32 CVI_VENC_GetH264Vui(VENC_CHN VeChn, VENC_H264_VUI_S *pstH264Vui); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH264Vui

h264 vui Parameter.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.264 encoding

Example

  • None

7.3.47. CVI_VENC_SetH265Vui

Description

Set h265 vui Parameter

Syntax

CVI_S32 CVI_VENC_SetH265Vui(VENC_CHN VeChn, const VENC_H265_VUI_S *pstH265Vui); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH265Vui

h265 vui Parameter.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.265 encoding

Example

  • None

7.3.48. CVI_VENC_GetH265Vui

Description

Get h265 vui Parameter

Syntax

CVI_S32 CVI_VENC_GetH265Vui(VENC_CHN VeChn, VENC_H265_VUI_S *pstH265Vui); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH265Vui

h265 vui Parameter.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.265 encoding

Example

  • None

7.3.49. CVI_VENC_SetH265Dblk

Description

Set h265 goblockeffectiveshouldParameter

Syntax

CVI_S32 CVI_VENC_SetH265Dblk(VENC_CHN VeChn, const VENC_H265_DBLK_S *pstH265Dblk); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH265Dblk

H.265 deblocking parameters.

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.265 encoding

Example

  • None

7.3.50. CVI_VENC_GetH265Dblk

Description

Get h265 goblockeffectiveshouldParameter

Syntax

CVI_S32 CVI_VENC_GetH265Dblk(VENC_CHN VeChn, VENC_H265_DBLK_S *pstH265Dblk); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstH265Dblk

H.265 deblocking parameters.

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

  • This interface currently applies only to H.265 encoding

Example

  • None

7.3.51. CVI_VENC_SetSuperFrameStrategy

Description

Set super FrameParameter

Syntax

CVI_S32 CVI_VENC_SetSuperFrameStrategy(VENC_CHN VeChn, const VENC_SUPERFRAME_CFG_S *pstSuperFrmParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstSuperFrmParam

super FrameParameter

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.52. CVI_VENC_GetSuperFrameStrategy

Description

Get super FrameParameter

Syntax

CVI_S32 CVI_VENC_GetSuperFrameStrategy(VENC_CHN VeChn, VENC_SUPERFRAME_CFG_S *pstSuperFrmParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstSuperFrmParam

super FrameParameter

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.53. CVI_VENC_SetFrameParam

Description

SetFrameParameter

Syntax

CVI_S32 CVI_VENC_SetFrameParam(VENC_CHN VeChn, const VENC_FRAME_PARAM_S *pstFrameParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstFrameParam

FrameParameter

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.54. CVI_VENC_GetFrameParam

Description

GetFrameParameter

Syntax

CVI_S32 CVI_VENC_GetFrameParam(VENC_CHN VeChn, VENC_FRAME_PARAM_S *pstFrameParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstFrameParam

FrameParameter

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.55. CVI_VENC_EnableSvc

Description

EnableintelligentEncoding

Syntax

CVI_S32 CVI_VENC_EnableSvc(VENC_CHN VeChn, CVI_BOOL enable); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

enable

Whether to enableintelligentEncoding

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.56. CVI_VENC_SetSvcParam

Description

SetintelligentEncodingParameter

Syntax

CVI_S32 CVI_VENC_SetSvcParam(VENC_CHN VeChn, const VENC_SVC_PARAM_S *pstSvcParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstSvcParam

intelligentEncodingParameter

Input

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None

7.3.57. CVI_VENC_GetSvcParam

Description

GetintelligentEncodingParameter

Syntax

CVI_S32 CVI_VENC_GetSvcParam(VENC_CHN VeChn, VENC_SVC_PARAM_S *pstSvcParam); 

Parameters

Parameter Name

Description

Input/Output

VeChn

Channel number.

Input

pstSvcParam

intelligentEncodingParameter

Output

Return Value

Return Value

Description

0

Success

Non-zero

Failure; its value is Error Codes.

Requirements

  • Header files: cvi_comm_venc.h, cvi_venc.h

  • Library files: libvenc.a

Note

  • The channel must have been created; otherwise, the CVI_FAILURE error code is returned.

Example

  • None