10#include <mpix/custom_api.h>
11#include <mpix/formats.h>
12#include <mpix/operation.h>
13#include <mpix/pipeline.h>
14#include <mpix/sample.h>
15#include <mpix/stats.h>
16#include <mpix/types.h>
49 mpix_ring_set_buffer(&img->
last_op->
ring, buffer, size);
68 int32_t p[] = { (int32_t)new_format };
85 int32_t p[] = { (int32_t)fourcc };
136 enum mpix_op_type type = (window_size == 1) ? MPIX_OP_DEBAYER_1X1 :
137 (window_size == 2) ? MPIX_OP_DEBAYER_2X2 :
138 (window_size == 3) ? MPIX_OP_DEBAYER_3X3 : MPIX_NB_OP;
233 uint16_t width, uint16_t height)
235 int32_t p[] = { width, height };
253 uint16_t crop_width, uint16_t crop_height)
255 int32_t p[] = { x_offset, y_offset, crop_width, crop_height };
269 enum mpix_op_type type = (level == 3) ? MPIX_OP_KERNEL_CONVOLVE_3X3 :
270 (level == 5) ? MPIX_OP_KERNEL_CONVOLVE_5X5 : MPIX_NB_OP;
282 enum mpix_op_type type = (level == 3) ? MPIX_OP_KERNEL_DENOISE_3X3 :
283 (level == 5) ? MPIX_OP_KERNEL_DENOISE_5X5 : MPIX_NB_OP;
297 enum mpix_op_type type = (level == 3) ? MPIX_OP_KERNEL_CONVOLVE_3X3 :
298 (level == 5) ? MPIX_OP_KERNEL_CONVOLVE_5X5 : MPIX_NB_OP;
312 enum mpix_op_type type = (level == 3) ? MPIX_OP_KERNEL_CONVOLVE_3X3 :
313 (level == 5) ? MPIX_OP_KERNEL_CONVOLVE_5X5 : MPIX_NB_OP;
361 uint16_t num_samples);
444 if (img->
ctrls[cid] == NULL)
return -ENOENT;
445 img->
ctrls[cid][0] = value;
461 int32_t *array,
size_t size)
464 for (
size_t i = 0; i < size; i++) {
465 if (img->
ctrls[cid + i] == NULL)
return -ENOENT;
466 *img->
ctrls[cid + i] = array[i];
483 if (img->
last_op == NULL)
return -EINVAL;
484 mpix_op_input_all(img->
last_op, buf, size);
485 return (*size == 0) ? -ENODATA : 0;
static void mpix_image_from_buf(struct mpix_image *img, const uint8_t *buffer, size_t size, const struct mpix_format *fmt)
Initialize an image from a memory buffer.
Definition image.h:30
static int mpix_image_edge_detect(struct mpix_image *img, uint8_t level)
Apply an edge detection operation to an image.
Definition image.h:294
int mpix_image_optimize_palette(struct mpix_image *img, struct mpix_palette *palette, uint16_t num_samples)
Optimize a color palette after the values from the image.
static int mpix_image_resize_subsample(struct mpix_image *img, uint16_t width, uint16_t height)
Resize an image.
Definition image.h:232
static int mpix_image_palette_encode(struct mpix_image *img, uint32_t fourcc)
Convert an image to an indexed color format.
Definition image.h:83
static int mpix_image_debayer(struct mpix_image *img, uint32_t window_size)
Convert an image from a bayer array format to RGB24.
Definition image.h:134
static int mpix_image_ctrl_array(struct mpix_image *img, enum mpix_control_id cid, int32_t *array, size_t size)
Set a control to a pipeline.
Definition image.h:460
static struct mpix_format * mpix_image_format(struct mpix_image *img)
Get the input format of an image, matching the inage input buffer.
Definition image.h:386
static int mpix_image_gaussian_blur(struct mpix_image *img, uint8_t level)
Apply a gaussian blur operation to an image.
Definition image.h:309
static int mpix_image_crop(struct mpix_image *img, uint16_t x_offset, uint16_t y_offset, uint16_t crop_width, uint16_t crop_height)
Crop an image to a smaller region.
Definition image.h:252
static int mpix_image_qoi_encode(struct mpix_image *img)
Encode an image to the QOI compressed image format.
Definition image.h:204
static void mpix_image_free(struct mpix_image *img)
Free the resources of an image.
Definition image.h:373
static int mpix_image_read_output(struct mpix_image *img, const uint8_t **buf, size_t *size)
Return the output buffer and its size, resetting it to zero.
Definition image.h:481
static int mpix_image_convert(struct mpix_image *img, uint32_t new_format)
Convert an image to a new pixel format.
Definition image.h:66
static int mpix_image_correct_black_level(struct mpix_image *img)
Apply Black Level Correction (BLC) to the image.
Definition image.h:179
static int mpix_image_ctrl_value(struct mpix_image *img, enum mpix_control_id cid, int32_t value)
Set a control to a pipeline.
Definition image.h:440
static int mpix_image_palette_decode(struct mpix_image *img)
Convert an image from an indexed color format.
Definition image.h:98
static int mpix_image_set_palette(struct mpix_image *img, struct mpix_palette *palette)
Set the palette of every operation currently in the pipeline.
Definition image.h:116
static int mpix_image_jpeg_encode(struct mpix_image *img)
Compressed an image to the JPEG format.
Definition image.h:215
static void mpix_image_from_palette(struct mpix_image *img, const struct mpix_palette *palette)
Initialize an image from a palette.
Definition image.h:326
static int mpix_image_to_buf(struct mpix_image *img, uint8_t *buffer, size_t size)
Convert an image and store it into the output buffer.
Definition image.h:46
static int mpix_image_sample_random_rgb(struct mpix_image *img, uint8_t rgb[3])
Collect a random RGB pixel from an image.
Definition image.h:408
static int mpix_image_correct_color_matrix(struct mpix_image *img)
Apply Color Correction Matrix (CCM) to the image.
Definition image.h:151
static int mpix_image_correct_white_balance(struct mpix_image *img)
Apply White Balance Correction (AWB) to the image.
Definition image.h:165
static int mpix_image_correct_gamma(struct mpix_image *img)
Apply Gamma Correction (GC) to the image.
Definition image.h:193
static void mpix_image_stats(struct mpix_image *img, struct mpix_stats *stats)
Collect statistics from an image.
Definition image.h:424
static int mpix_image_sharpen(struct mpix_image *img, uint8_t level)
Apply a sharpen operation to an image.
Definition image.h:266
static int mpix_image_to_palette(struct mpix_image *img, struct mpix_palette *palette)
Convert an image and store it into a color palette.
Definition image.h:342
static int mpix_image_denoise(struct mpix_image *img, uint8_t level)
Apply a denoise operation to an image.
Definition image.h:280
static void * mpix_op_append(struct mpix_image *img, enum mpix_op_type op_type, size_t op_sz, size_t buf_sz)
Allocate a new operation and add it to an image pipeline.
Definition operation.h:188
int mpix_pipeline_process(struct mpix_base_op *op, const uint8_t *buffer, size_t size)
Process a buffer into a pipeline.
void mpix_pipeline_free(struct mpix_base_op *first_op)
Free the intermediate memory as well as operations of a pipeline.
int mpix_pipeline_add(struct mpix_image *img, enum mpix_op_type type, const int32_t *params, size_t params_nb)
Add an operation to an image.
int mpix_pipeline_set_palette(struct mpix_base_op *first_op, struct mpix_palette *palette)
Set an image palette for every palette-related elements of the pipeline.
int mpix_sample_random_rgb(const uint8_t *buf, const struct mpix_format *fmt, uint8_t *dst)
Collect a pixel at a random location from the input buffer in RGB24 format.
void mpix_stats_from_buf(struct mpix_stats *stats, const uint8_t *buf, struct mpix_format *fmt)
Collect red, green, blue channel averages of all pixels in an RGB24 frame.
mpix_op_type
MPIX operation type identifying an operation family.
Definition types.h:21
mpix_control_id
Definition types.h:52
@ MPIX_KERNEL_EDGE_DETECT
Definition types.h:40
@ MPIX_KERNEL_GAUSSIAN_BLUR
Definition types.h:42
@ MPIX_KERNEL_SHARPEN
Definition types.h:46
@ MPIX_NB_CID
Definition types.h:82
struct mpix_ring ring
Definition types.h:149
struct mpix_format fmt
Definition types.h:145
Represent the image currently being processed.
Definition types.h:164
struct mpix_base_op * first_op
Definition types.h:166
struct mpix_base_op * last_op
Definition types.h:168
int32_t * ctrls[MPIX_NB_CID]
Definition types.h:176
const uint8_t * buffer
Definition types.h:170
size_t size
Definition types.h:172
struct mpix_format fmt
Definition types.h:174
uint32_t fourcc
Definition types.h:194
uint8_t colors_rgb24[3<< 8]
Definition types.h:192