ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_camera_codec_passthrough.c File Reference

Zero-copy JPEG passthrough backend implementation. More...

#include "ra8_camera_codec_passthrough.h"
#include <stddef.h>
#include "ra8_attributes.h"
#include "ra8_camera_internal.h"
#include "ra8_err.h"
Include dependency graph for ra8_camera_codec_passthrough.c:

Go to the source code of this file.

Functions

static ra8_err_t internal_passthrough_encode (void *ctx, const ra8_camera_frame_t *input, const ra8_camera_buffer_t *output_buffer, ra8_camera_frame_t *out_frame)
 Return a JPEG input view unchanged.
ra8_err_t ra8_camera_codec_passthrough_init (ra8_camera_codec_t *codec)
 Bind the zero-copy JPEG passthrough codec.

Variables

static const ra8_camera_codec_iface_t s_passthrough_codec_iface
 Stateless passthrough codec vtable.

Detailed Description

Zero-copy JPEG passthrough backend implementation.

Tag
[Ring 4 / Service] {World: NS}

The codec row accepts only k_ra8_camera_format_jpeg and aliases the validated input view. It never reads or writes the supplied output buffer.

Since
0.1.0

Definition in file ra8_camera_codec_passthrough.c.

Function Documentation

◆ internal_passthrough_encode()

ra8_err_t internal_passthrough_encode ( void * ctx,
const ra8_camera_frame_t * input,
const ra8_camera_buffer_t * output_buffer,
ra8_camera_frame_t * out_frame )
static

Return a JPEG input view unchanged.

Implements zero-copy encoding by aliasing an already-compressed JPEG frame and ignoring the output buffer.

Parameters
[in]ctxUnused stateless backend context.
[in]inputValid input frame.
[in]output_bufferUnused caller output buffer.
[out]out_frameReceives an alias of input.
Returns
ra8_err_t Error code.
Return values
k_ra8_okJPEG view returned.
k_ra8_err_null_ptrRequired frame pointer is NULL.
k_ra8_err_not_supportedInput is not JPEG.
Precondition
input passed generic frame validation.
out_frame is writable.
Postcondition
On success out_frame->data == input->data.
No input or output storage is modified.
Note
Thread-safe because the backend has no state.
Since
0.1.0

Definition at line 46 of file ra8_camera_codec_passthrough.c.

References ra8_camera_frame_t::format, k_ra8_camera_format_jpeg, k_ra8_err_not_supported, k_ra8_err_null_ptr, k_ra8_ok, and RA8_INTERNAL.

◆ ra8_camera_codec_passthrough_init()

ra8_err_t ra8_camera_codec_passthrough_init ( ra8_camera_codec_t * codec)
nodiscard

Bind the zero-copy JPEG passthrough codec.

Parameters
[out]codecCaller-owned codec handle to bind.
Returns
ra8_err_t Error code.
Return values
k_ra8_okCodec bound.
k_ra8_err_null_ptrcodec was NULL.
Precondition
codec out-lives every codec operation.
The caller does not mutate the handle while encoding.
Postcondition
On success JPEG input is returned byte-for-byte without copying.
On error no state is modified.
Note
Stateless; independent handles are thread-safe.
Since
0.1.0

Definition at line 71 of file ra8_camera_codec_passthrough.c.

References ra8_camera_codec_t::ctx, ra8_camera_codec_t::iface, k_ra8_err_null_ptr, k_ra8_ok, and s_passthrough_codec_iface.

Referenced by internal_bring_up_capture_pipeline().

Variable Documentation

◆ s_passthrough_codec_iface

const ra8_camera_codec_iface_t s_passthrough_codec_iface
static
Initial value:
= {
}
static ra8_err_t internal_passthrough_encode(void *ctx, const ra8_camera_frame_t *input, const ra8_camera_buffer_t *output_buffer, ra8_camera_frame_t *out_frame)
Return a JPEG input view unchanged.

Stateless passthrough codec vtable.

Definition at line 67 of file ra8_camera_codec_passthrough.c.

Referenced by ra8_camera_codec_passthrough_init().