core/image/jpeg
jpeg
Types
9Block
Block :: [Component][COEFFICIENT_COUNT]i16Source8x8 block of pixels
Coefficient
Coefficient :: enum u8 {
DC = 0,
AC = 1,
}SourceColor_Component
Color_Component :: struct {
dc_table_idx: u8,
ac_table_idx: u8,
quantization_table_idx: u8,
v_sampling_factor: int,
h_sampling_factor: int,
}SourceComponent
Component :: enum u8 {
Y = 1,
Cb = 2,
Cr = 3,
}SourceError
Error :: ErrorSourceHuffman_Table
Huffman_Table :: struct {
symbols: [176]u8,
codes: [176]u32,
offsets: [17]u8,
}SourceImage
Image :: ImageSourceOptions
Options :: OptionsSourceQuantization_Table
Quantization_Table :: [COEFFICIENT_COUNT]u16beSourceConstants
6BLOCK_SIZE
BLOCK_SIZE :: 8SourceCOEFFICIENT_COUNT
COEFFICIENT_COUNT :: BLOCK_SIZE * BLOCK_SIZESourceHUFFMAN_MAX_BITS
HUFFMAN_MAX_BITS :: 16SourceHUFFMAN_MAX_SYMBOLS
HUFFMAN_MAX_SYMBOLS :: 176SourceSEGMENT_MAX_SIZE
SEGMENT_MAX_SIZE :: 65533SourceTHUMBNAIL_PALETTE_SIZE
THUMBNAIL_PALETTE_SIZE :: 768Source768 bytes of 24-bit RGB values.
Procedures
4destroy
destroy :: proc(img: ^Image)Sourceload_from_bytes
load_from_bytes :: proc(data: []u8, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (img: ^Image, err: Error)Sourceload_from_context
load_from_context :: proc(ctx: ^C, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (img: ^Image, err: Error)Sourceload_from_file
load_from_file :: proc(filename: string, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (img: ^Image, err: Error)Source