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 4th January 2017, 22:22   #2781  |  Link
ryrynz
Registered User
 
ryrynz's Avatar
 
Join Date: Mar 2009
Posts: 3,229
Quote:
Originally Posted by real.finder View Post
Could you please avoid quoting entire posts when there's no reason to? Also your post is directly after pinterf's post which makes it even worse.

Thanks for the new build pinterf!
ryrynz is offline   Reply With Quote
Old 4th January 2017, 23:28   #2782  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Quote:
new script function:
bool IsPackedRGB(clip)
returns true when clip is RGB24/32/48/64
This function is redundant. Please use IsInterleaved(clip) and IsRGB(clip) instead. (There is no IsPackedYUV(clip) either.)

and similarly IsPlanar(clip) and IsRGB(clip) / IsYUV(clip).

-----

With respect to this post: http://forum.doom9.org/showthread.ph...46#post1791946

I think it would be great if (at least) the formats RGB64, YUV422P10 and YUV422P16 would be exposed through the VfW interface. Then we can open such scripts in Virtualdub and encode straight to MagicYUV (without any color conversion).
Wilbert is offline   Reply With Quote
Old 6th January 2017, 12:47   #2783  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by Wilbert View Post
This function is redundant. Please use IsInterleaved(clip) and IsRGB(clip) instead. (There is no IsPackedYUV(clip) either.)

and similarly IsPlanar(clip) and IsRGB(clip) / IsYUV(clip).
I think you are right, IsYUV does not follow this logic, as it applies to YUY2, too.

Quote:
Originally Posted by Wilbert View Post
With respect to this post: http://forum.doom9.org/showthread.ph...46#post1791946

I think it would be great if (at least) the formats RGB64, YUV422P10 and YUV422P16 would be exposed through the VfW interface. Then we can open such scripts in Virtualdub and encode straight to MagicYUV (without any color conversion).
BGR[48] and BRA[64] is already available, ignus2 has done it
https://github.com/pinterf/AviSynthP...c6ee125243c82c
pinterf is offline   Reply With Quote
Old 6th January 2017, 14:10   #2784  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 708
Quote:
Originally Posted by pinterf View Post
BGR[48] and BRA[64] is already available, ignus2 has done it
https://github.com/pinterf/AviSynthP...c6ee125243c82c
But is this patch for source (not for output)?
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 6th January 2017, 14:23   #2785  |  Link
gaak
Registered User
 
Join Date: Apr 2016
Posts: 27
Error msg with x86 builds

Hello all,

When trying to encode a clip I get the following error:

avs [info]: AviSynth+ 0.1 (r2359, MT, i386)
avs [info]: Video colorspace: YV12
avs [info]: Video resolution: 988x720
avs [info]: Video framerate: 24000/1001
avs [info]: Video framecount: 121878
avs4x26x [info]: "C:\MKVideo Encoder\EXEs\x264_x64.exe" - --preset medium --tune
film --crf 18 --profile high --level 4.1 --open-gop --quiet --threads 0 --threa
d-input -o Output_Video_File.h264 --frames 121878 --fps 24000/1001 --input-res
988x720 --input-csp i420
avs [error]: Filter Error: Filter attempted to break alignment of VideoFrame. occurred while reading frame 0

I've tried earlier builds, only r1858 works for me.

The script follows:

Code:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGDecodeNV", 3)
LoadPlugin("C:\MKVideo Encoder\FFMS2\ffms2.dll")
Import("C:\MKVideo Encoder\AVS Scripts\LoadPlugins.avs")
FFVideoSource(source = "C:\MKVideo Files\Input_Video_File.mkv")
Spline144Resize(1280, 720)
RoboCrop(Laced=False)
LSFmod(defaults="slow", preblur="DeGrainMedian(limitY=4, limitUV=6, mode=1, interlaced=false)")
Prefetch(3)
Thanks for any help.
gaak is offline   Reply With Quote
Old 6th January 2017, 14:36   #2786  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by shekh View Post
But is this patch for source (not for output)?
Yes. Avisource and DirectShowSource.
pinterf is offline   Reply With Quote
Old 6th January 2017, 14:36   #2787  |  Link
BakaProxy
Registered User
 
Join Date: Jan 2015
Posts: 47
Quote:
Originally Posted by gaak View Post
Hello all,

When trying to encode a clip I get the following error:

avs [info]: AviSynth+ 0.1 (r2359, MT, i386)
avs [info]: Video colorspace: YV12
avs [info]: Video resolution: 988x720
avs [info]: Video framerate: 24000/1001
avs [info]: Video framecount: 121878
avs4x26x [info]: "C:\MKVideo Encoder\EXEs\x264_x64.exe" - --preset medium --tune
film --crf 18 --profile high --level 4.1 --open-gop --quiet --threads 0 --threa
d-input -o Output_Video_File.h264 --frames 121878 --fps 24000/1001 --input-res
988x720 --input-csp i420
avs [error]: Filter Error: Filter attempted to break alignment of VideoFrame. occurred while reading frame 0

I've tried earlier builds, only r1858 works for me.

The script follows:

Code:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGDecodeNV", 3)
LoadPlugin("C:\MKVideo Encoder\FFMS2\ffms2.dll")
Import("C:\MKVideo Encoder\AVS Scripts\LoadPlugins.avs")
FFVideoSource(source = "C:\MKVideo Files\Input_Video_File.mkv")
Spline144Resize(1280, 720)
RoboCrop(Laced=False)
LSFmod(defaults="slow", preblur="DeGrainMedian(limitY=4, limitUV=6, mode=1, interlaced=false)")
Prefetch(3)
Thanks for any help.
First off try without MT before you start complaining online.

Verstuurd vanaf mijn SM-A500FU met Tapatalk
BakaProxy is offline   Reply With Quote
Old 6th January 2017, 14:57   #2788  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by gaak View Post
avs [error]: Filter Error: Filter attempted to break alignment of VideoFrame. occurred while reading frame 0

I've tried earlier builds, only r1858 works for me.

The script follows:

Code:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGDecodeNV", 3)
LoadPlugin("C:\MKVideo Encoder\FFMS2\ffms2.dll")
Import("C:\MKVideo Encoder\AVS Scripts\LoadPlugins.avs")
FFVideoSource(source = "C:\MKVideo Files\Input_Video_File.mkv")
Spline144Resize(1280, 720)
RoboCrop(Laced=False)
LSFmod(defaults="slow", preblur="DeGrainMedian(limitY=4, limitUV=6, mode=1, interlaced=false)")
Prefetch(3)
One of the filters used SubFrame or SubframePlanar and specified plane offsets and/or pitches that are incompatible with recent versions of Avisynth+. This prevention was introduced because Avisynth+ core and filters in general assume proper alignment for processing the frame. Avisynth plus' default alignment is 32 bytes. One of the filter is using the subframe function with frame properties that are aligned for less than 32 bytes.

I suspect the RoboCrop function in the script, try to use it with align=true

Internally Avisynth+'s Crop is alignment-safe. It checks whether alignment is o.k. for the fast SubFrame. If not, it creates a new frame instead (guaranteed to have proper alignment) and copies the cropped area there.

Last edited by pinterf; 9th January 2017 at 11:38. Reason: word avs->avs+
pinterf is offline   Reply With Quote
Old 6th January 2017, 16:08   #2789  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,173
Hey folks, I haven't been around for a while (been busy with other things), and I'm glad the development has progressed.

Converting my auto-generated scripts to native 16-bit is something I'd like to do (and adapting AviSynthShader to support conversion to/from native 16-bit), but where I have hesitation is in compromising quality in doing so. Is there now a way of performing these 2 operations without DitherTools?
- Dithering with Floyd-Steinberg
- Resizing with NoRinging (Dither_resize16nr)

Actually, as I'm writing this, I'm remembering that NoRinging resize is simply a script-based wrapper around the standard resizer so it probably can be used just the same (would have to try to confirm). Still that leaves dithering which requires custom coding.

Have I missed any other major update that either impact quality of performance since I last interacted here, or was it mostly new features?
MysteryX is offline   Reply With Quote
Old 6th January 2017, 16:55   #2790  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 701
dithering is possible with convertto8bits or convertbits, but IIRC there is only dither or not dither (truncate, round?)

as you can see from the wrapper function nr resize it's just a repair between the chosen one and gauss
Code:
Function Dither_resize16nr (clip src, int width, int height,
\	float  "src_left",
\	float  "src_top",
\	float  "src_width",
\	float  "src_height",
\	string "kernel",
\	float  "fh",
\	float  "fv",
\	int    "taps",
\	float  "a1",
\	float  "a2",
\	float  "a3",
\	int    "kovrspl",
\	bool   "cnorm",
\	bool   "center",
\	string "cplace",
\	int    "y",
\	int    "u",
\	int    "v",
\	string "kernelh",
\	string "kernelv",
\	float  "totalh",
\	float  "totalv",
\	bool   "invks",
\	bool   "invksh",
\	bool   "invksv",
\	int    "invkstaps",
\	string "cplaces",
\	string "cplaced",
\	string "csp",
\	bool   "noring")
{
	noring = Default (noring, true)

	Assert (width > 0 && height > 0, "Dither_resize16nr: width and height must be > 0.")

	sr_h  = Float (width ) / Float (src.width () )
	sr_v  = Float (height) / Float (src.height ())
	sr_up =       Dither_max (sr_h, sr_v)
	sr_dw = 1.0 / Dither_min (sr_h, sr_v)
	sr    = Dither_max (sr_up, sr_dw)
	Assert (sr >= 1.0)

	# Depending on the scale ratio, we may blend or totally disable
	# the ringing cancellation
	thr = 2.5
	nrb = (sr > thr)
	nrf = (sr < thr + 1.0 && noring)
	nrr = (nrb) ? Dither_min (sr - thr, 1.0) : 1.0
	nrv = (nrb) ? Round ((1.0 - nrr) * 255) * $010101 : 0

	main = src.Dither_resize16 (width, height,
\		src_left  =src_left,
\		src_top   =src_top,
\		src_width =src_width,
\		src_height=src_height,
\		kernel    =kernel,
\		fh        =fh,
\		fv        =fv,
\		taps      =taps,
\		a1        =a1,
\		a2        =a2,
\		a3        =a3,
\		kovrspl   =kovrspl,
\		cnorm     =cnorm,
\		center    =center,
\		cplace    =cplace,
\		y         =y,
\		u         =u,
\		v         =v,
\		kernelh   =kernelh,
\		kernelv   =kernelv,
\		totalh    =totalh,
\		totalv    =totalv,
\		invks     =invks,
\		invksh    =invksh,
\		invksv    =invksv,
\		invkstaps =invkstaps,
\		cplaces   =cplaces,
\		cplaced   =cplaced,
\		csp       =csp
\	)

	nrng = (nrf) ? src.Dither_resize16 (width, height,
\		src_left  =src_left,
\		src_top   =src_top,
\		src_width =src_width,
\		src_height=src_height,
\		kernel    ="gauss",
\		a1        =100,
\		center    =center,
\		cplace    =cplace,
\		cplaces   =cplaces,
\		cplaced   =cplaced,
\		csp       =csp,
\		y         =y,
\		u         =u,
\		v         =v
\	) : main

	nrm = (nrb && nrf) ? main.BlankClip (color_yuv=nrv, height=main.Height()/2) : main

	# To do: use a simple frame blending instead of Dither_merge16
	rgm = 1
	rgc = (nrb) ? -1 : 0
	rgy = Defined (y) ? ((y == 3) ? rgm : rgc) : rgm
	rgu = Defined (u) ? ((u == 3) ? rgm : rgc) : rgm
	rgv = Defined (v) ? ((v == 3) ? rgm : rgc) : rgm
	rguv = Dither_max (rgu, rgv)
	(nrf       ) ? main.Dither_repair16 (nrng, rgy, rguv)            : main
	(nrf && nrb) ? Dither_merge16_8 (main, last, nrm, y=y, u=u, v=v) : last
}Function Dither_resize16nr (clip src, int width, int height,
\	float  "src_left",
\	float  "src_top",
\	float  "src_width",
\	float  "src_height",
\	string "kernel",
\	float  "fh",
\	float  "fv",
\	int    "taps",
\	float  "a1",
\	float  "a2",
\	float  "a3",
\	int    "kovrspl",
\	bool   "cnorm",
\	bool   "center",
\	string "cplace",
\	int    "y",
\	int    "u",
\	int    "v",
\	string "kernelh",
\	string "kernelv",
\	float  "totalh",
\	float  "totalv",
\	bool   "invks",
\	bool   "invksh",
\	bool   "invksv",
\	int    "invkstaps",
\	string "cplaces",
\	string "cplaced",
\	string "csp",
\	bool   "noring")
{
	noring = Default (noring, true)

	Assert (width > 0 && height > 0, "Dither_resize16nr: width and height must be > 0.")

	sr_h  = Float (width ) / Float (src.width () )
	sr_v  = Float (height) / Float (src.height ())
	sr_up =       Dither_max (sr_h, sr_v)
	sr_dw = 1.0 / Dither_min (sr_h, sr_v)
	sr    = Dither_max (sr_up, sr_dw)
	Assert (sr >= 1.0)

	# Depending on the scale ratio, we may blend or totally disable
	# the ringing cancellation
	thr = 2.5
	nrb = (sr > thr)
	nrf = (sr < thr + 1.0 && noring)
	nrr = (nrb) ? Dither_min (sr - thr, 1.0) : 1.0
	nrv = (nrb) ? Round ((1.0 - nrr) * 255) * $010101 : 0

	main = src.Dither_resize16 (width, height,
\		src_left  =src_left,
\		src_top   =src_top,
\		src_width =src_width,
\		src_height=src_height,
\		kernel    =kernel,
\		fh        =fh,
\		fv        =fv,
\		taps      =taps,
\		a1        =a1,
\		a2        =a2,
\		a3        =a3,
\		kovrspl   =kovrspl,
\		cnorm     =cnorm,
\		center    =center,
\		cplace    =cplace,
\		y         =y,
\		u         =u,
\		v         =v,
\		kernelh   =kernelh,
\		kernelv   =kernelv,
\		totalh    =totalh,
\		totalv    =totalv,
\		invks     =invks,
\		invksh    =invksh,
\		invksv    =invksv,
\		invkstaps =invkstaps,
\		cplaces   =cplaces,
\		cplaced   =cplaced,
\		csp       =csp
\	)

	nrng = (nrf) ? src.Dither_resize16 (width, height,
\		src_left  =src_left,
\		src_top   =src_top,
\		src_width =src_width,
\		src_height=src_height,
\		kernel    ="gauss",
\		a1        =100,
\		center    =center,
\		cplace    =cplace,
\		cplaces   =cplaces,
\		cplaced   =cplaced,
\		csp       =csp,
\		y         =y,
\		u         =u,
\		v         =v
\	) : main

	nrm = (nrb && nrf) ? main.BlankClip (color_yuv=nrv, height=main.Height()/2) : main

	# To do: use a simple frame blending instead of Dither_merge16
	rgm = 1
	rgc = (nrb) ? -1 : 0
	rgy = Defined (y) ? ((y == 3) ? rgm : rgc) : rgm
	rgu = Defined (u) ? ((u == 3) ? rgm : rgc) : rgm
	rgv = Defined (v) ? ((v == 3) ? rgm : rgc) : rgm
	rguv = Dither_max (rgu, rgv)
	(nrf       ) ? main.Dither_repair16 (nrng, rgy, rguv)            : main
	(nrf && nrb) ? Dither_merge16_8 (main, last, nrm, y=y, u=u, v=v) : last
}
as rgtools and merge(luma/chroma) now works in 16bit it can be adapted
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Old 6th January 2017, 17:16   #2791  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,173
Quote:
Originally Posted by Motenai Yoda View Post
as rgtools and merge(luma/chroma) now works in 16bit it can be adapted
If someone wants to do that adaptation, it would then work for both 8-bit and 16-bit with the same code.
MysteryX is offline   Reply With Quote
Old 6th January 2017, 18:00   #2792  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,293
Quote:
Originally Posted by Foja View Post
Hello,

since long time I am a silent reader in this discussion. I am using the plug-in RemoveDirt in the 8-bit version of avisynth for many years. I am very satisfied with this plug-in.
Now I am starting to use avisynth+ for my cleaning script, all plugins which i normaly use in the 8-bit version are already available exept "RemoveDirt".
RemoveDirt is for me a important plugin which I don't want to miss in my cleaning script for avisynth+.

Is there the plan to convert the plugin "RemoveDirt" to the new version avisynth+?
yes its important for many

and if someone add it to rgtools I wish that he/she add the others mode of RemoveGrain too (more than 24) as there are some scripts use them, and there are RemoveGrainHD and RemoveGrainT too
__________________
My Avisynth Stuff

Last edited by real.finder; 19th January 2017 at 03:09.
real.finder is offline   Reply With Quote
Old 6th January 2017, 18:11   #2793  |  Link
gaak
Registered User
 
Join Date: Apr 2016
Posts: 27
Quote:
Originally Posted by pinterf View Post
I suspect the RoboCrop function in the script, try to use it with align=true
@pinterf Thank you very much for the answer, that worked!
gaak is offline   Reply With Quote
Old 6th January 2017, 21:27   #2794  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
I'd also like to be able to do linear-light resizing in 16-bit. Dither tools has "Dither_y_gamma_to_linear" and "Dither_y_linear_to_gamma". But for these to work you need to convert to and from stacked as well. And also use "dither_resize16" unless you really want to go to and from stacked a lot of times.

Is there another way to convert between linear and gamma light? mt_lut could do it if it worked in 16 bits.
ajp_anton is offline   Reply With Quote
Old 7th January 2017, 00:30   #2795  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Quote:
Originally Posted by pinterf View Post
Yes. Avisource and DirectShowSource.
Was asking about the output. Apperantly the code is in main.cpp (*), but i don't know that part well enough to tell what and how it should be updated.

(*) see CAVIStreamSynth::Info, CAVIFileSynth::ImageSize, CAVIStreamSynth::ReadFrame and CAVIStreamSynth::ReadFormat.

Last edited by Wilbert; 7th January 2017 at 00:35.
Wilbert is offline   Reply With Quote
Old 8th January 2017, 14:59   #2796  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Quote:
One of the filters used SubFrame or SubframePlanar and specified plane offsets and/or pitches that are incompatible with Avisynth.
Pinterf, you really should use the term Avisynth+ or similar when talking about such, RoboCrop is totally compatible with Avisynth, it's Avs+ where
the problem arises.

Also might be related:- I wrote a plugin a few weeks/months ago with optional clip which produced some kind of access Violation when NULL clip,
(with avs+ I think), I suspect that the code that causes/detects above SubFrame error in avs+ was accessing the NULL clip at some point and causing the
access violation, (I'm not sure about that being the cause, but if internal avs+ is gonna mess with clips it should make sure not to mess with optional
NULL ones, I think that problem only appeared in avs+ and not avs standard, but am not completely sure).

Also, can you tell me how to reliably detect Avs+ in most recent versions (at least), without basing it on Version or VersionString, I'll have a go at doing modified RoboCrop behaviour only for avs+ and the default avs+ cropping alignment of 32.

Thanx very much
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th January 2017 at 15:07.
StainlessS is offline   Reply With Quote
Old 8th January 2017, 16:29   #2797  |  Link
Groucho2004
Fossil
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Location: A wretched hive of scum and villainy
Posts: 4,470
Quote:
Originally Posted by StainlessS View Post
Also, can you tell me how to reliably detect Avs+ in most recent versions (at least), without basing it on Version or VersionString, I'll have a go at doing modified RoboCrop behaviour only for avs+ and the default avs+ cropping alignment of 32.
See here. As for newer builds, just test for newly introduced functions.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 8th January 2017, 17:00   #2798  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Thanx G2K4, think i'll use "AddAutoloadDir()".

Any body aware of bulletproof way to call GScript() code in both avs+ and avs standard ?
(GScript does not appear in list of builtin functions in avs+, nor does eg GImport, GEval, for, if, else, etc.)

EDIT: I guess that easiest way is to still use GScript plugin even in avs+.
GScript() really should have been incorporated into avs many moons ago, then we would not have current nonsense.

EDIT: Maybe have to force Eval/GEval into use with some kind of string replace to select plus or standard.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th January 2017 at 17:27.
StainlessS is offline   Reply With Quote
Old 9th January 2017, 09:55   #2799  |  Link
dipje
Registered User
 
Join Date: Oct 2014
Posts: 270
Isn't it possible and an idea to port fmtconv from vapoursynth to avs+? Would give you all the resizers, kernels, chroma conversion, matrix conversion, gamma space conversion and dithering tools you would I guess.
dipje is offline   Reply With Quote
Old 9th January 2017, 11:43   #2800  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,293
Quote:
Originally Posted by dipje View Post
Isn't it possible and an idea to port fmtconv from vapoursynth to avs+? Would give you all the resizers, kernels, chroma conversion, matrix conversion, gamma space conversion and dithering tools you would I guess.
or just update dither tools to read all avs+ features
__________________
My Avisynth Stuff
real.finder 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 10:40.


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