View Full Version : Lanczos/Bicubic Upscaling of Chroma
Isochroma
1st January 2006, 04:12
It would be interesting if the functions ConvertToRGB24(), ConvertToRGB32(), and ConvertToYUY2() [from YV12 source] used bicubic or lanczos scaling to upsize the chroma plane...
This could be implemented by modifying the functions to take one more (optional) parameter, which would specify the chroma upsampling function to use.
ffdshow could also use this in either the Resize section or the Output section (when RGB24/32 output is selected).
Lanczos or bicubic scaling could help eliminate the problematic red blocking on edges from YV12 codecs like MPEG-2/4.
Question: when YV12 video is downsized to 1/4 x 1/4, is the chroma left alone and just the luma resized? What I mean is that an intelligent downsizer could take a parameter specifying RGB output, so it would only need to scale the luma plane in this case.
Mug Funky
2nd January 2006, 14:23
mplayer uses it's resizers for chroma up/downsampling IIRC.
i think avs 3.0 will also do this.
as far as how the chroma is currently upsampled, there's been some discussion about it here, i think in the yv12 faq thread. a search should show something.
Wilbert
2nd January 2006, 15:43
I don't know about avs 3.0, but avs 2.6 will do this already.
as far as how the chroma is currently upsampled
http://www.avisynth.org/Sampling
Inc
5th January 2006, 21:13
I was once "thinking" if it could be a sort of tricky if someone could selfdecide which routine is used as chroma planes resizing routine
Hmmmm .... like in case of a simple pointresize so the colors from YUY2 to YV12 in their height would be treaten as /2 instead being interpolated, so less blurry colors could be a result? just a thought ....
c = BlaBlasource("MyYUY2video.bla")
u_chroma = c.UToY().pointresize(width,height/2)
v_chroma = c.VToY().pointresize(width,height/2)
ConverttoYV12()
YtoUV(u_chroma, v_chroma)
MergeLuma(c)
(written full out of brain - at the moment no PC here, so for shure syntax bugs could be inside)
Inc
13th March 2006, 00:24
Heres a little function where you can chose the interpolation within a colorpsace conversion between YUY2 and YV12.
Only for progressive inputs and of course it could be assembled more elegant.
function convertBetweenYUV(clip c, string resizer) {
assert( ( IsYUY2(c) || IsYV12(c) ) , "Clip must be either YV12 or YUY2")
u = utoy(c)
v = vtoy(c)
IsYV12(c) ? Eval("u=u."+resizer+"(width(c)/2, height(c)).converttoYUY2()") :
\ Eval("u=u."+resizer+"(width(c)/2, height(c)/2).converttoYV12()")
IsYV12(c) ? Eval("v=v."+resizer+"(width(c)/2, height(c)).converttoYUY2()") :
\ Eval("v=v."+resizer+"(width(c)/2, height(c)/2).converttoYV12()")
IsYV12(c) ? Eval("c=c.ConverttoYUY2()") : Eval("c=c.ConverttoYV12()")
c=c.mergechroma(ytouv(u,v))
return c
}
So if your input is YUY2 it will be converted to YV12 and vice versa. Use as resizer string ... "pointresize", "bicubicresize", ... etc
A Test ...
xxxSource("D:\PathTo\Movie.xxx")
subtract(IsYV12()?converttoyuy2():converttoyv12(),convertBetweenYUV("pointresize")).levels(240,1,255,0,255)
So as I have to bump up the contrast by using Levels after subtract'ing, therefore the diff. for human eyes will be minimal. but if you separate the channels you will see the diffs in the chroma ones.
IanB
13th March 2006, 00:53
AVS 2.56 and prior use linear interpolation.
AVS 2.6 development currently is hard coded to use Bicubic for it's planar chroma resizer. Plans are to allow the user to select the resizer.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.