[XviD-devel] chroma down-sampling

peter ross xvid-devel@xvid.org
Mon, 21 Oct 2002 23:39:41 +1000


hello,

[warning: --pedantic]
is anyone familar with (progressive) chroma sampling, because iam
wondering if a round-up average is better than a round-down average?
in order to convert yuyv->yv12, the conversion function must down-
sample (or halve) the chroma info.

for those unitiated: yuyv/rgb specifies chroma on each line, whereas
yv12 (4:2:0) specifies chrom on every second line.

ive seen three ways to perform sampling: (c1 and c2 represent adjacent
yuyv chroma lines)

* simply use chroma=c1, and ignore each second line of chroma.
  i believe ffmpeg/mplayer does this.

* round-down average: chroma=(c1+c2)/2, the current xvid code performs
  this.

* round-up average: chroma = (c1+c2+1)/2. using mmx pavg[us]b, round-
  up can be performed ~10% faster than round-down.

ive done some test encodings, and found that most of the time the
rounding doesnt matter (you end up with identical bitstream). some
times the bitstream is a few bytes smaller, using a 2minute video
clip. i guess this is due to quantization.

anyone have any thoughts on this? 10% faster yuyv->yv12 conversion
isnt that important, but the concept can be applied to other input
colorspaces.

note: this doesnt have much todo with interlace down sampling.
the docs ive recommend chroma=0.75*c1 + 0.25*c3.

-- pete

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963