24#include <fvutils/color/yuv.h>
25#include <fvutils/statistical/imagediff.h>
42 this->scanline_model = scanline_model;
50 scanline_model = NULL;
66 buffer_a = yuv422planar_buffer;
79 buffer_b = yuv422planar_buffer;
94 if ((buffer_a == NULL) && (buffer_b == NULL))
96 if ((buffer_a == NULL) && (buffer_b != NULL))
98 if ((buffer_a != NULL) && (buffer_b == NULL))
100 if ((width_a != width_b) || (height_a != height_b))
103 if (scanline_model != NULL) {
107 unsigned char y_a, u_a, v_a, y_b, u_b, v_b;
109 scanline_model->reset();
110 while (!scanline_model->finished()) {
111 x = (*scanline_model)->
x;
112 y = (*scanline_model)->y;
114 YUV422_PLANAR_YUV(buffer_a, width_a, height_a, x, y, y_a, u_a, v_a);
115 YUV422_PLANAR_YUV(buffer_b, width_b, height_b, x, y, y_b, u_b, v_b);
117 if ((y_a != y_b) || (u_a != u_b) || (v_a != v_b)) {
124 unsigned char *ypa = buffer_a;
125 unsigned char *ypb = buffer_b;
127 for (
unsigned int i = 0; i < (width_a * height_a); ++i) {
147 if ((buffer_a == NULL) && (buffer_b == NULL))
149 if ((buffer_a == NULL) && (buffer_b != NULL))
150 return (width_b * height_b);
151 if ((buffer_a != NULL) && (buffer_b == NULL))
152 return (width_a * height_a);
153 if ((width_a != width_b) || (height_a != height_b)) {
154 return std::abs((
long)width_a - (
long)width_b) * std::abs((
long)height_a - (
long)height_b);
157 unsigned int num = 0;
158 if (scanline_model != NULL) {
162 unsigned char y_a, u_a, v_a, y_b, u_b, v_b;
164 scanline_model->reset();
165 while (!scanline_model->finished()) {
166 x = (*scanline_model)->
x;
167 y = (*scanline_model)->y;
169 YUV422_PLANAR_YUV(buffer_a, width_a, height_a, x, y, y_a, u_a, v_a);
170 YUV422_PLANAR_YUV(buffer_b, width_b, height_b, x, y, y_b, u_b, v_b);
172 if ((y_a != y_b) || (u_a != u_b) || (v_a != v_b)) {
179 unsigned char *ypa = buffer_a;
180 unsigned char *ypb = buffer_b;
182 for (
unsigned int i = 0; i < (width_a * height_a); ++i) {
183 if (*ypa++ != *ypb++)
void setBufferA(unsigned char *yuv422planar_buffer, unsigned int width, unsigned int height)
Set first buffer.
unsigned int numDifferingPixels()
Number of differing pixels.
void setBufferB(unsigned char *yuv422planar_buffer, unsigned int width, unsigned int height)
Set second buffer.
bool different()
Check if images are different.
Scanline model interface.
unsigned int x
x coordinate