24 #include <fvfilters/rectify.h> 26 #include <core/exceptions/software.h> 28 #include <fvutils/rectification/rectinfo_lut_block.h> 29 #include <fvutils/rectification/rectinfo_block.h> 30 #include <fvutils/color/yuv.h> 59 __mark_zeros = mark_zeros;
63 #define FILTER_RECTIFY_ADVANCE_LINE \ 64 ldyp += dst_roi->line_step; \ 65 ldup += dst_roi->line_step / 2; \ 66 ldvp += dst_roi->line_step / 2; \ 71 #define FILTER_RECTIFY_ASSIGN \ 74 *dup++ = (pu1 + pu2) / 2; \ 75 *dvp++ = (pv1 + pv2) / 2; \ 93 unsigned char *ldyp = dyp;
94 unsigned char *ldup = dup;
95 unsigned char *ldvp = dvp;
97 unsigned char py1=0, py2=0, pu1=0, pu2=0, pv1=0, pv2=0;
114 if ( __mark_zeros ) {
117 if ( lut->
x == 0 && lut->
y == 0 ) {
118 py1 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w, h);
123 lut->
x, lut->
y, py1, pu1, pv1);
127 if ( lut->
x == 0 && lut->
y == 0 ) {
128 py2 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w, h);
133 lut->
x, lut->
y, py2, pu2, pv2);
137 FILTER_RECTIFY_ASSIGN;
140 FILTER_RECTIFY_ADVANCE_LINE;
148 lut->
x, lut->
y, py1, pu1, pv1);
151 lut->
x, lut->
y, py2, pu2, pv2);
154 FILTER_RECTIFY_ASSIGN;
157 FILTER_RECTIFY_ADVANCE_LINE;
164 printf(
"Unknown info block\n");
166 uint16_t ur1_x = 0, ur1_y = 0,
167 ur2_x = 0, ur2_y = 0;
172 __rib->
mapping(w, h, &ur1_x, &ur1_y);
173 __rib->
mapping(w+1, h, &ur2_x, &ur2_y);
175 if ( (ur1_x == 0) && (ur1_y == 0) ) {
176 py1 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w, h);
181 ur1_x, ur1_y, py1, pu1, pv1);
183 if ( (ur2_x == 0) && (ur2_y == 0) ) {
184 py2 = YUV422_PLANAR_Y_AT(
src[0],
src_roi[0]->image_width, w+1, h);
189 ur2_x, ur2_y, py2, pu2, pv2);
192 FILTER_RECTIFY_ASSIGN;
195 FILTER_RECTIFY_ADVANCE_LINE;
200 __rib->
mapping(w, h, &ur1_x, &ur1_y);
201 __rib->
mapping(w+1, h, &ur2_x, &ur2_y);
204 ur1_x, ur1_y, py1, pu1, pv1);
206 ur2_x, ur2_y, py2, pu2, pv2);
208 FILTER_RECTIFY_ASSIGN;
211 FILTER_RECTIFY_ADVANCE_LINE;
uint16_t pixel_width()
Get width of the LUT.
FilterRectify(RectificationInfoBlock *rib, bool mark_zeros=true)
Constructor.
Recitification Lookup Table Block.
fawkes::upoint_t start
ROI start.
unsigned int y
y coordinate
unsigned int x
x coordinate
unsigned int width
ROI width.
unsigned int image_width
width of image that contains this ROI
Data type used to build a rectification LUT.
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned int image_height
height of image that contains this ROI
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).
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
uint16_t pixel_height()
Get height the LUT.
Rectification info block.
unsigned int height
ROI height.
virtual void apply()
Apply the filter.
unsigned int line_step
line step
uint16_t y
map to y pixel coordinate
rectinfo_lut_16x16_entry_t * lut_data()
Get raw LUT data.
unsigned char * dst
Destination buffer.
Expected parameter is missing.
unsigned int pixel_step
pixel step
ROI * dst_roi
Destination ROI.
uint16_t x
map to x pixel coordinate