View Full Version : investigating HD->SD scalers
hanfrunz
3rd August 2012, 13:24
Hello everyone,
i want to do some research on how different machines/tools do HD->SD downscaling, especialy interlaced material. To mimic them in avisynth.
Any ideas for testpatterns/testsequences which would give good information?
Simple 1 pixel lines to see pulse response, scenes with motion... etc. Any further ideas?
regards,
hanfrunz
jmac698
4th August 2012, 23:15
Hmm... that should be pretty simple. Just scan the source with a white pixel and read out the coefficients in the destination:
#Find filter taps for a resize
#For example, HorizontalReduceBy2 is
#dstp[0] = (srcp[0] + 2*srcp[1] + srcp[2] + 2) >> 2;
#which means 1,2,1
blankclip(pixel_type="YV12", color_yuv=$8080)
#Find 3 tap filter coeficients
luma0=putpixel(0, 0, 255).horizontalreduceby2.GetPixel(0, 0)
luma1=putpixel(1, 0, 255).horizontalreduceby2.GetPixel(0, 0)
luma2=putpixel(2, 0, 255).horizontalreduceby2.GetPixel(0, 0)
minluma=min(luma0, luma1, luma2)
tap0=luma0/minluma
tap1=luma1/minluma
tap2=luma2/minluma
subtitle("The resizer coefficients are: "+string(tap0)+", "+string(tap1)+", "+string(tap2))
Function GetPixel(clip clip, int x, int y) {
#Return luma of a pixel
current_frame=0
clip
IsYUY2 ? ConvertToYV12 : clip#AverageLuma only works on planar. YV12 is planar.
pointresize(6,6,x,y,1,1)#Blow up the pixel at x,y by 6 times (minimum possible with resize)
int(AverageLuma)
}
Function PutPixel(clip clip, int x, int y, int luma) {
#Plot a pixel
clip
ClipIsYV12=IsYV12
ClipIsYV12 ? ConvertToYUY2 : last
pointresize(width*2, height)
u=128
v=128
pixel=blankclip(last, color_yuv=luma*65536+u*256+v, width=2, height=1)
layer(last, pixel, "add", 256, x*2, y)#Layer only works with YUY2
pointresize(width/2, height)
ClipIsYV12 ? ConvertToYV12 : last
}
-the taps you find should be put in a convolution matrix, e.g. in masktools. In this case, "0 0 0 1 2 1 0 0 0".
-this could be completely done with a script; one to generate the animation, another to analyze the result.
-if you have to deal with compression in the process, you could show many dots simultaneously and average them.
-the dots only have to scan, say an 8x8 area (the expected maximum number of taps).
-you can determine the number of taps by seeing at which point the source pixel has no effect on the destination pixel.
-you can increase coefficient accuracy by testing two pixels at a time once you've done a rough scan.
-you'll probably be dealing with 16-235 levels; compensate accordingly
Mug Funky
20th August 2012, 04:13
i'd combine a standard "Marcie" picture and dick the grey card in favour of a resolution chart on that side. maybe a similar one to what's used on dpreview.com and the like for testing digicams, but a BBC telecine chart would do perfectly as well. whichever you can get hold of without too much trouble.
diagonals are always a killer.
you can throw in some custom test signals as well as jmac698 suggests - the marcie will give you an impression of real-world action and also help you spot issues like colour changes etc.
most hardware does it wrong IMHO. a snell and wilcox ARC will do it well, but leaves "kernel ghosts" on scenechanges.
here's what i've been using outside of avisynth land:
ffmpeg -i "yada.mov" ...<codec stuff>... -sws_flags lanczos -vf yadif=1:-1,format=yuv422p16le,crop=in_w:0.975*in_h:0:0.0125*in_h,colormatrix=bt709:bt601,scale=720:576,tinterlace=4
it's pretty good for rushes and whatnot.
this accounts for the 702/720 issue with SD video so aspect ratio is not changed.
pandy
27th August 2012, 14:22
http://www2.rohde-schwarz.com/file/7BM24_0E.pdf
Zone plate - static and dynamic (X,Y,Z and combined direction)
and this one
http://www2.rohde-schwarz.com/file/7BM74_0E.pdf
DTL
13th March 2021, 14:21
Links to www2.rohde-schwarz.com looks like died. Do anyone knows how to calculate hyperbolic zone plate ? May be f(x,y) or at least some geometry ideas for formula ?
Reel.Deel
13th March 2021, 20:31
http://www2.rohde-schwarz.com/file/7BM24_0E.pdf
Zone plate - static and dynamic (X,Y,Z and combined direction)
https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_application/application_notes/7bm24/7BM24_0E.pdf
and this one
http://www2.rohde-schwarz.com/file/7BM74_0E.pdf
https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_application/application_notes/7bm74/7BM74_0E.pdf
DTL
14th March 2021, 19:55
Thank you - it works.
Made simple raw-file calculator of vertical hyperbolic zone plate with some conditioning applied to edges and transition to 16-black codelevel: https://github.com/DTL2020/hpzp .
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.