Reverse Field Dominance
(Version 1.0)

by Donald A. Graft


Introduction

This filter for VirtualDub reverses the field dominance of a clip. It is a rarely used function but when you need it, you really need it.

Field dominance defines the field that is to be played first. For example, a PAL DV clip has lower (bottom) field dominance, so as each frame is displayed, first the lower field is shown, then the upper field is shown.

A little thought reveals that if you have a progressive clip, it doesn't matter in which order you display the fields, because the two fields are pictures from the same temporal moment. But if you have nonprogressive frames (interlaced video), then displaying the fields in the wrong order is catastrophic.

Consider that PAL DV is lower-field first and Standard PAL is upper-field first. Without the ability to reverse the field dominance, transcoding one to the other is not possible. Some other scenarios also require dominance reversal, so this filter was created.


Method of Operation

One may be tempted to simply swap the fields. This will reverse the field dominance, but it is not a correct solution. Field dominance refers to which field is displayed first in time, i.e., temporal order. Swapping fields means interchanging the fields of a frame. Swapping fields will reverse the temporal order, but it will also interchange each pair of lines, putting them spatially in the wrong position.

There are cases where a field swap is needed. For example, a capture card may erroneously put each captured field in the wrong field of the output frame. That creates incorrect temporal and spatial order that can be corrected by swapping fields. But swapping fields is not useful when only the temporal order needs to be reversed.

There are two methods for reversing the temporal order without reversing the spatial order. The first method, used by this filter, is sneaky. It simply shifts the frame up by one line and duplicates the bottom line to replace the resulting missing line. It is clear that this has the effect of reversing the temporal order of the fields while retaining the relative spatial order of the lines. It is necessary to use the qualifying word 'relative' because they have all been shifted up by a line, but they have not been reversed pair-wise as they would be by a field swap.

The second method is more complicated and trickier to implement but does not cause a one-line shift. However, it has its own disadvantages that will be discussed after describing the method.

Suppose we represent a portion of the clip as follows, where the numbers represent different fields, two fields one above each other are a frame, and the upper numbers are the upper fields:

1 3 5
2 4 6

A filter could rearrange the fields like this:

3 5 7
2 4 6

The temporal dominance has been changed, but the fields have been recombined. In some applications this rearrangement may not be acceptable, but in many applications where reversing dominance is required it is acceptable. Another point to notice about this method is that the first field of video is lost, which could result in audio sync difficulties.


Version 1.0 [Source code]


[up to home page]