libmpix
The open imaging DSP library
Loading...
Searching...
No Matches
image.h
1
7#ifndef MPIX_IMAGE_H
8#define MPIX_IMAGE_H
9
10#include <mpix/formats.h>
11#include <mpix/op.h>
12#include <mpix/op_kernel.h>
13#include <mpix/op_palettize.h>
14
18struct mpix_image {
20 struct {
25 } ops;
27 uint16_t width;
29 uint16_t height;
31 uint32_t format;
33 uint8_t *buffer;
35 size_t size;
37 int err;
38};
39
50void mpix_image_from_buf(struct mpix_image *img, uint8_t *buf, size_t size,
51 uint16_t width, uint16_t height, uint32_t format);
52
61int mpix_image_to_buf(struct mpix_image *img, uint8_t *buf, size_t size);
62
75int mpix_image_convert(struct mpix_image *img, uint32_t new_format);
76
90int mpix_image_palettize(struct mpix_image *img, struct mpix_palette *palette);
91
105int mpix_image_depalettize(struct mpix_image *img, struct mpix_palette *palette);
106
118int mpix_image_optimize_palette(struct mpix_image *img, struct mpix_palette *palette,
119 uint16_t num_samples);
120
133int mpix_image_debayer(struct mpix_image *img, uint32_t window_size);
134
147int mpix_image_qoi_encode(struct mpix_image *img, size_t max_sz);
148
159int mpix_image_resize(struct mpix_image *img, uint16_t width, uint16_t height);
160
171int mpix_image_kernel(struct mpix_image *img, uint32_t kernel_type, int kernel_sz);
172
179
186
204int mpix_image_append_op(struct mpix_image *img, const struct mpix_base_op *template,
205 size_t op_sz, size_t buf_sz, size_t threshold);
206
221int mpix_image_append_uncompressed_op(struct mpix_image *img, const struct mpix_base_op *op,
222 size_t op_sz);
223
235int mpix_image_process(struct mpix_image *img);
236
248int mpix_image_error(struct mpix_image *img, int err);
249
252#endif
int mpix_image_optimize_palette(struct mpix_image *img, struct mpix_palette *palette, uint16_t num_samples)
Update the color palette after an input image buffer.
int mpix_image_convert(struct mpix_image *img, uint32_t new_format)
Convert an image to a new pixel format.
int mpix_image_qoi_encode(struct mpix_image *img, size_t max_sz)
Convert an image from a bayer array format to RGB24.
int mpix_image_kernel(struct mpix_image *img, uint32_t kernel_type, int kernel_sz)
Apply a kernel operation on an image.
void mpix_image_print_truecolor(struct mpix_image *img)
Print an image using higher quality TRUECOLOR terminal escape codes.
int mpix_image_to_buf(struct mpix_image *img, uint8_t *buf, size_t size)
Initialize an image from a memory buffer.
int mpix_image_palettize(struct mpix_image *img, struct mpix_palette *palette)
Convert an image to an indexed color format.
int mpix_image_resize(struct mpix_image *img, uint16_t width, uint16_t height)
Resize an image.
void mpix_image_from_buf(struct mpix_image *img, uint8_t *buf, size_t size, uint16_t width, uint16_t height, uint32_t format)
Initialize an image from a memory buffer.
int mpix_image_depalettize(struct mpix_image *img, struct mpix_palette *palette)
Convert an image from an indexed color format.
int mpix_image_debayer(struct mpix_image *img, uint32_t window_size)
Convert an image from a bayer array format to RGB24.
void mpix_image_print_256color(struct mpix_image *img)
Print an image using higher speed 256COLOR terminal escape codes.
One step of a line operation pipeline.
Definition op.h:27
uint16_t threshold
Definition op.h:45
uint16_t window_size
Definition op.h:43
uint16_t width
Definition op.h:37
uint16_t height
Definition op.h:39
Represent the image currently being processed.
Definition image.h:18
uint8_t * buffer
Definition image.h:33
int err
Definition image.h:37
uint32_t format
Definition image.h:31
struct mpix_base_op * first
Definition image.h:22
uint16_t height
Definition image.h:29
struct mpix_image::@0 ops
size_t size
Definition image.h:35
uint16_t width
Definition image.h:27
struct mpix_base_op * last
Definition image.h:24
Color palette as a list of pixels in the described format.
Definition op_palettize.h:18