24 #include <fvfilters/sum.h>
26 #include <fvutils/color/yuv.h>
30 namespace firevision {
42 FilterSum::FilterSum()
51 if (
src[0] == NULL )
return;
52 if (
src[1] == NULL )
return;
53 if (
src_roi[0] == NULL )
return;
54 if (
src_roi[1] == NULL )
return;
56 register unsigned int h = 0;
57 register unsigned int w = 0;
63 register unsigned char *bup = YUV422_PLANAR_U_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
66 register unsigned char *bvp = YUV422_PLANAR_V_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
73 register unsigned char *fup = YUV422_PLANAR_U_PLANE(
src[1],
src_roi[1]->image_width,
src_roi[1]->image_height)
76 register unsigned char *fvp = YUV422_PLANAR_V_PLANE(
src[1],
src_roi[1]->image_width,
src_roi[1]->image_height)
90 unsigned char *lbyp = byp;
91 unsigned char *lbup = fup;
92 unsigned char *lbvp = fvp;
93 unsigned char *lfyp = fyp;
94 unsigned char *lfup = fup;
95 unsigned char *lfvp = fvp;
96 unsigned char *ldyp = dyp;
97 unsigned char *ldup = dup;
98 unsigned char *ldvp = dvp;
100 for (h = 0; (h <
src_roi[1]->
height) && (h < dst_roi->height); ++h) {
101 for (w = 0; (w <
src_roi[1]->
width) && (w < dst_roi->width); w += 2) {
102 *dyp++ = ((*byp + *fyp) > 255) ? 255 : (*byp + *fyp);
104 *dyp++ = ((*byp + *fyp) > 255) ? 255 : (*byp + *fyp);
107 *dup++ = (*fup++ + *bup++) / 2;
108 *dvp++ = (*fvp++ + *bvp++) / 2;