1 #ifndef __LINUX_OV511_H
2 #define __LINUX_OV511_H
3 
4 #include <asm/uaccess.h>
5 #include <linux/videodev.h>
6 #include <linux/smp_lock.h>
7 #include <linux/usb.h>
8 
9 #define OV511_DEBUG	/* Turn on debug messages */
10 
11 #ifdef OV511_DEBUG
12 	#define PDEBUG(level, fmt, args...) \
13 		if (debug >= (level)) info("[%s:%d] " fmt, \
14 		__PRETTY_FUNCTION__, __LINE__ , ## args)
15 #else
16 	#define PDEBUG(level, fmt, args...) do {} while(0)
17 #endif
18 
19 /* This macro restricts an int variable to an inclusive range */
20 #define RESTRICT_TO_RANGE(v,mi,ma) { \
21 	if ((v) < (mi)) (v) = (mi); \
22 	else if ((v) > (ma)) (v) = (ma); \
23 }
24 
25 /* --------------------------------- */
26 /* DEFINES FOR OV511 AND OTHER CHIPS */
27 /* --------------------------------- */
28 
29 /* USB IDs */
30 #define VEND_OMNIVISION	0x05A9
31 #define PROD_OV511	0x0511
32 #define PROD_OV511PLUS	0xA511
33 #define PROD_OV518	0x0518
34 #define PROD_OV518PLUS	0xA518
35 
36 #define VEND_MATTEL	0x0813
37 #define PROD_ME2CAM	0x0002
38 
39 /* --------------------------------- */
40 /*     OV51x REGISTER MNEMONICS      */
41 /* --------------------------------- */
42 
43 /* Camera interface register numbers */
44 #define R511_CAM_DELAY		0x10
45 #define R511_CAM_EDGE		0x11
46 #define R511_CAM_PXCNT		0x12
47 #define R511_CAM_LNCNT		0x13
48 #define R511_CAM_PXDIV		0x14
49 #define R511_CAM_LNDIV		0x15
50 #define R511_CAM_UV_EN		0x16
51 #define R511_CAM_LINE_MODE	0x17
52 #define R511_CAM_OPTS		0x18
53 
54 /* Snapshot mode camera interface register numbers */
55 #define R511_SNAP_FRAME		0x19
56 #define R511_SNAP_PXCNT		0x1A
57 #define R511_SNAP_LNCNT		0x1B
58 #define R511_SNAP_PXDIV		0x1C
59 #define R511_SNAP_LNDIV		0x1D
60 #define R511_SNAP_UV_EN		0x1E
61 #define R511_SNAP_OPTS		0x1F
62 
63 /* DRAM register numbers */
64 #define R511_DRAM_FLOW_CTL	0x20
65 #define R511_DRAM_ARCP		0x21
66 #define R511_DRAM_MRC		0x22
67 #define R511_DRAM_RFC		0x23
68 
69 /* ISO FIFO register numbers */
70 #define R51x_FIFO_PSIZE		0x30	/* 2 bytes wide w/ OV518(+) */
71 #define R511_FIFO_OPTS		0x31
72 
73 /* Parallel IO register numbers */
74 #define R511_PIO_OPTS		0x38
75 #define R511_PIO_DATA		0x39
76 #define R511_PIO_BIST		0x3E
77 #define R518_GPIO_IN		0x55	/* OV518(+) only */
78 #define R518_GPIO_OUT		0x56	/* OV518(+) only */
79 #define R518_GPIO_CTL		0x57	/* OV518(+) only */
80 #define R518_GPIO_PULSE_IN	0x58	/* OV518(+) only */
81 #define R518_GPIO_PULSE_CLEAR	0x59	/* OV518(+) only */
82 #define R518_GPIO_PULSE_POL	0x5a	/* OV518(+) only */
83 #define R518_GPIO_PULSE_EN	0x5b	/* OV518(+) only */
84 #define R518_GPIO_RESET		0x5c	/* OV518(+) only */
85 
86 /* I2C registers */
87 #define R511_I2C_CTL		0x40
88 #define R518_I2C_CTL		0x47	/* OV518(+) only */
89 #define R51x_I2C_W_SID		0x41
90 #define R51x_I2C_SADDR_3	0x42
91 #define R51x_I2C_SADDR_2	0x43
92 #define R51x_I2C_R_SID		0x44
93 #define R51x_I2C_DATA		0x45
94 #define R51x_I2C_CLOCK		0x46
95 #define R51x_I2C_TIMEOUT	0x47
96 
97 /* I2C snapshot registers */
98 #define R511_SI2C_SADDR_3	0x48
99 #define R511_SI2C_DATA		0x49
100 
101 /* System control registers */
102 #define R51x_SYS_RESET		0x50
103 		/* Reset type definitions */
104 #define 	OV511_RESET_UDC		0x01
105 #define 	OV511_RESET_I2C		0x02
106 #define 	OV511_RESET_FIFO	0x04
107 #define 	OV511_RESET_OMNICE	0x08
108 #define 	OV511_RESET_DRAM	0x10
109 #define 	OV511_RESET_CAM_INT	0x20
110 #define 	OV511_RESET_OV511	0x40
111 #define 	OV511_RESET_NOREGS	0x3F /* All but OV511 & regs */
112 #define 	OV511_RESET_ALL		0x7F
113 
114 #define R511_SYS_CLOCK_DIV	0x51
115 #define R51x_SYS_SNAP		0x52
116 #define R51x_SYS_INIT         	0x53
117 #define R511_SYS_PWR_CLK	0x54 /* OV511+/OV518(+) only */
118 #define R511_SYS_LED_CTL	0x55 /* OV511+ only */
119 #define R511_SYS_USER		0x5E
120 #define R511_SYS_CUST_ID	0x5F
121 
122 /* OmniCE (compression) registers */
123 #define R511_COMP_PHY		0x70
124 #define R511_COMP_PHUV		0x71
125 #define R511_COMP_PVY		0x72
126 #define R511_COMP_PVUV		0x73
127 #define R511_COMP_QHY		0x74
128 #define R511_COMP_QHUV		0x75
129 #define R511_COMP_QVY		0x76
130 #define R511_COMP_QVUV		0x77
131 #define R511_COMP_EN		0x78
132 #define R511_COMP_LUT_EN	0x79
133 #define R511_COMP_LUT_BEGIN	0x80
134 
135 /* --------------------------------- */
136 /*         ALTERNATE NUMBERS         */
137 /* --------------------------------- */
138 
139 /* Alternate numbers for various max packet sizes (OV511 only) */
140 #define OV511_ALT_SIZE_992	0
141 #define OV511_ALT_SIZE_993	1
142 #define OV511_ALT_SIZE_768	2
143 #define OV511_ALT_SIZE_769	3
144 #define OV511_ALT_SIZE_512	4
145 #define OV511_ALT_SIZE_513	5
146 #define OV511_ALT_SIZE_257	6
147 #define OV511_ALT_SIZE_0	7
148 
149 /* Alternate numbers for various max packet sizes (OV511+ only) */
150 #define OV511PLUS_ALT_SIZE_0	0
151 #define OV511PLUS_ALT_SIZE_33	1
152 #define OV511PLUS_ALT_SIZE_129	2
153 #define OV511PLUS_ALT_SIZE_257	3
154 #define OV511PLUS_ALT_SIZE_385	4
155 #define OV511PLUS_ALT_SIZE_513	5
156 #define OV511PLUS_ALT_SIZE_769	6
157 #define OV511PLUS_ALT_SIZE_961	7
158 
159 /* Alternate numbers for various max packet sizes (OV518(+) only) */
160 #define OV518_ALT_SIZE_0	0
161 #define OV518_ALT_SIZE_128	1
162 #define OV518_ALT_SIZE_256	2
163 #define OV518_ALT_SIZE_384	3
164 #define OV518_ALT_SIZE_512	4
165 #define OV518_ALT_SIZE_640	5
166 #define OV518_ALT_SIZE_768	6
167 #define OV518_ALT_SIZE_896	7
168 
169 /* --------------------------------- */
170 /*     OV7610 REGISTER MNEMONICS     */
171 /* --------------------------------- */
172 
173 /* OV7610 registers */
174 #define OV7610_REG_GAIN          0x00	/* gain setting (5:0) */
175 #define OV7610_REG_BLUE          0x01	/* blue channel balance */
176 #define OV7610_REG_RED           0x02	/* red channel balance */
177 #define OV7610_REG_SAT           0x03	/* saturation */
178 					/* 04 reserved */
179 #define OV7610_REG_CNT           0x05	/* Y contrast */
180 #define OV7610_REG_BRT           0x06	/* Y brightness */
181 					/* 08-0b reserved */
182 #define OV7610_REG_BLUE_BIAS     0x0C	/* blue channel bias (5:0) */
183 #define OV7610_REG_RED_BIAS      0x0D	/* read channel bias (5:0) */
184 #define OV7610_REG_GAMMA_COEFF   0x0E	/* gamma settings */
185 #define OV7610_REG_WB_RANGE      0x0F	/* AEC/ALC/S-AWB settings */
186 #define OV7610_REG_EXP           0x10	/* manual exposure setting */
187 #define OV7610_REG_CLOCK         0x11	/* polarity/clock prescaler */
188 #define OV7610_REG_COM_A         0x12	/* misc common regs */
189 #define OV7610_REG_COM_B         0x13	/* misc common regs */
190 #define OV7610_REG_COM_C         0x14	/* misc common regs */
191 #define OV7610_REG_COM_D         0x15	/* misc common regs */
192 #define OV7610_REG_FIELD_DIVIDE  0x16	/* field interval/mode settings */
193 #define OV7610_REG_HWIN_START    0x17	/* horizontal window start */
194 #define OV7610_REG_HWIN_END      0x18	/* horizontal window end */
195 #define OV7610_REG_VWIN_START    0x19	/* vertical window start */
196 #define OV7610_REG_VWIN_END      0x1A	/* vertical window end */
197 #define OV7610_REG_PIXEL_SHIFT   0x1B	/* pixel shift */
198 #define OV7610_REG_ID_HIGH       0x1C	/* manufacturer ID MSB */
199 #define OV7610_REG_ID_LOW        0x1D	/* manufacturer ID LSB */
200 					/* 0e-0f reserved */
201 #define OV7610_REG_COM_E         0x20	/* misc common regs */
202 #define OV7610_REG_YOFFSET       0x21	/* Y channel offset */
203 #define OV7610_REG_UOFFSET       0x22	/* U channel offset */
204 					/* 23 reserved */
205 #define OV7610_REG_ECW           0x24	/* Exposure white level for AEC */
206 #define OV7610_REG_ECB           0x25	/* Exposure black level for AEC */
207 #define OV7610_REG_COM_F         0x26	/* misc settings */
208 #define OV7610_REG_COM_G         0x27	/* misc settings */
209 #define OV7610_REG_COM_H         0x28	/* misc settings */
210 #define OV7610_REG_COM_I         0x29	/* misc settings */
211 #define OV7610_REG_FRAMERATE_H   0x2A	/* frame rate MSB + misc */
212 #define OV7610_REG_FRAMERATE_L   0x2B	/* frame rate LSB */
213 #define OV7610_REG_ALC           0x2C	/* Auto Level Control settings */
214 #define OV7610_REG_COM_J         0x2D	/* misc settings */
215 #define OV7610_REG_VOFFSET       0x2E	/* V channel offset adjustment */
216 #define OV7610_REG_ARRAY_BIAS	 0x2F	/* Array bias -- don't change */
217 					/* 30-32 reserved */
218 #define OV7610_REG_YGAMMA        0x33	/* misc gamma settings (7:6) */
219 #define OV7610_REG_BIAS_ADJUST   0x34	/* misc bias settings */
220 #define OV7610_REG_COM_L         0x35	/* misc settings */
221 					/* 36-37 reserved */
222 #define OV7610_REG_COM_K         0x38	/* misc registers */
223 
224 /* --------------------------------- */
225 /*           I2C ADDRESSES           */
226 /* --------------------------------- */
227 
228 #define OV7xx0_SID   0x42
229 #define OV6xx0_SID   0xC0
230 #define OV8xx0_SID   0xA0
231 #define KS0127_SID   0xD8
232 #define SAA7111A_SID 0x48
233 
234 /* --------------------------------- */
235 /*       MISCELLANEOUS DEFINES       */
236 /* --------------------------------- */
237 
238 #define I2C_CLOCK_PRESCALER 	0x03
239 
240 #define FRAMES_PER_DESC		10	/* FIXME - What should this be? */
241 #define MAX_FRAME_SIZE_PER_DESC	993	/* For statically allocated stuff */
242 #define PIXELS_PER_SEG		256	/* Pixels per segment */
243 
244 #define OV511_ENDPOINT_ADDRESS	1	/* Isoc endpoint number */
245 
246 #define OV511_NUMFRAMES	2
247 #if OV511_NUMFRAMES > VIDEO_MAX_FRAME
248 	#error "OV511_NUMFRAMES is too high"
249 #endif
250 
251 #define OV511_NUMSBUF		2
252 
253 /* Control transfers use up to 4 bytes */
254 #define OV511_CBUF_SIZE		4
255 
256 /* Size of usb_make_path() buffer */
257 #define OV511_USB_PATH_LEN	64
258 
259 /* Bridge types */
260 enum {
261 	BRG_UNKNOWN,
262 	BRG_OV511,
263 	BRG_OV511PLUS,
264 	BRG_OV518,
265 	BRG_OV518PLUS,
266 };
267 
268 /* Bridge classes */
269 enum {
270 	BCL_UNKNOWN,
271 	BCL_OV511,
272 	BCL_OV518,
273 };
274 
275 /* Sensor types */
276 enum {
277 	SEN_UNKNOWN,
278 	SEN_OV76BE,
279 	SEN_OV7610,
280 	SEN_OV7620,
281 	SEN_OV7620AE,
282 	SEN_OV6620,
283 	SEN_OV6630,
284 	SEN_OV6630AE,
285 	SEN_OV6630AF,
286 	SEN_OV8600,
287 	SEN_KS0127,
288 	SEN_KS0127B,
289 	SEN_SAA7111A,
290 };
291 
292 enum {
293 	STATE_SCANNING,		/* Scanning for start */
294 	STATE_HEADER,		/* Parsing header */
295 	STATE_LINES,		/* Parsing lines */
296 };
297 
298 /* Buffer states */
299 enum {
300 	BUF_NOT_ALLOCATED,
301 	BUF_ALLOCATED,
302 };
303 
304 /* --------- Definition of ioctl interface --------- */
305 
306 #define OV511_INTERFACE_VER 101
307 
308 /* LED options */
309 enum {
310 	LED_OFF,
311 	LED_ON,
312 	LED_AUTO,
313 };
314 
315 /* Raw frame formats */
316 enum {
317 	RAWFMT_INVALID,
318 	RAWFMT_YUV400,
319 	RAWFMT_YUV420,
320 	RAWFMT_YUV422,
321 	RAWFMT_GBR422,
322 };
323 
324 /* Unsigned short option numbers */
325 enum {
326 	OV511_USOPT_INVALID,
327 	OV511_USOPT_BRIGHT,
328 	OV511_USOPT_SAT,
329 	OV511_USOPT_HUE,
330 	OV511_USOPT_CONTRAST,
331 };
332 
333 /* Unsigned int option numbers */
334 enum {
335 	OV511_UIOPT_INVALID,
336 	OV511_UIOPT_POWER_FREQ,
337 	OV511_UIOPT_BFILTER,
338 	OV511_UIOPT_LED,
339 	OV511_UIOPT_DEBUG,
340 	OV511_UIOPT_COMPRESS,
341 };
342 
343 struct ov511_ushort_opt {
344 	int optnum;		/* Specific option number */
345 	unsigned short val;
346 };
347 
348 struct ov511_uint_opt {
349 	int optnum;		/* Specific option number */
350 	unsigned int val;
351 };
352 
353 struct ov511_i2c_struct {
354 	unsigned char slave; /* Write slave ID (read ID - 1) */
355 	unsigned char reg;   /* Index of register */
356 	unsigned char value; /* User sets this w/ write, driver does w/ read */
357 	unsigned char mask;  /* Bits to be changed. Not used with read ops */
358 };
359 
360 /* ioctls */
361 #define OV511IOC_GINTVER  _IOR('v', BASE_VIDIOCPRIVATE + 0, int)
362 #define OV511IOC_GUSHORT _IOWR('v', BASE_VIDIOCPRIVATE + 1, \
363 			       struct ov511_ushort_opt)
364 #define OV511IOC_SUSHORT  _IOW('v', BASE_VIDIOCPRIVATE + 2, \
365 			       struct ov511_ushort_opt)
366 #define OV511IOC_GUINT   _IOWR('v', BASE_VIDIOCPRIVATE + 3, \
367 			       struct ov511_uint_opt)
368 #define OV511IOC_SUINT    _IOW('v', BASE_VIDIOCPRIVATE + 4, \
369 			       struct ov511_uint_opt)
370 #define OV511IOC_WI2C     _IOW('v', BASE_VIDIOCPRIVATE + 5, \
371 			       struct ov511_i2c_struct)
372 #define OV511IOC_RI2C    _IOWR('v', BASE_VIDIOCPRIVATE + 6, \
373 			       struct ov511_i2c_struct)
374 /* ------------- End IOCTL interface -------------- */
375 
376 struct usb_ov511;		/* Forward declaration */
377 
378 struct ov511_sbuf {
379 	struct usb_ov511 *ov;
380 	unsigned char *data;
381 	struct urb *urb;
382 	spinlock_t lock;
383 	int n;
384 };
385 
386 enum {
387 	FRAME_UNUSED,		/* Unused (no MCAPTURE) */
388 	FRAME_READY,		/* Ready to start grabbing */
389 	FRAME_GRABBING,		/* In the process of being grabbed into */
390 	FRAME_DONE,		/* Finished grabbing, but not been synced yet */
391 	FRAME_ERROR,		/* Something bad happened while processing */
392 };
393 
394 struct ov511_regvals {
395 	enum {
396 		OV511_DONE_BUS,
397 		OV511_REG_BUS,
398 		OV511_I2C_BUS,
399 	} bus;
400 	unsigned char reg;
401 	unsigned char val;
402 };
403 
404 struct ov511_frame {
405 	int framenum;		/* Index of this frame */
406 	unsigned char *data;	/* Frame buffer */
407 	unsigned char *tempdata; /* Temp buffer for multi-stage conversions */
408 	unsigned char *rawdata;	/* Raw camera data buffer */
409 	unsigned char *compbuf;	/* Temp buffer for decompressor */
410 
411 	int depth;		/* Bytes per pixel */
412 	int width;		/* Width application is expecting */
413 	int height;		/* Height application is expecting */
414 
415 	int rawwidth;		/* Actual width of frame sent from camera */
416 	int rawheight;		/* Actual height of frame sent from camera */
417 
418 	int sub_flag;		/* Sub-capture mode for this frame? */
419 	unsigned int format;	/* Format for this frame */
420 	int compressed;		/* Is frame compressed? */
421 
422 	volatile int grabstate;	/* State of grabbing */
423 	int scanstate;		/* State of scanning */
424 
425 	int bytes_recvd;	/* Number of image bytes received from camera */
426 
427 	long bytes_read;	/* Amount that has been read() */
428 
429 	wait_queue_head_t wq;	/* Processes waiting */
430 
431 	int snapshot;		/* True if frame was a snapshot */
432 };
433 
434 #define DECOMP_INTERFACE_VER 4
435 
436 /* Compression module operations */
437 struct ov51x_decomp_ops {
438 	int (*decomp_400)(unsigned char *, unsigned char *, unsigned char *,
439 			  int, int, int);
440 	int (*decomp_420)(unsigned char *, unsigned char *, unsigned char *,
441 			  int, int, int);
442 	int (*decomp_422)(unsigned char *, unsigned char *, unsigned char *,
443 			  int, int, int);
444 	struct module *owner;
445 };
446 
447 struct usb_ov511 {
448 	struct video_device vdev;
449 
450 	/* Device structure */
451 	struct usb_device *dev;
452 
453 	int customid;
454 	char *desc;
455 	unsigned char iface;
456 	char usb_path[OV511_USB_PATH_LEN];
457 
458 	/* Determined by sensor type */
459 	int maxwidth;
460 	int maxheight;
461 	int minwidth;
462 	int minheight;
463 
464 	int brightness;
465 	int colour;
466 	int contrast;
467 	int hue;
468 	int whiteness;
469 	int exposure;
470 	int auto_brt;		/* Auto brightness enabled flag */
471 	int auto_gain;		/* Auto gain control enabled flag */
472 	int auto_exp;		/* Auto exposure enabled flag */
473 	int backlight;		/* Backlight exposure algorithm flag */
474 	int mirror;		/* Image is reversed horizontally */
475 
476 	int led_policy;		/* LED: off|on|auto; OV511+ only */
477 
478 	struct semaphore lock;	/* Serializes user-accessible operations */
479 	int user;		/* user count for exclusive use */
480 
481 	int streaming;		/* Are we streaming Isochronous? */
482 	int grabbing;		/* Are we grabbing? */
483 
484 	int compress;		/* Should the next frame be compressed? */
485 	int compress_inited;	/* Are compression params uploaded? */
486 
487 	int lightfreq;		/* Power (lighting) frequency */
488 	int bandfilt;		/* Banding filter enabled flag */
489 
490 	unsigned char *fbuf;	/* Videodev buffer area */
491 	unsigned char *tempfbuf; /* Temporary (intermediate) buffer area */
492 	unsigned char *rawfbuf;	/* Raw camera data buffer area */
493 
494 	int sub_flag;		/* Pix Array subcapture on flag */
495 	int subx;		/* Pix Array subcapture x offset */
496 	int suby;		/* Pix Array subcapture y offset */
497 	int subw;		/* Pix Array subcapture width */
498 	int subh;		/* Pix Array subcapture height */
499 
500 	int curframe;		/* Current receiving sbuf */
501 	struct ov511_frame frame[OV511_NUMFRAMES];
502 
503 	struct ov511_sbuf sbuf[OV511_NUMSBUF];
504 
505 	wait_queue_head_t wq;	/* Processes waiting */
506 
507 	int snap_enabled;	/* Snapshot mode enabled */
508 
509 	int bridge;		/* Type of bridge (BRG_*) */
510 	int bclass;		/* Class of bridge (BCL_*) */
511 	int sensor;		/* Type of image sensor chip (SEN_*) */
512 
513 	int packet_size;	/* Frame size per isoc desc */
514 	int packet_numbering;	/* Is ISO frame numbering enabled? */
515 
516 	struct semaphore param_lock;	/* params lock for this camera */
517 
518 	/* /proc entries, relative to /proc/video/ov511/ */
519 	struct proc_dir_entry *proc_devdir;   /* Per-device proc directory */
520 	struct proc_dir_entry *proc_info;     /* <minor#>/info entry */
521 	struct proc_dir_entry *proc_button;   /* <minor#>/button entry */
522 	struct proc_dir_entry *proc_control;  /* <minor#>/control entry */
523 
524 	/* Framebuffer/sbuf management */
525 	int buf_state;
526 	struct semaphore buf_lock;
527 
528 	struct ov51x_decomp_ops *decomp_ops;
529 
530 	/* Stop streaming while changing picture settings */
531 	int stop_during_set;
532 
533 	int stopped;		/* Streaming is temporarily paused */
534 
535 	/* Video decoder stuff */
536 	int input;		/* Composite, S-VIDEO, etc... */
537 	int num_inputs;		/* Number of inputs */
538 	int norm; 		/* NTSC / PAL / SECAM */
539 	int has_decoder;	/* Device has a video decoder */
540 	int pal;		/* Device is designed for PAL resolution */
541 
542 	/* I2C interface */
543 	struct semaphore i2c_lock;	  /* Protect I2C controller regs */
544 	unsigned char primary_i2c_slave;  /* I2C write id of sensor */
545 
546 	/* Control transaction stuff */
547 	unsigned char *cbuf;		/* Buffer for payload */
548 	struct semaphore cbuf_lock;
549 };
550 
551 /* Used to represent a list of values and their respective symbolic names */
552 struct symbolic_list {
553 	int num;
554 	char *name;
555 };
556 
557 #define NOT_DEFINED_STR "Unknown"
558 
559 /* Returns the name of the matching element in the symbolic_list array. The
560  * end of the list must be marked with an element that has a NULL name.
561  */
562 static inline char *
symbolic(struct symbolic_list list[],int num)563 symbolic(struct symbolic_list list[], int num)
564 {
565 	int i;
566 
567 	for (i = 0; list[i].name != NULL; i++)
568 			if (list[i].num == num)
569 				return (list[i].name);
570 
571 	return (NOT_DEFINED_STR);
572 }
573 
574 /* Compression stuff */
575 
576 #define OV511_QUANTABLESIZE	64
577 #define OV518_QUANTABLESIZE	32
578 
579 #define OV511_YQUANTABLE { \
580 	0, 1, 1, 2, 2, 3, 3, 4, \
581 	1, 1, 1, 2, 2, 3, 4, 4, \
582 	1, 1, 2, 2, 3, 4, 4, 4, \
583 	2, 2, 2, 3, 4, 4, 4, 4, \
584 	2, 2, 3, 4, 4, 5, 5, 5, \
585 	3, 3, 4, 4, 5, 5, 5, 5, \
586 	3, 4, 4, 4, 5, 5, 5, 5, \
587 	4, 4, 4, 4, 5, 5, 5, 5  \
588 }
589 
590 #define OV511_UVQUANTABLE { \
591 	0, 2, 2, 3, 4, 4, 4, 4, \
592 	2, 2, 2, 4, 4, 4, 4, 4, \
593 	2, 2, 3, 4, 4, 4, 4, 4, \
594 	3, 4, 4, 4, 4, 4, 4, 4, \
595 	4, 4, 4, 4, 4, 4, 4, 4, \
596 	4, 4, 4, 4, 4, 4, 4, 4, \
597 	4, 4, 4, 4, 4, 4, 4, 4, \
598 	4, 4, 4, 4, 4, 4, 4, 4  \
599 }
600 
601 #define OV518_YQUANTABLE { \
602 	5, 4, 5, 6, 6, 7, 7, 7, \
603 	5, 5, 5, 5, 6, 7, 7, 7, \
604 	6, 6, 6, 6, 7, 7, 7, 8, \
605 	7, 7, 6, 7, 7, 7, 8, 8  \
606 }
607 
608 #define OV518_UVQUANTABLE { \
609 	6, 6, 6, 7, 7, 7, 7, 7, \
610 	6, 6, 6, 7, 7, 7, 7, 7, \
611 	6, 6, 6, 7, 7, 7, 7, 8, \
612 	7, 7, 7, 7, 7, 7, 8, 8  \
613 }
614 
615 #endif
616