AutoYUY2


Traditional YV12 to YUY2 upsamplers operate either in the progressive or interlaced mode, and the upsampler must be told which mode to use. This paradigm can be unsatisfactory in several cases:

  • The user is unsure of, or unable to determine, which mode to use.
  • Segments of a clip are sampled progressively, while others are sampled interlaced.
  • There are frames which have areas sampled progressively, while others are sampled interlaced.
Commonly encountered instances are field blending conversions and 3:2 pulldown of progressively sampled video. The former results in parts of frames being effectively interlaced, while the latter results in a mixture of progressive and interlaced frames. Use of a traditional upsampler in these cases will result in the wrong upsampling being performed on some frames or frame areas. The result will be the chroma upsampling error (CUE) if a progressively sampled area is upsampled interlaced, or destruction of interlacing (DOI) if an interlaced area is upsampled progressively. The AutoYUY2() filter avoids these problems by detecting interlaced frame areas and then applying either progressive or interlaced upsampling as required.

The screen shots linked below illustrate the problem. They are taken from a video clip supplied by scharfis_brain. The 'interlaced.bmp' shot is upsampled as interlaced. You can see that the interlacing is properly preserved but there is bad CUE throughout the frame. The 'progressive.bmp' shot is upsampled as progressive. You can see that the CUE is eliminated, but the interlacing is destroyed. The 'autoyuy2.bmp' shot is upsampled adaptively using AutoYUY2(). You can see that the CUE is eliminated and the interlacing is preserved. If you look hard, you may find small areas where there is remaining CUE or DOI, due to imperfections in the detection of interlacing.

interlaced.bmp
progressive.bmp
autoyuy2.bmp

The current version is a proof-of-concept version. I plan to improve the interlace detection in future versions. I also plan to create an AutoRGB() filter that performs the same function but outputs RGB.

This filter was inspired by a discussion with scharfis_brain, who demonstrated an Avisynth script that performs this function. I wanted to create a native filter for this functionality.


Version 1.0.1 adds a more correct upsampling algorithm (as done in DGDecode), a means to force interlaced or progressive upsampling for the entire frame (the mode parameter), and optimized performance. These changes were contributed by Jean-Philippe Scotto Di Rinaldi.

Version 1.0.1 (includes source code under GPL)

Version 1.0.0 beta 2 (includes source code under GPL)


Jean-Philippe Scotto Di Rinaldi has provided ASM/SSE2 optimized builds for various architectures:

autoyuy2_opt.zip (includes source code under GPL)


Jean-Philippe also made a VirtualDub version of AutoYUY2:

JPSDR_AutoYUY2.zip (includes source code under GPL)


[up to home page] autoyuy2_opt.zip