ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
common.h File Reference

Common SIMD utilities and structures. More...

Go to the source code of this file.

Data Structures

struct  utf8_char_t
 UTF-8 character structure. More...
 
struct  utf8_palette_cache_s
 UTF-8 palette cache structure. More...
 

Macros

#define RAMP64_SIZE   64
 Ramp64 cache size (64 entries)
 
Cache Eviction Algorithm Parameters
#define CACHE_FREQUENCY_DECAY_TIME   300.0
 Frequency bonus decay time (5 minutes in seconds)
 
#define CACHE_RECENCY_SCALE   60.0
 Recency importance scale (1 minute in seconds)
 
#define CACHE_RECENT_ACCESS_THRESHOLD   10
 Recent access protection threshold (10 seconds)
 
#define CACHE_MAX_LIFETIME   3600
 Maximum cache lifetime (1 hour in seconds)
 
#define CACHE_MIN_ACCESS_THRESHOLD   3
 Minimum accesses for frequency protection.
 

Typedefs

typedef struct utf8_palette_cache_s utf8_palette_cache_t
 UTF-8 palette cache structure.
 

Functions

void build_ramp64 (uint8_t ramp64[64], const char *ascii_chars)
 Build 64-entry character ramp cache.
 
double calculate_cache_eviction_score (uint64_t last_access_time, uint32_t access_count, uint64_t creation_time, uint64_t current_time)
 Calculate cache eviction score.
 
uint64_t get_current_time_ns (void)
 Get current time in nanoseconds.
 
utf8_palette_cache_tget_utf8_palette_cache (const char *ascii_chars)
 Get or create UTF-8 palette cache.
 
void build_utf8_luminance_cache (const char *ascii_chars, utf8_char_t cache[256])
 Build UTF-8 luminance cache.
 
void build_utf8_ramp64_cache (const char *ascii_chars, utf8_char_t cache64[64], uint8_t char_index_ramp[64])
 Build UTF-8 ramp64 cache.
 
void simd_caches_destroy_all (void)
 Destroy all SIMD caches.
 
bool has_sse2_support (void)
 Check if SSE2 is supported.
 
bool has_ssse3_support (void)
 Check if SSSE3 is supported.
 
bool has_avx2_support (void)
 Check if AVX2 is supported.
 
bool has_neon_support (void)
 Check if NEON is supported.
 
bool has_sve_support (void)
 Check if SVE is supported.
 
char * append_sgr_truecolor_fg (char *dst, uint8_t r, uint8_t g, uint8_t b)
 Append truecolor foreground SGR sequence.
 
char * append_sgr_truecolor_bg (char *dst, uint8_t r, uint8_t g, uint8_t b)
 Append truecolor background SGR sequence.
 
char * append_sgr_truecolor_fg_bg (char *dst, uint8_t fr, uint8_t fg, uint8_t fb, uint8_t br, uint8_t bg, uint8_t bb)
 Append truecolor foreground and background SGR sequence.
 
char * append_sgr_reset (char *dst)
 Append ANSI reset sequence.
 
size_t write_rgb_triplet (uint8_t value, char *dst)
 Write decimal RGB triplet using dec3 cache.
 

Detailed Description

Common SIMD utilities and structures.

Definition in file video/simd/common.h.