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

Encoder state – buffer cursor, bit accumulator, scaled quant tables, Huffman LUTs and DC predictors. More...

#include <ra8_jpeg_sw_encode_internal.h>

Data Fields

uint8_t * dst
 Destination JPEG byte buffer.
uint32_t cap
 Capacity of dst in bytes.
uint32_t pos
 Write cursor into dst.
uint32_t bit_buf
 MSB-first entropy bit accumulator.
uint8_t bit_cnt
 Bits currently valid in bit_buf.
uint8_t qy [k_ra8_jpeg_block_size]
 Scaled luma quant table.
uint8_t qc [k_ra8_jpeg_block_size]
 Scaled chroma quant table.
int32_t dc_pred [k_ra8_jpeg_max_comps]
 Per-component DC predictors.
uint16_t code_dc_l [k_ra8_jpeg_huff_max]
 Luma DC Huffman codes.
uint8_t size_dc_l [k_ra8_jpeg_huff_max]
 Luma DC code lengths.
uint16_t code_ac_l [k_ra8_jpeg_huff_max]
 Luma AC Huffman codes.
uint8_t size_ac_l [k_ra8_jpeg_huff_max]
 Luma AC code lengths.
uint16_t code_dc_c [k_ra8_jpeg_huff_max]
 Chroma DC Huffman codes.
uint8_t size_dc_c [k_ra8_jpeg_huff_max]
 Chroma DC code lengths.
uint16_t code_ac_c [k_ra8_jpeg_huff_max]
 Chroma AC Huffman codes.
uint8_t size_ac_c [k_ra8_jpeg_huff_max]
 Chroma AC code lengths.
bool overflow
 Set on capacity exhaustion.

Detailed Description

Encoder state – buffer cursor, bit accumulator, scaled quant tables, Huffman LUTs and DC predictors.

One instance drives a whole ra8_jpeg_sw_encode() call: the destination byte cursor and MSB-first bit accumulator feed the entropy emitters in ra8_jpeg_sw_encode_emit.c, while the scaled quantization tables, canonical Huffman code/size look-up tables and per-component DC predictors are consumed by the block encoder in ra8_jpeg_sw_encode.c.

Invariant
pos <= cap whenever overflow is false.
bit_cnt < 8 between priv_jpeg_sw_enc_put_bits() calls.
See also
ra8_jpeg_sw_encode() Public API that owns the single instance.
Since
0.1.0

Definition at line 64 of file ra8_jpeg_sw_encode_internal.h.

Field Documentation

◆ bit_buf

uint32_t ra8_jpeg_enc_ctx_t::bit_buf

MSB-first entropy bit accumulator.

Definition at line 69 of file ra8_jpeg_sw_encode_internal.h.

Referenced by priv_jpeg_sw_enc_flush_bits(), and priv_jpeg_sw_enc_put_bits().

◆ bit_cnt

uint8_t ra8_jpeg_enc_ctx_t::bit_cnt

Bits currently valid in bit_buf.

Definition at line 70 of file ra8_jpeg_sw_encode_internal.h.

Referenced by priv_jpeg_sw_enc_flush_bits(), and priv_jpeg_sw_enc_put_bits().

◆ cap

uint32_t ra8_jpeg_enc_ctx_t::cap

Capacity of dst in bytes.

Definition at line 66 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_emit_u8(), and ra8_jpeg_sw_encode().

◆ code_ac_c

uint16_t ra8_jpeg_enc_ctx_t::code_ac_c[k_ra8_jpeg_huff_max]

Chroma AC Huffman codes.

Definition at line 83 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ code_ac_l

uint16_t ra8_jpeg_enc_ctx_t::code_ac_l[k_ra8_jpeg_huff_max]

Luma AC Huffman codes.

Definition at line 79 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ code_dc_c

uint16_t ra8_jpeg_enc_ctx_t::code_dc_c[k_ra8_jpeg_huff_max]

Chroma DC Huffman codes.

Definition at line 81 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ code_dc_l

uint16_t ra8_jpeg_enc_ctx_t::code_dc_l[k_ra8_jpeg_huff_max]

Luma DC Huffman codes.

Definition at line 77 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ dc_pred

int32_t ra8_jpeg_enc_ctx_t::dc_pred[k_ra8_jpeg_max_comps]

Per-component DC predictors.

Definition at line 75 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_block().

◆ dst

uint8_t* ra8_jpeg_enc_ctx_t::dst

Destination JPEG byte buffer.

Definition at line 65 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_emit_u8(), and ra8_jpeg_sw_encode().

◆ overflow

bool ra8_jpeg_enc_ctx_t::overflow

Set on capacity exhaustion.

Definition at line 85 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_emit_u8(), and internal_enc_run().

◆ pos

uint32_t ra8_jpeg_enc_ctx_t::pos

Write cursor into dst.

Definition at line 67 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_emit_u8(), and ra8_jpeg_sw_encode().

◆ qc

uint8_t ra8_jpeg_enc_ctx_t::qc[k_ra8_jpeg_block_size]

Scaled chroma quant table.

Definition at line 73 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_emit_dqt(), internal_enc_encode_mcu_row(), and internal_enc_run().

◆ qy

uint8_t ra8_jpeg_enc_ctx_t::qy[k_ra8_jpeg_block_size]

Scaled luma quant table.

Definition at line 72 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_emit_dqt(), internal_enc_encode_mcu_row(), and internal_enc_run().

◆ size_ac_c

uint8_t ra8_jpeg_enc_ctx_t::size_ac_c[k_ra8_jpeg_huff_max]

Chroma AC code lengths.

Definition at line 84 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ size_ac_l

uint8_t ra8_jpeg_enc_ctx_t::size_ac_l[k_ra8_jpeg_huff_max]

Luma AC code lengths.

Definition at line 80 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ size_dc_c

uint8_t ra8_jpeg_enc_ctx_t::size_dc_c[k_ra8_jpeg_huff_max]

Chroma DC code lengths.

Definition at line 82 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().

◆ size_dc_l

uint8_t ra8_jpeg_enc_ctx_t::size_dc_l[k_ra8_jpeg_huff_max]

Luma DC code lengths.

Definition at line 78 of file ra8_jpeg_sw_encode_internal.h.

Referenced by internal_enc_encode_mcu_row(), and priv_jpeg_sw_enc_build_huff().


The documentation for this struct was generated from the following file: