Log in

View Full Version : Resizer for resizing analog caps


Wilbert
10th September 2004, 21:59
I finally made my first plugin :)

It's a resizer for resizing analog caps using the active capture window. Only PAL and YUY2 support (will add NTSC support later). It assumes you are resizing to DivX/XviD having par 1.0.

http://www.geocities.com/wilbertdijkhof/Resizer_v1.zip

It works very simple:

It resizes analogue captures: by cropping (if image is wider than pal standard) or adding borders (if image is smaller than pal standard) first, and resizing to a 4:3 format afterwards. The target image should be centralized (wrt the black borders, if there are some left).

syntax:
Resizer(clip, int width, float cap_window, int filmpixel, int leftborder, string method)

width = target width
cap_window = active capture window
filmpixel = source width minus black borders
leftborder = left black border
method = resize method (bicubic, bilinear, point, etc.) (default: "bicubic")

Mug Funky
13th September 2004, 15:48
oops! nearly missed this one.

thought i'd bump it a little (i'll test it out later :))

thanks wilbert.

hmm... maybe this'd get more attention in the capturing forum?

kingmob
13th September 2004, 17:31
I'm confused. What would this filter do with a 768x576 capture of mine? I mean, what i would not be able to do with crop().Bilinearresize(), that this can?

Wilbert
13th September 2004, 19:20
I'm confused. What would this filter do with a 768x576 capture of mine? I mean, what i would not be able to do with crop().Bilinearresize(), that this can?

The only difference is that it makes some calculations for you. Using the active capture window it calculates how much should be cropped (or added) *before* resizing to a 4:3 format. The amount it crops is determined by the difference between the active capture window and the pal standard 52 µs.

If you want to know what your active capture window is you should read the Analogue Capture Guide.

btw, I will move it to the capturing forum.

kingmob
14th September 2004, 14:34
That sounds usefull, as i'm still a bit confused with all the standards etc.
I'll try it out!

Edit: tried it, and it doesn't seem to do anything with an active capture window of 52.03? I have a BT878 with the latest wincap drivers, but it has a small (about 4 pixels) black border on the left. Trying Resizing(640,52.03,764,4) does not crop that border off. when i tell it it has huge 40 pixel border on the left side, it still does not do anything?

Inc
22nd September 2004, 15:10
Wilbert, nice to see that!

I do see your filter gots its purpose to do a job for final PAR1:1 outputs.

An Idea:

You could look into the source of GripFit.dll.
Ross Thomas did a nice Job as it contains sources border detection and PAR based resizings.
I had a look into that code and (If I did understand right) when only the height (or was it the with?!) is determined as target, then the result is also a PAR1:1 based image.
IF not, then I do think someone with skills in C++ could add that.
Also you "could" add that Capture Area Window calculation routine you do use in your filter, so the result would be a
"Capture_Gripfit.dll"??

Just an Idea .... ;-)


The source provided by Latexxx (he made the AVS2.5 changes)
http://www.nic.fi/~lhahne/GripFit_YV12.zip


Here a quote from the code where I do "assume" that the width determination is responsable for an output other than PAR 1:1 ??
if(dest_dim.width.Defined())
{
dest_par = DeterminePAR(dest_standard, dest_dim);
if(0.0 == dest_par)
env->ThrowError("GripCrop: Unrecognized destination frame size");
} else
dest_par = 1.0; // Assume square pixels when only height is defined

Wilbert
23rd September 2004, 20:13
I already saw the source, and gave up half way. It looked very involved. Could you explain me a few things?

1) How does GripBorders/Size/Crop work together? In what order do you have to use them?

GripCrop crops top and bottom borders? It doesn't crop the left/right borders?

Is GripBorders only for adding overscan? Or does it (also ?) add top/bottom black borders back?

2) How does the border detection work?

Boulder
23rd September 2004, 23:14
I think SansGrip would be the best person to answer those questions since he wrote the filter in the first place. Maybe you should PM him, he doesn't seem to visit the forums very often nowadays but that way he would be notified.

Inc
24th September 2004, 09:19
Originally posted by Wilbert
I already saw the source, and gave up half way. It looked very involved. Could you explain me a few things?

1) How does GripBorders/Size/Crop work together? In what order do you have to use them?

GripCrop crops top and bottom borders? It doesn't crop the left/right borders?

Is GripBorders only for adding overscan? Or does it (also ?) add top/bottom black borders back?

2) How does the border detection work?

The usage is:

Avisource() # or mpeg2source()
Gripcrop( 704, 576, overscan=2, source_anamorphic=true, dest_anamorphic= false )
Gripsize("Bicubicresize")
#
# Filters
#
Gripborders()

------------------------

The syntax is:
GripCrop(clip clip, int width, int height, bool source_anamorphic, bool dest_anamorphic, int overscan, string resizer, int crop_round_width, int crop_round_height, int resize_round_width, int resize_round_height, int luma_threshold, int samples)

CripSize( string Resizer)

GripCrop()

-------------------------

The Defaults:

GripCrop:

clip = last
width = none
height = none
source_anamorphic = false, unless the source width is 720
dest_anamorphic = false, unless dest. width is 720 and height is 480/576
overscan = 0
crop_round_width = 4
crop_round_height = 4
resize_round_width = 16
resize_round_height = 16
luma_threshold = 60
samples = 5


Gripsize:

resizer = "BilinearResize"


------------------

So (just IMHO !) ....

Gripfit internally parses the orig resolution and fps to determine internally the source format. Then a border detection via Avisynth API will be performed (parameters "luma_threshold" and "samples"). The recognised black borders will be cropped (like when you do determine the active Movie area in FitCD). Then the PAR based cropping/resizing will be performed. The choice of the avisynth-resizer is given as parameters in GripSize("xxxxxx").

Finally you add the needed Borders to get to your final wanted dest. size by using just gripborders().

BUT! As you know sansgrip is in here registered and seems to be active on video stuff again as he had a break for some time ;-)

I hope this information just to begin is useful for you.

Greets Inc.


PS: Im tring to decide to get into another programming language beside Purebasic and Im thinking between c++ and Delphi.

I also tried to compile that source from latexx but no luck. (I wanted to fix that par issue in case of 528/544 output as Gripfit internally still uses "3/4" DVD PAR