Implementing new palettization operations.
More...
|
#define | MPIX_REGISTER_PALETTE_OP(id, fn, format_in, format_out) |
| Define a new palettization operation: from a pixel format to indexed colors.
|
|
#define | MPIX_REGISTER_QOI_PALETTE_OP(id, op, fmt_src, fmt_dst) |
| Define a new palettization operation: from a pixel format to indexed colors.
|
|
#define | MPIX_REGISTER_QOI_CONVERT_OP(id, op, fmt_src, fmt_dst) |
| Define a new palettization operation: from a pixel format to indexed colors.
|
|
|
void | mpix_convert_rgb24_to_palette8 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from RGB24 to PALETTE8.
|
|
void | mpix_convert_palette8_to_rgb24 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from PALETTE8 to RGB24.
|
|
void | mpix_convert_rgb24_to_palette4 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from RGB24 to PALETTE4.
|
|
void | mpix_convert_palette4_to_rgb24 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from PALETTE4 to RGB24.
|
|
void | mpix_convert_rgb24_to_palette2 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from RGB24 to PALETTE2.
|
|
void | mpix_convert_palette2_to_rgb24 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from PALETTE2 to RGB24.
|
|
void | mpix_convert_rgb24_to_palette1 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from RGB24 to PALETTE1.
|
|
void | mpix_convert_palette1_to_rgb24 (const uint8_t *src, uint8_t *dst, uint16_t width, const struct mpix_palette *palette) |
| Convert a line of pixel data from PALETTE1 to RGB24.
|
|
void | mpix_palettize_op (struct mpix_base_op *op) |
| Helper to turn a line palettization function into an operation.
|
|
int | mpix_image_qoi_depalettize (struct mpix_image *img, size_t max_sz, struct mpix_palette *plt) |
|
int | mpix_image_qoi_encode (struct mpix_image *img, size_t max_sz) |
|
Implementing new palettization operations.
SPDX-License-Identifier: Apache-2.0
◆ MPIX_REGISTER_PALETTE_OP
#define MPIX_REGISTER_PALETTE_OP |
( |
|
id, |
|
|
|
fn, |
|
|
|
format_in, |
|
|
|
format_out |
|
) |
| |
Value:
.base.format_dst = (MPIX_FMT_##format_out), \
.palette_fn = (fn), \
}
void mpix_palettize_op(struct mpix_base_op *op)
Helper to turn a line palettization function into an operation.
uint32_t format_src
Definition op.h:33
uint16_t window_size
Definition op.h:43
const uint8_t * name
Definition op.h:31
Definition op_palettize.h:26
struct mpix_base_op base
Definition op_palettize.h:28
Define a new palettization operation: from a pixel format to indexed colors.
- Parameters
-
id | Short identifier to differentiate operations of the same category. |
fn | Function converting one input line. |
format_in | The input format for that operation. |
format_out | The Output format for that operation. |
◆ MPIX_REGISTER_QOI_CONVERT_OP
#define MPIX_REGISTER_QOI_CONVERT_OP |
( |
|
id, |
|
|
|
op, |
|
|
|
fmt_src, |
|
|
|
fmt_dst |
|
) |
| |
Value:
.base.format_dst = (MPIX_FMT_##fmt_dst), \
.base.run = (op), \
}
struct mpix_base_op base
Definition op_qoi.h:18
Define a new palettization operation: from a pixel format to indexed colors.
- Parameters
-
id | Short identifier to differentiate operations of the same category. |
fn | Function converting one input line. |
format_in | The input format for that operation. |
format_out | The Output format for that operation. |
◆ MPIX_REGISTER_QOI_PALETTE_OP
#define MPIX_REGISTER_QOI_PALETTE_OP |
( |
|
id, |
|
|
|
op, |
|
|
|
fmt_src, |
|
|
|
fmt_dst |
|
) |
| |
Value:
.base.format_dst = (MPIX_FMT_##fmt_dst), \
.base.run = op, \
}
struct mpix_base_op base
Definition op_qoi.h:24
Define a new palettization operation: from a pixel format to indexed colors.
- Parameters
-
id | Short identifier to differentiate operations of the same category. |
fn | Function converting one input line. |
format_in | The input format for that operation. |
format_out | The Output format for that operation. |
◆ mpix_convert_palette1_to_rgb24()
void mpix_convert_palette1_to_rgb24 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from PALETTE1 to RGB24.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_palette2_to_rgb24()
void mpix_convert_palette2_to_rgb24 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from PALETTE2 to RGB24.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_palette4_to_rgb24()
void mpix_convert_palette4_to_rgb24 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from PALETTE4 to RGB24.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_palette8_to_rgb24()
void mpix_convert_palette8_to_rgb24 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from PALETTE8 to RGB24.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_rgb24_to_palette1()
void mpix_convert_rgb24_to_palette1 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from RGB24 to PALETTE1.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_rgb24_to_palette2()
void mpix_convert_rgb24_to_palette2 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from RGB24 to PALETTE2.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_rgb24_to_palette4()
void mpix_convert_rgb24_to_palette4 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from RGB24 to PALETTE4.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_convert_rgb24_to_palette8()
void mpix_convert_rgb24_to_palette8 |
( |
const uint8_t * |
src, |
|
|
uint8_t * |
dst, |
|
|
uint16_t |
width, |
|
|
const struct mpix_palette * |
palette |
|
) |
| |
Convert a line of pixel data from RGB24 to PALETTE8.
You only need to call this function to work directly on raw buffers. See mpix_image_palettize for a more convenient high-level API.
- Parameters
-
src | Buffer of the input line, with the format XXX in mpix_palettize_XXX_to_YYY() . |
dst | Buffer of the output line, with the format YYY in mpix_palettize_XXX_to_YYY() . |
width | Width of the lines in number of pixels. |
palette | Color palette to use for the conversion. |
◆ mpix_image_qoi_depalettize()
◆ mpix_image_qoi_encode()
int mpix_image_qoi_encode |
( |
struct mpix_image * |
img, |
|
|
size_t |
max_sz |
|
) |
| |
◆ mpix_palettize_op()
Helper to turn a line palettization function into an operation.
The line conversion function is to be provided in op->arg
. It processes on the input line to convert it to the destination format.
The palette is to be provided in op->arg1
.
- Parameters
-
op | Current operation in progress. |