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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

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

Reply
 
Thread Tools Search this Thread
Old 2nd October 2002, 07:51   #1  |  Link
HarryM
Registered User
 
Join Date: May 2002
Location: Czech rep.
Posts: 390
'OnlyVerticalBicubicResize' filters in Avisynth

Hi,

I often need to resize only height of movie. Width without change.

E.g. 'PAL movie'

Crop(12,71,704,434)
BicubicResize(704,304,0,0.5) 'width not changed!

I have any question:

Do exist in LanczosResize, BicubicResize, BilinearResize filters the overskip of width-resize routines (=logically less time for resizing), when I dont need a width-change?
HarryM is offline   Reply With Quote
Old 2nd October 2002, 08:03   #2  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
yes
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 11:41   #3  |  Link
HarryM
Registered User
 
Join Date: May 2002
Location: Czech rep.
Posts: 390
Quote:
Originally posted by sh0dan
yes
Short and clear answer...

Thanks
HarryM is offline   Reply With Quote
Old 2nd October 2002, 11:49   #4  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
if you want a slightly longer one:

Avisynth has completely separate vertical and horizontal resizers.
If input is the same as output on one axis, that resizer will be skipped.
Which one is called first, is determined by which one has the smallest downscale ratio. This is done to preserve maximum quality, so the 2nd resizer has the best possible picture to work with.
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 27th July 2003 at 17:32.
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 15:34   #5  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
Is then my assumption correct:
Resizing only horizontally won't create errors on interlaced videos (I mean the resizing kernel does not mix different lines but "stays" on one line)
WarpEnterprises is offline   Reply With Quote
Old 2nd October 2002, 15:35   #6  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
yes
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 15:43   #7  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
It is a nice feature that these resizer are smart enough to recognize that the vertical or horizontal value is unchanged and leave it alone. (SimpleResize isn't)

But for awhile now I have toyed with the idea of making a combined BicubicResize. For the most common cases where both the vertical and horizontal sizes change it could eliminate one entire pass through the data by having the vertical resize save the appropriate format that the following horizontal resize wants. This would probably speed it up noticeably for the average case and would not have to affect the above cases at all.

I had actually set out to do this when I instead wrote SimpleResize, but have sort of moved on to other things now. But if someone likes to optimze and happens to have too much time on their hands it might be an interesting thing to look at.

- Tom
trbarry is offline   Reply With Quote
Old 2nd October 2002, 15:59   #8  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
I'm not sure how much you'd gain by implementing a onepass resizer.

First of all you get massive overhead, since you'll most probably run out of free registers due to the added complexity.
It would also mean you would have a very non-liniear memory access pattern, which can result in penalties - all of us who has written a spatial smooth filter knows how it is.

Whoever wrote the current resizers did a very good job - it's very fast and very flexible.
The horizontal also has per-line unpacking, which speeds up the process massively - this could also be implemented in a one-pass resizer, but you'll probably run into many cache-misses, if your unpacked data gets larger then half the cache size. Otherwise, you'd have to unpack x-lines ahead.

I think you could gain up to 25% by doing a onepass resizer, but I did a profile a week ago on a script, that loaded an MPEG2 file, resized (using lanczos), did Fielddeinterlace() and saved out the result uncompressed using fast repack in vdub.
The resizer took ~ 15% of the total CPU time, so in a typical repack as this would gain 4% encoding speed - (and using bicubic and an MPEG4 compressor, the gain would probably be <2%). IMO not worth the massive complexity of writing a onepass resizer.

(hope this made any kind of sense )
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 17:32   #9  |  Link
HarryM
Registered User
 
Join Date: May 2002
Location: Czech rep.
Posts: 390
I have next question...

Resize filter works with luma (Y) and chroma (U, V) separatelly?

When you want to resize faster, is good (idea- luma is much more important as chroma)

luma (Y) resize precise (like to bicubic resize) and
chroma (U, V) resize less precise (like to nearest neighbour).
HarryM is offline   Reply With Quote
Old 2nd October 2002, 17:52   #10  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
IMO not in Avisynth. Yes, the resizers operate seperately with luma/chroma internally, but not more seperate than they are in the same X/Y loop.
Implementing different resizers will only make the code more complex, and gain you little speed. In principle what you're supposing is possible, but I doubt it will help much.
I will do a testversion to see how complex it is, and see if there is any gain but it's not high priority.

If you require seperate processing for quality concerns, you can still use MergeChroma/MergeLuma.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 18:09   #11  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
ok - I was wrong (and I was right)

Implementing it was easy, but it's only possible to do in the horizontal resize, since vertical doesn't have seperate Y/UV processing.
[Edit]: Hence it will not be of any gain, if we implemented it in that one.

Get is at the bottom of the CVS bin site

It is hardcoded to use Biliniar filtering on UV always! Both lanczos and bicubic are affected.
I doubt it will give you much speed improvement though. (I'll try to do a nearest neighbough, if I can do it quick).
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 2nd October 2002 at 18:34.
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 18:19   #12  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
the bicublin resize is a good concept, but more a planar concept.

BTW sh0dan, would it be possible to have a alpha version of avisynth working with YV12 / I420 planar colorspaces ??

or need i to hack my self my own version
Marc FD is offline   Reply With Quote
Old 2nd October 2002, 18:29   #13  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Did a point sampler (nearest neighbour) using the existing filter - even when only used on horizontal Chroma, it looks like crap - visible artifacts along lines. I can put it up, if you're interested, but trust me, it's not worth the speed.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 18:33   #14  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@MarcFD: Patience my friend - still working day and night on float/int32 samples (see the avisynth_2_1 branch in CVS).
If I do a hasty version, it will probably be changed anyway, and I think it should be well tested before we begin to do plugins. Preparing for it is not a bad thing though.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 18:57   #15  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
i wait... i wait..
but in the meantime i can't work on my new filters, because they are almost all in YV12
i'll use some huge convertion step to use planar colorspace in YUY2.

YUY2->I420->YUY2

it's not lossless, and very very slow(not too much,i've some MMX code under my hands), but it's a good begining to do testing

BTW, do you think it would be usefull to adapt VDub's (arbitrary) resize to Avisynth ??
Marc FD is offline   Reply With Quote
Old 2nd October 2002, 19:08   #16  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Marc, I'll get the sample thing debugged and tested, and then throw myself at YV12 ASAP - I think we have a fairly good idea of how to do it from out previous discussion
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd October 2002, 19:19   #17  |  Link
Acaila
Retired
 
Acaila's Avatar
 
Join Date: Jan 2002
Location: Netherlands
Posts: 1,529
Quote:
Marc FD wrote:
but in the meantime i can't work on my new filters
So all the (YUY2) filters you've worked on so far are now working perfectly and are completely bug free??
Acaila is offline   Reply With Quote
Old 2nd October 2002, 19:27   #18  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
how to say it ? yes
in fact i didn't liked the concept of CopySame and MAM, and some approach i tested with XviD gived me much better result, and almost no quality destruction. So i've stopped developpement on these.

nobody reported a bug in Cnr2/Focus2/MPEG2DecPP for a while.
Marc FD is offline   Reply With Quote
Old 2nd October 2002, 20:23   #19  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
Whoever wrote the current resizers did a very good job - it's very fast and very flexible.
The horizontal also has per-line unpacking, which speeds up the process massively - this could also be implemented in a one-pass resizer, but you'll probably run into many cache-misses, if your unpacked data gets larger then half the cache size. Otherwise, you'd have to unpack x-lines ahead.
sh0dan -

Just doing this from memory but I think the vertical resize creates a new frame 1 horizontal line at a time. When it is done the horizontal resize takes one horizontal line at a time and converts it to the unpacked work format, then resizes it.

What I had considered was having a modified version of the vertical resize save one horizontal line at a time in unpacked format and after each line call a modified horizontal resize to resize that single line from the unpacked format into the output frame. I think this would actually lesson cache hits compared to the current scheme as each unpacked line could be created from register values during the vertical resize and immediately horizontal resized (after the line was done) while still possibly in some level cache.

But I guess you are right it would be only an incremental improvement in the grand scheme of things.

- Tom
trbarry is offline   Reply With Quote
Old 3rd October 2002, 08:05   #20  |  Link
HarryM
Registered User
 
Join Date: May 2002
Location: Czech rep.
Posts: 390
sh0dan: I have next idea (good for 'B/W mode' in XviD, e.g.).
When I encoding b/w movie and resized this, is needless resize chroma (chroma not exist, only luma, right?).

Can you define next parameter for resize filters like "forced b/w=on/off"? We can 'resize' and 'convert to b/w' at the same time (with much less time)...
HarryM is offline   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 17:52.


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