Skip to content

API Encoder

Lu-Fi edited this page Oct 27, 2026 · 15 revisions

API reference: Encoder

The encoder module turns frames from a FrameSource channel into H.264, H.265 or JPEG streams. An encoder channel belongs to a group; the group is bound to a FrameSource channel with IMP_System_Bind. The application pulls finished streams with GetStream (or waits with PollingStream first) and gives them back with ReleaseStream.

Typical call order: CreateGroup, CreateChn with a IMPEncoderChnAttr (use SetDefaultParam to fill it), RegisterChn, bind the group to the FrameSource, StartRecvPic, then the loop PollingStream, GetStream, process, ReleaseStream. Stop with StopRecvPic, UnRegisterChn, DestroyChn, DestroyGroup.

Rate-control behaviour differs between SoCs; the pages state where a setting is only stored. The rate-control modes are FIXQP, CBR, VBR, CAPPED_VBR and CAPPED_QUALITY (some SoCs also SMART). What OpenIMP does beyond the vendor library (closed-loop capped modes, HEVC on T31, telemetry) is collected in Beyond the Vendor. Calls whose status is · on a SoC do not exist in that SoC's vendor library.

Status columns: T10 T20 T21 T23 T30 T31 T40 T41. As of 2026-10-26. Part of the API reference.

Contents

Status symbols are those of the feature matrix (API coverage tables):

  • ✅ works, device-tested
  • ✅+ works, device-tested, better than the vendor
  • ✅rt API round trip on device, no visible effect expected
  • ✅r works: called by the streamer on fleet cameras of this SoC that passed the fleet soak
  • ✅○ vendor no-op, OpenIMP matches that
  • 🔧h implemented, host tests only (no camera run yet)
  • 🔧a really connected per static audit, no device test tracked
  • 🔧+ API round trip in QEMU, no camera
  • ⚠c value only stored and read back, nothing applied
  • ⚠s returns 0 without any effect
  • ❌e exported but fails or has a known defect
  • ❌ not exported by OpenIMP
  • · function does not exist on this SoC (not in that SoC's vendor API; not a gap)
  • ? state not determined
  • 📋 no OpenIMP build for this SoC yet (planned)

Groups and channels

IMP_Encoder_CreateGroup

int IMP_Encoder_CreateGroup(int encGroup);

Creates an encoder group, the container a FrameSource channel is bound to.

Parameters

  • encGroup: Group number.

Returns: 0 on success, -1 if the group exists or the number is invalid.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

See also: IMP_Encoder_CreateChn, IMP_Encoder_RegisterChn

IMP_Encoder_DestroyGroup

int IMP_Encoder_DestroyGroup(int encGroup);

Removes a group. All channels must be unregistered first.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_Encoder_CreateChn

int IMP_Encoder_CreateChn(int encChn, IMPEncoderCHNAttr *attr);

Creates an encoder channel from an attribute structure (profile, size, rate control, GOP). The channel is idle until it is registered and receives pictures.

Parameters

  • encChn: Channel number.
  • attr: Encoder, rate control and GOP attributes.

Returns: 0 on success, -1 on invalid attributes, a channel in use, or a profile the SoC cannot encode.

The picture size has to match the FrameSource channel, and the rate-control block has to belong to the selected mode. The log prints the rate control that is really used; the requested mode can map to a different one on some SoCs.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

Difference from the vendor library: Asking for H.265 on a SoC without HEVC hardware fails with -1 and a log line. The vendor library returns 0 and creates a channel that never produces a frame.

See also: IMP_Encoder_SetDefaultParam, IMP_Encoder_RegisterChn

IMP_Encoder_DestroyChn

int IMP_Encoder_DestroyChn(int encChn);

Destroys a channel and frees its buffers. The channel must not be receiving pictures.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_Encoder_RegisterChn

int IMP_Encoder_RegisterChn(int encGroup, int encChn);

Attaches a channel to a group, which makes it a destination of the bound FrameSource.

Parameters

  • encGroup: Group number.
  • encChn: Channel number.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_Encoder_UnRegisterChn

int IMP_Encoder_UnRegisterChn(int encChn);

Detaches a channel from its group.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_Encoder_StartRecvPic

int IMP_Encoder_StartRecvPic(int encChn);

Starts encoding. Pictures that arrive after this call are encoded.

Returns: 0 on success, -1 on error.

Call after the bind. Pictures that came before are not encoded.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

See also: IMP_Encoder_StopRecvPic

IMP_Encoder_StopRecvPic

int IMP_Encoder_StopRecvPic(int encChn);

Stops encoding. Streams already encoded can still be fetched.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

Streams

One call chain per picture - PollingStream (wait), GetStream (take), ReleaseStream (return). Streams that are not fetched are dropped by the encoder, not queued without limit.

IMP_Encoder_GetStream

int IMP_Encoder_GetStream(int encChn, IMPEncoderStream *stream, int block);

Takes the next encoded stream of a channel. The stream consists of packs that point into the stream buffer of the channel.

Parameters

  • encChn: Channel number.
  • stream: Receives the pack list, sequence number and reference type.
  • block: Non-zero waits for a stream, zero returns at once.

Returns: 0 on success, -1 when there is no stream or on error.

A stream is one picture, in several packs (parameter sets and slices). The pack timestamps are in microseconds. Return it with ReleaseStream; holding streams too long stalls the encoder when the stream buffer is full.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

Difference from the vendor library: On T40 and T41 the picture is encoded when the application polls, not ahead of time; the encoder keeps at most one finished stream.

See also: IMP_Encoder_PollingStream, IMP_Encoder_ReleaseStream

IMP_Encoder_GetStream_Impl

/* IMP_Encoder_GetStream_Impl: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Internal worker behind GetStream, exported by some builds of the library.

Returns: 0 on success, -1 on error.

IMP_Encoder_ReleaseStream

int IMP_Encoder_ReleaseStream(int encChn, IMPEncoderStream *stream);

Returns a stream taken with GetStream.

Returns: 0 on success, -1 on a stream that does not belong to the channel.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_Encoder_PollingStream

int IMP_Encoder_PollingStream(int encChn, uint32_t timeoutMsec);

Waits until the channel has a stream or the timeout expires.

Parameters

  • encChn: Channel number.
  • timeoutMsec: Maximum wait in milliseconds.

Returns: 0 when a stream is ready, -1 on timeout or error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

Difference from the vendor library: On T40 the wait honours its timeout even when the ISP delivers no frames.

See also: IMP_Encoder_GetStream

IMP_Encoder_PollingModuleStream

int IMP_Encoder_PollingModuleStream(uint32_t *encChnBitmap, uint32_t timeoutMsec);

Waits on several channels at once and reports which have a stream.

Parameters

  • encChnBitmap: Bit mask of channels to wait on; on return the channels that are ready.
  • timeoutMsec: Maximum wait in milliseconds.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T10, T20, T30

T10 T20 T21 T23 T30 T31 T40 T41
· · ✅ 🔧a · ✅ ✅ 🔧a

IMP_Encoder_FlushStream

int IMP_Encoder_FlushStream(int encChn);

Drops the encoded streams nobody has fetched, so the next stream is fresh.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor.

IMP_Encoder_GetFd

int IMP_Encoder_GetFd(int encChn);

Returns a file descriptor that becomes readable when a stream is ready, for use with select or poll.

Returns: 0 on success, -1 on error.

On T21, T23 and T31 this is a pipe filled by a helper thread.

SoC: not in the vendor API of T10, T20

T10 T20 T21 T23 T30 T31 T40 T41
· · ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

Difference from the vendor library: See Beyond the Vendor: New in RC1 (since the 2026-10-06 state).

IMP_Encoder_Query

int IMP_Encoder_Query(int encChn, IMPEncoderCHNStat *stat);

Reads the channel statistics - pictures waiting, streams ready, state and the bitrate counters.

Parameters

  • encChn: Channel number.
  • stat: Receives the statistics structure.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor, timps.

Difference from the vendor library: Returns the full vendor layout including a real average bitrate. On T40 the encoder keeps no input queue, so the number of waiting pictures is not a measure of load.

Channel attributes and defaults

IMP_Encoder_GetChnAttr

int IMP_Encoder_GetChnAttr(int encChn, IMPEncoderChnAttr *attr);

Reads the attributes of a channel as they are in effect.

Returns: 0 on success, -1 on error.

Rate-control values are the ones after clamping, not necessarily those you set.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor.

See also: IMP_Encoder_CreateChn

IMP_Encoder_SetDefaultParam

int IMP_Encoder_SetDefaultParam(IMPEncoderChnAttr *attr, IMPEncoderProfile profile, IMPEncoderRcMode rcMode, int width, int height, int fpsNum, int fpsDen, int gopLen, int maxSameSceneCnt, int quality, int bitrate);

Fills an attribute structure with sensible values for a profile, rate-control mode, size, frame rate and GOP length.

Parameters

  • attr: Structure to fill.
  • profile: IMP_ENC_PROFILE_*, for example AVC main or HEVC main.
  • rcMode: Rate-control mode.
  • width: Picture width.
  • height: Picture height.
  • fpsNum: Frame rate numerator.
  • fpsDen: Frame rate denominator.

Returns: 0 on success, -1 on error.

The remaining arguments are the GOP length, the QP bounds and the bitrate; see the header for the exact order. Start from this and then change the fields you need.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

Used by: timps.

IMP_Encoder_GetChnEncType

int IMP_Encoder_GetChnEncType(int encChn, IMPPayloadType *encType);

Reads the payload type (H.264, H.265, JPEG) of a channel.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T10, T20

T10 T20 T21 T23 T30 T31 T40 T41
· · ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

Rate control

Modes: FIXQP keeps one quantiser, CBR holds the bitrate, VBR lets it vary within a range, the capped modes limit the quality-driven rate to a ceiling. Bitrate is in kbit/s in the attribute structures. Out-of-range QP and frame rate values are clamped with a warning in the log.

IMP_Encoder_Get/SetChnAttrRcMode

int IMP_Encoder_GetChnAttrRcMode(int encChn, IMPEncoderAttrRcMode *rcMode);
int IMP_Encoder_SetChnAttrRcMode(int encChn, IMPEncoderAttrRcMode *rcMode);

Reads or changes the rate-control attribute (mode and its parameters) of a running channel.

Returns: 0 on success, -1 on error.

Changing the mode at run time restarts the rate controller; the next picture is a key frame on most SoCs.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor, timps.

Difference from the vendor library: On T10, T20 and T21 the vendor-clamped values are returned, so a read after a write can differ from what you wrote.

See also: IMP_Encoder_Get/SetChnRcAttr

IMP_Encoder_Get/SetChnRcAttr

int IMP_Encoder_GetChnRcAttr(int encChn, void *rcAttr);
int IMP_Encoder_SetChnRcAttr(int encChn, void *rcAttr);

Reads or sets the rate-control block through a generic pointer.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T10, T20

T10 T20 T21 T23 T30 T31 T40 T41
❌ ❌ · · · · · ·

IMP_Encoder_SetChnBitRate

int IMP_Encoder_SetChnBitRate(int encChn, int bitrate, int bitrateMax);

Changes the target and maximum bitrate of a channel without touching the other rate-control settings.

Parameters

  • bitrate: Target in kbit/s.
  • bitrateMax: Upper limit in kbit/s (used by the VBR modes).

Returns: 0 on success, -1 on error.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

Used by: timps.

IMP_Encoder_Get/SetMbRC

int IMP_Encoder_GetMbRC(int encChn, int *enable);
int IMP_Encoder_SetMbRC(int encChn, int enable);

Switches macroblock-level rate control on or off. When on, the quantiser can change inside a picture to hold the picture budget.

Returns: 0 on success, -1 on error.

On T21 and T23 the setting is parsed and kept. The T23 macroblock rate control is opt-in via OPENIMP_EPRC_* variables.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
✅○ ✅ ✅ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetSuperFrameCfg

int IMP_Encoder_GetSuperFrameCfg(int encChn, IMPEncoderSuperFrmCfg *config);
int IMP_Encoder_SetSuperFrameCfg(int encChn, const IMPEncoderSuperFrmCfg *config);

Configures what happens when a single picture gets much larger than planned (a "super frame").

Returns: 0 on success, -1 on error.

The configuration sets a size limit for key and predicted pictures and an action - do nothing, discard or re-encode with a higher quantiser.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetChnMaxPictureSize

int IMP_Encoder_GetChnMaxPictureSize(int encChn, uint32_t *maxPictureSizeI, uint32_t *maxPictureSizeP);
int IMP_Encoder_SetChnMaxPictureSize(int encChn, uint32_t maxPictureSizeI, uint32_t maxPictureSizeP);

Sets or reads the largest size, in bytes, of an I and a P picture before the encoder re-encodes with a higher quantiser.

Returns: 0 on success, -1 on error.

SoC: T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ✅

Used by: raptor.

IMP_Encoder_SetChnRcTrigLevel

int IMP_Encoder_SetChnRcTrigLevel(int encChn, float level, int mode);

Sets the level at which the rate control switches its mode (trigger level).

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
? ? ❌ ? ? · · ·

IMP_Encoder_GetChnAveBitrate

int IMP_Encoder_GetChnAveBitrate(int encChn, IMPEncoderStream *stream, int frames, double *bitrate);

Computes the average bitrate over a number of streams.

Parameters

  • stream: A stream just fetched.
  • frames: How many frames to average over.
  • bitrate: Receives the result in kbit/s.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ · ·

Used by: timps.

IMP_Encoder_SetFrameRelease

int IMP_Encoder_SetFrameRelease(int encChn, int num, int den);

Sets the ratio at which the encoder gives the source frame back early (num/den).

Returns: 0 on success, -1 on error.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅○ ✅○ ❌

GOP, key frames and frame rate

IMP_Encoder_Get/SetChnFrmRate

int IMP_Encoder_GetChnFrmRate(int encChn, IMPEncoderFrmRate *rate);
int IMP_Encoder_SetChnFrmRate(int encChn, const IMPEncoderFrmRate *rate);

Reads or changes the output frame rate of the channel.

Parameters

  • rate: Numerator and denominator.

Returns: 0 on success, -1 on error.

The rate must not exceed the FrameSource rate. The encoder drops pictures to get down to it.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor.

IMP_Encoder_Get/SetGOPSize

int IMP_Encoder_GetGOPSize(int encChn, IMPEncoderGOPSizeCfg *cfg);
int IMP_Encoder_SetGOPSize(int encChn, const IMPEncoderGOPSizeCfg *gop);

Reads or sets the GOP length - the number of pictures between two key frames.

Returns: 0 on success, -1 on error.

A short GOP recovers faster after packet loss, a long one is smaller. For per-channel control after creation use this or SetChnGopAttr.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetChnGopAttr

int IMP_Encoder_GetChnGopAttr(int encChn, IMPEncoderGopAttr *gopAttr);
int IMP_Encoder_SetChnGopAttr(int encChn, IMPEncoderGopAttr *gopAttr);

Reads or sets the GOP attributes (length, type and reference structure).

Returns: 0 on success, -1 on error.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

IMP_Encoder_SetChnGopLength

int IMP_Encoder_SetChnGopLength(int encChn, int gopLength);

Changes the GOP length of a running channel.

Returns: 0 on success, -1 on error.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

IMP_Encoder_RequestIDR

int IMP_Encoder_RequestIDR(int encChn);

Asks the encoder to make the next picture a key frame (IDR), with fresh parameter sets.

Returns: 0 on success, -1 on error.

Use it when a new client connects, or after a loss. Several requests before one picture count once.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: prudynt, raptor, timps.

IMP_Encoder_Get/SetGDRCfg

int IMP_Encoder_GetGDRCfg(int encChn, IMPEncoderGDRCfg *cfg);
int IMP_Encoder_SetGDRCfg(int encChn, const IMPEncoderGDRCfg *cfg);

Configures gradual decoder refresh, which refreshes the picture in slices over several frames instead of one large key frame.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ·

IMP_Encoder_RequestGDR

int IMP_Encoder_RequestGDR(int encChn, int gdrFrames);

Starts a gradual refresh cycle of the given number of frames.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ·

IMP_Encoder_Get/SetChangeRef

int IMP_Encoder_GetChangeRef(int encChn, int *bEnable);
int IMP_Encoder_SetChangeRef(int encChn, int bEnable);

Reads or sets the switch for changing the reference picture.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
⚠c ⚠c ✅ ✅ ⚠c · · ·

IMP_Encoder_Get/SetChnHSkip

int IMP_Encoder_GetChnHSkip(int encChn, IMPEncoderAttrHSkip *attr);
int IMP_Encoder_SetChnHSkip(int encChn, const IMPEncoderAttrHSkip *attr);

Reads or sets the hierarchical skip mode, a reference structure in which some predicted pictures can be dropped.

Returns: 0 on success, -1 on error.

Needs a created channel. On T10, T20 and T30 the setting is only stored.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
⚠c ⚠c ✅ ✅ ⚠c · · ·

IMP_Encoder_SetChnHSkipBlackEnhance

int IMP_Encoder_SetChnHSkipBlackEnhance(int encChn, const int bBlackEnhance);

Sets the black enhancement flag of the skip mode.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
⚠c ⚠c ⚠c ✅ ⚠c · · ·

IMP_Encoder_Get/SetChnFrmUsedMode

int IMP_Encoder_GetChnFrmUsedMode(int encChn, IMPEncoderAttrFrmUsed *attr);
int IMP_Encoder_SetChnFrmUsedMode(int encChn, const IMPEncoderAttrFrmUsed *attr);

Reads or sets the frame use mode, which says how input frames are used by the encoder.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ 🔧h · · ·

Quantiser, regions and picture quality

IMP_Encoder_SetChnQp

int IMP_Encoder_SetChnQp(int encChn, int iQP);

Fixes the quantiser (QP) of the channel to one value.

Returns: 0 on success, -1 on error.

SoC: T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ · ·

IMP_Encoder_SetChnQpBounds

int IMP_Encoder_SetChnQpBounds(int encChn, int minQp, int maxQp);

Sets the lowest and highest quantiser the rate control may use.

Parameters

  • minQp: Lowest QP, lower means better quality.
  • maxQp: Highest QP.

Returns: 0 on success, -1 on error.

Out-of-range values are clamped with a warning.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

Used by: timps.

IMP_Encoder_SetChnQpBoundsPerFrame

int IMP_Encoder_SetChnQpBoundsPerFrame(int encChn, int minQpI, int maxQpI, int minQpP, int maxQpP);

Sets separate QP bounds for I and P pictures.

Returns: 0 on success, -1 on error.

SoC: T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · ✅

IMP_Encoder_SetChnQpIPDelta

int IMP_Encoder_SetChnQpIPDelta(int encChn, int delta);

Sets the QP difference between I and P pictures.

Returns: 0 on success, -1 on error.

SoC: T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ · ·

Used by: timps.

IMP_Encoder_SetChnInitQP

int IMP_Encoder_SetChnInitQP(int encChn, uint32_t initQP);

Sets the quantiser of the first picture.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ·

IMP_Encoder_Get/SetQpgMode

int IMP_Encoder_GetQpgMode(int encChn, IMPEncoderQpgMode *mode);
int IMP_Encoder_SetQpgMode(int encChn, const IMPEncoderQpgMode *mode);

Selects the mode of the quantiser generator. On T21 it is kept without check, as in the vendor library.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T21, T23, T30

T10 T20 T21 T23 T30 T31 T40 T41
· · ✅○ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetChnROI

int IMP_Encoder_GetChnROI(int encChn, IMPEncoderROICfg *config);
int IMP_Encoder_SetChnROI(int encChn, const IMPEncoderROICfg *config);

Defines regions of interest in which the picture is coded with better quality.

Parameters

  • config: Region rectangles and the QP offset per region.

Returns: 0 on success, -1 on error.

Regions are in picture coordinates and aligned to the macroblock grid (16 pixels).

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅+ ✅ ? · · ·

Used by: raptor.

Difference from the vendor library: Better than the vendor on T21.

IMP_Encoder_Get/SetChnRoiAttr

int IMP_Encoder_GetChnRoiAttr(int encChn, IMPEncoderRoiAttr *roiAttr);
int IMP_Encoder_SetChnRoiAttr(int encChn, IMPEncoderRoiAttr *roiAttr);

Region of interest attributes of the newer SoCs, with several regions and a QP value for each.

Returns: 0 on success, -1 on error.

SoC: T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · ✅ ⚠c

Difference from the vendor library: See Beyond the Vendor: New in RC1 (since the 2026-10-06 state).

IMP_Encoder_SetChnMapRoi

int IMP_Encoder_SetChnMapRoi(int encChn, IMPEncoderMapRoiAttr *pstMapRoi);

Sets a region of interest from a map with one entry per macroblock.

Returns: 0 on success, -1 on error.

SoC: T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · 🔧h ⚠c

IMP_Encoder_Get/SetChnColor2Grey

int IMP_Encoder_GetChnColor2Grey(int encChn, IMPEncoderColor2GreyCfg *config);
int IMP_Encoder_SetChnColor2Grey(int encChn, const IMPEncoderColor2GreyCfg *config);

Makes the encoder code the picture without colour (the chroma planes are neutral), which saves bits at night.

Returns: 0 on success, -1 on error.

SoC: T10, T20, T21, T23, T30

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetChnDenoise

int IMP_Encoder_GetChnDenoise(int encChn, IMPEncoderAttrDenoise *config);
int IMP_Encoder_SetChnDenoise(int encChn, const IMPEncoderAttrDenoise *config);

Reads or sets the encoder-side noise filter.

Returns: 0 on success, -1 on error.

SoC: T10, T20, T21, T23

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetChnDemask

int IMP_Encoder_GetChnDemask(int encChn, IMPEncoderAttrDemask *attr);
int IMP_Encoder_SetChnDemask(int encChn, const IMPEncoderAttrDemask *attr);

Reads or sets the demask (lens shading) attribute of the encoder. The values are stored.

Returns: 0 on success, -1 on error.

SoC: T10, T20

T10 T20 T21 T23 T30 T31 T40 T41
⚠c ⚠c · · · · · ·

IMP_Encoder_Get/SetChnCrop

int IMP_Encoder_GetChnCrop(int encChn, IMPEncoderCropCfg *cfg);
int IMP_Encoder_SetChnCrop(int encChn, const IMPEncoderCropCfg *cfg);

Crops the picture at the encoder input.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
❌ ❌ ❌ ✅ ❌ · · ·

IMP_Encoder_SetChnResizeMode

int IMP_Encoder_SetChnResizeMode(int encChn, int en);

Switches the resize mode of the channel.

Returns: 0 on success, -1 on error.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · ? ✅ ✅ ✅

H.264 and H.265 options

IMP_Encoder_Get/SetH264TransCfg

int IMP_Encoder_GetH264TransCfg(int encChn, IMPEncoderH264TransCfg *config);
int IMP_Encoder_SetH264TransCfg(int encChn, const IMPEncoderH264TransCfg *config);

Reads or sets H.264 transform options such as the chroma QP offset.

Returns: 0 on success, -1 on error.

SoC: T10, T20, T21, T23

T10 T20 T21 T23 T30 T31 T40 T41
⚠c ✅ ✅ ✅ ? · · ·

Used by: raptor.

IMP_Encoder_Get/SetH265TransCfg

int IMP_Encoder_GetH265TransCfg(int encChn, IMPEncoderH265TransCfg *config);
int IMP_Encoder_SetH265TransCfg(int encChn, const IMPEncoderH265TransCfg *config);

Reads or sets H.265 transform options. Checked and dropped on T21 and T23, as the vendor does.

Returns: 0 on success, -1 on error.

SoC: T20, T21, T23

T10 T20 T21 T23 T30 T31 T40 T41
· · ✅○ ✅○ ? · · ·

Used by: raptor.

IMP_Encoder_SetChnEntropyMode

int IMP_Encoder_SetChnEntropyMode(int encChn, IMPEncoderEntropyMode mode);

Chooses CAVLC or CABAC for H.264.

Returns: 0 on success, -1 on error.

SoC: T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ · ·

IMP_Encoder_Get/SetChnSeiAttr

int IMP_Encoder_GetChnSeiAttr(int encChn, IMPEncoderSeiAttr *SeiAttr);
int IMP_Encoder_SetChnSeiAttr(int encChn, IMPEncoderSeiAttr *SeiAttr);

Enables and configures a user-data SEI message that is written into the stream.

Returns: 0 on success, -1 on error.

SoC: T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · 🔧h ❌

Difference from the vendor library: On IDR pictures of T40 the SEI may be left out, because the header area holds the parameter sets twice.

IMP_Encoder_InsertUserData

int IMP_Encoder_InsertUserData(int encChn, void *data, uint32_t size);

Inserts user data into the stream of the next picture, as a user_data_unregistered SEI message.

Parameters

  • data: Bytes to insert.
  • size: Length in bytes.

Returns: 0 on success, -1 on error.

SoC: T10, T20, T21, T23

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? · · ·

IMP_Encoder_Get/Setframelossthd

int IMP_Encoder_Getframelossthd(int encChn, uint32_t *framelossthd);
int IMP_Encoder_Setframelossthd(int encChn, uint32_t framelossthd);

Reads or sets the frame loss threshold. On T23 the value is kept for the getter only.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ⚠c · · · ·

IMP_Encoder_SetMultiSectionMode

int IMP_Encoder_SetMultiSectionMode(int mode, int size, int cnt);

Sets slice (section) splitting of pictures. Kept for the getter only on T23.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ⚠c · · · ·

JPEG

IMP_Encoder_Get/SetJpegeQl

int IMP_Encoder_GetJpegeQl(int encChn, IMPEncoderJpegeQl *attr);
int IMP_Encoder_SetJpegeQl(int encChn, IMPEncoderJpegeQl *attr);

Reads or sets the quantisation table level of a JPEG channel - the picture quality.

Returns: 0 on success, -1 on error.

Takes effect on the next picture. Can be called while the channel runs.

SoC: not in the vendor API of T31, T40

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? · · ✅

IMP_Encoder_SetAvpuJpegQp

int IMP_Encoder_SetAvpuJpegQp(int encChn, int jpegQp);

Sets the JPEG quality value on T40 and T41 (hardware encoder).

Returns: 0 on success, -1 on error.

SoC: T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · ✅

IMP_Encoder_InputJpege

int IMP_Encoder_InputJpege(uint8_t *src, uint8_t *dst, int src_w, int src_h, int q, int *stream_length);

Encodes one picture to JPEG without a channel.

Parameters

  • src: Source picture, NV12.
  • dst: Output buffer.
  • src_w: Width.
  • src_h: Height.
  • q: Quality.
  • stream_length: Receives the JPEG size in bytes.

Returns: 0 on success, -1 on error.

SoC: T23, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ✅

Used by: timps.

IMP_Encoder_InputJpege_Ex

int IMP_Encoder_InputJpege_Ex(uint8_t *src, uint8_t *dst, int src_w, int src_h, int q, int *stream_length);

Same as InputJpege for a context with an integer handle.

Returns: 0 on success, -1 on error.

SoC: T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

Unbound encoding of own frames (YUV interface)

The encoder can be used without FrameSource: YuvInit creates an encoder context, YuvEncode encodes one frame you supply, YuvExit frees the context. The _Ex variants use an integer handle instead of a pointer.

IMP_Encoder_YuvInit

int IMP_Encoder_YuvInit(void **h, int inWidth, int inHeight, IMPEncoderYuvIn *encIn);

Creates an encoder context for frames supplied by the application.

Returns: 0 on success, -1 on error.

SoC: T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

Used by: timps.

Difference from the vendor library: See Beyond the Vendor: Extensions an application can use or detect.

IMP_Encoder_YuvEncode

int IMP_Encoder_YuvEncode(void *h, IMPFrameInfo frame, IMPEncoderYuvOut *encOut);

Encodes one frame with the context and returns the stream.

Returns: 0 on success, -1 on error.

An output buffer must be big enough; a non-zero outLen on entry is the capacity of outAddr.

SoC: T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

Used by: timps.

Difference from the vendor library: A picture that does not fit the output buffer fails with -1 and outLen 0, instead of writing past the buffer.

IMP_Encoder_YuvExit

int IMP_Encoder_YuvExit(void *h);

Frees the context.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

Used by: timps.

IMP_Encoder_YuvRequestIDR

int IMP_Encoder_YuvRequestIDR(void *h);

Makes the next frame of the context a key frame.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ·

Used by: timps.

IMP_Encoder_YuvGetCrop

int IMP_Encoder_YuvGetCrop(void *h, IMPEncoderCropCfg *cfg);

Reads the crop of the context.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ·

IMP_Encoder_YuvSetCrop

int IMP_Encoder_YuvSetCrop(void *h, IMPEncoderCropCfg *cfg);

Sets a crop on the context.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · · ·

IMP_Encoder_YuvInit_Ex

int IMP_Encoder_YuvInit_Ex(int *h, int inWidth, int inHeight, IMPEncoderYuvIn *encIn);

Same as YuvInit with an integer handle.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

IMP_Encoder_YuvEncode_Ex

int IMP_Encoder_YuvEncode_Ex(int h, IMPFrameInfo frame, IMPEncoderYuvOut *encOut);

Same as YuvEncode with an integer handle.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

IMP_Encoder_YuvExit_Ex

int IMP_Encoder_YuvExit_Ex(int h);

Same as YuvExit with an integer handle.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

IMP_Encoder_VbmAlloc

void *IMP_Encoder_VbmAlloc(uint32_t size, uint32_t align);

Allocates a physically contiguous buffer that the YUV interface can read.

Parameters

  • size: Size in bytes.
  • align: Alignment in bytes.

Returns: Pointer to the buffer or NULL.

SoC: only in the vendor API of T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

Used by: timps.

IMP_Encoder_VbmFree

void IMP_Encoder_VbmFree(void *vaddr);

Frees a buffer from VbmAlloc.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

Used by: timps.

IMP_Encoder_VbmV2P

intptr_t IMP_Encoder_VbmV2P(intptr_t vaddr);

Converts a virtual address of such a buffer to its physical address.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

Used by: timps.

IMP_Encoder_VbmP2V

intptr_t IMP_Encoder_VbmP2V(intptr_t paddr);

Converts a physical address back to the virtual one.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T23, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · · ✅ ✅

IMP_Encoder_VbmAlloc_Ex

void *IMP_Encoder_VbmAlloc_Ex(uint32_t size, uint32_t align);

Allocation for the handle based YUV interface.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

IMP_Encoder_VbmFree_Ex

void IMP_Encoder_VbmFree_Ex(void *vaddr);

Free for the handle based YUV interface.

Returns: 0 on success, -1 on error.

SoC: only in the vendor API of T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

Memory, buffer sharing and pools

IMP_Encoder_Get/SetMaxStreamCnt

int IMP_Encoder_GetMaxStreamCnt(int encChn, int *cnt);
int IMP_Encoder_SetMaxStreamCnt(int encChn, int cnt);

Sets or reads how many streams a channel may hold at the same time.

Returns: 0 on success, -1 on error.

Raise it when the consumer is slow and you can afford the memory.

T10 T20 T21 T23 T30 T31 T40 T41
✅ ✅ ✅ ✅ ? ✅ ✅ ✅

Used by: raptor.

IMP_Encoder_Get/SetStreamBufSize

int IMP_Encoder_GetStreamBufSize(int encChn, int *size);
int IMP_Encoder_SetStreamBufSize(int encChn, int size);

Sets or reads the size of the stream buffer of a channel.

Returns: 0 on success, -1 on error.

Set it before the channel starts; it should hold several key frames at your bitrate.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

IMP_Encoder_SetbufshareChn

int IMP_Encoder_SetbufshareChn(int encChn, int shareChn);

Shares the reference buffer of a channel with another, to save memory.

Parameters

  • shareChn: The channel to share with.

Returns: 0 on success, -1 on error.

SoC: T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ ✅ ✅

Used by: prudynt, raptor.

IMP_Encoder_SetAvpuBsShare

int IMP_Encoder_SetAvpuBsShare(bool enAvpuBs, uint32_t avpuBsSize);

Switches sharing of the stream buffer of the hardware encoder.

Returns: 0 on success, -1 on error.

SoC: T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

IMP_Encoder_SetRdBufShare

int IMP_Encoder_SetRdBufShare(int encChn, int enable);

Switches sharing of the read buffer between channels.

Returns: 0 on success, -1 on error.

SoC: T23

T10 T20 T21 T23 T30 T31 T40 T41
· · · ? · · · ·

IMP_Encoder_SetIvpuBsSize

int IMP_Encoder_SetIvpuBsSize(uint32_t ivpuBsSize);

Sets the size of the stream buffer of the second hardware unit.

Returns: 0 on success, -1 on error.

SoC: T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · · · 🔧h

IMP_Encoder_SetPoolSize

int IMP_Encoder_SetPoolSize(int size);

Sets the size of the encoder memory pool.

Returns: 0 on success, -1 on error.

IMP_Encoder_Get/SetPool

int IMP_Encoder_GetPool(int encChn);
int IMP_Encoder_SetPool(int encChn, int poolId);

Binds the encoder buffers to a memory pool, or reads the pool id.

Returns: 0 on success, -1 on error.

SoC: T23, T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
· · · ✅ · ✅ ✅ ✅

Used by: raptor.

IMP_Encoder_ClearPoolId

int IMP_Encoder_ClearPoolId(int encChn);

Forgets the pool id of the channel.

Returns: 0 on success, -1 on error.

SoC: T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ? · ·

Other

IMP_Encoder_Get/SetFisheyeEnableStatus

int IMP_Encoder_GetFisheyeEnableStatus(int encChn, int *enable);
int IMP_Encoder_SetFisheyeEnableStatus(int encChn, int enable);

Marks the channel as a fisheye channel. The flag is only stored.

Returns: 0 on success, -1 on error.

T10 T20 T21 T23 T30 T31 T40 T41
⚠c ⚠c ⚠c ⚠c ⚠c ⚠c ⚠c ❌

IMP_Encoder_EnableAllNCUDenoise

int IMP_Encoder_EnableAllNCUDenoise(void);

Switches the NCU based denoise on for all channels. Internal entry kept for compatibility.

Returns: 0 on success, -1 on error.

IMP_Encoder_DisableAllNCUDenoise

int IMP_Encoder_DisableAllNCUDenoise(void);

Switches the NCU based denoise off for all channels.

Returns: 0 on success, -1 on error.

IMP_Encoder_PadFrame

/* IMP_Encoder_PadFrame: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Pads the frame to the encoder size. Not exported by OpenIMP on T10, T20, T21 and T31.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
❌ ❌ ❌ ? ❌ · · ·

IMP_Encoder_SetPadFrameAttr

/* IMP_Encoder_SetPadFrameAttr: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */

Sets the padding attributes for PadFrame.

Returns: 0 on success, -1 on error.

SoC: not in the vendor API of T31, T40, T41

T10 T20 T21 T23 T30 T31 T40 T41
❌ ❌ ❌ ? ❌ · · ·

IMP_Encoder_GetChnEvalInfo

int IMP_Encoder_GetChnEvalInfo(int encChn, void *info);

Reads evaluation information of the channel for tuning.

Returns: 0 on success, -1 on error.

SoC: T31

T10 T20 T21 T23 T30 T31 T40 T41
· · · · · ✅ · ·

Used by: raptor.

Clone this wiki locally