View Full Version : half pixel chroma shift problem
pandy
1st February 2007, 18:21
hi,
can somebody can explain me that conversion of chroma from RGB source to the YV12 destination is done with interpolation (average) of two chroma samples or simple by discarding one of them??
example script:
ImageSource("1080.bmp", end = 1799 , fps = 30000/1001)
ConvertToYV12(interlaced=False, matrix="Rec709")
AssumeFPS(30000,1001)
I try to look in the avisynth source but i giveup on MMX mambo jumbo...
thank you!
sh0dan
1st February 2007, 19:36
RGB (4:4:4) to YV12 (4:2:0) is in AviSynth 2.5 done through an intermediate YUY2 (4:2:2) conversion.
The RGB to YUY2 is done by a 1:2:1 weighed horisontal interpolation, so chroma is left aligned for a pixel pair. YUY2 to YV12 is done by a averaging chroma vertically.
See more at http://avisynth.org/index.php?page=Sampling
pandy
2nd February 2007, 09:38
sh0dan - hm seems that this is improper method... - subjective quality is better but this sampling/resampling violate regulations of standards and generate easily measurable error...
Error is equal half pixel ie 1000/(2*Fs[MHz])=error[nS]
(i assume that YCbCr transcoder take chroma samples and oversample by 2)
sh0dan
2nd February 2007, 15:02
@Pandy: To get proper MPEG 2 chroma placement you have to interpolate. If you want to convert RGB to YUY without interpolation, use ConvertBackToYUY2(), which calculates chroma based only on the leftmost pixel. This will avoid chroma drift on YUY2 -> RGB -> YUY2.
ImageSource("1080.bmp", end = 1799 , fps = 30000/1001)
ConvertBackToYUY2(matrix="Rec709")
ConvertToYV12()
AssumeFPS(30000,1001)
pandy
2nd February 2007, 18:09
Hmm... thank You sh0dan - but this is weird... accordingly to the MPEG-2 sampling scheme...
anyway THANK YOU sh0dan!
IanB
3rd February 2007, 01:34
Note:-
ImageSource(... , fps = 30000/1001)
Will use integer division and result in fps=29!
Add a decimal point to either number to get floating point division, i.e 30000.0/1001.0
pandy
4th February 2007, 20:15
@IanB
a yes, i know this - but thanks IanB!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.