ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
Data Structures | Enumerations | Functions

video encoding (H264, JPEG)modules,including video encoding channel management and it's parameter setting and so on More...

Collaboration diagram for IMP_Encoder:

Data Structures

struct  IMPEncoderFrmRate
 Define video encode channel framerate structure frmRateNum and frmRateDen is LCM must be 1 and GCD must be not greater than 64 The least common multiple of the greatest common divisor divisibility between frmRateNum and frmRateDen can not be more than 64, it is better to get the greatest common divisor number before the settings. More...
 
struct  IMPEncoderAttrH264FixQP
 Define the FixQp ratecontrol attribute of h264 channel. More...
 
struct  IMPEncoderAttrH264CBR
 Define the CBR ratecontrol attribute of h264 channel. More...
 
struct  IMPEncoderAttrH264VBR
 Define the VBR ratecontrol attribute of h264 channel. More...
 
struct  IMPEncoderAttrH264Smart
 Define the Smart ratecontrol attribute of h264 channel. More...
 
struct  IMPEncoderAttrDemask
 Define the demask attribute of h264 channel, it is suggested not to use it. More...
 
struct  IMPEncoderAttrDenoise
 Define the denoise attribute of h264 channel. More...
 
struct  IMPEncoderAttrFrmUsed
 Define the input frame usage mode attribute of h264 channel. More...
 
struct  IMPEncoderAttrHSkip
 Define high skip frame type structure of h264 channel. More...
 
struct  IMPEncoderAttrInitHSkip
 Define high skip frame type init structure of h264 channel. More...
 
struct  IMPEncoderAttrRcMode
 Define the channel ratecontroller mode attribute. More...
 
struct  IMPEncoderRcAttr
 Define the channel ratecontroller attribute. More...
 
union  IMPEncoderDataType
 Define the H264E bitstream type. More...
 
struct  IMPEncoderPack
 Define frame bitstream packet structure. More...
 
struct  IMPEncoderStream
 Define the bitstream structure of one frame. More...
 
struct  IMPEncoderCropCfg
 Define the encoder crop attribute(crop first, scaler second) More...
 
struct  IMPEncoderUserDataCfg
 Define insert user data attribute of h264 channel. More...
 
struct  IMPEncoderAttr
 Define encoder attribute structure. More...
 
struct  IMPEncoderCHNAttr
 Define encoder channel attribute structure. More...
 
struct  IMPEncoderCHNStat
 Define encode channel state attribute structure. More...
 
struct  IMPEncoderColor2GreyCfg
 Define color to grey parameter. More...
 
struct  IMPEncoderEnIDRCfg
 Define the Enalbe IDR parameter. More...
 
struct  IMPEncoderGOPSizeCfg
 Define the gopsize parameter. More...
 
struct  IMPEncoderROICfg
 Define ROI parameters. More...
 
struct  IMPEncoderSuperFrmCfg
 Paramete of super frame process strategy. More...
 
struct  IMPEncoderH264TransCfg
 Define H.264 encoder channel transform quantization struct. More...
 
struct  IMPEncoderJpegeQl
 Define JPEG encoder channel quantization table set param struct. More...
 

Enumerations

enum  IMPEncoderRcMode {
  ENC_RC_MODE_FIXQP = 0, ENC_RC_MODE_CBR = 1, ENC_RC_MODE_VBR = 2, ENC_RC_MODE_SMART = 3,
  ENC_RC_MODE_INV = 4
}
 Define h264 channel ratecontrol method. More...
 
enum  EncFrmUsedMode { ENC_FRM_BYPASS = 0, ENC_FRM_REUSED = 1, ENC_FRM_SKIP = 2 }
 Define the input frame usage mode of h264 channel. More...
 
enum  IMPSkipType {
  IMP_Encoder_STYPE_N1X = 0, IMP_Encoder_STYPE_N2X = 1, IMP_Encoder_STYPE_N4X = 2, IMP_Encoder_STYPE_HN1_FALSE = 3,
  IMP_Encoder_STYPE_HN1_TRUE = 4, IMP_Encoder_STYPE_H1M_FALSE = 5, IMP_Encoder_STYPE_H1M_TRUE = 6
}
 
enum  IMPRefType { IMP_Encoder_FSTYPE_IDR = 0, IMP_Encoder_FSTYPE_LBASE = 1, IMP_Encoder_FSTYPE_SBASE = 2, IMP_Encoder_FSTYPE_ENHANCE = 3 }
 
enum  IMPEncoderH264NaluType {
  IMP_H264_NAL_UNKNOWN = 0, IMP_H264_NAL_SLICE = 1, IMP_H264_NAL_SLICE_DPA = 2, IMP_H264_NAL_SLICE_DPB = 3,
  IMP_H264_NAL_SLICE_DPC = 4, IMP_H264_NAL_SLICE_IDR = 5, IMP_H264_NAL_SEI = 6, IMP_H264_NAL_SPS = 7,
  IMP_H264_NAL_PPS = 8, IMP_H264_NAL_AUD = 9, IMP_H264_NAL_FILLER = 12
}
 H264 stream NAL unit type codes. More...
 
enum  IMPEncoderSuperFrmMode { IMP_RC_SUPERFRM_NONE = 0, IMP_RC_SUPERFRM_DISCARD = 1, IMP_RC_SUPERFRM_REENCODE = 2, IMP_RC_SUPERFRM_BUTT = 3 }
 Define process strategy of ratecontrol super frame. More...
 
enum  IMPEncoderRcPriority { IMP_RC_PRIORITY_RDO = 0, IMP_RC_PRIORITY_BITRATE_FIRST = 1, IMP_RC_PRIORITY_FRAMEBITS_FIRST = 2, IMP_RC_PRIORITY_BUTT = 3 }
 Define priority type of ratecontrol. More...
 

Functions

int IMP_Encoder_CreateGroup (int encGroup)
 Create encode Group. More...
 
int IMP_Encoder_DestroyGroup (int encGroup)
 destroy the encoding Group More...
 
int IMP_Encoder_CreateChn (int encChn, const IMPEncoderCHNAttr *attr)
 create encoding channel More...
 
int IMP_Encoder_DestroyChn (int encChn)
 destroy encode Channel More...
 
int IMP_Encoder_GetChnAttr (int encChn, IMPEncoderCHNAttr *const attr)
 get encode channel attribute More...
 
int IMP_Encoder_RegisterChn (int encGroup, int encChn)
 register encode channel to Group More...
 
int IMP_Encoder_UnRegisterChn (int encChn)
 unregister encode channel from group More...
 
int IMP_Encoder_StartRecvPic (int encChn)
 start encode channel to receive frames More...
 
int IMP_Encoder_StopRecvPic (int encChn)
 stop encode channel to receive frames More...
 
int IMP_Encoder_Query (int encChn, IMPEncoderCHNStat *stat)
 query encode channel state More...
 
int IMP_Encoder_GetStream (int encChn, IMPEncoderStream *stream, bool blockFlag)
 Get encode bitstream. More...
 
int IMP_Encoder_ReleaseStream (int encChn, IMPEncoderStream *stream)
 release the bitstream buffer More...
 
int IMP_Encoder_PollingStream (int encChn, uint32_t timeoutMsec)
 Polling bitstream buffer. More...
 
int IMP_Encoder_SetMaxStreamCnt (int encChn, int nrMaxStream)
 Set bitstream buffer number. More...
 
int IMP_Encoder_GetMaxStreamCnt (int encChn, int *nrMaxStream)
 Get bitstream buffer number. More...
 
int IMP_Encoder_RequestIDR (int encChn)
 Requst IDR frame. More...
 
int IMP_Encoder_FlushStream (int encChn)
 flush old bitstream of encoder and start with idr frame to encode More...
 
int IMP_Encoder_SetChnColor2Grey (int encChn, const IMPEncoderColor2GreyCfg *pstColor2Grey)
 set color to grey attribute More...
 
int IMP_Encoder_GetChnColor2Grey (int encChn, IMPEncoderColor2GreyCfg *pstColor2Grey)
 get color to grey attribute More...
 
int IMP_Encoder_SetChnAttrRcMode (int encChn, const IMPEncoderAttrRcMode *pstRcModeCfg)
 Set encoding channel rate controller mode attribute(s) More...
 
int IMP_Encoder_GetChnAttrRcMode (int encChn, IMPEncoderAttrRcMode *pstRcModeCfg)
 Get encode channel rate controller mode attribute(s) More...
 
int IMP_Encoder_SetChnFrmRate (int encChn, const IMPEncoderFrmRate *pstFps)
 Set encode channel framerate controlled attribute. More...
 
int IMP_Encoder_GetChnFrmRate (int encChn, IMPEncoderFrmRate *pstFps)
 Get encode channel framerate controlled attribute. More...
 
int IMP_Encoder_SetChnROI (int encChn, const IMPEncoderROICfg *pstVencRoiCfg)
 Set encoder channel ROI attribute. More...
 
int IMP_Encoder_GetChnROI (int encChn, IMPEncoderROICfg *pstVencRoiCfg)
 Get encoder channel roi attribute. More...
 
int IMP_Encoder_GetGOPSize (int encChn, IMPEncoderGOPSizeCfg *pstGOPSizeCfg)
 Get encoder channel GOP attribute. More...
 
int IMP_Encoder_SetGOPSize (int encChn, const IMPEncoderGOPSizeCfg *pstGOPSizeCfg)
 Set encoder channel gop attribute. More...
 
int IMP_Encoder_SetChnDemask (int encChn, const IMPEncoderAttrDemask *pdemaskAttr)
 Set encoder channel demask attribute. More...
 
int IMP_Encoder_GetChnDemask (int encChn, IMPEncoderAttrDemask *pdemaskAttr)
 Get encoder channel demask attribute. More...
 
int IMP_Encoder_SetChnFrmUsedMode (int encChn, const IMPEncoderAttrFrmUsed *pfrmUsedAttr)
 Set encoder channel input frame usage mode attribute. More...
 
int IMP_Encoder_GetChnFrmUsedMode (int encChn, IMPEncoderAttrFrmUsed *pfrmUsedAttr)
 Get encoder channel input frame usage mode attribute. More...
 
int IMP_Encoder_SetChnDenoise (int encChn, const IMPEncoderAttrDenoise *pdenoiseAttr)
 Set encode channel denoise attribute. More...
 
int IMP_Encoder_GetChnDenoise (int encChn, IMPEncoderAttrDenoise *pdenoiseAttr)
 Get encode channel denoise attribute. More...
 
int IMP_Encoder_SetChnHSkip (int encChn, const IMPEncoderAttrHSkip *phSkipAttr)
 Set encode channel high skip reference attribute. More...
 
int IMP_Encoder_GetChnHSkip (int encChn, IMPEncoderAttrHSkip *phSkipAttr)
 Get encode channel high skip reference attribute. More...
 
int IMP_Encoder_SetChnHSkipBlackEnhance (int encChn, const int bBlackEnhance)
 Set encode channel'bBlackEnhance in high skip reference attribute. More...
 
int IMP_Encoder_InsertUserData (int encChn, void *userData, uint32_t userDataLen)
 insert userdata More...
 
int IMP_Encoder_SetFisheyeEnableStatus (int encChn, int enable)
 set enabled status of ingenic fisheye correction algorithm More...
 
int IMP_Encoder_GetFisheyeEnableStatus (int encChn, int *enable)
 get enabled status of ingenic fisheye correction algorithm More...
 
int IMP_Encoder_SetChangeRef (int encChn, int bEnable)
 set whether allow change base skip frame's reference or not More...
 
int IMP_Encoder_GetChangeRef (int encChn, int *bEnable)
 get whether allow change base skip frame's reference or not More...
 
int IMP_Encoder_SetMbRC (int encChn, int bEnable)
 set whether open mb ratecontrol or not More...
 
int IMP_Encoder_GetMbRC (int encChn, int *bEnable)
 get the status whether open mb ratecontrol or not More...
 
int IMP_Encoder_SetSuperFrameCfg (int encChn, const IMPEncoderSuperFrmCfg *pstSuperFrmParam)
 Set video coded supper frame configuration. More...
 
int IMP_Encoder_GetSuperFrameCfg (int encChn, IMPEncoderSuperFrmCfg *pstSuperFrmParam)
 Get video coded supper frame configuration. More...
 
int IMP_Encoder_SetH264TransCfg (int encChn, const IMPEncoderH264TransCfg *pstH264TransCfg)
 Set H.264 encode channel transform and quantization attribute. More...
 
int IMP_Encoder_GetH264TransCfg (int encChn, IMPEncoderH264TransCfg *pstH264TransCfg)
 Get H.264 encode channel transform and quantization attribute. More...
 
int IMP_Encoder_SetJpegeQl (int encChn, const IMPEncoderJpegeQl *pstJpegeQl)
 Set JPEG encode channel quantization table set param. More...
 
int IMP_Encoder_GetJpegeQl (int encChn, IMPEncoderJpegeQl *pstJpegeQl)
 Get JPEG encode channel quantization table set param. More...
 

Detailed Description

video encoding (H264, JPEG)modules,including video encoding channel management and it's parameter setting and so on

1 module structure

Encoder module internal structure as following:

encoder_struct.jpg

In this mentioned picture, The coding module consists of a number of Group (the T15 supports two Group), each Group consists of encoding Channel. each encoding Channel comes with an output stream buffer, which is composed of a number of buffer.

2 encoder Channel

One coding channel can only deal with one coding protocol entity, each group can add a H264 encoding Channel with a JPEG encoding channel;

3 encoder bitrate control

3.1 CBR

CBR, Constant Bit Rate, the code rate is constant in the rate statistical time. Such as H264 encode, users can set maxQp,minQp,bitrate and so on. maxQp, minQp is used to control the quality range. bitrate is used to control the constant bitrate. (Average coding bit rate for a certain time) when the coding rate is greater than the constant bit rate, the image maxQp will gradually adjust to the QP, when the coding rate is much smaller than the constant bit rate, the image QP will gradually adjust to the minQp. when the image QP reaches maxQP, Qp is clamped to the maximum value, bitrate clamping effect fails, the coding rate might exceed bitrate. when the image QP reaches minQp, QP is clamped to the minimum value, and when the coding rate has reaches the maximum value, the image quality will get better.

3.2 FixQP

Fix Qp fixes the value of Qp. In the rate statistics time, all the Qp value of the coded image is the same, and the image Qp value is adopted by the user.

Enumeration Type Documentation

Define the input frame usage mode of h264 channel.

Enumerator
ENC_FRM_BYPASS 

Sequential full use mode - default mode.

ENC_FRM_REUSED 

repeat use of a frame mode

ENC_FRM_SKIP 

Frame loss mode.

H264 stream NAL unit type codes.

Enumerator
IMP_H264_NAL_UNKNOWN 

Unspecified.

IMP_H264_NAL_SLICE 

Coded slice of a non-IDR picture.

IMP_H264_NAL_SLICE_DPA 

Coded slice data partition A.

IMP_H264_NAL_SLICE_DPB 

Coded slice data partition B.

IMP_H264_NAL_SLICE_DPC 

Coded slice data partition C.

IMP_H264_NAL_SLICE_IDR 

Coded slice of an IDR picture.

IMP_H264_NAL_SEI 

Supplemental enhancement information(SEI)

IMP_H264_NAL_SPS 

Sequence parameter set.

IMP_H264_NAL_PPS 

Picture parameter set.

IMP_H264_NAL_AUD 

Access unit delimiter.

IMP_H264_NAL_FILLER 

Filler data.

Define h264 channel ratecontrol method.

Enumerator
ENC_RC_MODE_FIXQP 

Fixqp method.

ENC_RC_MODE_CBR 

CBR method.

ENC_RC_MODE_VBR 

VBR method.

ENC_RC_MODE_SMART 

Smart method.

ENC_RC_MODE_INV 

invalidate method

Define priority type of ratecontrol.

Enumerator
IMP_RC_PRIORITY_RDO 

rdo priority

IMP_RC_PRIORITY_BITRATE_FIRST 

target frame rate first

IMP_RC_PRIORITY_FRAMEBITS_FIRST 

super frame threshold first

Define process strategy of ratecontrol super frame.

Enumerator
IMP_RC_SUPERFRM_NONE 

no strategy (supported)

IMP_RC_SUPERFRM_DISCARD 

dop super frame (unsupported), users should decide whether drop or not

IMP_RC_SUPERFRM_REENCODE 

reencoder super frame (supported), default

enum IMPRefType
Enumerator
IMP_Encoder_FSTYPE_IDR 

the idr frame in high skip frame reference mode

IMP_Encoder_FSTYPE_LBASE 

the long base(p) frame in high skip frame reference mode

IMP_Encoder_FSTYPE_SBASE 

the short base(p) frame in high skip frame reference mode

IMP_Encoder_FSTYPE_ENHANCE 

the enhance(p) frame in high skip frame reference mode

Enumerator
IMP_Encoder_STYPE_N1X 

1 time (skip frame reference)

IMP_Encoder_STYPE_N2X 

2 times (skip frame reference)

IMP_Encoder_STYPE_N4X 

4 times (skip frame reference)

IMP_Encoder_STYPE_HN1_FALSE 

high skip frame reference mode:N1 open skip frame

IMP_Encoder_STYPE_HN1_TRUE 

high skip frame reference mode:N1 close skip frame

IMP_Encoder_STYPE_H1M_FALSE 

high skip frame reference mode:1M open skip frame

IMP_Encoder_STYPE_H1M_TRUE 

high skip frame reference mode:1M close skip frame

Function Documentation

int IMP_Encoder_CreateChn ( int  encChn,
const IMPEncoderCHNAttr attr 
)

create encoding channel

Parameters
[in]encChnencoder channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]attrencode channel attribute pointer
Return values
0success
not0 failure
Remarks
encoder channel contains encoder attribute and ratecontroller attribute
encoder should choose encoder protocol, and then set the attribute to the encoder
int IMP_Encoder_CreateGroup ( int  encGroup)

Create encode Group.

Parameters
[in]encGroupGroup number,range:[0, NR_MAX_ENC_GROUPS - 1]
Return values
0success
not0 failure
Remarks
one Group only support one resolution, and can allow one h264e and one jpg channel to be registered into.
Attention
return failure if group has been created.
int IMP_Encoder_DestroyChn ( int  encChn)

destroy encode Channel

Parameters
[in]encChnencoder channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Attention
destroy uncreated channel will cause failure
Before destroying a channel, make sure that it is not registered, otherwise it will return a failure value.
int IMP_Encoder_DestroyGroup ( int  encGroup)

destroy the encoding Group

Parameters
[in]encGroupGroup number,range:[0, NR_MAX_ENC_GROUPS - 1]
Return values
0success
not0 failure
Remarks
Destroy a Group, requires that the group must be empty, that is to say,no channel is registered into, otherwise it will return a failure value.
Attention
the group must have been created, otherwise it will return a failure value.
int IMP_Encoder_FlushStream ( int  encChn)

flush old bitstream of encoder and start with idr frame to encode

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Remarks
After calling this current function there will be an application for IDR frame coding.
int IMP_Encoder_GetChangeRef ( int  encChn,
int *  bEnable 
)

get whether allow change base skip frame's reference or not

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]enablereturn the status whether allow change base skip frame's reference or not, 0:not allowed, 1: allowed
Return values
0success
not0 failure
Remarks
this api only used by h264;
int IMP_Encoder_GetChnAttr ( int  encChn,
IMPEncoderCHNAttr *const  attr 
)

get encode channel attribute

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]attrencode channel attribute
Return values
0success
not0 failure
int IMP_Encoder_GetChnAttrRcMode ( int  encChn,
IMPEncoderAttrRcMode pstRcModeCfg 
)

Get encode channel rate controller mode attribute(s)

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pstRcCfgencode channel rate control mode attribute
Return values
0success
not0 failure
Remarks
this function gets the mode attribute(s) of the current Channel rate controller. The channel must have been created before calling this function.
Attention
it is meaningless for JPEG Encoder
int IMP_Encoder_GetChnColor2Grey ( int  encChn,
IMPEncoderColor2GreyCfg pstColor2Grey 
)

get color to grey attribute

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pstColor2Greycolor to grey encode parameter
Return values
0success
not0 failure
Remarks
this interface just get the grayscale function attribute(s). the channel should be created before calling this function
Attention
it is meaningless for JPEG Encoder
int IMP_Encoder_GetChnDemask ( int  encChn,
IMPEncoderAttrDemask pdemaskAttr 
)

Get encoder channel demask attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pdemaskAttrdemask attribute pointer
Return values
0success
not0 failure
Remarks
It gets the Channel's Demask attribute(s), and the channel must have been created before calling this function.
int IMP_Encoder_GetChnDenoise ( int  encChn,
IMPEncoderAttrDenoise pdenoiseAttr 
)

Get encode channel denoise attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pdenoiseAttrdenoise attribute pointer
Return values
0success
not0 failure
Remarks
It gets the Channel's denoise attribute(s), and the channel must have been created before calling this function.
Attention
it is meaningless for JPEG Encoder
int IMP_Encoder_GetChnFrmRate ( int  encChn,
IMPEncoderFrmRate pstFps 
)

Get encode channel framerate controlled attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pstFpsCfgframerate controlled attribute pointer
Return values
0success
not0 failure
Remarks
this function gets the Channel 's frame rate control attribute(s). The channel must have been created before calling this function
Attention
it is meaningless for JPEG Encoder
int IMP_Encoder_GetChnFrmUsedMode ( int  encChn,
IMPEncoderAttrFrmUsed pfrmUsedAttr 
)

Get encoder channel input frame usage mode attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pfrmUsedAttrinput frame usage mode attribute pointer
Return values
0success
not0 failure
Remarks
It gets the Channel's input frame usage mode attribute(s), and the channel must have been created before calling this function.
int IMP_Encoder_GetChnHSkip ( int  encChn,
IMPEncoderAttrHSkip phSkipAttr 
)

Get encode channel high skip reference attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]phSkipAttrhigh skip reference attribute pointer
Return values
0success
not0 failure
Remarks
It gets the Channel's high skip reference attribute(s), and the channel must have been created
int IMP_Encoder_GetChnROI ( int  encChn,
IMPEncoderROICfg pstVencRoiCfg 
)

Get encoder channel roi attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pstFpsCfgROI attribute pointer
Return values
0success
not0 failure
Remarks
It gets the Channel's ROI attribute(s), and the channel must have been created before calling this function
Attention
it is meaningless for JPEG Encoder
int IMP_Encoder_GetFisheyeEnableStatus ( int  encChn,
int *  enable 
)

get enabled status of ingenic fisheye correction algorithm

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]enable0: disabled, 1: enabled
Return values
0success
not0 failure
Remarks
this api only used by h264;
int IMP_Encoder_GetGOPSize ( int  encChn,
IMPEncoderGOPSizeCfg pstGOPSizeCfg 
)

Get encoder channel GOP attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pstGOPSizeCfgGOPSize attribute pointer
Return values
0success
not0 failure
Remarks
It gets the Channel's GOPSize attribute(s), and the channel must have been created before calling this function
int IMP_Encoder_GetH264TransCfg ( int  encChn,
IMPEncoderH264TransCfg pstH264TransCfg 
)

Get H.264 encode channel transform and quantization attribute.

Parameters
[in]encChnencode channel num, range:[0, NR_MAX_ENC_CHN - 1]
[out]pstH264TransCfgreturned H.264 encode channel transform and quantization attribute
Return values
0success
not0 failure
Remarks
the channel must have been created before calling this function.
this api only used by h264;
int IMP_Encoder_GetJpegeQl ( int  encChn,
IMPEncoderJpegeQl pstJpegeQl 
)

Get JPEG encode channel quantization table set param.

Parameters
[in]encChnencode channel num, range:[0, NR_MAX_ENC_CHN - 1]
[out]pstJpegeQlreturned JPEG encode channel quantization table set param
Return values
0success
not0 failure
Remarks
the channel must have been created before calling this function.
this api only used by JPEG;
int IMP_Encoder_GetMaxStreamCnt ( int  encChn,
int *  nrMaxStream 
)

Get bitstream buffer number.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]nrMaxStreambitstream buffer num pointer
Return values
0success
not0 failure
int IMP_Encoder_GetMbRC ( int  encChn,
int *  bEnable 
)

get the status whether open mb ratecontrol or not

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]bEnablereturn the status whether open mb ratecontrol or not, 0:close, 1:open
Return values
0success
not0 failure
Remarks
this api only used by h264;
int IMP_Encoder_GetStream ( int  encChn,
IMPEncoderStream stream,
bool  blockFlag 
)

Get encode bitstream.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]streamthe bitstream pointer
[in]blockFlaguse block mode variable,0:no,1:yes
Return values
0success
not0 failure
Remarks
each time get one frame bitstream
If the user does not get any stream for a long time, the stream buffer will be full. If a code Channel is full, The last received images will be lost until the user starts getting some streams, in order to have enough code stream buffer for encoding.

It is suggested that the users access the code stream interface and the release of the code stream interface in pairs , and then release the stream as soon as possible, in order to prevent the user state to get the stream, when the release is not timely it might lead to the case where the stream buffer is full, and then stop coding.

Remarks
For H264 type code stream, each time that it is called successfully, it is to get one frame stream, this frame stream may contain multiple packages.
For JPEG type code stream, each time that it is called successfully, it is to get one frame stream, this frame can contain only one package, this frame contains the complete information of the JPEG image file.

examples:

1 int ret;
2 ret = IMP_Encoder_PollingStream(ENC_H264_CHANNEL, 1000); //Polling the bitstream buffer
3 if (ret < 0) {
4  printf("Polling stream timeout\n");
5  return -1;
6 }
7 
8 IMPEncoderStream stream;
9 ret = IMP_Encoder_GetStream(ENC_H264_CHANNEL, &stream, 1); //get a frame stream; block mode
10 if (ret < 0) {
11  printf("Get Stream failure\n");
12  return -1;
13 }
14 
15 int i, nr_pack = stream.packCount;
16 for (i = 0; i < nr_pack; i++) { //save each package of the frame stream
17  ret = write(stream_fd, (void *)stream.pack[i].virAddr,
18  stream.pack[i].length);
19  if (ret != stream.pack[i].length) {
20  printf("stream write error:%s\n", strerror(errno));
21  return -1;
22  }
23 }
Attention
if pstStream is NULL,then return failure;
if the channel uncreated,then return failure;
int IMP_Encoder_GetSuperFrameCfg ( int  encChn,
IMPEncoderSuperFrmCfg pstSuperFrmParam 
)

Get video coded supper frame configuration.

Parameters
[in]encChnencode channel num, range:[0, NR_MAX_ENC_CHN - 1]
[out]pstSuperFrmParamreturn video coded supper frame configuration
Return values
0success
not0 failure
Remarks
the channel must have been created before calling this function.
this api only used by h264;
int IMP_Encoder_InsertUserData ( int  encChn,
void *  userData,
uint32_t  userDataLen 
)

insert userdata

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]userDatauserdata virtual address pointer
[in]userDataLenuser data length, range:(0, 1024], unit:byte
Return values
0success
not0 failure
Remarks
the channel must have been created before call this function, otherwise it will return a failure value.
if userData is null or userDataLen is 0, then return a failure value
this function only supports h264 protocol
H.264 protocol channel allocation is up to 2 blocks of memory space for caching user data, and each user data size does not exceed 1K byte. This interface will return an error if the data inserted by the user is more than 2 blocks, or if the user data is more than byte 1K.
Each user data in SEI package is inserted into the previous new image codestream package. After a user data package is encoded and transmitted, the H.264 channel customer data in the cache memory space is cleared for new user data storage.
each userdata is encapsulated to sei nal and placed at the front of the latest frame nal.
when the userdata is encapsulated, the userdata buffer will be set to zero
the channel must have been created before call this function
int IMP_Encoder_PollingStream ( int  encChn,
uint32_t  timeoutMsec 
)

Polling bitstream buffer.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]timeoutMsecpolling timeout,unit:ms
Return values
0success
not0 failure
Remarks
call this interface before calling IMP_Encoder_GetStream
int IMP_Encoder_Query ( int  encChn,
IMPEncoderCHNStat stat 
)

query encode channel state

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]statencode channel stat pointer
Return values
0success
not0 failure
int IMP_Encoder_RegisterChn ( int  encGroup,
int  encChn 
)

register encode channel to Group

Parameters
[in]encGroupencode group num, range:[0, NR_MAX_ENC_GROUPS - 1]
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Attention
registration of a channel to an uncreated Group will cause failure
One channel can be registed to only one group, if it has already been registered to another Group, it will return failure;
If one Group is already used by a Channel, so it can not be used again by another one unless this Group's Channel is first destroyed, otherwise it wil return failure.
int IMP_Encoder_ReleaseStream ( int  encChn,
IMPEncoderStream stream 
)

release the bitstream buffer

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]streamthe bitstream pointer
Return values
0success
not0 failure
Remarks
This interface should be paired up with IMP_Encoder_GetStream users after getting the stream must release in time the obtained stream caches, otherwise it might cause the stream buffer to be full, this fact will have an impact the encoder.
and the user must use FIFO process for the releasing.
After cancelling the registration of the encoding Channel, all of the non-released stream packages are invalid, they can no longer be used or released. this current function is invalid when the channel is unregistered
Attention
if pstStream is NULL,then return failure;
if the channel uncreated,then return failure;
invalid release bitstream will cause failure
int IMP_Encoder_RequestIDR ( int  encChn)

Requst IDR frame.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Remarks
After calling this current function there will be an application for IDR frame coding.
int IMP_Encoder_SetChangeRef ( int  encChn,
int  bEnable 
)

set whether allow change base skip frame's reference or not

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]enable0:not allowed to change, 1: allowed to change(default)
Return values
0success
not0 failure
Remarks
this API should be used after create h264 encoder channel, only available to H264 smart ratecontrol
int IMP_Encoder_SetChnAttrRcMode ( int  encChn,
const IMPEncoderAttrRcMode pstRcModeCfg 
)

Set encoding channel rate controller mode attribute(s)

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pstRcCfgencode channel ratecontrol mode attribute
Return values
0success
not0 failure
Remarks
This function configures the current Channel rate controller attribute(s) until it is deactivated, the channel should be created before calling this function.
Attention
up to now, rate control supports ENC_RC_MODE_FIXQP, ENC_RC_MODE_CBR. ENC_RC_MODE_VBR, ENC_RC_MODE_SMART
it is meaningless for JPEG Encoder
int IMP_Encoder_SetChnColor2Grey ( int  encChn,
const IMPEncoderColor2GreyCfg pstColor2Grey 
)

set color to grey attribute

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pstColor2Greycolor to grey encode parameter
Return values
0success
not0 failure
Remarks
After calling this interface, the grayscale function will be active until it is deactivated.
the channel should be created before calling this function
int IMP_Encoder_SetChnDemask ( int  encChn,
const IMPEncoderAttrDemask pdemaskAttr 
)

Set encoder channel demask attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pdemaskAttrdemask attribute pointer
Return values
0success
not0 failure
Remarks
It sets the Channel's Demask attribute(s), and the channel must have been created before calling this function.
int IMP_Encoder_SetChnDenoise ( int  encChn,
const IMPEncoderAttrDenoise pdenoiseAttr 
)

Set encode channel denoise attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pdenoiseAttrdenoise attribute pointer
Return values
0success
not0 failure
Remarks
It sets the Channel's denoise attribute(s), and the channel must have been created before calling this function.
int IMP_Encoder_SetChnFrmRate ( int  encChn,
const IMPEncoderFrmRate pstFps 
)

Set encode channel framerate controlled attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pstFpsCfgframerate controlled attribute pointer
Return values
0success
not0 failure
Remarks
this function can reset encode frame rate attribute(s), and it will take effect at the next GOP(delay to be effective:1s).
if you want to use IMP_FrameSource_SetChnFPS() to set isp framerate, you need to first call this current function in order to set encoder framerate
the channel must have been created before calling this function
int IMP_Encoder_SetChnFrmUsedMode ( int  encChn,
const IMPEncoderAttrFrmUsed pfrmUsedAttr 
)

Set encoder channel input frame usage mode attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[out]pfrmUsedAttrinput frame usage mode attribute pointer
Return values
0success
not0 failure
Remarks
It sets the Channel's input frame usage mode attribute(s), and the channel must have been created before calling this function.
int IMP_Encoder_SetChnHSkip ( int  encChn,
const IMPEncoderAttrHSkip phSkipAttr 
)

Set encode channel high skip reference attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]phSkipAttrhigh skip reference attribute pointer
Return values
0success
not0 failure
Remarks
It sets the Channel's high skip reference attribute(s), and the channel must have been created before calling this function.
If the Channel's created high skip reference type is one of IMP_Encoder_STYPE_N1X or IMP_Encoder_STYPE_N2X, this function only be permited to set to be IMP_Encoder_STYPE_N1X or IMP_Encoder_STYPE_N2X;
If the Channel's created high skip reference type is one of the type from IMP_Encoder_STYPE_N4X to IMP_Encoder_STYPE_H1M_TRUE, then this function can set any one enum skip type of IMPSkipType;
int IMP_Encoder_SetChnHSkipBlackEnhance ( int  encChn,
const int  bBlackEnhance 
)

Set encode channel'bBlackEnhance in high skip reference attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]bBlackEnhancebool value, mean to bBlackEnhance in IMPEncoderAttrHSkip attribute
Return values
0success
not0 failure
Remarks
It sets the Channel' bBlackEnhance in high skip reference attribute(s), and the channel must have been created before calling this function.
int IMP_Encoder_SetChnROI ( int  encChn,
const IMPEncoderROICfg pstVencRoiCfg 
)

Set encoder channel ROI attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pstFpsCfgROI attribute pointer
Return values
0success
not0 failure
Remarks
It sets the Channel's ROI attribute(s), and the channel must have been created before calling this function
Attention
it is meaningless for JPEG Encoder
int IMP_Encoder_SetFisheyeEnableStatus ( int  encChn,
int  enable 
)

set enabled status of ingenic fisheye correction algorithm

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]enable0: disable(default), 1: enable
Return values
0success
not0 failure
Remarks
Since the enabled status of ingenic fisheye correction algorithm has been fixed during the channel creation, so the API needs to call this current before creating the Channel.
If you do not call this API before the creation of the channel to set enabled status of ingenic fisheye correction algorithm, then the status is disable, that is to say, you can't use ingenic fisheye correction algorithm to correct any h264 stream;
this api only used by h264;
int IMP_Encoder_SetGOPSize ( int  encChn,
const IMPEncoderGOPSizeCfg pstGOPSizeCfg 
)

Set encoder channel gop attribute.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]pstGOPSizeCfgGOPSize attribute pointer
Return values
0success
not0 failure
Remarks
It sets the Channel's GOPSize attribute(s), and the channel must have been created before calling this function
int IMP_Encoder_SetH264TransCfg ( int  encChn,
const IMPEncoderH264TransCfg pstH264TransCfg 
)

Set H.264 encode channel transform and quantization attribute.

Parameters
[in]encChnencode channel num, range:[0, NR_MAX_ENC_CHN - 1]
[in]pstH264TransCfgH.264 encode channel transform and quantization attribute
Return values
0success
not0 failure
Remarks
the channel must have been created before calling this function.
this api only used by h264;
advice used after IMP_Encoder_CreateChn and before IMP_Encoder_StartRecvPic function, should GetH264TransCfg first, and then use this API to set h264 transform configuration
int IMP_Encoder_SetJpegeQl ( int  encChn,
const IMPEncoderJpegeQl pstJpegeQl 
)

Set JPEG encode channel quantization table set param.

Parameters
[in]encChnencode channel num, range:[0, NR_MAX_ENC_CHN - 1]
[in]pstJpegeQlJPEG encode channel quantization table set param,Fill in the first 128 bytes of the quantized table and fill in the other 0
Return values
0success
not0 failure
Remarks
the channel must have been created before calling this function.
this api only used by JPEG;
int IMP_Encoder_SetMaxStreamCnt ( int  encChn,
int  nrMaxStream 
)

Set bitstream buffer number.

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]nrMaxStreambitstream buffer num,range:[1, NR_MAX_ENC_CHN_STREAM]
Return values
0success
not0 failure
Remarks
Since the stream cache Buffer number has been fixed during the channel creation, so the API needs to call this current before creating the Channel. If you do not call this API before the creation of the channel to set the number of stream cache Buffer, then the H264 channel default number is 5, JPEG channel default number is 1.
int IMP_Encoder_SetMbRC ( int  encChn,
int  bEnable 
)

set whether open mb ratecontrol or not

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
[in]bEnable0:close(default), 1:open
Return values
0success
not0 failure
Remarks
this API should be used after create h264 encoder channel, and effect next frame
int IMP_Encoder_SetSuperFrameCfg ( int  encChn,
const IMPEncoderSuperFrmCfg pstSuperFrmParam 
)

Set video coded supper frame configuration.

Parameters
[in]encChnencode channel num, range:[0, NR_MAX_ENC_CHN - 1]
[in]pstSuperFrmParamvideo coded supper frame configuration
Return values
0success
not0 failure
Remarks
the channel must have been created before calling this function.
this api only used by h264;
int IMP_Encoder_StartRecvPic ( int  encChn)

start encode channel to receive frames

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Remarks
First open the encoded Channel (receive the image) then this function can be used.
Attention
uncreated channel will cause failure
unregistered channel whill cause failure
int IMP_Encoder_StopRecvPic ( int  encChn)

stop encode channel to receive frames

Parameters
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Remarks
the function can be successly used repeatedly
Call this interface only to stop receiving the original data encoding, code stream buffer and will not be eliminated.
Attention
stop uncreated channel will cause failure
stop unregistered channel whill cause failure
int IMP_Encoder_UnRegisterChn ( int  encChn)

unregister encode channel from group

Parameters
[in]encGroupencode group num, range:[0, NR_MAX_ENC_GROUPS - 1]
[in]encChnencode channel num,range:[0, NR_MAX_ENC_CHN - 1]
Return values
0success
not0 failure
Remarks
After unregistering a Channel, the channel bitstream buffer will be flushed. if the bitstream hasn't been released, the data in bitstream buffer might be invalid. so, users can use the IMP_Encoder_Query interface to check the status of the buffer's Channel code in order to confirm Confirm code stream buffer in the code stream to take over and then we can make new registration.
Attention
To unregister uncreated channel will return failure.
To unregister unregistered channel will return failure
if the channel is running, then it will return failure