|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
ra8_jpeg_sw adapter for the generic camera codec facade. More...
#include "ra8_camera_codec_jpeg_sw.h"#include <stddef.h>#include <stdint.h>#include "ra8_attributes.h"#include "ra8_camera_internal.h"#include "ra8_err.h"#include "ra8_jpeg_sw.h"Go to the source code of this file.
Enumerations | |
| enum | camera_jpeg_color_t : int32_t { k_camera_jpeg_luma_black = 16 , k_camera_jpeg_chroma_mid = 128 , k_camera_jpeg_luma_scale = 298 , k_camera_jpeg_red_cr = 409 , k_camera_jpeg_green_cb = 100 , k_camera_jpeg_green_cr = 208 , k_camera_jpeg_blue_cb = 516 , k_camera_jpeg_rounding = 128 , k_camera_jpeg_shift = 8 , k_camera_jpeg_u8_max = 255 } |
| BT.601 limited-range fixed-point conversion constants. More... | |
Functions | |
| static uint8_t | internal_jpeg_sw_clamp (int32_t component) |
| Clamp a signed RGB component to one byte. | |
| static void | internal_jpeg_sw_ycbcr_to_rgb (uint8_t y, uint8_t cb, uint8_t cr, uint8_t *output) |
| Convert one limited-range YCbCr pixel to packed RGB888. | |
| static void | internal_jpeg_sw_read_rgb (const ra8_camera_frame_t *input, uint32_t x, uint32_t y, uint8_t *output) |
| Read one source pixel as RGB888. | |
| static void | internal_jpeg_sw_prepare_rgb (const ra8_camera_codec_jpeg_sw_state_t *state, const ra8_camera_frame_t *input) |
| Nearest-neighbour sample input into the configured RGB workspace. | |
| static ra8_err_t | internal_jpeg_sw_encode (void *ctx, const ra8_camera_frame_t *input, const ra8_camera_buffer_t *output_buffer, ra8_camera_frame_t *out_frame) |
| Convert and encode one raw frame with ra8_jpeg_sw. | |
| ra8_err_t | ra8_camera_codec_jpeg_sw_init (ra8_camera_codec_t *codec, ra8_camera_codec_jpeg_sw_state_t *state, const ra8_camera_codec_jpeg_sw_cfg_t *cfg) |
| Bind the software baseline-JPEG encoder backend. | |
Variables | |
| static const ra8_camera_codec_iface_t | s_jpeg_sw_codec_iface |
| Software JPEG codec vtable. | |
ra8_jpeg_sw adapter for the generic camera codec facade.
Samples RGB888 or UYVY422 into the configured packed-RGB workspace, delegates baseline-JPEG encoding, and translates the produced byte count into a generic JPEG frame view.
Definition in file ra8_camera_codec_jpeg_sw.c.
| enum camera_jpeg_color_t : int32_t |
BT.601 limited-range fixed-point conversion constants.
Definition at line 29 of file ra8_camera_codec_jpeg_sw.c.
|
static |
Clamp a signed RGB component to one byte.
Saturates a fixed-point conversion result into packed RGB range.
| [in] | component | Signed channel value. |
| 0 | Component was below the packed range. |
| 255 | Component was above the packed range. |
Definition at line 57 of file ra8_camera_codec_jpeg_sw.c.
References k_camera_jpeg_u8_max, and RA8_INTERNAL.
Referenced by internal_jpeg_sw_ycbcr_to_rgb().
|
static |
Convert and encode one raw frame with ra8_jpeg_sw.
Converts or samples the input into caller-owned RGB workspace, then writes a baseline JPEG into the per-call output buffer.
| [in] | ctx | Bound software-JPEG state. |
| [in] | input | Valid RGB888 or UYVY422 frame. |
| [in] | output_buffer | Caller-owned JPEG destination. |
| [out] | out_frame | Receives the encoded JPEG view. |
| k_ra8_ok | JPEG encoded. |
| k_ra8_err_null_ptr | Required state, frame, or buffer pointer is NULL. |
| k_ra8_err_not_supported | Input format is not raw RGB888 or UYVY422. |
| other | Forwarded from ra8_jpeg_sw_encode. |
Definition at line 193 of file ra8_camera_codec_jpeg_sw.c.
References ra8_camera_buffer_t::capacity, ra8_camera_codec_jpeg_sw_state_t::cfg, ra8_camera_buffer_t::data, ra8_camera_frame_t::format, internal_jpeg_sw_prepare_rgb(), k_ra8_camera_format_jpeg, k_ra8_camera_format_rgb888, k_ra8_camera_format_uyvy422, k_ra8_err_not_supported, k_ra8_err_null_ptr, k_ra8_ok, ra8_camera_codec_jpeg_sw_cfg_t::output_height, ra8_camera_codec_jpeg_sw_cfg_t::output_width, ra8_camera_codec_jpeg_sw_cfg_t::quality, RA8_INTERNAL, ra8_jpeg_sw_encode(), and ra8_camera_codec_jpeg_sw_cfg_t::rgb_workspace.
|
static |
Nearest-neighbour sample input into the configured RGB workspace.
Maps each configured output coordinate into the source frame and materializes a tightly packed RGB image for the JPEG encoder.
| [in] | state | Backend state holding output geometry and workspace. |
| [in] | input | Valid RGB888 or UYVY422 input frame. |
Definition at line 155 of file ra8_camera_codec_jpeg_sw.c.
References ra8_camera_codec_jpeg_sw_state_t::cfg, ra8_camera_frame_t::height, internal_jpeg_sw_read_rgb(), ra8_camera_codec_jpeg_sw_cfg_t::output_height, ra8_camera_codec_jpeg_sw_cfg_t::output_width, RA8_INTERNAL, ra8_camera_codec_jpeg_sw_cfg_t::rgb_workspace, and ra8_camera_frame_t::width.
Referenced by internal_jpeg_sw_encode().
|
static |
Read one source pixel as RGB888.
Copies RGB input directly or decodes the selected pixel from its shared UYVY chroma pair.
| [in] | input | Valid RGB888 or UYVY422 frame. |
| [in] | x | Source column. |
| [in] | y | Source row. |
| [out] | output | Receives packed red, green, and blue bytes. |
Definition at line 123 of file ra8_camera_codec_jpeg_sw.c.
References ra8_camera_frame_t::data, ra8_camera_frame_t::format, internal_jpeg_sw_ycbcr_to_rgb(), k_ra8_camera_format_rgb888, and ra8_camera_frame_t::stride_bytes.
Referenced by internal_jpeg_sw_prepare_rgb().
|
static |
Convert one limited-range YCbCr pixel to packed RGB888.
Applies the integer BT.601 limited-range transform and saturation.
| [in] | y | Luma sample. |
| [in] | cb | Blue-difference chroma sample. |
| [in] | cr | Red-difference chroma sample. |
| [out] | output | Receives packed red, green, and blue bytes. |
Definition at line 84 of file ra8_camera_codec_jpeg_sw.c.
References internal_jpeg_sw_clamp(), k_camera_jpeg_blue_cb, k_camera_jpeg_chroma_mid, k_camera_jpeg_green_cb, k_camera_jpeg_green_cr, k_camera_jpeg_luma_black, k_camera_jpeg_luma_scale, k_camera_jpeg_red_cr, k_camera_jpeg_rounding, and k_camera_jpeg_shift.
Referenced by internal_jpeg_sw_read_rgb().
|
nodiscard |
Bind the software baseline-JPEG encoder backend.
| [out] | codec | Caller-owned codec handle to bind. |
| [out] | state | Caller-owned backend state to populate. |
| [in] | cfg | Output geometry, quality, and RGB workspace. |
| k_ra8_ok | Codec bound. |
| k_ra8_err_null_ptr | An argument or cfg->rgb_workspace was NULL. |
| k_ra8_err_invalid_arg | Quality or output geometry was invalid. |
| k_ra8_err_invalid_size | RGB workspace was too small. |
Definition at line 250 of file ra8_camera_codec_jpeg_sw.c.
References ra8_camera_codec_jpeg_sw_state_t::cfg, ra8_camera_codec_t::ctx, ra8_camera_codec_t::iface, k_ra8_err_invalid_arg, k_ra8_err_invalid_size, k_ra8_err_null_ptr, k_ra8_jpeg_sw_quality_max, k_ra8_jpeg_sw_quality_min, k_ra8_ok, ra8_camera_codec_jpeg_sw_cfg_t::output_height, ra8_camera_codec_jpeg_sw_cfg_t::output_width, ra8_camera_codec_jpeg_sw_cfg_t::quality, ra8_camera_codec_jpeg_sw_cfg_t::rgb_workspace, ra8_camera_codec_jpeg_sw_cfg_t::rgb_workspace_capacity, and s_jpeg_sw_codec_iface.
Referenced by c6_cam_camera_init().
|
static |
Software JPEG codec vtable.
Definition at line 246 of file ra8_camera_codec_jpeg_sw.c.
Referenced by ra8_camera_codec_jpeg_sw_init().