ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/video/ascii/render.h
Go to the documentation of this file.
1#pragma once
2
3/* Existing buffer budgets in bytes, including NUL for text storage. */
4#define ASCII_INLINE_SCRATCH_COLUMNS 512
5#define ASCII_SCRATCH_PLANES 6
6
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
22uint32_t ascii_stabilizer_choose(ascii_temporal_cell_t *cell, const uint8_t samples[16], uint32_t candidate, uint64_t candidate_error, uint64_t previous_error, uint32_t color, uint64_t elapsed_ns,
23 uint32_t *stabilized_color);
24char *ascii_render(const image_t *image, const char *palette, ascii_color_t color, bool background, bool dither, const simd_cells_t *ops);
25
26bool ascii_glyph_palette_supported(const char *palette);
27char *ascii_render_glyph_match(const image_t *image, ascii_color_t color, const simd_cells_t *ops, const char *palette);
28char *ascii_render_glyph_match_mode(const image_t *image, ascii_color_t color, const simd_cells_t *ops, const char *palette, bool background);
29
31char *ascii_render_halfblocks(const uint8_t *rgb, int width, int height, int stride_bytes, ascii_color_t color, const simd_cells_t *ops);
32
33#ifndef ASCII_FRAME_DECLARED
34#define ASCII_FRAME_DECLARED
41typedef struct {
49 size_t row;
52 // A terminal row normally fits on the stack; unusually wide images retain
53 // the heap fallback. Each invocation owns its scratch, including reentry.
54 // SIMD consumers load this storage with unaligned-safe operations.
57asciichat_error_t ascii_frame_init(ascii_frame_t *frame, const image_t *image, const char *palette);
58void ascii_frame_emit_row(ascii_frame_t *frame, ascii_color_t mode, bool background, bool more_rows, const simd_cells_t *ops);
60#define DECLARE_ASCII_PROCESSOR(isa) char *render_ascii_cells_##isa(const image_t *, const char *, ascii_color_t, bool)
66#undef DECLARE_ASCII_PROCESSOR
67
68asciichat_error_t ascii_half_frame_init(ascii_frame_t *frame, const uint8_t *rgb, int width, int height, int *stride, ascii_color_t mode);
69void ascii_frame_emit_halfrow(ascii_frame_t *frame, ascii_color_t mode, bool more_rows, const simd_cells_t *ops);
70#define DECLARE_HALF_PROCESSOR(isa) char *render_halfblocks_##isa(const uint8_t *, int, int, int, ascii_color_t)
76#undef DECLARE_HALF_PROCESSOR
77
82#endif
83
84#ifdef __cplusplus
85}
86#endif
unsigned int height
Definition fft.c:24
unsigned int width
Definition fft.c:24
unsigned int uint32_t
unsigned long long uint64_t
unsigned char uint8_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
char * ascii_render_glyph_match_mode(const image_t *image, ascii_color_t color, const simd_cells_t *ops, const char *palette, bool background)
#define DECLARE_HALF_PROCESSOR(isa)
char * ascii_render_glyph_match(const image_t *image, ascii_color_t color, const simd_cells_t *ops, const char *palette)
#define DECLARE_ASCII_PROCESSOR(isa)
bool ascii_glyph_palette_supported(const char *palette)
#define ascii_frame_emit_halfrow
#define ascii_render_set_output_target
#define ascii_stabilizer_prepare
#define ascii_stabilizer_reset
#define ascii_frame_init
#define ascii_stabilizer_choose
#define ascii_half_frame_init
#define ascii_stabilizer_set_target
#define ascii_frame_emit_row
#define ascii_render
#define ascii_render_halfblocks
#define ascii_frame_finish
When code needs to work with ascii frame, it keeps output, output_target, width, source_height here i...
SIMD-friendly storage for one RGB pixel. r, g, and b hold the color channels and padding keeps the la...
Dynamic output buffer (auto-expanding).
The useful part of simd cells is in luminance: together they describe what is pending,...
Definition cells.h:14