|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
🖨️ Image processing: format detection, decoding, scaling, and pixel format conversion More...
Go to the source code of this file.
Functions | |
| image_t * | image_new (size_t width, size_t height) |
| void | image_destroy (image_t *p) |
| image_t * | image_new_from_pool (size_t width, size_t height) |
| void | image_destroy_to_pool (image_t *image) |
| void | image_clear (image_t *p) |
| image_t * | image_new_copy (const image_t *source) |
| rgb_pixel_t * | image_pixel (image_t *p, const int x, const int y) |
| void | image_resize (const image_t *s, image_t *d) |
| void | image_resize_interpolation (const image_t *source, image_t *dest) |
| void | precalc_rgb_palettes (const float red, const float green, const float blue) |
| char * | image_print (const image_t *p, const char *palette) |
| void | quantize_color (int *r, int *g, int *b, int levels) |
| char * | image_print_color (const image_t *p, const char *palette) |
| char * | rgb_to_ansi_fg (int r, int g, int b) |
| char * | rgb_to_ansi_bg (int r, int g, int b) |
| void | rgb_to_ansi_8bit (int r, int g, int b, int *fg_code, int *bg_code) |
| char * | image_print_with_capabilities (const image_t *image, const terminal_capabilities_t *caps, const char *palette) |
| char * | image_print_256color (const image_t *image, const char *palette) |
| char * | image_print_16color (const image_t *image, const char *palette) |
| char * | image_print_16color_dithered (const image_t *image, const char *palette) |
| char * | image_print_16color_dithered_with_background (const image_t *image, bool use_background, const char *palette) |
🖨️ Image processing: format detection, decoding, scaling, and pixel format conversion
Definition in file video/image.c.
| void image_clear | ( | image_t * | p | ) |
Definition at line 203 of file video/image.c.
Referenced by ascii_convert(), and ascii_convert_with_capabilities().
| void image_destroy | ( | image_t * | p | ) |
Definition at line 85 of file video/image.c.
References buffer_pool_free().
Referenced by ascii_convert(), ascii_convert_with_capabilities(), benchmark_simd_color_conversion(), benchmark_simd_color_conversion_with_source(), benchmark_simd_conversion(), benchmark_simd_conversion_with_source(), create_mixed_ascii_frame_for_client(), ffmpeg_decoder_destroy(), session_display_convert_to_ascii(), session_host_add_client(), session_host_add_memory_participant(), session_host_destroy(), session_host_inject_frame(), session_host_remove_client(), and webcam_destroy().
| void image_destroy_to_pool | ( | image_t * | image | ) |
Definition at line 171 of file video/image.c.
References buffer_pool_free().
Referenced by create_mixed_ascii_frame_for_client().
| image_t * image_new | ( | size_t | width, |
| size_t | height | ||
| ) |
Definition at line 36 of file video/image.c.
References image_validate_dimensions().
Referenced by ascii_convert(), ascii_convert_with_capabilities(), benchmark_simd_color_conversion(), benchmark_simd_color_conversion_with_source(), benchmark_simd_conversion(), benchmark_simd_conversion_with_source(), ffmpeg_decoder_create(), image_new_copy(), session_capture_process_for_transmission(), session_display_convert_to_ascii(), session_host_add_client(), session_host_add_memory_participant(), session_host_inject_frame(), and webcam_read().
| image_t * image_new_copy | ( | const image_t * | source | ) |
Definition at line 224 of file video/image.c.
References image_new().
Referenced by create_mixed_ascii_frame_for_client().
| image_t * image_new_from_pool | ( | size_t | width, |
| size_t | height | ||
| ) |
Definition at line 126 of file video/image.c.
References buffer_pool_alloc().
|
inline |
Definition at line 246 of file video/image.c.
| char * image_print | ( | const image_t * | p, |
| const char * | palette | ||
| ) |
Definition at line 395 of file video/image.c.
References emit_rep(), get_utf8_palette_cache(), ob_putc(), ob_term(), ob_write(), and rep_is_profitable().
Referenced by ascii_convert(), benchmark_simd_conversion(), image_print_simd(), and image_print_with_capabilities().
| char * image_print_16color | ( | const image_t * | image, |
| const char * | palette | ||
| ) |
Definition at line 862 of file video/image.c.
References ansi_fast_init_16color(), append_16color_fg(), buffer_size, get_utf8_palette_cache(), and rgb_to_16color().
| char * image_print_16color_dithered | ( | const image_t * | image, |
| const char * | palette | ||
| ) |
Definition at line 956 of file video/image.c.
References ansi_fast_init_16color(), append_16color_fg(), buffer_size, get_utf8_palette_cache(), and rgb_to_16color_dithered().
| char * image_print_16color_dithered_with_background | ( | const image_t * | image, |
| bool | use_background, | ||
| const char * | palette | ||
| ) |
Definition at line 1059 of file video/image.c.
References ansi_fast_init_16color(), append_16color_bg(), append_16color_fg(), buffer_size, get_16color_rgb(), get_utf8_palette_cache(), and rgb_to_16color_dithered().
Referenced by image_print_with_capabilities().
| char * image_print_256color | ( | const image_t * | image, |
| const char * | palette | ||
| ) |
Definition at line 845 of file video/image.c.
References image_print_color(), and image_print_color_simd().
Referenced by image_print_with_capabilities().
| char * image_print_color | ( | const image_t * | p, |
| const char * | palette | ||
| ) |
Converts an image to colored ASCII art with ANSI escape codes.
This function generates a string representation of an image where each pixel is converted to an ASCII character with ANSI color codes. The character is chosen based on luminance, and colors are applied using 24-bit RGB ANSI escape sequences.
Buffer allocation is precisely calculated to avoid waste and prevent overflows:
Color modes:
ANSI escape code format:
| p | Pointer to image_t structure containing pixel data |
Definition at line 559 of file video/image.c.
References ansi_rle_add_pixel(), ansi_rle_finish(), ansi_rle_init(), get_utf8_palette_cache(), and safe_snprintf().
Referenced by ascii_convert(), benchmark_simd_color_conversion(), benchmark_simd_conversion_with_source(), image_print_256color(), image_print_color_simd(), and image_print_with_capabilities().
| char * image_print_with_capabilities | ( | const image_t * | image, |
| const terminal_capabilities_t * | caps, | ||
| const char * | palette | ||
| ) |
Definition at line 758 of file video/image.c.
References image_print(), image_print_16color_dithered_with_background(), image_print_256color(), image_print_color(), image_print_color_simd(), and image_print_simd().
Referenced by ascii_convert_with_capabilities().
| void image_resize | ( | const image_t * | s, |
| image_t * | d | ||
| ) |
Definition at line 254 of file video/image.c.
References image_resize_interpolation().
Referenced by ascii_convert(), ascii_convert_with_capabilities(), and session_capture_process_for_transmission().
| void image_resize_interpolation | ( | const image_t * | source, |
| image_t * | dest | ||
| ) |
Definition at line 265 of file video/image.c.
Referenced by image_resize().
| void precalc_rgb_palettes | ( | const float | red, |
| const float | green, | ||
| const float | blue | ||
| ) |
Definition at line 330 of file video/image.c.
References BLUE, GRAY, GREEN, and RED.
Referenced by server_main().
| void quantize_color | ( | int * | r, |
| int * | g, | ||
| int * | b, | ||
| int | levels | ||
| ) |
Definition at line 508 of file video/image.c.
| void rgb_to_ansi_8bit | ( | int | r, |
| int | g, | ||
| int | b, | ||
| int * | fg_code, | ||
| int * | bg_code | ||
| ) |
Definition at line 731 of file video/image.c.
| char * rgb_to_ansi_bg | ( | int | r, |
| int | g, | ||
| int | b | ||
| ) |
Definition at line 725 of file video/image.c.
| char * rgb_to_ansi_fg | ( | int | r, |
| int | g, | ||
| int | b | ||
| ) |
Definition at line 719 of file video/image.c.