libmpix
The open imaging DSP library
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
mpix/op_kernel.h

Implementing new kernel operations. More...

Data Structures

struct  mpix_kernel_op
 

Macros

#define MPIX_REGISTER_KERNEL_5X5_OP(id, fn, t, fmt)
 Define a new 5x5 kernel conversion operation.
 
#define MPIX_REGISTER_KERNEL_3X3_OP(id, fn, t, fmt)
 Define a new 3x3 kernel conversion operation.
 

Enumerations

enum  mpix_kernel_type {
  MPIX_KERNEL_IDENTITY , MPIX_KERNEL_EDGE_DETECT , MPIX_KERNEL_GAUSSIAN_BLUR , MPIX_KERNEL_SHARPEN ,
  MPIX_KERNEL_DENOISE
}
 

Functions

void mpix_identity_rgb24_3x3 (const uint8_t *in[3], uint8_t *out, uint16_t width)
 Apply a 3x3 identity kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_identity_rgb24_5x5 (const uint8_t *in[5], uint8_t *out, uint16_t width)
 Apply a 5x5 identity kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_sharpen_rgb24_3x3 (const uint8_t *in[3], uint8_t *out, uint16_t width)
 Apply a 3x3 sharpen kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_sharpen_rgb24_5x5 (const uint8_t *in[5], uint8_t *out, uint16_t width)
 Apply a 5x5 unsharp kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_edgedetect_rgb24_3x3 (const uint8_t *in[3], uint8_t *out, uint16_t width)
 Apply a 3x3 edge detection kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_gaussianblur_rgb24_3x3 (const uint8_t *in[3], uint8_t *out, uint16_t width)
 Apply a 3x3 gaussian blur kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_median_rgb24_3x3 (const uint8_t *in[3], uint8_t *out, uint16_t width)
 Apply a 3x3 median denoise kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_median_rgb24_5x5 (const uint8_t *in[5], uint8_t *out, uint16_t width)
 Apply a 5x5 median denoise kernel to an RGB24 input window and produce one RGB24 line.
 
void mpix_kernel_5x5_op (struct mpix_base_op *op)
 Helper to turn a 5x5 kernel conversion function into an operation.
 
void mpix_kernel_3x3_op (struct mpix_base_op *op)
 Helper to turn a 3x3 kernel conversion function into an operation.
 

Detailed Description

Implementing new kernel operations.

SPDX-License-Identifier: Apache-2.0

Macro Definition Documentation

◆ MPIX_REGISTER_KERNEL_3X3_OP

#define MPIX_REGISTER_KERNEL_3X3_OP (   id,
  fn,
  t,
  fmt 
)
Value:
const struct mpix_kernel_op mpix_kernel_3x3_op_##id = { \
.base.name = ("kernel_3x3_" #id), \
.base.format_src = (MPIX_FMT_##fmt), \
.base.format_dst = (MPIX_FMT_##fmt), \
.base.window_size = 3, \
.base.run = mpix_kernel_3x3_op, \
.kernel_fn = (fn), \
.type = (MPIX_KERNEL_##t), \
}
void mpix_kernel_3x3_op(struct mpix_base_op *op)
Helper to turn a 3x3 kernel conversion 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_kernel.h:32
struct mpix_base_op base
Definition op_kernel.h:34

Define a new 3x3 kernel conversion operation.

Parameters
idShort identifier to differentiate operations of the same type.
fnFunction converting 3 input lines into 1 output line.
tKernel operation type from mpix_kernel_type
fmtThe input format for that operation.

◆ MPIX_REGISTER_KERNEL_5X5_OP

#define MPIX_REGISTER_KERNEL_5X5_OP (   id,
  fn,
  t,
  fmt 
)
Value:
const struct mpix_kernel_op mpix_kernel_5x5_op_##id = { \
.base.name = ("kernel_5x5_" #id), \
.base.format_src = (MPIX_FMT_##fmt), \
.base.format_dst = (MPIX_FMT_##fmt), \
.base.window_size = 5, \
.base.run = mpix_kernel_5x5_op, \
.kernel_fn = (fn), \
.type = (MPIX_KERNEL_##t), \
}
void mpix_kernel_5x5_op(struct mpix_base_op *op)
Helper to turn a 5x5 kernel conversion function into an operation.

Define a new 5x5 kernel conversion operation.

Parameters
idShort identifier to differentiate operations of the same category.
fnFunction converting 5 input lines into 1 output line.
tKernel operation type from mpix_kernel_type
fmtThe input format for that operation.

Enumeration Type Documentation

◆ mpix_kernel_type

Available kernel operations to apply to the image.

Enumerator
MPIX_KERNEL_IDENTITY 

Identity kernel: no change, the input is the same as the output

MPIX_KERNEL_EDGE_DETECT 

Edge detection kernel: keep only an outline of the edges

MPIX_KERNEL_GAUSSIAN_BLUR 

Gaussian blur kernel: apply a blur onto an image following a Gaussian curve

MPIX_KERNEL_SHARPEN 

Sharpen kernel: accentuate the edges, making the image look less blurry

MPIX_KERNEL_DENOISE 

Denoise kernel: remove the parasitic image noise using the local median value

Function Documentation

◆ mpix_edgedetect_rgb24_3x3()

void mpix_edgedetect_rgb24_3x3 ( const uint8_t *  in[3],
uint8_t *  out,
uint16_t  width 
)

Apply a 3x3 edge detection kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_gaussianblur_rgb24_3x3()

void mpix_gaussianblur_rgb24_3x3 ( const uint8_t *  in[3],
uint8_t *  out,
uint16_t  width 
)

Apply a 3x3 gaussian blur kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_identity_rgb24_3x3()

void mpix_identity_rgb24_3x3 ( const uint8_t *  in[3],
uint8_t *  out,
uint16_t  width 
)

Apply a 3x3 identity kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_identity_rgb24_5x5()

void mpix_identity_rgb24_5x5 ( const uint8_t *  in[5],
uint8_t *  out,
uint16_t  width 
)

Apply a 5x5 identity kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_kernel_3x3_op()

void mpix_kernel_3x3_op ( struct mpix_base_op op)

Helper to turn a 3x3 kernel conversion function into an operation.

The line conversion function is free to perform any processing on the input lines and expected to produce one output line.

The line conversion function is to be provided in op->arg0.

Parameters
opCurrent operation in progress.

◆ mpix_kernel_5x5_op()

void mpix_kernel_5x5_op ( struct mpix_base_op op)

Helper to turn a 5x5 kernel conversion function into an operation.

The line conversion function is free to perform any processing on the input lines and expected to produce one output line.

The line conversion function is to be provided in op->arg0.

Parameters
opCurrent operation in progress.

◆ mpix_median_rgb24_3x3()

void mpix_median_rgb24_3x3 ( const uint8_t *  in[3],
uint8_t *  out,
uint16_t  width 
)

Apply a 3x3 median denoise kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_median_rgb24_5x5()

void mpix_median_rgb24_5x5 ( const uint8_t *  in[5],
uint8_t *  out,
uint16_t  width 
)

Apply a 5x5 median denoise kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_sharpen_rgb24_3x3()

void mpix_sharpen_rgb24_3x3 ( const uint8_t *  in[3],
uint8_t *  out,
uint16_t  width 
)

Apply a 3x3 sharpen kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.

◆ mpix_sharpen_rgb24_5x5()

void mpix_sharpen_rgb24_5x5 ( const uint8_t *  in[5],
uint8_t *  out,
uint16_t  width 
)

Apply a 5x5 unsharp kernel to an RGB24 input window and produce one RGB24 line.

Parameters
inArray of input line buffers to convert.
outPointer to the output line converted.
widthWidth of the input and output lines in pixels.