• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>Field Order</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Video for Linux Two API Specification"
11HREF="book1.htm"><LINK
12REL="UP"
13TITLE="Input/Output"
14HREF="c5742.htm"><LINK
15REL="PREVIOUS"
16TITLE="Buffers"
17HREF="x5953.htm"><LINK
18REL="NEXT"
19TITLE="Interfaces"
20HREF="c6488.htm"></HEAD
21><BODY
22CLASS="SECTION"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Video for Linux Two API Specification: Revision 0.24</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="x5953.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56>Chapter 3. Input/Output</TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="c6488.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><DIV
72CLASS="SECTION"
73><H1
74CLASS="SECTION"
75><A
76NAME="FIELD-ORDER"
77>3.6. Field Order</A
78></H1
79><P
80>We have to distinguish between progressive and interlaced
81video. Progressive video transmits all lines of a video image
82sequentially. Interlaced video divides an image into two fields,
83containing only the odd and even lines of the image, respectively.
84Alternating the so called odd and even field are transmitted, and due
85to a small delay between fields a cathode ray TV displays the lines
86interleaved, yielding the original frame. This curious technique was
87invented because at refresh rates similar to film the image would
88fade out too quickly. Transmitting fields reduces the flicker without
89the necessity of doubling the frame rate and with it the bandwidth
90required for each channel.</P
91><P
92>It is important to understand a video camera does not expose
93one frame at a time, merely transmitting the frames separated into
94fields. The fields are in fact captured at two different instances in
95time. An object on screen may well move between one field and the
96next. For applications analysing motion it is of paramount importance
97to recognize which field of a frame is older, the <SPAN
98CLASS="emphasis"
99><I
100CLASS="EMPHASIS"
101>temporal
102order</I
103></SPAN
104>.</P
105><P
106>When the driver provides or accepts images field by field
107rather than interleaved, it is also important applications understand
108how the fields combine to frames. We distinguish between top and
109bottom fields, the <SPAN
110CLASS="emphasis"
111><I
112CLASS="EMPHASIS"
113>spatial order</I
114></SPAN
115>: The first line
116of the top field is the first line of an interlaced frame, the first
117line of the bottom field is the second line of that frame.</P
118><P
119>However because fields were captured one after the other,
120arguing whether a frame commences with the top or bottom field is
121pointless. Any two successive top and bottom, or bottom and top fields
122yield a valid frame. Only when the source was progressive to begin
123with, e.&nbsp;g. when transferring film to video, two fields may come from
124the same frame, creating a natural order.</P
125><P
126>Counter to intuition the top field is not necessarily the
127older field. Whether the older field contains the top or bottom lines
128is a convention determined by the video standard. Hence the
129distinction between temporal and spatial order of fields. The diagrams
130below should make this clearer.</P
131><P
132>All video capture and output devices must report the current
133field order. Some drivers may permit the selection of a different
134order, to this end applications initialize the
135<CODE
136CLASS="STRUCTFIELD"
137>field</CODE
138> field of struct&nbsp;<A
139HREF="c2030.htm#V4L2-PIX-FORMAT"
140>v4l2_pix_format</A
141> before
142calling the <A
143HREF="r10944.htm"
144><CODE
145CLASS="CONSTANT"
146>VIDIOC_S_FMT</CODE
147></A
148> ioctl. If this is not desired it should
149have the value <CODE
150CLASS="CONSTANT"
151>V4L2_FIELD_ANY</CODE
152> (0).</P
153><DIV
154CLASS="TABLE"
155><A
156NAME="V4L2-FIELD"
157></A
158><P
159><B
160>Table 3-8. enum v4l2_field</B
161></P
162><TABLE
163BORDER="0"
164FRAME="void"
165WIDTH="100%"
166CLASS="CALSTABLE"
167><COL
168WIDTH="38%"
169TITLE="C1"><COL
170WIDTH="12%"
171TITLE="C2"><COL
172WIDTH="50%"
173TITLE="C3"><TBODY
174VALIGN="TOP"
175><TR
176><TD
177><CODE
178CLASS="CONSTANT"
179>V4L2_FIELD_ANY</CODE
180></TD
181><TD
182>0</TD
183><TD
184>Applications request this field order when any
185one of the <CODE
186CLASS="CONSTANT"
187>V4L2_FIELD_NONE</CODE
188>,
189<CODE
190CLASS="CONSTANT"
191>V4L2_FIELD_TOP</CODE
192>,
193<CODE
194CLASS="CONSTANT"
195>V4L2_FIELD_BOTTOM</CODE
196>, or
197<CODE
198CLASS="CONSTANT"
199>V4L2_FIELD_INTERLACED</CODE
200> formats is acceptable.
201Drivers choose depending on hardware capabilities or e.&nbsp;g. the
202requested image size, and return the actual field order. struct&nbsp;<A
203HREF="x5953.htm#V4L2-BUFFER"
204>v4l2_buffer</A
205>
206<CODE
207CLASS="STRUCTFIELD"
208>field</CODE
209> can never be
210<CODE
211CLASS="CONSTANT"
212>V4L2_FIELD_ANY</CODE
213>.</TD
214></TR
215><TR
216><TD
217><CODE
218CLASS="CONSTANT"
219>V4L2_FIELD_NONE</CODE
220></TD
221><TD
222>1</TD
223><TD
224>Images are in progressive format, not interlaced.
225The driver may also indicate this order when it cannot distinguish
226between <CODE
227CLASS="CONSTANT"
228>V4L2_FIELD_TOP</CODE
229> and
230<CODE
231CLASS="CONSTANT"
232>V4L2_FIELD_BOTTOM</CODE
233>.</TD
234></TR
235><TR
236><TD
237><CODE
238CLASS="CONSTANT"
239>V4L2_FIELD_TOP</CODE
240></TD
241><TD
242>2</TD
243><TD
244>Images consist of the top field only.</TD
245></TR
246><TR
247><TD
248><CODE
249CLASS="CONSTANT"
250>V4L2_FIELD_BOTTOM</CODE
251></TD
252><TD
253>3</TD
254><TD
255>Images consist of the bottom field only.
256Applications may wish to prevent a device from capturing interlaced
257images because they will have "comb" or "feathering" artefacts around
258moving objects.</TD
259></TR
260><TR
261><TD
262><CODE
263CLASS="CONSTANT"
264>V4L2_FIELD_INTERLACED</CODE
265></TD
266><TD
267>4</TD
268><TD
269>Images contain both fields, interleaved line by
270line. The temporal order of the fields (whether the top or bottom
271field is first transmitted) depends on the current video standard.
272M/NTSC transmits the bottom field first, all other standards the top
273field first.</TD
274></TR
275><TR
276><TD
277><CODE
278CLASS="CONSTANT"
279>V4L2_FIELD_SEQ_TB</CODE
280></TD
281><TD
282>5</TD
283><TD
284>Images contain both fields, the top field lines
285are stored first in memory, immediately followed by the bottom field
286lines. Fields are always stored in temporal order, the older one first
287in memory. Image sizes refer to the frame, not fields.</TD
288></TR
289><TR
290><TD
291><CODE
292CLASS="CONSTANT"
293>V4L2_FIELD_SEQ_BT</CODE
294></TD
295><TD
296>6</TD
297><TD
298>Images contain both fields, the bottom field
299lines are stored first in memory, immediately followed by the top
300field lines. Fields are always stored in temporal order, the older one
301first in memory. Image sizes refer to the frame, not fields.</TD
302></TR
303><TR
304><TD
305><CODE
306CLASS="CONSTANT"
307>V4L2_FIELD_ALTERNATE</CODE
308></TD
309><TD
310>7</TD
311><TD
312>The two fields of a frame are passed in separate
313buffers, in temporal order, i.&nbsp;e. the older one first. To indicate the field
314parity (whether the current field is a top or bottom field) the driver
315or application, depending on data direction, must set struct&nbsp;<A
316HREF="x5953.htm#V4L2-BUFFER"
317>v4l2_buffer</A
318>
319<CODE
320CLASS="STRUCTFIELD"
321>field</CODE
322> to
323<CODE
324CLASS="CONSTANT"
325>V4L2_FIELD_TOP</CODE
326> or
327<CODE
328CLASS="CONSTANT"
329>V4L2_FIELD_BOTTOM</CODE
330>. Any two successive fields pair
331to build a frame. If fields are successive, without any dropped fields
332between them (fields can drop individually), can be determined from
333the struct&nbsp;<A
334HREF="x5953.htm#V4L2-BUFFER"
335>v4l2_buffer</A
336> <CODE
337CLASS="STRUCTFIELD"
338>sequence</CODE
339> field. Image
340sizes refer to the frame, not fields. This format cannot be selected
341when using the read/write I/O method.</TD
342></TR
343><TR
344><TD
345><CODE
346CLASS="CONSTANT"
347>V4L2_FIELD_INTERLACED_TB</CODE
348></TD
349><TD
350>8</TD
351><TD
352>Images contain both fields, interleaved line by
353line, top field first. The top field is transmitted first.</TD
354></TR
355><TR
356><TD
357><CODE
358CLASS="CONSTANT"
359>V4L2_FIELD_INTERLACED_BT</CODE
360></TD
361><TD
362>9</TD
363><TD
364>Images contain both fields, interleaved line by
365line, top field first. The bottom field is transmitted first.</TD
366></TR
367></TBODY
368></TABLE
369></DIV
370><DIV
371CLASS="FIGURE"
372><A
373NAME="FIELDSEQ-TB"
374></A
375><P
376><B
377>Figure 3-1. Field Order, Top Field First Transmitted</B
378></P
379><DIV
380CLASS="MEDIAOBJECT"
381><P
382><IMG
383SRC="fieldseq_tb.gif"></P
384></DIV
385></DIV
386><DIV
387CLASS="FIGURE"
388><A
389NAME="FIELDSEQ-BT"
390></A
391><P
392><B
393>Figure 3-2. Field Order, Bottom Field First Transmitted</B
394></P
395><DIV
396CLASS="MEDIAOBJECT"
397><P
398><IMG
399SRC="fieldseq_bt.gif"></P
400></DIV
401></DIV
402></DIV
403><DIV
404CLASS="NAVFOOTER"
405><HR
406ALIGN="LEFT"
407WIDTH="100%"><TABLE
408SUMMARY="Footer navigation table"
409WIDTH="100%"
410BORDER="0"
411CELLPADDING="0"
412CELLSPACING="0"
413><TR
414><TD
415WIDTH="33%"
416ALIGN="left"
417VALIGN="top"
418><A
419HREF="x5953.htm"
420ACCESSKEY="P"
421>Prev</A
422></TD
423><TD
424WIDTH="34%"
425ALIGN="center"
426VALIGN="top"
427><A
428HREF="book1.htm"
429ACCESSKEY="H"
430>Home</A
431></TD
432><TD
433WIDTH="33%"
434ALIGN="right"
435VALIGN="top"
436><A
437HREF="c6488.htm"
438ACCESSKEY="N"
439>Next</A
440></TD
441></TR
442><TR
443><TD
444WIDTH="33%"
445ALIGN="left"
446VALIGN="top"
447>Buffers</TD
448><TD
449WIDTH="34%"
450ALIGN="center"
451VALIGN="top"
452><A
453HREF="c5742.htm"
454ACCESSKEY="U"
455>Up</A
456></TD
457><TD
458WIDTH="33%"
459ALIGN="right"
460VALIGN="top"
461>Interfaces</TD
462></TR
463></TABLE
464></DIV
465></BODY
466></HTML
467>
468