ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
include/ascii-chat/video/ascii/render/common.h
Go to the documentation of this file.
1#pragma once
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7#define ASCII_INLINE_SCRATCH_COLUMNS 512
8#define ASCII_SCRATCH_PLANES 6
9
10#ifndef ASCII_FRAME_DECLARED
11#define ASCII_FRAME_DECLARED
13typedef struct {
14 outbuf_t output;
15 outbuf_t *output_target;
16 size_t width, source_height;
17 uint32_t table[64];
18 uint32_t *scratch, *packed, *index, *glyph, *fg, *bg;
19 uint8_t *luma;
20 ascii_stabilizer_t *stabilizer;
21 size_t row;
22 bool temporal_preselected;
23 bool dithered;
24 // A terminal row normally fits on the stack; unusually wide images retain
25 // the heap fallback. Each invocation owns its scratch, including reentry.
28asciichat_error_t ascii_frame_init(ascii_frame_t *frame, const image_t *image, const char *palette);
29void ascii_frame_emit_row(ascii_frame_t *frame, ascii_color_t mode, bool background, bool more_rows, const simd_cells_t *ops);
31#define DECLARE_ASCII_PROCESSOR(isa) char *render_ascii_cells_##isa(const image_t *, const char *, ascii_color_t, bool)
37#undef DECLARE_ASCII_PROCESSOR
38
39asciichat_error_t ascii_half_frame_init(ascii_frame_t *frame, const uint8_t *rgb, int width, int height, int *stride, ascii_color_t mode);
40void ascii_frame_emit_halfrow(ascii_frame_t *frame, ascii_color_t mode, bool more_rows, const simd_cells_t *ops);
41#define DECLARE_HALF_PROCESSOR(isa) char *render_halfblocks_##isa(const uint8_t *, int, int, int, ascii_color_t)
47#undef DECLARE_HALF_PROCESSOR
48
49void ascii_emit_prepared_row(outbuf_t *out, ascii_color_t mode, const simd_cells_t *ops, const uint32_t *glyph, const uint32_t *fg, const uint32_t *bg, size_t width);
51
52void ascii_stabilizer_frame_row(ascii_frame_t *frame, ascii_color_t mode, bool background, const simd_cells_t *ops);
54#endif
55
56#ifdef __cplusplus
57}
58#endif
unsigned int height
Definition fft.c:24
unsigned int width
Definition fft.c:24
unsigned int uint32_t
unsigned char uint8_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
uint32_t ascii_background_contrast(ascii_color_t mode, uint32_t color, uint8_t luma)
char * ascii_frame_finish(ascii_frame_t *frame)
void ascii_frame_emit_row(ascii_frame_t *frame, ascii_color_t mode, bool background, bool more_rows, const simd_cells_t *ops)
void ascii_emit_prepared_row(outbuf_t *out, ascii_color_t mode, const simd_cells_t *ops, const uint32_t *glyph, const uint32_t *fg, const uint32_t *bg, size_t width)
asciichat_error_t ascii_frame_init(ascii_frame_t *frame, const image_t *image, const char *palette)
void ascii_stabilizer_halfrow(ascii_frame_t *frame, ascii_color_t mode, const simd_cells_t *ops)
Definition stabilize.c:175
void ascii_stabilizer_frame_row(ascii_frame_t *frame, ascii_color_t mode, bool background, const simd_cells_t *ops)
Definition stabilize.c:123
#define ascii_frame_emit_halfrow
#define ascii_half_frame_init
static bool size_t index
Definition queries.h:8
static bool size_t gotel_query_t * out
Definition queries.h:8
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]
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