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>
33 namespace firevision {
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;