aboutsummaryrefslogtreecommitdiffstats
path: root/utils/v4l2-compliance/v4l2-test-colors.cpp
blob: 7c62dc726d23c6888f39a727945db39d2ed7a5c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
/*
    V4L2 API compliance color checking tests.

    Copyright (C) 2015  Hans Verkuil <hverkuil@xs4all.nl>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 */

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <math.h>
#include "v4l2-compliance.h"

static void setupPlanes(const cv4l_fmt &fmt, __u8 *planes[3])
{
	if (fmt.g_num_planes() > 1)
		return;

	unsigned bpl = fmt.g_bytesperline();
	unsigned h = fmt.g_height();
	unsigned size = bpl * h;

	switch (fmt.g_pixelformat()) {
	case V4L2_PIX_FMT_YUV420:
	case V4L2_PIX_FMT_YVU420:
		planes[1] = planes[0] + size;
		planes[2] = planes[1] + size / 4;
		break;
	case V4L2_PIX_FMT_YUV422P:
		planes[1] = planes[0] + size;
		planes[2] = planes[1] + size / 2;
		break;
	case V4L2_PIX_FMT_NV16:
	case V4L2_PIX_FMT_NV61:
	case V4L2_PIX_FMT_NV12:
	case V4L2_PIX_FMT_NV21:
	case V4L2_PIX_FMT_NV24:
	case V4L2_PIX_FMT_NV42:
		planes[1] = planes[0] + size;
		break;
	default:
		break;
	}
}

struct color {
	double r, g, b, a;
};

static const double bt601[3][3] = {
	{ 1, 0,       1.4020  },
	{ 1, -0.3441, -0.7141 },
	{ 1, 1.7720,  0       },
};
static const double rec709[3][3] = {
	{ 1, 0,       1.5748  },
	{ 1, -0.1873, -0.4681 },
	{ 1, 1.8556,  0       },
};
static const double smpte240m[3][3] = {
	{ 1, 0,       1.5756  },
	{ 1, -0.2253, -0.4767 },
	{ 1, 1.8270,  0       },
};
static const double bt2020[3][3] = {
	{ 1, 0,       1.4746  },
	{ 1, -0.1646, -0.5714 },
	{ 1, 1.8814,  0       },
};

static void ycbcr2rgb(const double m[3][3], double y, double cb, double cr,
			color &c)
{
	c.r = m[0][0] * y + m[0][1] * cb + m[0][2] * cr;
	c.g = m[1][0] * y + m[1][1] * cb + m[1][2] * cr;
	c.b = m[2][0] * y + m[2][1] * cb + m[2][2] * cr;
}

static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
		unsigned y, unsigned x, color &c)
{
	unsigned bpl = fmt.g_bytesperline();
	unsigned yeven = y & ~1;
	unsigned xeven = x & ~1;
	unsigned offset = bpl * y;
	unsigned hoffset = (bpl / 2) * y;
	unsigned voffset = bpl * (y / 2);
	unsigned hvoffset = (bpl / 2) * (y / 2);
	const __u8 *p8 = planes[0] + offset;
	__u8 v8 = 0;
	__u16 v16 = 0;
	__u32 v32 = 0;

	/* component order: ARGB or AYUV */
	switch (fmt.g_pixelformat()) {
	case V4L2_PIX_FMT_RGB332:
		v8 = p8[x];
		break;
	case V4L2_PIX_FMT_RGB565:
	case V4L2_PIX_FMT_RGB444:
	case V4L2_PIX_FMT_XRGB444:
	case V4L2_PIX_FMT_ARGB444:
	case V4L2_PIX_FMT_RGB555:
	case V4L2_PIX_FMT_XRGB555:
	case V4L2_PIX_FMT_ARGB555:
	case V4L2_PIX_FMT_YUV444:
	case V4L2_PIX_FMT_YUV555:
	case V4L2_PIX_FMT_YUV565:
		v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
		break;
	case V4L2_PIX_FMT_RGB565X:
	case V4L2_PIX_FMT_RGB555X:
	case V4L2_PIX_FMT_XRGB555X:
	case V4L2_PIX_FMT_ARGB555X:
		v16 = p8[2 * x + 1] + (p8[2 * x] << 8);
		break;
	case V4L2_PIX_FMT_RGB24:
		v32 = p8[3 * x + 2] + (p8[3 * x + 1] << 8) +
		      (p8[3 * x] << 16);
		break;
	case V4L2_PIX_FMT_BGR24:
		v32 = p8[3 * x] + (p8[3 * x + 1] << 8) +
		      (p8[3 * x + 2] << 16);
		break;
	case V4L2_PIX_FMT_RGB32:
	case V4L2_PIX_FMT_XRGB32:
	case V4L2_PIX_FMT_ARGB32:
	case V4L2_PIX_FMT_YUV32:
	case V4L2_PIX_FMT_AYUV32:
	case V4L2_PIX_FMT_XYUV32:
		v32 = p8[4 * x + 3] + (p8[4 * x + 2] << 8) +
		      (p8[4 * x + 1] << 16) + (p8[4 * x] << 24);
		break;
	case V4L2_PIX_FMT_BGR666:
		v32 = ((p8[4 * x + 2] & 0xc0) << 10) + ((p8[4 * x + 1] & 0xf) << 18) +
		      ((p8[4 * x + 1] & 0xf0) << 4) +
		      ((p8[4 * x] & 0x3) << 12) + ((p8[4 * x] & 0xfc) >> 2);
		break;
	case V4L2_PIX_FMT_BGR32:
	case V4L2_PIX_FMT_XBGR32:
	case V4L2_PIX_FMT_ABGR32:
	case V4L2_PIX_FMT_VUYA32:
	case V4L2_PIX_FMT_VUYX32:
		v32 = p8[4 * x] + (p8[4 * x + 1] << 8) +
		      (p8[4 * x + 2] << 16) + (p8[4 * x + 3] << 24);
		break;
	case V4L2_PIX_FMT_SBGGR8:
		p8 = planes[0] + bpl * yeven + xeven;
		v32 = p8[0] + (p8[(y & 1) * bpl + 1 - (y & 1)] << 8) + (p8[bpl + 1] << 16);
		break;
	case V4L2_PIX_FMT_SGBRG8:
		p8 = planes[0] + bpl * yeven + xeven;
		v32 = (p8[bpl] << 16) + (p8[(y & 1) * bpl + (y & 1)] << 8) + p8[1];
		break;
	case V4L2_PIX_FMT_SGRBG8:
		p8 = planes[0] + bpl * yeven + xeven;
		v32 = p8[bpl] + (p8[(y & 1) * bpl + (y & 1)] << 8) + (p8[1] << 16);
		break;
	case V4L2_PIX_FMT_SRGGB8:
		p8 = planes[0] + bpl * yeven + xeven;
		v32 = (p8[0] << 16) + (p8[(y & 1) * bpl + 1 - (y & 1)] << 8) + p8[bpl + 1];
		break;
	case V4L2_PIX_FMT_YUYV:
		v32 = (p8[2 * x] << 16) + (p8[2 * xeven + 1] << 8) + p8[2 * xeven + 3];
		break;
	case V4L2_PIX_FMT_UYVY:
		v32 = (p8[2 * x + 1] << 16) + (p8[2 * xeven] << 8) + p8[2 * xeven + 2];
		break;
	case V4L2_PIX_FMT_YVYU:
		v32 = (p8[2 * x] << 16) + (p8[2 * xeven + 3] << 8) + p8[2 * xeven + 1];
		break;
	case V4L2_PIX_FMT_VYUY:
		v32 = (p8[2 * x + 1] << 16) + (p8[2 * xeven + 2] << 8) + p8[2 * xeven];
		break;
	case V4L2_PIX_FMT_NV12:
	case V4L2_PIX_FMT_NV12M:
		v32 = (p8[x] << 16) +
		      (planes[1][voffset + xeven] << 8) +
		      planes[1][voffset + xeven + 1];
		break;
	case V4L2_PIX_FMT_NV21:
	case V4L2_PIX_FMT_NV21M:
		v32 = (p8[x] << 16) +
		      (planes[1][voffset + xeven + 1] << 8) +
		      planes[1][voffset + xeven];
		break;
	case V4L2_PIX_FMT_NV16:
	case V4L2_PIX_FMT_NV16M:
		v32 = (p8[x] << 16) +
		      (planes[1][offset + xeven] << 8) +
		      planes[1][offset + xeven + 1];
		break;
	case V4L2_PIX_FMT_NV61:
	case V4L2_PIX_FMT_NV61M:
		v32 = (p8[x] << 16) +
		      (planes[1][offset + xeven + 1] << 8) +
		      planes[1][offset + xeven];
		break;
	case V4L2_PIX_FMT_YVU422M:
		v32 = (p8[x] << 16) +
		      (planes[2][hoffset + x / 2] << 8) +
		      planes[1][hoffset + x / 2];
		break;
	case V4L2_PIX_FMT_YUV422M:
	case V4L2_PIX_FMT_YUV422P:
		v32 = (p8[x] << 16) +
		      (planes[1][hoffset + x / 2] << 8) +
		      planes[2][hoffset + x / 2];
		break;
	case V4L2_PIX_FMT_YUV444M:
		v32 = (p8[x] << 16) + (planes[1][offset + x] << 8) +
		      planes[2][offset + x];
		break;
	case V4L2_PIX_FMT_YVU444M:
		v32 = (p8[x] << 16) + (planes[2][offset + x] << 8) +
		      planes[1][offset + x];
		break;
	case V4L2_PIX_FMT_YUV420:
	case V4L2_PIX_FMT_YUV420M:
		v32 = (p8[x] << 16) +
		      (planes[1][hvoffset + x / 2] << 8) +
		      planes[2][hvoffset + x / 2];
		break;
	case V4L2_PIX_FMT_YVU420:
	case V4L2_PIX_FMT_YVU420M:
		v32 = (p8[x] << 16) +
		      (planes[2][hvoffset + x / 2] << 8) +
		      planes[1][hvoffset + x / 2];
		break;
	case V4L2_PIX_FMT_NV24:
		v32 = (p8[x] << 16) +
		      (planes[1][bpl * 2 * y + 2 * x] << 8) +
		      planes[1][bpl * 2 * y + 2 * x + 1];
		break;
	case V4L2_PIX_FMT_NV42:
		v32 = (p8[x] << 16) +
		      (planes[1][bpl * 2 * y + 2 * x + 1] << 8) +
		      planes[1][bpl * 2 * y + 2 * x];
		break;
	}

	switch (fmt.g_pixelformat()) {
	case V4L2_PIX_FMT_RGB332:
		c.r = (v8 >> 5) / 7.0;
		c.g = ((v8 >> 2) & 7) / 7.0;
		c.b = (v8 & 3) / 3.0;
		break;
	case V4L2_PIX_FMT_RGB565:
	case V4L2_PIX_FMT_RGB565X:
	case V4L2_PIX_FMT_YUV565:
		c.r = (v16 >> 11) / 31.0;
		c.g = ((v16 >> 5) & 0x3f) / 63.0;
		c.b = (v16 & 0x1f) / 31.0;
		break;
	case V4L2_PIX_FMT_ARGB444:
		c.a = (v16 >> 12) / 15.0;
		/* fall through */
	case V4L2_PIX_FMT_YUV444:
	case V4L2_PIX_FMT_RGB444:
	case V4L2_PIX_FMT_XRGB444:
		c.r = ((v16 >> 8) & 0xf) / 15.0;
		c.g = ((v16 >> 4) & 0xf) / 15.0;
		c.b = (v16 & 0xf) / 15.0;
		break;
	case V4L2_PIX_FMT_ARGB555:
	case V4L2_PIX_FMT_ARGB555X:
		c.a = v16 >> 15;
		/* fall through */
	case V4L2_PIX_FMT_YUV555:
	case V4L2_PIX_FMT_RGB555:
	case V4L2_PIX_FMT_XRGB555:
	case V4L2_PIX_FMT_RGB555X:
	case V4L2_PIX_FMT_XRGB555X:
		c.r = ((v16 >> 10) & 0x1f) / 31.0;
		c.g = ((v16 >> 5) & 0x1f) / 31.0;
		c.b = (v16 & 0x1f) / 31.0;
		break;
	case V4L2_PIX_FMT_YUYV:
	case V4L2_PIX_FMT_UYVY:
	case V4L2_PIX_FMT_YVYU:
	case V4L2_PIX_FMT_VYUY:
		c.r = (v32 >> 16) / 255.0;
		c.g = ((v32 >> 8) & 0xff) / 255.0;
		c.b = (v32 & 0xff) / 255.0;
		break;
	case V4L2_PIX_FMT_BGR666:
		c.r = ((v32 >> 16) & 0x3f) / 63.0;
		c.g = ((v32 >> 8) & 0x3f) / 63.0;
		c.b = (v32 & 0x3f) / 63.0;
		break;
	case V4L2_PIX_FMT_ARGB32:
	case V4L2_PIX_FMT_ABGR32:
		c.a = ((v32 >> 24) & 0xff) / 255.0;
		/* fall through */
	default:
		c.r = ((v32 >> 16) & 0xff) / 255.0;
		c.g = ((v32 >> 8) & 0xff) / 255.0;
		c.b = (v32 & 0xff) / 255.0;
		break;
	}

	switch (fmt.g_pixelformat()) {
	case V4L2_PIX_FMT_YUV444:
	case V4L2_PIX_FMT_YUV555:
	case V4L2_PIX_FMT_YUV565:
	case V4L2_PIX_FMT_YUV32:
	case V4L2_PIX_FMT_AYUV32:
	case V4L2_PIX_FMT_XYUV32:
	case V4L2_PIX_FMT_VUYA32:
	case V4L2_PIX_FMT_VUYX32:
	case V4L2_PIX_FMT_YUYV:
	case V4L2_PIX_FMT_UYVY:
	case V4L2_PIX_FMT_YVYU:
	case V4L2_PIX_FMT_VYUY:
	case V4L2_PIX_FMT_NV12:
	case V4L2_PIX_FMT_NV12M:
	case V4L2_PIX_FMT_NV21:
	case V4L2_PIX_FMT_NV21M:
	case V4L2_PIX_FMT_NV16:
	case V4L2_PIX_FMT_NV16M:
	case V4L2_PIX_FMT_NV61:
	case V4L2_PIX_FMT_NV61M:
	case V4L2_PIX_FMT_YUV422M:
	case V4L2_PIX_FMT_YVU422M:
	case V4L2_PIX_FMT_YUV422P:
	case V4L2_PIX_FMT_YUV420:
	case V4L2_PIX_FMT_YUV420M:
	case V4L2_PIX_FMT_YVU420:
	case V4L2_PIX_FMT_YVU420M:
	case V4L2_PIX_FMT_NV24:
	case V4L2_PIX_FMT_NV42:
	case V4L2_PIX_FMT_YUV444M:
	case V4L2_PIX_FMT_YVU444M:
		break;
	default:
		if (fmt.g_quantization() == V4L2_QUANTIZATION_LIM_RANGE ||
		    (fmt.g_colorspace() == V4L2_YCBCR_ENC_BT2020 &&
		     fmt.g_quantization() == V4L2_QUANTIZATION_DEFAULT)) {
			c.r = (c.r - 16.0 / 255.0) * 255.0 / 219.0;
			c.g = (c.g - 16.0 / 255.0) * 255.0 / 219.0;
			c.b = (c.b - 16.0 / 255.0) * 255.0 / 219.0;
		}

		return;
	}

	double Y = c.r;
	double cb = c.g - 0.5;
	double cr = c.b - 0.5;

	if (fmt.g_quantization() != V4L2_QUANTIZATION_FULL_RANGE) {
		Y = (Y - 16.0 / 255.0) * 255.0 / 219.0;
		cb *= 255.0 / 224.0;
		cr *= 255.0 / 224.0;
	}

	switch (fmt.g_ycbcr_enc()) {
	case V4L2_YCBCR_ENC_XV601:
		Y = (Y - 16.0 / 255.0) * 255.0 / 219.0;
		cb *= 255.0 / 224.0;
		cr *= 255.0 / 224.0;
		/* fall through */
	case V4L2_YCBCR_ENC_601:
	default:
		ycbcr2rgb(bt601, Y, cb, cr, c);
		break;
	case V4L2_YCBCR_ENC_XV709:
		Y = (Y - 16.0 / 255.0) * 255.0 / 219.0;
		cb *= 255.0 / 224.0;
		cr *= 255.0 / 224.0;
		/* fall through */
	case V4L2_YCBCR_ENC_709:
		ycbcr2rgb(rec709, Y, cb, cr, c);
		break;
	case V4L2_YCBCR_ENC_SMPTE240M:
		ycbcr2rgb(smpte240m, Y, cb, cr, c);
		break;
	/*
	 * For now just interpret BT2020_CONST_LUM as BT2020.
	 * It's pretty complex to handle this correctly, so
	 * for now approximate it with BT2020.
	 */
	case V4L2_YCBCR_ENC_BT2020_CONST_LUM:
	case V4L2_YCBCR_ENC_BT2020:
		ycbcr2rgb(bt2020, Y, cb, cr, c);
		break;
	}
}

static const char * const colors[] = {
	"red",
	"green",
	"blue"
};

static int testColorsFmt(struct node *node, unsigned component,
		unsigned skip, unsigned perc)
{
	cv4l_queue q;
	cv4l_fmt fmt;
	__u8 *planes[3] = { 0, 0, 0 };
	skip++;

	node->g_fmt(fmt);

	if (node->g_caps() & V4L2_CAP_STREAMING) {
		cv4l_buffer buf;

		q.init(node->g_type(), V4L2_MEMORY_MMAP);
		buf.init(q);
		fail_on_test(q.reqbufs(node, 3));
		fail_on_test(q.obtain_bufs(node));
		fail_on_test(q.queue_all(node));
		fail_on_test(node->streamon());

		while (node->dqbuf(buf) == 0) {
			if (--skip == 0)
				break;
			fail_on_test(node->qbuf(buf));
		}
		fail_on_test(skip);
		for (unsigned i = 0; i < fmt.g_num_planes(); i++)
			planes[i] = (__u8 *)q.g_dataptr(buf.g_index(), i);

	} else {
		fail_on_test(!(node->g_caps() & V4L2_CAP_READWRITE));

		int size = fmt.g_sizeimage();
		void *tmp = malloc(size);

		for (unsigned i = 0; i < skip; i++) {
			int ret;

			ret = node->read(tmp, size);
			fail_on_test(ret != size);
		}
		planes[0] = (__u8 *)tmp;
	}

	setupPlanes(fmt, planes);

	if (fmt.g_ycbcr_enc() == V4L2_YCBCR_ENC_DEFAULT) {
		switch (fmt.g_colorspace()) {
		case V4L2_COLORSPACE_REC709:
			fmt.s_ycbcr_enc(V4L2_YCBCR_ENC_709);
			break;
		case V4L2_COLORSPACE_SMPTE240M:
			fmt.s_ycbcr_enc(V4L2_YCBCR_ENC_SMPTE240M);
			break;
		case V4L2_COLORSPACE_BT2020:
			fmt.s_ycbcr_enc(V4L2_YCBCR_ENC_BT2020);
			break;
		default:
			fmt.s_ycbcr_enc(V4L2_YCBCR_ENC_601);
			break;
		}
	}

	unsigned h = fmt.g_height();
	unsigned w = fmt.g_width();
	unsigned color_cnt[3] = { 0, 0, 0 };
	v4l2_std_id std;
	bool is_50hz = false;
	unsigned total;

	if ((node->cur_io_caps & V4L2_IN_CAP_STD) &&
	    !node->g_std(std) && (std & V4L2_STD_625_50))
		is_50hz = true;

	total = w * h - (is_50hz ? w / 2 : 0);

	for (unsigned y = 0; y < h; y++) {
		/*
		 * 50 Hz (PAL/SECAM) formats have a garbage first half-line,
		 * so skip that.
		 */
		for (unsigned x = (y == 0 && is_50hz) ? w / 2 : 0; x < w; x++) {
			color c = { 0, 0, 0, 0 };

			getColor(fmt, planes, y, x, c);
			if (c.r > c.b && c.r > c.g)
				color_cnt[0]++;
			else if (c.g > c.r && c.g > c.b)
				color_cnt[1]++;
			else
				color_cnt[2]++;
		}
	}
	if (node->g_caps() & V4L2_CAP_STREAMING)
		q.free(node);
	else
		free(planes[0]);

	if (color_cnt[component] < total * perc / 100) {
		return fail("red: %u%% green: %u%% blue: %u%% expected: %s >= %u%%\n",
			color_cnt[0] * 100 / total,
			color_cnt[1] * 100 / total,
			color_cnt[2] * 100 / total,
			colors[component], perc);
	}
	return 0;
}

int testColorsAllFormats(struct node *node, unsigned component,
			 unsigned skip, unsigned perc)
{
	v4l2_fmtdesc fmtdesc;

	if (node->enum_fmt(fmtdesc, true))
		return 0;
	do {
		if (fmtdesc.flags & V4L2_FMT_FLAG_COMPRESSED)
			continue;
		switch (fmtdesc.pixelformat) {
		case V4L2_PIX_FMT_GREY:
		case V4L2_PIX_FMT_Y4:
		case V4L2_PIX_FMT_Y6:
		case V4L2_PIX_FMT_Y10:
		case V4L2_PIX_FMT_Y12:
		case V4L2_PIX_FMT_Y16:
		case V4L2_PIX_FMT_Y16_BE:
		case V4L2_PIX_FMT_Y10BPACK:
		case V4L2_PIX_FMT_PAL8:
		case V4L2_PIX_FMT_UV8:
			continue;
		}

		restoreFormat(node);

		cv4l_fmt fmt;
		node->g_fmt(fmt);
		fmt.s_pixelformat(fmtdesc.pixelformat);
		node->s_fmt(fmt);
		printf("\ttest %u%% %s for format %s: %s\n",
				perc, colors[component],
				fcc2s(fmt.g_pixelformat()).c_str(),
				ok(testColorsFmt(node, component, skip, perc)));
	} while (!node->enum_fmt(fmtdesc));
	printf("\n");
	return 0;
}

Privacy Policy