Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd August 2012, 13:24   #1  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 540
investigating HD->SD scalers

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
hanfrunz is offline   Reply With Quote
Old 4th August 2012, 23:15   #2  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Hmm... that should be pretty simple. Just scan the source with a white pixel and read out the coefficients in the destination:
Code:
#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

Last edited by jmac698; 4th August 2012 at 23:27.
jmac698 is offline   Reply With Quote
Old 20th August 2012, 04:13   #3  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
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.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 27th August 2012, 14:22   #4  |  Link
pandy
Registered User
 
Join Date: Mar 2006
Posts: 1,049
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

Last edited by pandy; 28th August 2012 at 12:08.
pandy is offline   Reply With Quote
Old 13th March 2021, 14:21   #5  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,074
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 ?
DTL is online now   Reply With Quote
Old 13th March 2021, 20:31   #6  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by pandy View Post
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...4/7BM24_0E.pdf

Quote:
Originally Posted by pandy View Post
https://cdn.rohde-schwarz.com/pws/dl...4/7BM74_0E.pdf
Reel.Deel is offline   Reply With Quote
Old 14th March 2021, 19:55   #7  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,074
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 .
DTL is online now   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.