24#include <core/exceptions/software.h>
25#include <fvfilters/rectify.h>
26#include <fvutils/color/yuv.h>
27#include <fvutils/rectification/rectinfo_block.h>
28#include <fvutils/rectification/rectinfo_lut_block.h>
53 mark_zeros_ = mark_zeros;
56#define FILTER_RECTIFY_ADVANCE_LINE \
57 ldyp += dst_roi->line_step; \
58 ldup += dst_roi->line_step / 2; \
59 ldvp += dst_roi->line_step / 2; \
64#define FILTER_RECTIFY_ASSIGN \
67 *dup++ = (pu1 + pu2) / 2; \
68 *dvp++ = (pv1 + pv2) / 2;
87 unsigned char *ldyp = dyp;
88 unsigned char *ldup = dup;
89 unsigned char *ldvp = dvp;
91 unsigned char py1 = 0, py2 = 0, pu1 = 0, pu2 = 0, pv1 = 0, pv2 = 0;
110 if (lut->
x == 0 && lut->
y == 0) {
111 py1 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w, h);
115 YUV422_PLANAR_YUV(
src[0],
126 if (lut->
x == 0 && lut->
y == 0) {
127 py2 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w, h);
131 YUV422_PLANAR_YUV(
src[0],
142 FILTER_RECTIFY_ASSIGN;
145 FILTER_RECTIFY_ADVANCE_LINE;
152 YUV422_PLANAR_YUV(
src[0],
161 YUV422_PLANAR_YUV(
src[0],
171 FILTER_RECTIFY_ASSIGN;
174 FILTER_RECTIFY_ADVANCE_LINE;
180 printf(
"Unknown info block\n");
182 uint16_t ur1_x = 0, ur1_y = 0, ur2_x = 0, ur2_y = 0;
187 rib_->
mapping(w, h, &ur1_x, &ur1_y);
188 rib_->
mapping(w + 1, h, &ur2_x, &ur2_y);
190 if ((ur1_x == 0) && (ur1_y == 0)) {
191 py1 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w, h);
195 YUV422_PLANAR_YUV(
src[0],
204 if ((ur2_x == 0) && (ur2_y == 0)) {
205 py2 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w + 1, h);
209 YUV422_PLANAR_YUV(
src[0],
219 FILTER_RECTIFY_ASSIGN;
222 FILTER_RECTIFY_ADVANCE_LINE;
227 rib_->
mapping(w, h, &ur1_x, &ur1_y);
228 rib_->
mapping(w + 1, h, &ur2_x, &ur2_y);
231 src[0],
src_roi[0]->image_width,
src_roi[0]->image_height, ur1_x, ur1_y, py1, pu1, pv1);
233 src[0],
src_roi[0]->image_width,
src_roi[0]->image_height, ur2_x, ur2_y, py2, pu2, pv2);
235 FILTER_RECTIFY_ASSIGN;
238 FILTER_RECTIFY_ADVANCE_LINE;
Expected parameter is missing.
FilterRectify(RectificationInfoBlock *rib, bool mark_zeros=true)
Constructor.
virtual void apply()
Apply the filter.
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned char * dst
Destination buffer.
ROI * dst_roi
Destination ROI.
unsigned int height
ROI height.
fawkes::upoint_t start
ROI start.
unsigned int line_step
line step
unsigned int width
ROI width.
unsigned int image_width
width of image that contains this ROI
unsigned int pixel_step
pixel step
unsigned int image_height
height of image that contains this ROI
Rectification info block.
virtual void mapping(uint16_t x, uint16_t y, uint16_t *to_x, uint16_t *to_y)=0
Get mapping (to_x, to_y) for (x, y).
Recitification Lookup Table Block.
uint16_t pixel_height()
Get height the LUT.
rectinfo_lut_16x16_entry_t * lut_data()
Get raw LUT data.
uint16_t pixel_width()
Get width of the LUT.
unsigned int x
x coordinate
unsigned int y
y coordinate
Data type used to build a rectification LUT.
uint16_t y
map to y pixel coordinate
uint16_t x
map to x pixel coordinate