[XviD-devel] chroma down-sampling

xvid-devel@xvid.org xvid-devel@xvid.org
Mon, 21 Oct 2002 10:14:43 -0400


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

I don't have any feelings towards rounding up or down but I think you
can add just one extra assembler instruction to get a round down version
using pavgb, as ((c1-1)+c2+1)/2:

	movq	   mm1, c1
	psubusb mm1, All_Ones
	pavgb   mm1, c2

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

This one can be done with 2 pavgb's, probably rounding down on just one
of them to avoid the upwards bias.

	movq	   mm1, c3
	pavgb   mm1, c1
	psubusb mm1, All_Ones
	pavgb   mm1, c1

- Tom



| -----Original Message-----
| From: xvid-devel-admin@xvid.org [mailto:xvid-devel-admin@xvid.org]On
| Behalf Of peter ross
| Sent: Monday, October 21, 2002 9:40 AM
| To: xvid-devel@xvid.org
| Subject: [XviD-devel] chroma down-sampling
|
|
| 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
|
| _______________________________________________
| XviD-devel mailing list
| XviD-devel@xvid.org
| http://list.xvid.org/mailman/listinfo/xvid-devel
|