24 #include <fvfilters/difference.h> 26 #include <fvutils/color/yuv.h> 40 :
Filter(
"FilterDifference", 2)
48 if (
src[0] == NULL )
return;
49 if (
src[1] == NULL )
return;
50 if (
src_roi[0] == NULL )
return;
51 if (
src_roi[1] == NULL )
return;
53 register unsigned int h = 0;
54 register unsigned int w = 0;
60 register unsigned char *bup = YUV422_PLANAR_U_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
63 register unsigned char *bvp = YUV422_PLANAR_V_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
70 register unsigned char *fup = YUV422_PLANAR_U_PLANE(
src[1],
src_roi[1]->image_width,
src_roi[1]->image_height)
73 register unsigned char *fvp = YUV422_PLANAR_V_PLANE(
src[1],
src_roi[1]->image_width,
src_roi[1]->image_height)
87 unsigned char *lbyp = byp;
88 unsigned char *lbup = fup;
89 unsigned char *lbvp = fvp;
90 unsigned char *lfyp = fyp;
91 unsigned char *lfup = fup;
92 unsigned char *lfvp = fvp;
93 unsigned char *ldyp = dyp;
94 unsigned char *ldup = dup;
95 unsigned char *ldvp = dvp;
97 for (h = 0; (h <
src_roi[1]->
height) && (h < dst_roi->height); ++h) {
98 for (w = 0; (w <
src_roi[1]->
width) && (w < dst_roi->width); w += 2) {
99 *dyp++ = ((*byp - *fyp) < 0) ? 0 : (*byp - *fyp);
101 *dyp++ = ((*byp - *fyp) < 0) ? 0 : (*byp - *fyp);
104 *dup++ = (*fup++ + *bup++) / 2;
105 *dvp++ = (*fvp++ + *bvp++) / 2;
FilterDifference()
Constructor.
virtual void apply()
Apply the filter.
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
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned int image_height
height of image that contains this ROI
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
unsigned int height
ROI height.
unsigned int line_step
line step
unsigned char * dst
Destination buffer.
unsigned int pixel_step
pixel step
ROI * dst_roi
Destination ROI.