ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
neon/halfblock.c
Go to the documentation of this file.
1#if SIMD_SUPPORT_NEON
2#define SIMD_CELL_NEON 1
3#define SIMD_CELL_ISA neon
4#include "../simd/pack.c"
6#include <libplatform/compiler.h>
7#include <libplatform/system.h>
8#include <libplatform/terminal.h>
11char *render_halfblocks_neon(const uint8_t *rgb, int width, int height, int stride, ascii_color_t mode) {
12 if (width <= 0 || height <= 0)
13 return platform_strdup("");
14 ascii_frame_t frame;
15 if (ascii_half_frame_init(&frame, rgb, width, height, &stride, mode) != ASCIICHAT_OK)
16 return NULL;
17 for (size_t y = 0; y < (size_t)height; y += 2) {
18 const uint8_t *top = rgb + y * (size_t)stride;
19 const uint8_t *bottom = y + 1 < (size_t)height ? top + stride : top;
20 simd_pack_neon(top, frame.packed, frame.width);
21 simd_pack_neon(bottom, frame.index, frame.width);
22 if (mode == ASCII_COLOR_TRUE) {
23 memcpy(frame.fg, frame.packed, frame.width * sizeof(uint32_t));
24 memcpy(frame.bg, frame.index, frame.width * sizeof(uint32_t));
25 } else if (mode != ASCII_COLOR_NONE) {
26 simd_quantize_neon(frame.packed, frame.fg, frame.width, mode == ASCII_COLOR_16 ? 16 : 256);
27 simd_quantize_neon(frame.index, frame.bg, frame.width, mode == ASCII_COLOR_16 ? 16 : 256);
28 }
29 simd_halfblock_neon(frame.packed, frame.index, frame.glyph, frame.fg, frame.bg, frame.width, (unsigned)mode, frame.table);
30 ascii_frame_emit_halfrow(&frame, mode, y + 2 < (size_t)height, &simd_cells_neon);
31 }
32 return ascii_frame_finish(&frame);
33}
34char *rgb_to_truecolor_halfblocks_neon(const uint8_t *rgb, int width, int height, int stride) {
36}
37char *rgb_to_256color_halfblocks_neon(const uint8_t *rgb, int width, int height, int stride, const char *palette) {
38 (void)palette;
40}
41char *rgb_to_16color_halfblocks_neon(const uint8_t *rgb, int width, int height, int stride, const char *palette) {
42 (void)palette;
44}
45char *rgb_to_halfblocks_neon(const uint8_t *rgb, int width, int height, int stride, const char *palette) {
46 (void)palette;
48}
49#endif
void simd_quantize_neon(const uint32_t *, uint32_t *, size_t, unsigned)
void simd_pack_neon(const uint8_t *, uint32_t *, size_t)
void simd_halfblock_neon(const uint32_t *, const uint32_t *, uint32_t *, uint32_t *, uint32_t *, size_t, unsigned, const uint32_t[5])
const simd_cells_t simd_cells_neon
unsigned int height
Definition fft.c:24
unsigned int width
Definition fft.c:24
unsigned int uint32_t
unsigned char uint8_t
@ ASCIICHAT_OK
Definition error_codes.h:50
char * render_halfblocks_neon(const uint8_t *, int, int, int, ascii_color_t)
#define ascii_frame_emit_halfrow
#define ascii_half_frame_init
#define ascii_frame_finish
NEON-optimized ASCII rendering functions.
char * platform_strdup(const char *s)
🔤 String Manipulation and Shell Escaping Utilities
When code needs to work with ascii frame, it keeps output, output_target, width, source_height here i...