View Full Version : mod4 automatic borders script ?
pitch.fr
16th July 2008, 20:06
hi there,
sorry for the noobish question :rolleyes:
LSF is doing some YV12 transformations in Avisynth, but it's mod4 in 2.57
latest AVS 2.58 RC2 is mod2 on YV12, but there's not MT modified version yet.
is there some trick to automatically add black borders to always be mod4 before feeding LSF ?
TIA,
martino
16th July 2008, 20:20
Ehh? What's so hard about that?
You use AddBorders() to add how much you need to make it mod(x) and then Crop() to return it back to what you want (also if you want it "automatic" you can make use of AviSynth's % mod operator)... or am I misunderstanding?
Example:
AviSource()
source=last
AddBorders(width%4,height%4,0,0)
#LSF here or something else that needs a mod4 resolution
Crop(source.width%4,source.height%4,0,0)
stickboy
16th July 2008, 20:39
Padding the right and bottom edges probably would be better than padding the left and top ones, no?
AddBorders(0, 0, Width() % 4, Height() % 4)
pitch.fr
16th July 2008, 20:46
yeah that's the thing, I'd like something automatic, to use in ffdshow in realtime :)
I'd rather add horizontal borders to avoid that Haali's Renderer resizes with its buggy internal resize.
martino
16th July 2008, 22:02
Padding the right and bottom edges probably would be better than padding the left and top ones, no?
AddBorders(0, 0, Width() % 4, Height() % 4)
Didn't know that, but it's certainly interesting. May I also ask why exactly? Or just because it's less noticeable there?
stickboy
17th July 2008, 09:02
Didn't know that, but it's certainly interesting. May I also ask why exactly? Or just because it's less noticeable there?That way you don't have to shift around existing pixels (and if you're using YUY2 or YV12, then chroma samples can't really be shifted by odd amounts anyway).
martino
17th July 2008, 12:42
Oh I see... Didn't think of that, thanks for the interesting info.
pitch.fr
22nd July 2008, 14:54
so I guess an automatic mod4 horizontal border script isn't quite possible ? :(
will wait for a MT version of the latest 2.58 then...
martino
22nd July 2008, 16:45
Ugh... http://forum.doom9.org/showthread.php?p=1159770#post1159770
pitch.fr
22nd July 2008, 17:04
oh cool thanks, didn't realize it was supposed to do the job :eek:
pitch.fr
23rd July 2008, 18:22
sorry my noobishness, so that would give ?
source=last
AddBorders(0, 0, Width() % 4, Height() % 4)
#LSF here or something else that needs a mod4 resolution
Crop(source.width%4,source.height%4,0,0)
martino
23rd July 2008, 19:51
You need to crop on the right and bottom, not left and top. And don't forget to negate the values.
pitch.fr
23rd July 2008, 20:37
yeah, that's what I thought....but I'm clueless about the required changes :D
martino
23rd July 2008, 21:02
...Docs/english/corefilters/crop.htm
Crop (clip, int left, int top, int -right, int -bottom, bool "align")
There's a reason why most programs come with documentation...
pitch.fr
23rd July 2008, 21:06
ok thanks
but that's cool I only use it for realtime use in ffdshow, I don't really care if it's not cropped properly.....as long as LSF doesn't whine "must be mod4, doh!" :D
and mostly I would have wanted it to add borders only if it's necessary, to avoid ruining the PQ...but soon or later there'll be a MT version of Avisynth 2.58 I guess.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.