|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
UYVY-to-RGB888 conversion and 0/90/180/270 SDRAM image production. More...
Go to the source code of this file.
Data Structures | |
| struct | cam_rgb_t |
| One RGB888 pixel used while scattering the four orientations. More... | |
Enumerations | |
| enum | cam_image_align_t : uint32_t { k_cam_image_cache_line_bytes = 32U } |
| Cache-line alignment shared by the SDRAM buffers and cache API. More... | |
| enum | cam_image_yuv_coeff_t : int32_t { k_cam_yuv_luma_black = 16 , k_cam_yuv_chroma_mid = 128 , k_cam_yuv_luma_scale = 298 , k_cam_yuv_red_cr = 409 , k_cam_yuv_green_cb = 100 , k_cam_yuv_green_cr = 208 , k_cam_yuv_blue_cb = 516 , k_cam_yuv_rounding = 128 , k_cam_yuv_shift = 8 } |
| BT.601 limited-range fixed-point YCbCr-to-RGB coefficients. More... | |
Functions | |
| static uint8_t | cam_image_clamp (int32_t component) |
| Clamp a signed RGB component to one byte. | |
| static cam_rgb_t | cam_image_ycbcr_to_rgb (uint8_t y, uint8_t cb, uint8_t cr) |
| Convert one limited-range YCbCr pixel to RGB888. | |
| static void | cam_image_scatter (uint32_t x, uint32_t y, cam_rgb_t rgb) |
| Write one RGB pixel to all four rotated row-major destinations. | |
| static void | cam_image_convert (const uint8_t *uyvy) |
| Convert one complete UYVY frame into all four RGB orientations. | |
| static ra8_err_t | cam_image_clean_outputs (void) |
| Clean all generated RGB views from the data cache. | |
| ra8_err_t | cam_image_generate (const uint8_t *uyvy, uint32_t source_bytes) |
| Convert one packed Cb-Y0-Cr-Y1 VGA frame into all four RGB views. | |
Variables | |
| uint8_t | g_cam_rgb_0 [k_cam_rgb_frame_bytes] |
| Unrotated 640x480 RGB888 image in external SDRAM. | |
| uint8_t | g_cam_rgb_90 [k_cam_rgb_frame_bytes] |
| Clockwise-90-degree 480x640 RGB888 image in external SDRAM. | |
| uint8_t | g_cam_rgb_180 [k_cam_rgb_frame_bytes] |
| Clockwise-180-degree 640x480 RGB888 image in external SDRAM. | |
| uint8_t | g_cam_rgb_270 [k_cam_rgb_frame_bytes] |
| Clockwise-270-degree 480x640 RGB888 image in external SDRAM. | |
| const uint32_t | g_cam_rgb_frame_bytes = (uint32_t)k_cam_rgb_frame_bytes |
| Stable byte count of each exported RGB888 buffer. | |
UYVY-to-RGB888 conversion and 0/90/180/270 SDRAM image production.
Converts one module-owned packed VGA frame into four statically allocated, cache-aligned RGB888 SDRAM views and performs cache maintenance for debugger-side validation.
Definition in file cam_image.c.
| enum cam_image_align_t : uint32_t |
Cache-line alignment shared by the SDRAM buffers and cache API.
| Enumerator | |
|---|---|
| k_cam_image_cache_line_bytes | Cortex-M85 data-cache line size. |
Definition at line 24 of file cam_image.c.
| enum cam_image_yuv_coeff_t : int32_t |
BT.601 limited-range fixed-point YCbCr-to-RGB coefficients.
Definition at line 29 of file cam_image.c.
|
static |
Clamp a signed RGB component to one byte.
Saturates negative and over-range fixed-point conversion results.
| [in] | component | Signed RGB channel value. |
| 0 | The component was negative. |
| UINT8_MAX | The component exceeded one byte. |
Definition at line 73 of file cam_image.c.
Referenced by cam_image_ycbcr_to_rgb().
|
static |
Clean all generated RGB views from the data cache.
| k_ra8_ok | All four image ranges were cleaned. |
Definition at line 194 of file cam_image.c.
References g_cam_rgb_0, g_cam_rgb_180, g_cam_rgb_270, g_cam_rgb_90, k_cam_rgb_frame_bytes, ra8_cache_dcache_clean_by_addr(), and RA8_RETURN_ON_ERROR.
Referenced by cam_image_generate().
|
static |
Convert one complete UYVY frame into all four RGB orientations.
| [in] | uyvy | Complete VGA UYVY source frame. |
Definition at line 167 of file cam_image.c.
References cam_image_scatter(), cam_image_ycbcr_to_rgb(), k_cam_image_height_px, and k_cam_image_width_px.
Referenced by cam_image_generate().
| ra8_err_t cam_image_generate | ( | const uint8_t * | uyvy, |
| uint32_t | source_bytes ) |
Convert one packed Cb-Y0-Cr-Y1 VGA frame into all four RGB views.
Performs fixed-point YCbCr conversion and scatters each pixel into caller-observable SDRAM buffers for the four clockwise orientations.
| [in] | uyvy | Source VGA frame in packed UYVY byte order. |
| [in] | source_bytes | Valid bytes at uyvy; must equal 614400. |
| k_ra8_ok | Four complete RGB888 buffers are visible to SWD. |
| k_ra8_err_null_ptr | uyvy was NULL. |
| k_ra8_err_invalid_arg | source_bytes was not one VGA UYVY frame. |
Definition at line 209 of file cam_image.c.
References cam_image_clean_outputs(), cam_image_convert(), k_cam_uyvy_frame_bytes, k_ra8_err_invalid_arg, and RA8_CHECK_NULL_PTR.
Referenced by cam_finish_verdict().
|
static |
Write one RGB pixel to all four rotated row-major destinations.
Computes the 0, 90, 180, and 270 degree row-major offsets once.
| [in] | x | Source-frame horizontal coordinate. |
| [in] | y | Source-frame vertical coordinate. |
| [in] | rgb | Pixel value to scatter. |
Definition at line 136 of file cam_image.c.
References cam_rgb_t::blue, g_cam_rgb_0, g_cam_rgb_180, g_cam_rgb_270, g_cam_rgb_90, cam_rgb_t::green, k_cam_image_height_px, k_cam_image_width_px, k_cam_rgb_bytes_per_px, and cam_rgb_t::red.
Referenced by cam_image_convert().
|
static |
Convert one limited-range YCbCr pixel to RGB888.
Applies fixed-point BT.601-style luma and chroma coefficients.
| [in] | y | Limited-range luma byte. |
| [in] | cb | Blue-difference chroma byte. |
| [in] | cr | Red-difference chroma byte. |
| cam_rgb_t | Saturated red, green, and blue channels. |
Definition at line 99 of file cam_image.c.
References cam_image_clamp(), k_cam_yuv_blue_cb, k_cam_yuv_chroma_mid, k_cam_yuv_green_cb, k_cam_yuv_green_cr, k_cam_yuv_luma_black, k_cam_yuv_luma_scale, k_cam_yuv_red_cr, k_cam_yuv_rounding, and k_cam_yuv_shift.
Referenced by cam_image_convert().
| uint8_t g_cam_rgb_0[k_cam_rgb_frame_bytes] |
Unrotated 640x480 RGB888 image in external SDRAM.
Definition at line 49 of file cam_image.c.
Referenced by cam_image_clean_outputs(), and cam_image_scatter().
| uint8_t g_cam_rgb_180[k_cam_rgb_frame_bytes] |
Clockwise-180-degree 640x480 RGB888 image in external SDRAM.
Definition at line 53 of file cam_image.c.
Referenced by cam_image_clean_outputs(), and cam_image_scatter().
| uint8_t g_cam_rgb_270[k_cam_rgb_frame_bytes] |
Clockwise-270-degree 480x640 RGB888 image in external SDRAM.
Definition at line 55 of file cam_image.c.
Referenced by cam_image_clean_outputs(), and cam_image_scatter().
| uint8_t g_cam_rgb_90[k_cam_rgb_frame_bytes] |
Clockwise-90-degree 480x640 RGB888 image in external SDRAM.
Definition at line 51 of file cam_image.c.
Referenced by cam_image_clean_outputs(), and cam_image_scatter().
| const uint32_t g_cam_rgb_frame_bytes = (uint32_t)k_cam_rgb_frame_bytes |
Stable byte count of each exported RGB888 buffer.
Definition at line 57 of file cam_image.c.
Referenced by cam_finish_verdict().