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

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd January 2011, 00:25   #141  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
A Happy New Year, to all our Avisynth friends and family.

Quote:
Originally Posted by Wilbert View Post
I'm updating the documentation again Regarding SkewRows. I noticed that for RGB it skews from the bottom and for YUY2/Y8 from the top. It's perhaps nice to add this as an option where it starts to skew.
Yes as noted above the skewing is memory layout based, so RGB images are skew from the bottom up, YUV images are skew from the top down. I threw it together to read those skewed error messages that some media player users were submitting a short while ago, so no great amount of thought went into the design.

The effect of the algorithm is to paste all of the input rows together as one single very long row, then slice them up based on the new width (= input width + skew). Skew can also be negative in which case the last skew pixels of each line are added to the beginning of the next line and you get some extra lines at the end. The last line is padded with grey pixels when required.

The geometry of the output is calculated thus :-
. OutWidth = InWidth + Skew // signed skew values acceptable
. OutHeight = (InHeight*InWidth + OutWidth-1) / OutWidth // Ceiling

Quote:
Also, when do you know when to use "Add "Global OPT_AVIPadScanlines=True" option for DWORD aligned planar padding."? Is it sometimes set to false by some input filters?
OPT_AVIPadScanlines controls the memory alignment used in the AVIFile output emulation, class CAVIFileSynth::, Avisynth input filters should have nothing to do with this output option. Programs that use direct Avisynth API input, e.g x264, will be unaffected by this option, but may choose to support it if appropriate.

Microsoft specify 4 byte, DWORD, alignment for the simple DIB compatible formats, RGB24, RGB32, YUY2 and Y8. They make no specification for other formats, i.e. it is format specific.

Avery Lee in VirtualDub assumes all planar YUV formats are packed, i.e. pitch = rowsize, and all DIB compatible formats are DWORD aligned, i.e. pitch = (rowsize+3)/4 * 4.

By default Avisynth conforms to VirtualDub's alignment and packing expectations. For other software using AVIFile input that may assume DWORD alignment of a planar format the user can set OPT_AVIPadScanlines=True. With VirtualDub's direct stream copy mode the Avisynth AVIFile emulation packing is copied through, so DWORD aligned planar AVI files can be created by this method.

Both DirectShowSource (257) and AviSource (260b3) test for and support both packed and DWORD aligned planar memory layouts.

For image widths such that the chroma rowsize is mod4 there is never an issue, i.e YV24 is mod4, YV16 and YV12 are mod8, YV411 is mod16. But for other widths the assumptions made by the software in use becomes relevant.

If the result of processing a planar output Avisynth script, via the AVIFile interface, shows row skewing then OPT_AVIPadScanlines=True may help.
IanB is offline   Reply With Quote
Old 2nd January 2011, 21:22   #142  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 805
Is there a build of this that includes SetMTmode?
ajp_anton is offline   Reply With Quote
Old 3rd January 2011, 00:51   #143  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
In this link, you have avaliable different versions included MT. http://avisynth.org/mediawiki/Main_Page
Overdrive80 is offline   Reply With Quote
Old 3rd January 2011, 09:56   #144  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by ajp_anton View Post
Is there a build of this that includes SetMTmode?
See IanB's answer at post #38:
Quote:
Originally Posted by IanB View Post
There is no MT in either the Alpha 1 or 2 releases. I have noted SEt's changes for a subsequent release. I will very probably not be doing threading the messy SetMTmode() way.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th January 2011, 01:49   #145  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Does this bug exist in 2.6?
Code:
#crop bug
exposebug=false#set to true to crash
n=exposebug?241:240
colorbars
crop(0,n,0,n)
#~ File "pyavs.pyo", line 310, in _GetFrame
#~ File "avisynth.pyo", line 139, in BitBlt
#~ WindowsError: exception: access violation reading 0x02DDFFE0
jmac698 is offline   Reply With Quote
Old 12th January 2011, 02:32   #146  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Yes it does.
Reason is code in transform.cpp:
Code:
 } else {
    // RGB is upside-down
    _top = vi.height - _height - _top;
  }

  if (_left + _width > vi.width || _top + _height > vi.height)
    env->ThrowError("Crop: you cannot use crop to enlarge or 'shift' a clip");
For RGB, if _top+_height > vi.height, _top will become negative and will not be caught by the following error check.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th January 2011, 02:42   #147  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Amazing. I did a quick search and can't find any other bugs reports. If only there were a bounty I tend to do advanced/weird stuff and find bugs in any program.
jmac698 is offline   Reply With Quote
Old 12th January 2011, 02:44   #148  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Yes, The "Crop: you cannot use crop to enlarge or 'shift' a clip" test is wrong for RGB. Fixed!


@Gavino: Snap!
IanB is offline   Reply With Quote
Old 12th January 2011, 03:09   #149  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
could we update this page:
http://avisynth.org/mediawiki/Known_Issues
I don't know where else to put it.

Last edited by jmac698; 12th January 2011 at 11:46.
jmac698 is offline   Reply With Quote
Old 12th January 2011, 11:47   #150  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
I was wondering if this behavior exists in 2.6, and if you can think of a way of reducing memory usage, and also improve the color problems to the same amount of accuracy as Layer, finally why do I get the wrong lines at the top when n>=26?:
Code:
#Overlay uses color conversions, this can be a problem if called many times
#you will see an increasing yellowish color at the top of the screen
#the script also uses a large amount of memory
#Layer has none of these issues
#Layer does have issues when n>=26, the wrong lines appear
base=blankclip.trim(0,9)
over=colorbars.trim(0,9)
showissue=true#Be careful with overlayissue, large values of n cause excessive memory use leading to a crash
showissue?overlayissue(base,over,25):layernonissue(base.resetmask,over.resetmask,26)
function overlayissue(clip base, clip over, int n) {
  n<2?overlay(base,over.crop(0,n-1,0,1),y=n-1):overlay(overlayissue(base,over.crop(0,n-1,0,1),n-1),over.crop(0,n-1,0,1),y=n-1)
}
function layernonissue(clip base, clip over, int n) {
  n<2?layer(base,over.crop(0,n-1,0,1),y=n-1):layer(layernonissue(base,over.crop(0,n-1,0,1),n-1),over.crop(0,n-1,0,1),y=n-1)
}

Last edited by jmac698; 12th January 2011 at 12:03.
jmac698 is offline   Reply With Quote
Old 12th January 2011, 13:47   #151  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by jmac698 View Post
why do I get the wrong lines at the top when n>=26?
Code:
function layernonissue(clip base, clip over, int n) {
  n<2?layer(base,over.crop(0,n-1,0,1),y=n-1):layer(layernonissue(base,over.crop(0,n-1,0,1),n-1),over.crop(0,n-1,0,1),y=n-1)
}
Because your script is wrong - you are passing a one-line clip on the recursive call, which then gets cropped beyond its end. (This should give an error, but doesn't, which is the bug you've already reported.)
The second parameter should just be over at all recursive levels. (Would have been easier using GScript )

The same error exists in overlayissue, which probably explains the crashes for large n.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th January 2011, 13:58   #152  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Great, that fixed one of the problems. There is still a huge amount of memory used in overlay, hundreds of MB.
Code:
#Overlay uses color conversions, this can be a problem if called many times
#you will see an increasing yellowish color at the top of the screen
#the script also uses a large amount of memory
#Layer has none of these issues
base=blankclip.trim(0,9)
over=colorbars.trim(0,9)
showissue=true#Be careful with overlayissue, large values of n cause excessive memory use leading to a crash
showissue?overlayissue(base,over,25):layernonissue(base.resetmask,over.resetmask,400)
function overlayissue(clip base, clip over, int n) {
  n<2?overlay(base,over.crop(0,n-1,0,1),y=n-1):overlay(overlayissue(base,over,n-1),over.crop(0,n-1,0,1),y=n-1)
}
function layernonissue(clip base, clip over, int n) {
  n<2?layer(base,over.crop(0,n-1,0,1),y=n-1):layer(layernonissue(base,over,n-1),over.crop(0,n-1,0,1),y=n-1)
}
jmac698 is offline   Reply With Quote
Old 16th January 2011, 19:08   #153  |  Link
GRKNGLR
Registered User
 
Join Date: Feb 2009
Posts: 30
Quote:
Originally Posted by IanB View Post
There is no MT in either the Alpha 1 or 2 releases. I have noted SEt's changes for a subsequent release. I will very probably not be doing threading the messy SetMTmode() way.
When will an MT-supporting version be released? Will there be x64 support at the 2.6 release?

Last edited by GRKNGLR; 16th January 2011 at 19:20.
GRKNGLR is offline   Reply With Quote
Old 22nd January 2011, 17:18   #154  |  Link
kemuri-_9
Compiling Encoder
 
kemuri-_9's Avatar
 
Join Date: Jan 2007
Posts: 1,348
latest repository does not compile in .net 2008:

Quote:
Originally Posted by Visual Studio 2008
1>.\filters\levels.cpp(187) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\filters\levels.cpp(201) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\filters\levels.cpp(213) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\filters\levels.cpp(224) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\filters\levels.cpp(236) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
since the fix is trivial i'll withhold posting a patch.
__________________
custom x264 builds & patches | F@H | My Specs

Last edited by kemuri-_9; 22nd January 2011 at 17:21.
kemuri-_9 is offline   Reply With Quote
Old 25th April 2011, 10:00   #155  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
I try last official Avisynth 2.6 with simple script
Code:
ImageSource("TSW Charger V4.4.jpg", end=0)
ConvertToYUY2()
nnediresize_YUY2()
function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
	v = c.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnleft()
	v = v.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnright()
	return v
}

function nnediresize_YUY2(clip c)
{
	cy = c
	cu = c.utoy()
	cv = c.vtoy()
	cy = nnediresize2x(cy,true,false,false)
	cu = nnediresize2x(cu,true,false,false)
	cv = nnediresize2x(cv,true,false,false)
	return ytouv(cu,cv,cy)
}

function nnediresize_YV12(clip c)
{
	return nnediresize2x(c,true,true,true)
}
for enlarge image, it is work with YV12 colorspace, but not work with YUY2.
Please explain.
yup.
yup is offline   Reply With Quote
Old 25th April 2011, 12:20   #156  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Sorry the YUY2 version of the YtoUV() code is broken. See post 132 above by Stainless.

The planar version works so you could use an intermediate YV16 and then convert that to YUY2 at the end.

Also a better workflow in 2.6 would be RGB -> YV24 -> nnedi3 -> YV16 -> YUY2, which would save doubling the chroma width.
Code:
ImageSource("TSW Charger V4.4.jpg", end=0) # RGB Format

ConvertToYV24() # No chroma subsampling

nnediresize_YUY2()

function nnediresize2x(clip c, bool pY, bool pU, bool pV)
{
	v = c.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnleft()
	v = v.nnedi3(dh=true,Y=pY,U=pU,V=pV,field=0).turnright()
	return v
}

function nnediresize_YUY2(clip c)
{
	cy = c.ConvertToY8().ConvertToYV12() # Fast extract Y, blank chroma
	cu = c.UtoY8().ConvertToYV12() # Fast extract U to Y, blank chroma
	cv = c.VtoY8().ConvertToYV12() # Fast extract V to Y, blank chroma

	cy = nnediresize2x(cy,true,false,false) # Double height and double width

	cu = nnedi3(dh=true,Y=True,U=False,V=False,field=0) # Double height only
	cv = nnedi3(dh=true,Y=True,U=False,V=False,field=0) # Double height only

	YtoUV(cu,cv,cy) # YV16 output
	return ConvertToYUY2() # Lossless conversion to YUY2
}
The *toY8() are all zero cost (pointer flip only) for planar. The Y8 to YV12 costs a plane blit + 2 memfills. A normal YV24 to YV12 would cost a resize of the chroma but as we don't want them here we can save a lot. As nnedi3() is a 2.5 filter it must have YV12.
IanB is offline   Reply With Quote
Old 25th April 2011, 12:49   #157  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
IanB
But I get error at line
Code:
cy = c.ConvertToY8().ConvertToYV12() # Fast extract Y, blank chroma
yup.
yup is offline   Reply With Quote
Old 25th April 2011, 15:32   #158  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
@yup,

And the error message is ????
IanB is offline   Reply With Quote
Old 25th April 2011, 17:35   #159  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
IanB!
Please.
Line 5 it it is line calling nnediresize_YUY2(), Line 16 it it is line
Code:
cy = c.ConvertToY8().ConvertToYV12() # Fast extract Y, blank chroma
yup.
Attached Images
 
yup is offline   Reply With Quote
Old 25th April 2011, 17:55   #160  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by IanB View Post
Sorry the YUY2 version of the YtoUV() code is broken.
Is this fixed in CVS?
Any timescale for getting a new release out?
On 18th Jan 2011, you said:
Quote:
Originally Posted by IanB View Post
The bugfix list has become pretty meaty, perhaps I should devote some cycles to give people a release. I'll try to put some effort into fixing the offset errors in the planar conversions and then roll out another alpha release soon.
I know there are some third party CVS builds floating about, but a new official release (even if still alpha) would be a very welcome addition.

@yup:
Wouldn't it have been more useful just to quote the error message? - images can take some time to be approved by a mod.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:42.


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