zoran.rst 20 KB
Newer Older
1 2
.. SPDX-License-Identifier: GPL-2.0

3 4 5 6 7
The Zoran driver
================

unified zoran driver (zr360x7, zoran, buz, dc10(+), dc30(+), lml33)

Linus Torvalds's avatar
Linus Torvalds committed
8 9 10
website: http://mjpeg.sourceforge.net/driver-zoran/


11 12
Frequently Asked Questions
--------------------------
Linus Torvalds's avatar
Linus Torvalds committed
13

14 15
What cards are supported
------------------------
Linus Torvalds's avatar
Linus Torvalds committed
16 17 18 19

Iomega Buz, Linux Media Labs LML33/LML33R10, Pinnacle/Miro
DC10/DC10+/DC30/DC30+ and related boards (available under various names).

20 21 22
Iomega Buz
~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
23 24 25 26
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7111 TV decoder
* Philips saa7185 TV encoder
27

Linus Torvalds's avatar
Linus Torvalds committed
28
Drivers to use: videodev, i2c-core, i2c-algo-bit,
29 30
videocodec, saa7111, saa7185, zr36060, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
31
Inputs/outputs: Composite and S-video
32

Linus Torvalds's avatar
Linus Torvalds committed
33
Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
34

Linus Torvalds's avatar
Linus Torvalds committed
35 36
Card number: 7

37 38 39
AverMedia 6 Eyes AVS6EYES
~~~~~~~~~~~~~~~~~~~~~~~~~

40 41 42 43
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Samsung ks0127 TV decoder
* Conexant bt866  TV encoder
44

45
Drivers to use: videodev, i2c-core, i2c-algo-bit,
46 47 48 49 50 51 52 53
videocodec, ks0127, bt866, zr36060, zr36067

Inputs/outputs:
	Six physical inputs. 1-6 are composite,
	1-2, 3-4, 5-6 doubles as S-video,
	1-3 triples as component.
	One composite output.

54
Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
55

56 57
Card number: 8

58 59 60 61 62 63 64
.. note::

   Not autodetected, card=8 is necessary.

Linux Media Labs LML33
~~~~~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
65 66 67 68
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Brooktree bt819 TV decoder
* Brooktree bt856 TV encoder
69

Linus Torvalds's avatar
Linus Torvalds committed
70
Drivers to use: videodev, i2c-core, i2c-algo-bit,
71 72
videocodec, bt819, bt856, zr36060, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
73
Inputs/outputs: Composite and S-video
74

Linus Torvalds's avatar
Linus Torvalds committed
75
Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
76

Linus Torvalds's avatar
Linus Torvalds committed
77 78
Card number: 5

79 80 81
Linux Media Labs LML33R10
~~~~~~~~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
82 83 84 85
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7114 TV decoder
* Analog Devices adv7170 TV encoder
86

Linus Torvalds's avatar
Linus Torvalds committed
87
Drivers to use: videodev, i2c-core, i2c-algo-bit,
88 89
videocodec, saa7114, adv7170, zr36060, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
90
Inputs/outputs: Composite and S-video
91

Linus Torvalds's avatar
Linus Torvalds committed
92
Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
93

Linus Torvalds's avatar
Linus Torvalds committed
94 95
Card number: 6

96 97 98
Pinnacle/Miro DC10(new)
~~~~~~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
99 100 101 102
* Zoran zr36057 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7110a TV decoder
* Analog Devices adv7176 TV encoder
103

Linus Torvalds's avatar
Linus Torvalds committed
104
Drivers to use: videodev, i2c-core, i2c-algo-bit,
105 106
videocodec, saa7110, adv7175, zr36060, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
107
Inputs/outputs: Composite, S-video and Internal
108

Linus Torvalds's avatar
Linus Torvalds committed
109
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
110

Linus Torvalds's avatar
Linus Torvalds committed
111 112
Card number: 1

113 114 115
Pinnacle/Miro DC10+
~~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
116 117 118 119
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7110a TV decoder
* Analog Devices adv7176 TV encoder
120

Linus Torvalds's avatar
Linus Torvalds committed
121
Drivers to use: videodev, i2c-core, i2c-algo-bit,
122 123
videocodec, sa7110, adv7175, zr36060, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
124
Inputs/outputs: Composite, S-video and Internal
125

Linus Torvalds's avatar
Linus Torvalds committed
126
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
127

Linus Torvalds's avatar
Linus Torvalds committed
128 129
Card number: 2

130 131 132
Pinnacle/Miro DC10(old)
~~~~~~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
133 134 135 136
* Zoran zr36057 PCI controller
* Zoran zr36050 MJPEG codec
* Zoran zr36016 Video Front End or Fuji md0211 Video Front End (clone?)
* Micronas vpx3220a TV decoder
137 138
* mse3000 TV encoder or Analog Devices adv7176 TV encoder

Linus Torvalds's avatar
Linus Torvalds committed
139
Drivers to use: videodev, i2c-core, i2c-algo-bit,
140 141
videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
142
Inputs/outputs: Composite, S-video and Internal
143

Linus Torvalds's avatar
Linus Torvalds committed
144
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
145

Linus Torvalds's avatar
Linus Torvalds committed
146 147
Card number: 0

148 149 150
Pinnacle/Miro DC30
~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
151 152 153 154 155
* Zoran zr36057 PCI controller
* Zoran zr36050 MJPEG codec
* Zoran zr36016 Video Front End
* Micronas vpx3225d/vpx3220a/vpx3216b TV decoder
* Analog Devices adv7176 TV encoder
156

Linus Torvalds's avatar
Linus Torvalds committed
157
Drivers to use: videodev, i2c-core, i2c-algo-bit,
158 159
videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
160
Inputs/outputs: Composite, S-video and Internal
161

Linus Torvalds's avatar
Linus Torvalds committed
162
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
163

Linus Torvalds's avatar
Linus Torvalds committed
164 165
Card number: 3

166 167 168
Pinnacle/Miro DC30+
~~~~~~~~~~~~~~~~~~~

Linus Torvalds's avatar
Linus Torvalds committed
169 170 171 172 173
* Zoran zr36067 PCI controller
* Zoran zr36050 MJPEG codec
* Zoran zr36016 Video Front End
* Micronas vpx3225d/vpx3220a/vpx3216b TV decoder
* Analog Devices adv7176 TV encoder
174

Linus Torvalds's avatar
Linus Torvalds committed
175
Drivers to use: videodev, i2c-core, i2c-algo-bit,
176 177
videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36015, zr36067

Linus Torvalds's avatar
Linus Torvalds committed
178
Inputs/outputs: Composite, S-video and Internal
179

Linus Torvalds's avatar
Linus Torvalds committed
180
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
181

Linus Torvalds's avatar
Linus Torvalds committed
182 183
Card number: 4

184
.. note::
Linus Torvalds's avatar
Linus Torvalds committed
185

186 187
   #) No module for the mse3000 is available yet
   #) No module for the vpx3224 is available yet
Linus Torvalds's avatar
Linus Torvalds committed
188 189

1.1 What the TV decoder can do an what not
190
------------------------------------------
Linus Torvalds's avatar
Linus Torvalds committed
191 192 193

The best know TV standards are NTSC/PAL/SECAM. but for decoding a frame that
information is not enough. There are several formats of the TV standards.
194 195 196
And not every TV decoder is able to handle every format. Also the every
combination is supported by the driver. There are currently 11 different
tv broadcast formats all aver the world.
Linus Torvalds's avatar
Linus Torvalds committed
197

198
The CCIR defines parameters needed for broadcasting the signal.
Linus Torvalds's avatar
Linus Torvalds committed
199
The CCIR has defined different standards: A,B,D,E,F,G,D,H,I,K,K1,L,M,N,...
200
The CCIR says not much about the colorsystem used !!!
Linus Torvalds's avatar
Linus Torvalds committed
201 202 203 204 205 206
And talking about a colorsystem says not to much about how it is broadcast.

The CCIR standards A,E,F are not used any more.

When you speak about NTSC, you usually mean the standard: CCIR - M using
the NTSC colorsystem which is used in the USA, Japan, Mexico, Canada
207
and a few others.
Linus Torvalds's avatar
Linus Torvalds committed
208 209

When you talk about PAL, you usually mean: CCIR - B/G using the PAL
210
colorsystem which is used in many Countries.
Linus Torvalds's avatar
Linus Torvalds committed
211

212
When you talk about SECAM, you mean: CCIR - L using the SECAM Colorsystem
Linus Torvalds's avatar
Linus Torvalds committed
213 214 215
which is used in France, and a few others.

There the other version of SECAM, CCIR - D/K is used in Bulgaria, China,
216
Slovakai, Hungary, Korea (Rep.), Poland, Rumania and a others.
Linus Torvalds's avatar
Linus Torvalds committed
217

218
The CCIR - H uses the PAL colorsystem (sometimes SECAM) and is used in
Linus Torvalds's avatar
Linus Torvalds committed
219 220 221 222 223 224 225 226 227 228
Egypt, Libya, Sri Lanka, Syrain Arab. Rep.

The CCIR - I uses the PAL colorsystem, and is used in Great Britain, Hong Kong,
Ireland, Nigeria, South Africa.

The CCIR - N uses the PAL colorsystem and PAL frame size but the NTSC framerate,
and is used in Argentinia, Uruguay, an a few others

We do not talk about how the audio is broadcast !

229
A rather good sites about the TV standards are:
230
http://www.sony.jp/support/
Linus Torvalds's avatar
Linus Torvalds committed
231 232 233 234 235
http://info.electronicwerkstatt.de/bereiche/fernsehtechnik/frequenzen_und_normen/Fernsehnormen/
and http://www.cabl.com/restaurant/channel.html

Other weird things around: NTSC 4.43 is a modificated NTSC, which is mainly
used in PAL VCR's that are able to play back NTSC. PAL 60 seems to be the same
236 237
as NTSC 4.43 . The Datasheets also talk about NTSC 44, It seems as if it would
be the same as NTSC 4.43.
Linus Torvalds's avatar
Linus Torvalds committed
238 239 240 241 242 243
NTSC Combs seems to be a decoder mode where the decoder uses a comb filter
to split coma and luma instead of a Delay line.

But I did not defiantly find out what NTSC Comb is.

Philips saa7111 TV decoder
244 245 246 247
~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1997, is used in the BUZ and
- can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC N, NTSC 4.43 and SECAM
Linus Torvalds's avatar
Linus Torvalds committed
248 249

Philips saa7110a TV decoder
250 251 252 253
~~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1995, is used in the Pinnacle/Miro DC10(new), DC10+ and
- can handle: PAL B/G, NTSC M and SECAM
Linus Torvalds's avatar
Linus Torvalds committed
254 255

Philips saa7114 TV decoder
256 257 258 259
~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 2000, is used in the LML33R10 and
- can handle: PAL B/G/D/H/I/N, PAL N, PAL M, NTSC M, NTSC 4.43 and SECAM
Linus Torvalds's avatar
Linus Torvalds committed
260 261

Brooktree bt819 TV decoder
262 263 264 265
~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1996, and is used in the LML33 and
- can handle: PAL B/D/G/H/I, NTSC M
Linus Torvalds's avatar
Linus Torvalds committed
266 267

Micronas vpx3220a TV decoder
268 269 270 271
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1996, is used in the DC30 and DC30+ and
- can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC 44, PAL 60, SECAM,NTSC Comb
Linus Torvalds's avatar
Linus Torvalds committed
272

273
Samsung ks0127 TV decoder
274
~~~~~~~~~~~~~~~~~~~~~~~~~
275

276 277
- is used in the AVS6EYES card and
- can handle: NTSC-M/N/44, PAL-M/N/B/G/H/I/D/K/L and SECAM
Linus Torvalds's avatar
Linus Torvalds committed
278

279 280 281

What the TV encoder can do an what not
--------------------------------------
Linus Torvalds's avatar
Linus Torvalds committed
282 283 284 285 286 287 288

The TV encoder are doing the "same" as the decoder, but in the oder direction.
You feed them digital data and the generate a Composite or SVHS signal.
For information about the colorsystems and TV norm take a look in the
TV decoder section.

Philips saa7185 TV Encoder
289 290 291 292
~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1996, is used in the BUZ
- can generate: PAL B/G, NTSC M
Linus Torvalds's avatar
Linus Torvalds committed
293 294

Brooktree bt856 TV Encoder
295 296 297 298
~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1994, is used in the LML33
- can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL-N (Argentina)
Linus Torvalds's avatar
Linus Torvalds committed
299 300

Analog Devices adv7170 TV Encoder
301 302 303 304
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 2000, is used in the LML300R10
- can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL 60
Linus Torvalds's avatar
Linus Torvalds committed
305 306

Analog Devices adv7175 TV Encoder
307 308 309 310
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1996, is used in the DC10, DC10+, DC10 old, DC30, DC30+
- can generate: PAL B/D/G/H/I/N, PAL M, NTSC M
Linus Torvalds's avatar
Linus Torvalds committed
311 312

ITT mse3000 TV encoder
313 314 315 316
~~~~~~~~~~~~~~~~~~~~~~

- was introduced in 1991, is used in the DC10 old
- can generate: PAL , NTSC , SECAM
Linus Torvalds's avatar
Linus Torvalds committed
317

318
Conexant bt866 TV encoder
319 320 321 322
~~~~~~~~~~~~~~~~~~~~~~~~~

- is used in AVS6EYES, and
- can generate: NTSC/PAL, PAL­M, PAL­N
323

324
The adv717x, should be able to produce PAL N. But you find nothing PAL N
325
specific in the registers. Seem that you have to reuse a other standard
326
to generate PAL N, maybe it would work if you use the PAL M settings.
Linus Torvalds's avatar
Linus Torvalds committed
327

328 329
How do I get this damn thing to work
------------------------------------
Linus Torvalds's avatar
Linus Torvalds committed
330 331 332 333 334

Load zr36067.o. If it can't autodetect your card, use the card=X insmod
option with X being the card number as given in the previous section.
To have more than one card, use card=X1[,X2[,X3,[X4[..]]]]

335
To automate this, add the following to your /etc/modprobe.d/zoran.conf:
Linus Torvalds's avatar
Linus Torvalds committed
336 337 338 339 340 341 342 343 344 345 346 347

options zr36067 card=X1[,X2[,X3[,X4[..]]]]
alias char-major-81-0 zr36067

One thing to keep in mind is that this doesn't load zr36067.o itself yet. It
just automates loading. If you start using xawtv, the device won't load on
some systems, since you're trying to load modules as a user, which is not
allowed ("permission denied"). A quick workaround is to add 'Load "v4l"' to
XF86Config-4 when you use X by default, or to run 'v4l-conf -c <device>' in
one of your startup scripts (normally rc.local) if you don't use X. Both
make sure that the modules are loaded on startup, under the root account.

348 349
What mainboard should I use (or why doesn't my card work)
---------------------------------------------------------
Linus Torvalds's avatar
Linus Torvalds committed
350 351 352 353 354 355 356 357


<insert lousy disclaimer here>. In short: good=SiS/Intel, bad=VIA.

Experience tells us that people with a Buz, on average, have more problems
than users with a DC10+/LML33. Also, it tells us that people owning a VIA-
based mainboard (ktXXX, MVP3) have more problems than users with a mainboard
based on a different chipset. Here's some notes from Andrew Stevens:
358

Linus Torvalds's avatar
Linus Torvalds committed
359 360
Here's my experience of using LML33 and Buz on various motherboards:

361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
- VIA MVP3
	- Forget it. Pointless. Doesn't work.
- Intel 430FX (Pentium 200)
	- LML33 perfect, Buz tolerable (3 or 4 frames dropped per movie)
- Intel 440BX (early stepping)
	- LML33 tolerable. Buz starting to get annoying (6-10 frames/hour)
- Intel 440BX (late stepping)
	- Buz tolerable, LML3 almost perfect (occasional single frame drops)
- SiS735
	- LML33 perfect, Buz tolerable.
- VIA KT133(*)
	- LML33 starting to get annoying, Buz poor enough that I have up.

- Both 440BX boards were dual CPU versions.

Linus Torvalds's avatar
Linus Torvalds committed
376
Bernhard Praschinger later added:
377 378 379 380 381 382

- AMD 751
	- Buz perfect-tolerable
- AMD 760
	- Buz perfect-tolerable

Linus Torvalds's avatar
Linus Torvalds committed
383 384 385 386 387 388 389 390 391 392 393 394 395 396
In general, people on the user mailinglist won't give you much of a chance
if you have a VIA-based motherboard. They may be cheap, but sometimes, you'd
rather want to spend some more money on better boards. In general, VIA
mainboard's IDE/PCI performance will also suck badly compared to others.
You'll noticed the DC10+/DC30+ aren't mentioned anywhere in the overview.
Basically, you can assume that if the Buz works, the LML33 will work too. If
the LML33 works, the DC10+/DC30+ will work too. They're most tolerant to
different mainboard chipsets from all of the supported cards.

If you experience timeouts during capture, buy a better mainboard or lower
the quality/buffersize during capture (see 'Concerning buffer sizes, quality,
output size etc.'). If it hangs, there's little we can do as of now. Check
your IRQs and make sure the card has its own interrupts.

397 398
Programming interface
---------------------
Linus Torvalds's avatar
Linus Torvalds committed
399

400 401
This driver conforms to video4linux2. Support for V4L1 and for the custom
zoran ioctls has been removed in kernel 2.6.38.
Linus Torvalds's avatar
Linus Torvalds committed
402 403

For programming example, please, look at lavrec.c and lavplay.c code in
404
the MJPEG-tools (http://mjpeg.sf.net/).
Linus Torvalds's avatar
Linus Torvalds committed
405 406 407 408 409 410 411 412 413

Additional notes for software developers:

   The driver returns maxwidth and maxheight parameters according to
   the current TV standard (norm). Therefore, the software which
   communicates with the driver and "asks" for these parameters should
   first set the correct norm. Well, it seems logically correct: TV
   standard is "more constant" for current country than geometry
   settings of a variety of TV capture cards which may work in ITU or
414
   square pixel format.
Linus Torvalds's avatar
Linus Torvalds committed
415

416 417
Applications
------------
Linus Torvalds's avatar
Linus Torvalds committed
418 419 420 421

Applications known to work with this driver:

TV viewing:
422

Linus Torvalds's avatar
Linus Torvalds committed
423 424 425 426 427
* xawtv
* kwintv
* probably any TV application that supports video4linux or video4linux2.

MJPEG capture/playback:
428

Linus Torvalds's avatar
Linus Torvalds committed
429 430 431 432 433
* mjpegtools/lavtools (or Linux Video Studio)
* gstreamer
* mplayer

General raw capture:
434

Linus Torvalds's avatar
Linus Torvalds committed
435 436 437 438 439
* xawtv
* gstreamer
* probably any application that supports video4linux or video4linux2

Video editing:
440

Linus Torvalds's avatar
Linus Torvalds committed
441 442 443 444 445
* Cinelerra
* MainActor
* mjpegtools (or Linux Video Studio)


446 447 448
Concerning buffer sizes, quality, output size etc.
--------------------------------------------------

Linus Torvalds's avatar
Linus Torvalds committed
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

The zr36060 can do 1:2 JPEG compression. This is really the theoretical
maximum that the chipset can reach. The driver can, however, limit compression
to a maximum (size) of 1:4. The reason for this is that some cards (e.g. Buz)
can't handle 1:2 compression without stopping capture after only a few minutes.
With 1:4, it'll mostly work. If you have a Buz, use 'low_bitrate=1' to go into
1:4 max. compression mode.

100% JPEG quality is thus 1:2 compression in practice. So for a full PAL frame
(size 720x576). The JPEG fields are stored in YUY2 format, so the size of the
fields are 720x288x16/2 bits/field (2 fields/frame) = 207360 bytes/field x 2 =
414720 bytes/frame (add some more bytes for headers and DHT (huffman)/DQT
(quantization) tables, and you'll get to something like 512kB per frame for
1:2 compression. For 1:4 compression, you'd have frames of half this size.

Some additional explanation by Martin Samuelsson, which also explains the
importance of buffer sizes:
--
> Hmm, I do not think it is really that way. With the current (downloaded
> at 18:00 Monday) driver I get that output sizes for 10 sec:
> -q 50 -b 128 : 24.283.332 Bytes
> -q 50 -b 256 : 48.442.368
> -q 25 -b 128 : 24.655.992
> -q 25 -b 256 : 25.859.820

474
I woke up, and can't go to sleep again. I'll kill some time explaining why
Linus Torvalds's avatar
Linus Torvalds committed
475 476
this doesn't look strange to me.

477
Let's do some math using a width of 704 pixels. I'm not sure whether the Buz
Linus Torvalds's avatar
Linus Torvalds committed
478 479
actually use that number or not, but that's not too important right now.

480 481 482 483
704x288 pixels, one field, is 202752 pixels. Divided by 64 pixels per block;
3168 blocks per field. Each pixel consist of two bytes; 128 bytes per block;
1024 bits per block. 100% in the new driver mean 1:2 compression; the maximum
output becomes 512 bits per block. Actually 510, but 512 is simpler to use
Linus Torvalds's avatar
Linus Torvalds committed
484 485
for calculations.

486 487 488
Let's say that we specify d1q50. We thus want 256 bits per block; times 3168
becomes 811008 bits; 101376 bytes per field. We're talking raw bits and bytes
here, so we don't need to do any fancy corrections for bits-per-pixel or such
Linus Torvalds's avatar
Linus Torvalds committed
489 490
things. 101376 bytes per field.

491
d1 video contains two fields per frame. Those sum up to 202752 bytes per
Linus Torvalds's avatar
Linus Torvalds committed
492 493
frame, and one of those frames goes into each buffer.

494
But wait a second! -b128 gives 128kB buffers! It's not possible to cram
Linus Torvalds's avatar
Linus Torvalds committed
495 496
202752 bytes of JPEG data into 128kB!

497
This is what the driver notice and automatically compensate for in your
Linus Torvalds's avatar
Linus Torvalds committed
498 499
examples. Let's do some math using this information:

500 501 502 503 504
128kB is 131072 bytes. In this buffer, we want to store two fields, which
leaves 65536 bytes for each field. Using 3168 blocks per field, we get
20.68686868... available bytes per block; 165 bits. We can't allow the
request for 256 bits per block when there's only 165 bits available! The -q50
option is silently overridden, and the -b128 option takes precedence, leaving
Linus Torvalds's avatar
Linus Torvalds committed
505 506
us with the equivalence of -q32.

507 508 509 510 511 512 513 514
This gives us a data rate of 165 bits per block, which, times 3168, sums up
to 65340 bytes per field, out of the allowed 65536. The current driver has
another level of rate limiting; it won't accept -q values that fill more than
6/8 of the specified buffers. (I'm not sure why. "Playing it safe" seem to be
a safe bet. Personally, I think I would have lowered requested-bits-per-block
by one, or something like that.) We can't use 165 bits per block, but have to
lower it again, to 6/8 of the available buffer space: We end up with 124 bits
per block, the equivalence of -q24. With 128kB buffers, you can't use greater
Linus Torvalds's avatar
Linus Torvalds committed
515 516
than -q24 at -d1. (And PAL, and 704 pixels width...)

517 518 519
The third example is limited to -q24 through the same process. The second
example, using very similar calculations, is limited to -q48. The only
example that actually grab at the specified -q value is the last one, which
Linus Torvalds's avatar
Linus Torvalds committed
520 521 522 523 524 525 526 527 528 529 530
is clearly visible, looking at the file size.
--

Conclusion: the quality of the resulting movie depends on buffer size, quality,
whether or not you use 'low_bitrate=1' as insmod option for the zr36060.c
module to do 1:4 instead of 1:2 compression, etc.

If you experience timeouts, lowering the quality/buffersize or using
'low_bitrate=1 as insmod option for zr36060.o might actually help, as is
proven by the Buz.

531 532
It hangs/crashes/fails/whatevers! Help!
---------------------------------------
Linus Torvalds's avatar
Linus Torvalds committed
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548

Make sure that the card has its own interrupts (see /proc/interrupts), check
the output of dmesg at high verbosity (load zr36067.o with debug=2,
load all other modules with debug=1). Check that your mainboard is favorable
(see question 2) and if not, test the card in another computer. Also see the
notes given in question 3 and try lowering quality/buffersize/capturesize
if recording fails after a period of time.

If all this doesn't help, give a clear description of the problem including
detailed hardware information (memory+brand, mainboard+chipset+brand, which
MJPEG card, processor, other PCI cards that might be of interest), give the
system PnP information (/proc/interrupts, /proc/dma, /proc/devices), and give
the kernel version, driver version, glibc version, gcc version and any other
information that might possibly be of interest. Also provide the dmesg output
at high verbosity. See 'Contacting' on how to contact the developers.

549 550
Maintainers/Contacting
----------------------
Linus Torvalds's avatar
Linus Torvalds committed
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567

The driver is currently maintained by Laurent Pinchart and Ronald Bultje
(<laurent.pinchart@skynet.be> and <rbultje@ronald.bitfreak.net>). For bug
reports or questions, please contact the mailinglist instead of the developers
individually. For user questions (i.e. bug reports or how-to questions), send
an email to <mjpeg-users@lists.sf.net>, for developers (i.e. if you want to
help programming), send an email to <mjpeg-developer@lists.sf.net>. See
http://www.sf.net/projects/mjpeg/ for subscription information.

For bug reports, be sure to include all the information as described in
the section 'It hangs/crashes/fails/whatevers! Help!'. Please make sure
you're using the latest version (http://mjpeg.sf.net/driver-zoran/).

Previous maintainers/developers of this driver include Serguei Miridonov
<mirsev@cicese.mx>, Wolfgang Scherr <scherr@net4you.net>, Dave Perks
<dperks@ibm.net> and Rainer Johanni <Rainer@Johanni.de>.

568 569
Driver's License
----------------
Linus Torvalds's avatar
Linus Torvalds committed
570

571
    This driver is distributed under the terms of the General Public License.
Linus Torvalds's avatar
Linus Torvalds committed
572 573 574 575 576 577 578 579 580 581 582 583

    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.

See http://www.gnu.org/ for more information.