7#ifndef MPIX_OPERATION_H
8#define MPIX_OPERATION_H
14#include <mpix/formats.h>
17#include <mpix/utils.h>
63static inline size_t mpix_op_pitch(
struct mpix_base_op *op)
80 for (
size_t i = 0; op_list[i] != NULL; i++) {
101static inline uint8_t *mpix_op_get_input_bytes(
struct mpix_base_op *op,
size_t sz)
105 data = mpix_ring_read(&op->
ring, sz);
106 assert(data != NULL );
123static inline uint8_t *mpix_op_get_output_bytes(
struct mpix_base_op *op,
size_t sz)
127 assert(op->
next != NULL );
129 data = mpix_ring_write(&op->
next->
ring, sz);
130 assert(data != NULL );
145static inline uint8_t *mpix_op_peek_input_bytes(
struct mpix_base_op *op,
size_t sz)
149 data = mpix_ring_peek(&op->
ring, sz);
150 assert(data != NULL );
163static inline uint8_t *mpix_op_get_output_line(
struct mpix_base_op *op)
165 return mpix_op_get_output_bytes(op, mpix_op_pitch(op->
next) * 1);
176static inline const uint8_t *mpix_op_get_input_line(
struct mpix_base_op *op)
178 return mpix_op_get_input_bytes(op, mpix_op_pitch(op));
189static inline uint8_t *mpix_op_peek_input_line(
struct mpix_base_op *op)
191 return mpix_op_peek_input_bytes(op, mpix_op_pitch(op->
next) * 1);
200static inline const uint8_t *mpix_op_get_all_input(
struct mpix_base_op *op,
size_t *sz)
202 *sz = mpix_ring_tailroom(&op->
ring);
203 return mpix_ring_read(&op->
ring, *sz);
217static inline uint8_t *mpix_op_peek_output(
struct mpix_base_op *op,
size_t *sz)
219 *sz = mpix_ring_tailroom(&op->
ring);
225 if (op != NULL && op->
run != NULL) {
252 mpix_op_run(op->
next);
uint32_t mpix_port_get_uptime_us(void)
Get the uptime in microsecond, used to compute performance statistics.
One step of a line operation pipeline.
Definition op.h:27
uint16_t threshold
Definition op.h:45
bool is_heap
Definition op.h:47
uint32_t format_src
Definition op.h:33
struct mpix_base_op * next
Definition op.h:29
uint16_t window_size
Definition op.h:43
uint16_t line_offset
Definition op.h:41
uint16_t width
Definition op.h:37
uint16_t height
Definition op.h:39
struct mpix_ring ring
Definition op.h:49
const uint8_t * name
Definition op.h:31
uint32_t total_time_us
Definition op.h:55
uint32_t format_dst
Definition op.h:35
void(* run)(struct mpix_base_op *op)
Definition op.h:51
uint32_t start_time_us
Definition op.h:53
Ring buffer of pixels.
Definition ring.h:16
uint8_t * data
Definition ring.h:18
size_t head
Definition ring.h:22