Repository navigation
API FrameSource
A FrameSource channel is one video output of the ISP: it has a size, a pixel format, an optional crop and scaler stage
and a frame rate. The usual SoCs offer three channels: 0 (main stream), 1 (sub stream) and 2 (third stream or an
extension channel). A channel feeds other modules (encoder, OSD, IVS) through IMP_System_Bind, or hands raw frames
to the application with IMP_FrameSource_GetFrame.
Typical call order: IMP_ISP_Open and sensor setup, then IMP_System_Init, then CreateChn, optional
SetChnFifoAttr / SetMaxDelay / SetFrameDepth, bind the channel to its consumers, EnableChn. Shut down in the
reverse order: DisableChn, unbind, DestroyChn.
OpenIMP also offers a fallback frame (a test image delivered while the sensor stalls); it is switched with the
environment variable OPENIMP_FALLBACK_FRAME and the OpenIMP extension OpenIMP_FrameSource_SetFallback, see
Beyond the Vendor.
Status columns: T10 T20 T21 T23 T30 T31 T40 T41. As of 2026-10-26. Part of the API reference.
- Channel lifecycle (4)
- Channel attributes (2)
- Getting frames (7)
- Delay FIFO and timed frames (4)
- Rotate, flip and mirror (2)
- Buffer memory (2)
- External injection (T40 and T41) (6)
- Other (7)
Status symbols are those of the feature matrix (API coverage tables):
-
✅works, device-tested -
✅+works, device-tested, better than the vendor -
✅rtAPI round trip on device, no visible effect expected -
✅rworks: called by the streamer on fleet cameras of this SoC that passed the fleet soak -
✅○vendor no-op, OpenIMP matches that -
🔧himplemented, host tests only (no camera run yet) -
🔧areally connected per static audit, no device test tracked -
🔧+API round trip in QEMU, no camera -
⚠cvalue only stored and read back, nothing applied -
⚠sreturns 0 without any effect -
❌eexported 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)
A channel goes through the states closed, created and running. Size, format and rate can only be changed while it is created but not running.
int IMP_FrameSource_CreateChn(int chnNum, IMPFSChnAttr *chn_attr);Creates a channel with the given attributes and registers it as a module that can be bound. The channel does not run yet.
Parameters
-
chnNum: Channel number, normally 0 to 2. -
chn_attr: Size, pixel format, crop, scaler, frame rate and number of buffers of the channel.
Returns: 0 on success, -1 on an invalid channel number, a NULL attribute, a width that is not a multiple of 16 (not for raw), or a channel 0 that is not of type FS_PHY_CHANNEL. On T31 a size above 1280x720 is refused. On T40 and T41 a channel that already exists also returns -1.
The width must be a multiple of 16 unless the format is raw, and channel 0 has to be the physical channel. The structure layout differs between SoC families (T40 and T41 put an I2D block in front, T23 and newer add a frame crop), so build against the header of the SoC you target. A frame rate of outFrmRateNum/outFrmRateDen below the sensor rate drops frames; it never raises the rate above the sensor rate.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest rc3gaps2 2026-10-27 .31
- T20: apitest rc3gaps2 2026-10-27 .107
- T21: apitest rc3gaps2 2026-10-27 .24
- T23: apitest rc3gaps2 2026-10-27 .30
- T31: apitest rc3gaps2 2026-10-27 .26
- T40: apitest agg47 2026-10-28 .184
- T41: apitest agg47 2026-10-28 .34
Used by: prudynt, raptor, timps.
See also: IMP_FrameSource_EnableChn, IMP_FrameSource_DestroyChn
int IMP_FrameSource_DestroyChn(int chnNum);Releases a channel and its buffers. The channel has to be disabled and unbound first.
Returns: 0 on success, also for a channel that was never created. -1 for an invalid channel number or for a channel that is still running.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest rc3gaps2 2026-10-27 .31
- T20: apitest rc3gaps2 2026-10-27 .107
- T21: apitest rc3gaps2 2026-10-27 .24
- T23: apitest rc3gaps2 2026-10-27 .30
- T31: apitest rc3gaps2 2026-10-27 .26
- T40: apitest agg47 2026-10-28 .184
- T41: apitest agg47 2026-10-28 .34
Used by: prudynt, raptor, timps.
See also: IMP_FrameSource_CreateChn
int IMP_FrameSource_EnableChn(int chnNum);Starts the channel: the capture format is programmed into the frame device and the capture buffers are allocated here.
Returns: 0 on success and when the channel is already running. -1 for a channel number out of range, when the channel was not created, when FrameSource is not initialised (T10 to T31), when the frame device cannot be opened or the format or buffer setup is refused, and on T10 to T31 when nrVBs plus the delay FIFO depth exceed the buffer limit. On T40 and T41 the pixel format must be NV12 and the size positive, otherwise -1.
Create the channel and set SetFrameDepth / SetMaxDelay first; both are read at this point. On T10 to T31 (except T20) the frame depth adds that many capture buffers to nrVBs. Bind the consumers before enabling, as in the typical order above.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest rc3gaps2 2026-10-27 .31
- T20: apitest rc3gaps2 2026-10-27 .107
- T21: apitest rc3gaps2 2026-10-27 .24
- T23: apitest rc3gaps2 2026-10-27 .30
- T31: apitest rc3gaps2 2026-10-27 .26
- T40: apitest agg47 2026-10-28 .184
- T41: apitest agg47 2026-10-28 .34
Used by: prudynt, raptor, timps.
See also: IMP_FrameSource_DisableChn
int IMP_FrameSource_DisableChn(int chnNum);Stops the channel and releases its capture buffers.
Returns: 0 on success and when the channel was not running. -1 for a channel number out of range, on T10 to T31 also when FrameSource is not initialised, and on T40 and T41 when stopping the stream fails.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest rc3gaps2 2026-10-27 .31
- T20: apitest rc3gaps2 2026-10-27 .107
- T21: apitest rc3gaps2 2026-10-27 .24
- T23: apitest rc3gaps2 2026-10-27 .30
- T31: apitest rc3gaps2 2026-10-27 .26
- T40: apitest agg47 2026-10-28 .184
- T41: apitest agg47 2026-10-28 .34
Used by: prudynt, raptor, timps.
See also: IMP_FrameSource_EnableChn
int IMP_FrameSource_GetChnAttr(int chnNum, IMPFSChnAttr *chn_attr);
int IMP_FrameSource_SetChnAttr(int chnNum, IMPFSChnAttr *chn_attr);Reads or changes the attribute structure of a channel. The values reach the hardware only when EnableChn runs.
Parameters
-
chnNum: Channel number. -
chn_attr: Attribute structure to read into or to store.
Returns: 0 on success, -1 on a NULL pointer, a channel number out of range, or when the channel does not exist yet. SetChnAttr on T10 to T31 also returns -1 when pixFmt is not RAW and picWidth is not a multiple of 16, when channel 0 is not of type FS_PHY_CHANNEL, or when FrameSource is not initialised; GetChnAttr returns -1 until an attribute was set. On T40 and T41 SetChnAttr on a running channel returns -1 unless the structure is unchanged apart from the I2D and frame rate words.
On T20 a picture or scaler output height that is not a multiple of 8 is rounded up (with a warning), and GetChnAttr reports the rounded value. The crop and scaler fields of the structure are applied at EnableChn.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: prudynt, raptor, timps.
See also: IMP_FrameSource_CreateChn, IMP_FrameSource_Get/SetI2dAttr
int IMP_FrameSource_SetYuvAlign(int chnNum, IMPFrameAlign *param);Asks for the YUV frames to be padded so that width and height are multiples of 8, 16 or 32.
Parameters
-
chnNum: Channel number. -
param: Enable flag and alignment of width and height.
Returns: 0 when the channel size already satisfies the alignment (or alignment is disabled), -1 (errno ENOTSUP) when padded frames would be needed or the alignment code is out of range, 0x80010001 for a channel number of 7 or more, 0x80010008 for a missing channel or NULL parameter.
SoC: T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | · | 🔧a |
Tested (tool, date, camera, what was checked):
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): static audit against the vendor libimp.a, no host test of its own; no camera run yet
Difference from the vendor library: Refuses padding that the channel would need; the open frame channel cannot pad.
The encoder normally pulls its frames through the bind, so a plain streamer never calls these. Use them when the
application needs raw NV12 frames (snapshots, motion detection of its own, analysis). Every frame obtained with
GetFrame has to be given back with ReleaseFrame, otherwise the channel runs out of buffers.
int IMP_FrameSource_GetFrameDepth(int chnNum, int *depth);
int IMP_FrameSource_SetFrameDepth(int chnNum, int depth);Sets or reads how many frames the application may hold at once through GetFrame.
Parameters
-
chnNum: Channel number. -
depth: Number of frames. 0 removes the depth.
Returns: 0 on success, -1 for a channel number out of range or a NULL pointer; the setter on T40 and T41 also refuses a negative depth.
On T41 a depth of 0 makes GetFrame return 0 without a frame, and with the depth reached GetFrame waits for a ReleaseFrame, 2 s at most, then returns 0x80012000 (vendor 1.2.5 behaviour). Not like the vendor: the T41 capture queue is shared and keeps the oldest frames when nobody pulls, where the vendor's depth queue replaces its oldest waiting frame. OpenIMP's own consumers do not count against the depth. On T40 GetFrame works without a depth. On T10 to T31 (except T20) the depth is added to the capture buffer count at EnableChn, so every frame costs a full capture buffer; keep it small.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 libimp swap 2026-10-27 .34 (depth semantics of the vendor 1.2.5 GetFrame: depth 0 -> no frame, N held, third waits 2 s -> 0x80012000)
Used by: prudynt, raptor, timps.
See also: IMP_FrameSource_GetFrame, IMP_FrameSource_ReleaseFrame
int IMP_FrameSource_GetFrame(int chnNum, void **frame);Waits for the next frame of the channel and returns a pointer to its description (IMPFrameInfo). The pixel data stays in the capture buffer, nothing is copied.
Parameters
-
chnNum: Channel number, which has to be running and have a frame depth. -
frame: Receives the frame pointer.
Returns: 0 on success, -1 on a bad argument or when no frame arrives within 2 seconds (T10 to T31). On T40 and T41 the call returns 0 without a frame when the frame depth is 0, and IMP_ERR_FS_* codes on errors and timeouts.
Give the frame back with ReleaseFrame. Frame data is NV12 for the YUV formats; the stride can be larger than the width.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: raptor, timps.
Difference from the vendor library: Waits up to 2 seconds like the vendor library.
See also: IMP_FrameSource_ReleaseFrame, IMP_FrameSource_Get/SetFrameDepth
int IMP_FrameSource_ReleaseFrame(int chnNum, void *frame);Gives a frame obtained with GetFrame back to the channel. Release every frame, or the channel runs out of buffers.
Returns: 0 on success. -1 for a channel number out of range or a NULL frame; on T40 and T41 also when the channel is not running or the frame is not one of its buffers (or was already released).
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: raptor, timps.
See also: IMP_FrameSource_GetFrame
int IMP_FrameSource_GetFrameEx(int chnNum, IMPFrameInfo **frame);Variant of GetFrame for T40 and T41 that takes a frame straight from the capture queue and does not need SetFrameDepth.
Returns: 0 on success, -1 for a channel number of 7 or more or a NULL pointer, otherwise the result of GetFrame (no frame within the wait).
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
See also: IMP_FrameSource_ReleaseFrameEx
int IMP_FrameSource_ReleaseFrameEx(int chnNum, IMPFrameInfo *pframe);Gives back a frame obtained with GetFrameEx; it does the same as ReleaseFrame.
Returns: 0 on success, -1 for a channel number of 7 or more, a NULL frame, or the errors of ReleaseFrame.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
See also: IMP_FrameSource_GetFrameEx
int IMP_FrameSource_SnapFrame(int chnNum, IMPPixelFormat fmt, int width, int height, void *out_buffer, IMPFrameInfo *info);Copies one frame into a buffer of the application, in the format and size of the channel, and fills a frame description. Meant for snapshots.
Parameters
-
chnNum: Channel number, running. -
fmt: Pixel format, must be the format of the channel. -
width: Width, must be the channel width. -
height: Height, must be the channel height. -
out_buffer: Buffer of at least one packed frame (for NV12width*height*3/2). -
info: Receives the frame description.
Returns: 0 on success, -1 when width, height or format differ from the channel or no frame arrives.
The channel needs no frame depth for this call. The output is packed NV12 without line padding. The call waits up to 2 seconds for a frame.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: raptor.
/* IMP_FrameSource_SetFrameDepthCopyType: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */Chooses whether frames of the depth queue are copies or are held in place (zero copy). Call it while the frame depth is 0.
Parameters
-
chnNum: Channel number. -
bNoCopy: Non-zero for zero copy.
Returns: 0 on success, -1 for an invalid channel, or when the frame depth is not in the required state: switching to zero copy needs depth 0, switching back needs the depth reset to 0 first.
SoC: T31
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | ? | · | · |
A channel can keep the last few frames in a FIFO so the application can ask for the frame that was captured a given time ago (for example to record a few seconds before a motion event).
int IMP_FrameSource_GetChnFifoAttr(int chnNum, IMPFSChnFifoAttr *attr);
int IMP_FrameSource_SetChnFifoAttr(int chnNum, IMPFSChnFifoAttr *attr);Configures the frame FIFO of the channel. In OpenIMP this is the same as setting the maximum delay to maxdepth and the delay to the same value.
Parameters
-
chnNum: Channel number. -
attr:maxdepthis the number of frames to keep (0 means no FIFO).typeselects the FIFO behaviour.
Returns: 0 on success, -1 on an invalid channel, a channel that was not created, a negative maxdepth, or a depth above 0 with a type other than FIFO_CACHE_PRIORITY.
A maxdepth of 0 is accepted in every state; it clears the delay FIFO while the channel is created and not running, which is what streamers send. With a non-zero depth the call is only allowed between CreateChn and EnableChn (it calls SetMaxDelay). Only FIFO_CACHE_PRIORITY is supported when the FIFO is used.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: prudynt, raptor.
Difference from the vendor library: FIFO_DATA_PRIORITY with a non-zero depth is refused with -1, because it needs capture buffers shared between readers that OpenIMP does not have.
See also: IMP_FrameSource_Get/SetMaxDelay, IMP_FrameSource_Get/SetDelay
int IMP_FrameSource_GetDelay(int chnNum, int *delay_ms);
int IMP_FrameSource_SetDelay(int chnNum, int delay_ms);Sets or reads the delay, in frames, of the channel's FIFO, that is how many of the newest frames are kept for GetTimedFrame.
Parameters
-
chnNum: Channel number. -
delay: Number of frames, between 0 and the value set withSetMaxDelay.
Returns: 0 on success, -1 when the channel was not created, the delay is below 0 or above 100, or above the value set with SetMaxDelay.
The delay can be changed while the channel is running. Each kept frame occupies one capture buffer, so the sum of nrVBs and the maximum delay has to fit the buffer budget (checked when the channel is enabled).
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest rc3gaps2 2026-10-27 .31
- T20: apitest rc3gaps2 2026-10-27 .107
- T21: apitest rc3gaps2 2026-10-27 .24
- T23: apitest rc3gaps2 2026-10-27 .30
- T31: apitest rc3gaps2 2026-10-27 .26
- T40: apitest agg47 2026-10-28 .184
- T41: apitest agg47 2026-10-28 .34
Used by: raptor.
See also: IMP_FrameSource_Get/SetMaxDelay, IMP_FrameSource_GetTimedFrame
int IMP_FrameSource_GetMaxDelay(int chnNum, int *max_delay_ms);
int IMP_FrameSource_SetMaxDelay(int chnNum, int max_delay_ms);Sets or reads the upper limit of the delay FIFO of a channel.
Parameters
-
chnNum: Channel number. -
max_delay: Maximum delay in frames, 0 to 100 in the API; OpenIMP holds fewer (31 frames on T10 to T31, 100 on T40 and T41, subject to the buffers that fit in memory).
Returns: -1 when the value is out of range or the channel is not in the created state (not yet running).
Call it between CreateChn and EnableChn. The default is 0, which keeps no frames.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest rc3gaps2 2026-10-27 .31
- T20: apitest rc3gaps2 2026-10-27 .107
- T21: apitest rc3gaps2 2026-10-27 .24
- T23: apitest rc3gaps2 2026-10-27 .30
- T31: apitest rc3gaps2 2026-10-27 .26
- T40: apitest agg47 2026-10-28 .184
- T41: apitest agg47 2026-10-28 .34
Used by: raptor.
See also: IMP_FrameSource_Get/SetDelay
int IMP_FrameSource_GetTimedFrame(int chnNum, void *framets, int block, void *framedata, void *frame);Returns the buffered frame that is closest to a requested capture time, together with the frame data copy.
Parameters
-
chnNum: Channel number. -
framets: Requested capture time (ts). On T40 and T41 the tolerance before (minus) and after (plus) is used as well; on T10 to T31 onlytsis read. -
block: Non-zero waits for a matching frame (up to 5 s on T10 to T31, 2 s on T40 and T41), zero returns at once. -
framedata: Buffer that receives the frame data. -
frame: Receives the frame description.
Returns: 0 on success. On T10 to T31: -1 without a delay FIFO (call SetMaxDelay before EnableChn) or when every held frame is newer than the requested time, -2 when no frame matches and block is 0. On T40 and T41 the vendor error codes (IMP_ERR_FS_*) are returned for no match, timeout and missing FIFO.
Used for pre-event recording. T40 and T41 keep the delay frames as copies, which costs one frame copy per GetFrame while the delay is above 0.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ? | ✅ | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T10: apitest agg47 2026-10-26 .31
- T20: apitest agg47 2026-10-26 .107
- T21: apitest agg47 2026-10-26 .24
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: raptor.
See also: IMP_FrameSource_Get/SetMaxDelay
int IMP_FrameSource_SetChnRotate(int chnNum, int rotTo90, int width, int height);Turns the channel picture by 90 or 180 degrees in software, before any consumer sees it. Works on T21 and T31 only.
Parameters
-
chnNum: Channel number. -
rotTo90: 0 off, 1 90 degrees counterclockwise, 2 90 degrees clockwise, 3 180 degrees. -
width: Picture width before the rotation. -
height: Picture height before the rotation.
Returns: 0 on success. -1 for an unsupported size (odd, above 4096) or mode. On SoCs without software rotation every mode but 0 returns -1. On T21 the size must be a multiple of 16 and is limited for CPU load, so the call refuses large pictures there.
Call it before CreateChn (the setting stays through DestroyChn). Create the encoder channel with the rotated size (width and height swapped for 90 degrees). The rotation costs CPU time on every frame; on T40 and T41 use the hardware I2D block instead.
SoC: T21 and T31 (software rotation). T40 and T41 use SetI2dAttr.
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | ✅ | · | · |
Tested (tool, date, camera, what was checked):
- T31: apitest next+ko/libimp swap 2026-10-27 .26
Used by: timps.
Difference from the vendor library: Mode 3 (180 degrees) is an OpenIMP addition; the vendor library only knows 0 to 2.
/* IMP_FrameSource_GetI2dAttr: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */
/* IMP_FrameSource_SetI2dAttr: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */Rotates, flips or mirrors the output of the channel with the hardware I2D block.
Parameters
-
chnNum: Channel number. -
attr: Enable flags for flip, mirror and rotate, and the angle.
Returns: 0 on success. Errors are the codes 0x80010001 (channel number 7 or more), 0x80010002 (NULL pointer) and 0x80010040 (channel does not exist or is not supported, or a forbidden flag combination).
The call only stores the attribute in the channel; EnableChn applies it, so a running channel takes a new attribute at its next enable. Flip together with mirror, or flip or mirror together with rotate, is refused. For a rotation the frame width and height must be multiples of 8 (width of 16 for 90 and 270 degrees) and the angle 0, 90, 180 or 270, otherwise EnableChn fails. The encoder size has to follow a rotation by 90 degrees.
SoC: T40 and T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | ✅ | ✅ |
Tested (tool, date, camera, what was checked):
- T40: apitest gate1026 (open-tx-isp 2acd1afa) 2026-10-26 .184
- T41: apitest rc3gaps2 2026-10-27 .34
Used by: raptor.
int IMP_FrameSource_GetPool(int chnNum);
int IMP_FrameSource_SetPool(int chnNum, int poolId);Binds a channel to a memory pool (created with IMP_System_MemPoolRequest) so its capture buffers come from that pool, or reads the binding back.
Parameters
-
chnNum: Channel number (T41: 0 to 32; the channel does not have to exist yet). -
poolId: Id of the pool. Set it beforeEnableChn.
Returns: T41, as the vendor library: the setter returns 0x80010001 for a channel number of 33 or more, 0x80010040 if the pool does not exist and 0x80010020 if the channel is already bound; the getter returns the pool id, 0x80010001 for a channel of 33 or more and 0x80010020 when none is bound. T31: the getter returns the pool id or -1 if none was set or the channel is invalid; the setter returns 0, or -1 for an invalid channel, a negative id or a pool already set.
Checked on a T41 camera: three enable/disable cycles with channel 1 frames inside a 2 MB pool, memory use identical before and after, and a 64 KB pool refused.
SoC: T23, T31, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | ✅ | · | ✅ | · | ✅ |
Tested (tool, date, camera, what was checked):
- T23: apitest agg47 2026-10-26 .30
- T31: apitest next+ko/libimp swap 2026-10-27 .26
- T41: apitest fspool 2026-10-27 .34 (OpenIMP 5270cc46): real rmem pool from MemPoolRequest, ch1 capture buffers inside the pool, 3 cycles, pool free after Destroy, too-small pool refused at EnableChn
Used by: raptor.
Difference from the vendor library: T41 pools are real: the pool is a contiguous block of media memory, the capture buffers of a bound channel are taken from it at the next EnableChn, and an EnableChn with a pool that is too small fails cleanly. Unbound channels keep using the common arena. Beyond the vendor, IMP_System_MemPoolFree releases an idle pool and unbinds the channels that used it. On the other SoCs (T31 and T23) a pool is a name only: SetPool records the id, reserves nothing and does not change where the buffers come from.
/* IMP_FrameSource_ClearPoolId: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */Forgets the pool ids that were set, so the buffers come from the default memory again. Takes no channel argument.
Returns: 0 on success, non-zero on error (mostly -1; T40 and T41 return their own error codes for some failures).
SoC: T31
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | ? | · | · |
A channel that is filled by the application instead of the sensor, for example to run a recorded or generated NV12 image through the encoder.
int IMP_FrameSource_DequeueBuffer(int chnNum, IMPFrameInfo **frame);Takes a free buffer of an injection channel (T40 and T41); the application then fills it with an NV12 picture and hands it back with QueueBuffer.
Returns: 0 on success with the frame in *frame; -1 for a bad channel or NULL pointer, when the injection channel is not enabled, or when no buffer is free.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | 🔧h | 🔧h |
Tested (tool, date, camera, what was checked):
- T40: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
See also: IMP_FrameSource_QueueBuffer
int IMP_FrameSource_QueueBuffer(int chnNum, const IMPFrameInfo *frame);Hands a filled buffer of an injection channel to its consumers. The CPU cache is written back first, and a frame without time stamp gets the current system time stamp.
Returns: 0 on success, -1 when the channel is not enabled or the frame is not a buffer obtained with DequeueBuffer.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | 🔧h | 🔧h |
Tested (tool, date, camera, what was checked):
- T40: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
See also: IMP_FrameSource_DequeueBuffer
int IMP_FrameSource_ExternInject_CreateChn(int chnNum, IMPFSChnAttr *chnAttr);Creates an injection channel (T40 and T41): a channel without sensor that is fed by the application. Use a channel number that the sensor channels do not use.
Returns: 0 on success, -1 for a channel number of 7 or more, a NULL attribute, a width that is not a positive multiple of 16, a height of 0 or less, a pixel format other than NV12, a scaler on channel 0, a channel number that is already a sensor channel, or an injection channel that already exists.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | 🔧h | 🔧h |
Tested (tool, date, camera, what was checked):
- T40: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
See also: IMP_FrameSource_DequeueBuffer
int IMP_FrameSource_ExternInject_DestroyChn(int chnNum);Destroys an injection channel. Disable it first.
Returns: 0 on success, -1 for a bad channel number, when the channel does not exist, or while it is still enabled.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | 🔧h | 🔧h |
Tested (tool, date, camera, what was checked):
- T40: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
int IMP_FrameSource_ExternInject_EnableChn(int chnNum);Starts the injection channel and allocates its buffers (nrVBs, 3 if unset, at most 8), so buffers can be dequeued.
Returns: 0 on success and when already enabled, -1 when the channel does not exist or the frame memory cannot be allocated.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | 🔧h | 🔧h |
Tested (tool, date, camera, what was checked):
- T40: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
int IMP_FrameSource_ExternInject_DisableChn(int chnNum);Stops the injection channel and frees its buffers.
Returns: 0 on success, -1 when the channel does not exist or a consumer (such as the encoder) still holds a frame.
SoC: only in the vendor API of T40, T41
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | · | 🔧h | 🔧h |
Tested (tool, date, camera, what was checked):
- T40: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
- T41: OpenIMP claude/t4x-api-gaps (2026-10-26): host test; no camera run yet
int IMP_FrameSource_ChnStatQuery(int chnNum, void *stat);Reads the state of a channel as a number.
Parameters
-
chnNum: Channel number. -
stat: Pointer to a 32-bit integer that receives 0 (closed), 1 (created) or 2 (running).
Returns: 0 on success, non-zero on error (mostly -1; T40 and T41 return their own error codes for some failures).
SoC: T31
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | · | ✅ | · | · |
Tested (tool, date, camera, what was checked):
- T31: apitest next+ko/libimp swap 2026-10-27 .26
/* IMP_FrameSource_GetDirectModeAttr: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */
/* IMP_FrameSource_SetDirectModeAttr: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */Stores and reads back the data threshold of the direct (online) mode of a channel. OpenIMP only records the value.
Parameters
-
chn: Channel number. -
data_threshold: Threshold value.
Returns: 0 on success, -1 when the channel has no attribute yet or the pointer is NULL.
SoC: T23
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | ✅ | · | · | · | · |
Tested (tool, date, camera, what was checked):
- T23: apitest agg47 2026-10-26 .30
/* IMP_FrameSource_SetSource: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */Declares which physical channel an extension channel (FS_EXT_CHANNEL) is derived from; the value is stored in the channel.
Parameters
-
extchnNum: Number of the extension channel. -
sourcechnNum: Number of the physical channel it is cut from, 0 to 2.
Returns: 0 on success, -1 for an extension channel number out of range, a source channel of 3 or more, or when FrameSource is not initialised.
SoC: T31
| T10 | T20 | T21 | T23 | T30 | T31 | T40 | T41 |
|---|---|---|---|---|---|---|---|
| · | · | · | · | ? | 🔧a | · | · |
int IMP_FrameSource_EnableChnUndistort(int chnNum, int param);Switches the lens distortion correction of the channel on. Accepted, no effect in OpenIMP.
Returns: 0, or -1 for a channel number out of range.
int IMP_FrameSource_DisableChnUndistort(int chnNum);Switches the lens distortion correction of the channel off. Accepted, no effect in OpenIMP.
Returns: 0, or -1 for a channel number out of range.
int IMP_FrameSource_SetFrameOffset(int chnNum, int x, int y);Sets a frame offset for the channel. Accepted and ignored, returns 0.
Returns: 0, or -1 for a channel number out of range.
/* IMP_FrameSource_CloseNCUInfo: exported by libimp; declared in the vendor SDK header, not in the OpenIMP include directory */Sets the flag that turns off the per-frame NCU information of the buffer manager. Internal helper of the vendor library, kept for compatibility.
Returns: 0 on success, -1 when the buffer manager does not exist yet.
Open Ingenic camera stack
- Home
- Supported SoCs and Sensors
- Per-SoC Status
- Feature Matrix
- Architecture
- Building
- Installing and Switching
- Module Parameters
- Environment Variables
- Beyond the Vendor
- API reference
- Memory
- Troubleshooting
- Testing
- Test Pattern
- Performance
- Changelog
- Release Scheme
- Release Gates
- Live feature matrix
- Project board
Current: RC2 (v2026.10.25-rc2); RC3 in progress