25 #include <fvfilters/hv_search.h> 27 #include <fvutils/color/yuv.h> 62 register unsigned int h = 0;
63 register unsigned int w = 0;
68 unsigned int top[width];
69 unsigned int bottom[width];
75 register unsigned char *up = YUV422_PLANAR_U_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
78 register unsigned char *vp = YUV422_PLANAR_V_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
85 unsigned char *lyp = yp;
86 unsigned char *lup = up;
87 unsigned char *lvp = vp;
88 unsigned char *ldyp = dyp;
96 const unsigned int MIN_INTERIA = 9;
97 unsigned int num_what;
102 const unsigned int MAX_SHRINK = 16;
103 unsigned int max_width = 0;
104 bool not_reflect =
true;
106 memset(top, 0, width *
sizeof(
unsigned int));
107 memset(bottom, 0, width *
sizeof(
unsigned int));
108 memset(vflag, 0, width *
sizeof(
bool));
110 for (h = 0; (h <
src_roi[0]->
height) && (h < dst_roi->height); ++h) {
114 for (w = 0; (w <
src_roi[0]->
width) && (w < dst_roi->width); ++w) {
115 if ( (cm->
determine(*yp++, *up, *vp) == what) ) {
117 if (not_reflect) bottom[w] = h;
123 if (!vflag[w]) top[w] = h;
125 if ( (cm->
determine(*yp++, *up++, *vp++) == what) ) {
127 if (not_reflect) bottom[w] = h;
134 if (!vflag[w]) top[w] = h;
141 if (num_what * MIN_INTERIA > right - left)
143 if (right - left > max_width)
144 max_width = right - left;
147 if (right - left < max_width / MAX_SHRINK)
158 if (left != 0 && left < dst_roi->width-1)
163 if (right != 0 && right < dst_roi->width-1)
FilterHVSearch(ColorModel *cm, color_t what)
Constructor.
fawkes::upoint_t start
ROI start.
unsigned int y
y coordinate
unsigned int x
x coordinate
unsigned int width
ROI width.
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
unsigned int height
ROI height.
virtual void apply()
Apply the filter.
unsigned int line_step
line step
unsigned char * dst
Destination buffer.
unsigned int pixel_step
pixel step
ROI * dst_roi
Destination ROI.
virtual color_t determine(unsigned int y, unsigned int u, unsigned int v) const =0
Determine classification of YUV pixel.