[Ffmpeg-devel] upsampling of subsampled video data
Michael Niedermayer
michaelni
Sun Sep 10 12:17:41 CEST 2006
Hi
On Sun, Sep 10, 2006 at 10:34:54AM +0200, Attila Kinali wrote:
> Moin,
>
> On the OGP mailinglist there is currently a discussion going on
> on how and when to perform upsampling of subsampled YUV data.
>
> My biggest question is whether the U and V data is just
> coppied to all the pixels or is it interpolated between
> the sample points?
>
> If it's interpolated, how much image quality los would it
> be to just copy it?
well, ideally it should be interpoated, the swscaler currently does for
yuv->yuv interpolation/copying as specified by the user (-sws parameter in
mplayer)
yuv->rgb interpolation/copying as specified by the user upto 4:2:2 and
then horizontally copying U/V once and finally yuv->rgb conversation
code to do this with full interpolation is half finished in svn since
years (patch would be welcome ...)
the unscaled 4:2:0 yuv->rgb converter used by us and many other projects
always copies UV around, which does sometimes look worse (well vissible on
diagonal red-<some other color> edges)
>
> Additionaly, would it be enough to support only 4:2:2 and 4:2:0
> as the most common formats, or shall other "odd" formats like 4:1:1,
> 3:1:1 or 3:1:0 ?
well, lets see, first heres a list of the common formats with ideal sample
positions shown below too
progressive 4:2:0 (mpeg1)
Y Y Y Y
C C
Y Y Y Y
Y Y Y Y
C C
Y Y Y Y
progressive 4:2:0 (mpeg2/mpeg4)
Y Y Y Y
C C
Y Y Y Y
Y Y Y Y
C C
Y Y Y Y
interlaced 4:2:0 (mpeg2/mpeg4)
field A field B
Y Y Y Y
C C
Y Y Y Y
Y Y Y Y
C C
Y Y Y Y
note, its very important that only luma and chroma samples from the same field
are used in building rgb values or pretty ugly artifacts appear
4:2:2 (mpeg2/mpeg4/ITU BT601/dv)
@ Y @ Y (@=Y+C)
@ Y @ Y
@ Y @ Y
@ Y @ Y
4:1:1 (dv)
@ Y Y Y (@=Y+C)
@ Y Y Y
@ Y Y Y
@ Y Y Y
now which are important? mpeg2/4 4:2:0 progressive and interlaced certainly
are and 4:2:2 too
the following codecs depend on 4:1:1 support (or a sw converter to make 4:2:2
out of their 4:1:1)
Cirrus Logic AccuPak
Creative YUV (CYUV)
Miro VideoXL codec
NTSC DV
from these probably only DV is relevant the others are obscure
the following codecs depend on 4:1:0 support (or a sw converter to make 4:2:0
out of their 4:1:0)
Sorenson Vector Quantizer 1
intel indeo2
intel indeo3
ATI VCR1
and 3:?:? well iam not even sure what they mean but iam sure they are
irrelevant from the yuv->rgb perspective of a grafic card
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
More information about the ffmpeg-devel
mailing list