ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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
10
19
36
45
48 uint64_t configuration);
54 uint64_t candidate_error, uint64_t previous_error, uint32_t color, uint64_t elapsed_ns,
55 uint32_t *stabilized_color);
56char *ascii_render(const image_t *image, const char *palette, ascii_color_t color, bool background, bool dither,
57 const simd_cells_t *ops);
58
59bool ascii_glyph_palette_supported(const char *palette);
60char *ascii_render_glyph_match(const image_t *image, ascii_color_t color, const simd_cells_t *ops, const char *palette);
61char *ascii_render_glyph_match_mode(const image_t *image, ascii_color_t color, const simd_cells_t *ops,
62 const char *palette, bool background);
63
65char *ascii_render_halfblocks(const uint8_t *rgb, int width, int height, int stride_bytes, ascii_color_t color,
66 const simd_cells_t *ops);
67
72typedef struct {
80 size_t row;
83 // A terminal row normally fits on the stack; unusually wide images retain
84 // the heap fallback. Each invocation owns its scratch, including reentry.
87asciichat_error_t ascii_frame_init(ascii_frame_t *frame, const image_t *image, const char *palette);
88void ascii_frame_emit_row(ascii_frame_t *frame, ascii_color_t mode, bool background, bool more_rows,
89 const simd_cells_t *ops);
91#define DECLARE_ASCII_PROCESSOR(isa) char *render_ascii_cells_##isa(const image_t *, const char *, ascii_color_t, bool)
97#undef DECLARE_ASCII_PROCESSOR
98
99asciichat_error_t ascii_half_frame_init(ascii_frame_t *frame, const uint8_t *rgb, int width, int height, int *stride,
100 ascii_color_t mode);
101void ascii_frame_emit_halfrow(ascii_frame_t *frame, ascii_color_t mode, bool more_rows, const simd_cells_t *ops);
102#define DECLARE_HALF_PROCESSOR(isa) char *render_halfblocks_##isa(const uint8_t *, int, int, int, ascii_color_t)
108#undef DECLARE_HALF_PROCESSOR
109
unsigned int height
Definition fft.c:23
unsigned int width
Definition fft.c:23
unsigned int uint32_t
Definition common.h:62
unsigned long long uint64_t
Definition common.h:63
unsigned char uint8_t
Definition common.h:60
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
char * ascii_render_glyph_match_mode(const image_t *image, ascii_color_t color, const simd_cells_t *ops, const char *palette, bool background)
char * ascii_frame_finish(ascii_frame_t *frame)
#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)
asciichat_error_t ascii_stabilizer_prepare(ascii_stabilizer_t *state, size_t width, size_t height, uint64_t configuration)
void ascii_frame_emit_row(ascii_frame_t *frame, ascii_color_t mode, bool background, bool more_rows, const simd_cells_t *ops)
asciichat_error_t ascii_half_frame_init(ascii_frame_t *frame, const uint8_t *rgb, int width, int height, int *stride, ascii_color_t mode)
uint32_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, uint32_t *stabilized_color)
#define DECLARE_ASCII_PROCESSOR(isa)
ascii_stabilizer_t * ascii_stabilizer_set_target(ascii_stabilizer_t *state)
asciichat_error_t ascii_frame_init(ascii_frame_t *frame, const image_t *image, const char *palette)
#define ASCII_INLINE_SCRATCH_COLUMNS
bool ascii_glyph_palette_supported(const char *palette)
outbuf_t * ascii_render_set_output_target(outbuf_t *target)
void ascii_frame_emit_halfrow(ascii_frame_t *frame, ascii_color_t mode, bool more_rows, const simd_cells_t *ops)
char * ascii_render_halfblocks(const uint8_t *rgb, int width, int height, int stride_bytes, ascii_color_t color, const simd_cells_t *ops)
void ascii_stabilizer_reset(ascii_stabilizer_t *state)
char * ascii_render(const image_t *image, const char *palette, ascii_color_t color, bool background, bool dither, const simd_cells_t *ops)
When code needs to work with ascii frame, it keeps output, output_target, width, source_height here i...
_Alignas(64) uint32_t inline_scratch[512 *6]
For ascii stabilizer, this is the live record that ties cells, width, height, configuration together....
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:10