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

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 21st December 2016, 20:33   #2741  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
As Avisynth+ project is demanding modernized filters, my next port will be masktools2.

Meantime I had a look at tp7's masktools project. As it was mentioned, there is a 16 bit branch, which is in quite a good shape, a lot of filters are basically ready, supporting stacked and 'doublewidth' hacked formats. This latter is basically the normal 16 bit way, how Avisynth+ works. This branch is a little behind over the latest masktools b2 release.

The extensions are 16 bit only, so the 10, 12, 14 bit support have to be inserted in. For practicing I have modded mt_binarize16 to have 10-14 bits, as the easiest part. After several hours it is still very hard for me to understand the framework, very general, very C++, macro magics, and those are somehow producing a working avisynth filter.

My goal will also be to have one filter name that works for all video formats, so there will be no separate mt_binarize and mt_binarize16.
pinterf is offline  
Old 21st December 2016, 21:35   #2742  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
Shouldn't be faster starting off Firesledge's dither_tools mt functions? also there is CLExpr which can be a good point to add heterogeneous computing too
__________________
powered by Google Translator
Motenai Yoda is offline  
Old 21st December 2016, 22:47   #2743  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by pinterf View Post
The real problem is the scope of variables, this plugin sets global paramers run-time, and this is somehow different in AVS+ than is classic AVS.
Does the standard ScriptClip work correctly under mt?
Since GScriptClip is essentially a wrapper around the original function, its multithreading characteristics should be the same. However it does have some differences which may or may not be significant - current_frame is made a global variable, and the function may (depending on parameters) start a new scope level with env->PushContext().

How do variables work under mt?
I don't see how functions like ScriptClip, which relies on 'current_frame', can ever be thread-safe (unless somehow each thread has its own set of variables?)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline  
Old 22nd December 2016, 09:57   #2744  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by Gavino View Post
Does the standard ScriptClip work correctly under mt?
Since GScriptClip is essentially a wrapper around the original function, its multithreading characteristics should be the same. However it does have some differences which may or may not be significant - current_frame is made a global variable, and the function may (depending on parameters) start a new scope level with env->PushContext().

How do variables work under mt?
I don't see how functions like ScriptClip, which relies on 'current_frame', can ever be thread-safe (unless somehow each thread has its own set of variables?)
Standard ScriptClip works under mt, and the filter itself is NICE_FILTER, but I don't know how the derived mt behaviour is figured out by the content.
As for the variables, there is a TLS (thread-local storage) for each thread. They have their own context of local and global variables. When a thread-locale variable is not found in the there, it looks out for the core level variables.
See here

The problem that I don't understand, that why I have "end of file reached without matching }" in the debug log.

EDIT:
There was a bug when an avisynth exception came from the thread-local environment, the variadic sprintf-like formatting was not correct, and it would corrupt the stack or the exception rollback mechanism somehow.
-- end of edit --

The error chain is thrown from this srestore.avsi line:
Code:
	Try { global Srestore_InstanceNumber = Srestore_InstanceNumber+1 } catch(err) { global Srestore_InstanceNumber = 1 }
Original error comes from the try block. The error lines are growing as the exceptions are re-thrown back to one level.

Then follows the "file end reached" error and this is what I don't understand.

And the log:
Code:
ERROR: I don't know what 'Srestore_InstanceNumber' means.
---------------------------------------------------------------------
ERROR: I don't know what 'Srestore_InstanceNumber' means.
(C:/Program Files (x86)/AviSynth/plugins/SRestore_27.avsi, line 80)
---------------------------------------------------------------------
ERROR: Script error: end of file reached without matching }
---------------------------------------------------------------------
ERROR: Script error: end of file reached without matching }
((null), line 50, column 0)
---------------------------------------------------------------------
ERROR: Script error: end of file reached without matching }
((null), line 50, column 0)
(C:/Program Files (x86)/AviSynth/plugins/SRestore_27.avsi, line 320)
---------------------------------------------------------------------
ERROR: Script error: end of file reached without matching }
((null), line 50, column 0)
(C:/Program Files (x86)/AviSynth/plugins/SRestore_27.avsi, line 320)
(.\s1.AVS, line 8)

Last edited by pinterf; 28th December 2016 at 13:41.
pinterf is offline  
Old 22nd December 2016, 13:09   #2745  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
New dev build
Download: Avisynth plus r2347

20161222 r2347dev
  • CombinePlanes: setting target to default RGBP(A)/YUV(A), when inputs are greyscale and no source planes are given
    Decision is made by the target plane characters, if they are like R,G,B then target video format will be planar RGB
    Same logic applies for YUV.
    Example:
    Y1, Y2 and Y3 are greyscale clips
    Old, still valid: CombinePlanes(Y1, Y2, Y3, planes="RGB", source_planes="YYY", pixel_type="RGBP8")
    New: CombinePlanes(Y1, Y2, Y3, planes="RGB") # result: Planar RGB
  • Fix: ScriptClip would show garbage text when internal exception occurs instead of the showing human readable error message
pinterf is offline  
Old 25th December 2016, 13:17   #2746  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Scriptclip

I tried script clip and ran into problem.My input is colorbars. I was continuously getting some large line number on top of the input image. I found that prefetch is the cause of this. After commenting out this I could run script clip correctly.
__________________
mohan
my plugins are now hosted here
vcmohan is offline  
Old 25th December 2016, 17:07   #2747  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Still getting large numbers with r2347? Or did your Scriptsclip sample work for you in MT before this latest build?
pinterf is offline  
Old 26th December 2016, 06:39   #2748  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I was using r2294
__________________
mohan
my plugins are now hosted here
vcmohan is offline  
Old 26th December 2016, 06:58   #2749  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Now I am on r2347. With the statement prefetch(4) , I get an error message now readable as "invalid arguments to ....". But commenting out prefetch the script runs fine without any error.
__________________
mohan
my plugins are now hosted here
vcmohan is offline  
Old 26th December 2016, 10:40   #2750  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
That will be difficult. Visible error message is only the first stage of a possible fix. Now my test is srestore. I made a modification (post 2347) that affects global variables in scriptclip runtime. Now it does not display the exception, finally goes on, but is turning into deadlock somewhere in the handling of the multithread guard mutexes. And I think this is the real problem to be solved.

Can you strip your script to a short one that is still showing the error?
pinterf is offline  
Old 27th December 2016, 14:15   #2751  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I found that if any parameter other than clip is specified it is giving an error. The parameter need not be calculated in the script. I found that placing Reformer(last, last) was ok, but Reformer(last,last, qr = true) raises error.
__________________
mohan
my plugins are now hosted here
vcmohan is offline  
Old 27th December 2016, 16:41   #2752  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by pinterf View Post
Misc. video info properties
  • ComponentSize
    8 bit: 1 (bytes)
    10-16 bit: 2 (bytes)
    32 bit float: 4 (bytes)
  • BitsPerComponent
    8, 10, 12, 14, 16, 32
  • ComponentCount
    1 for greyscale
    3 for YUV, Planar RGB, RGB24 and RGB48
    4 for YUVA, Planar RGBA, RGB32 and RGB64
ComponentCount not existing, it give me "There is no function named 'ComponentCount'"

and it will be more easy if we have "HasAlpha()"
__________________
See My Avisynth Stuff

Last edited by real.finder; 28th December 2016 at 08:47.
real.finder is offline  
Old 28th December 2016, 00:06   #2753  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
No reason for a full quote.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 28th December 2016, 00:09   #2754  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 805
Found this weird problem...

http://ajpanton.se/avsbug/source.mkv (~4.2MB)

Script:
Code:
ffms2("source.mkv")

vectors = msuper().manalyse(isb = false)
mdata = mdepan(vectors, zoom=true, rot=true)
depanstabilize(data=mdata, dxmax=100, dymax=100, rotmax=2.0, mirror=15)
Using the old 1.13 version of DePan and Avisynth+ r2347 (and pinterf's latest mvtools). I can test with "vanilla" Avisynth tomorrow, as I'm again posting when I should go to sleep...

VirtualDub (FilterMod) handles this fine, the video is smooth. Laptop isn't fast enough for realtime playback, but I can encode it using VD into a smooth video. However, opening the .avs file in both x264 (cli) and avs2pipemod somehow result in really jerky video.
ajp_anton is offline  
Old 28th December 2016, 13:35   #2755  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by real.finder View Post
ComponentCount not existing, it give me "There is no function named 'ComponentCount'"

and it will be more easy if we have "HasAlpha()"
Indeed. And it should be named the same as in the VideoInfo: NumComponents.

So I created a HasAlpha, NumComponents and IsPackedRGB script functions (no build yet).
pinterf is offline  
Old 30th December 2016, 15:36   #2756  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 805
Feature requests:
1. Function "Info": Add a second clip as an optional argument. Write the info of the first clip onto the second clip (or vice versa, whichever is better/easier/more logical).
2. Function "Default": If the variable in the first argument is defined, don't try to evaluate the second argument. I have a function that has arguments for width, height and aspect ratio, but only two are needed. In Default(w,h*ar) I get an unnecessary error if either "h" or "ar" is the only one being left undefined.
3. The ability to add comments at the end of a line that continues on the next line using \.

Last edited by ajp_anton; 31st December 2016 at 18:16.
ajp_anton is offline  
Old 31st December 2016, 08:27   #2757  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by ajp_anton View Post
2. Function "Default": If the variable in the first argument is defined, don't try to evaluate the second argument. I have a function that has arguments for width, height and aspect ratio, but only two are needed. In Default(w,h*ar) I get an unnecessary error if either "h" or "ar" is the only one being left undefined.
Default() must be a function, moving into the Parser as you suggest would likely result in a lot of work for printerf, and for no real reason, you can easily get around that (EDIT: rare) 'problem' yourself.

EDIT: Also, (1) whats wrong with y=x.info() ?

No problem with (3) [EDIT: I quite like the idea].
__________________
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; 31st December 2016 at 09:12.
StainlessS is offline  
Old 31st December 2016, 13:32   #2758  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
1. is probably asking for a chance to overlay the Info() details over a blank clip, for better readability. Well ... BlankClip(reference_clip) could be a base with mostly identical attributes, to display Info text onto. Except for the case that the clip has too small dimensions for the Info text to render completely; in that case it may indeed need a larger area than the original clip.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 31st December 2016, 13:50   #2759  |  Link
Sm3n
Registered User
 
Join Date: Jul 2012
Posts: 94
Hi,

I'm looking for a script capable to change the color of a harcoded subtitle. Here is a sample: https://framadrop.org/r/znJhfsO4lW#R...TNXzdQlpmmqi8=

I found something similar on videohelp: http://forum.videohelp.com/threads/3...Color-exchange
So I tweaked a bit but I can't properly change the grey subtitles into white. And there is lot of artefact created on the picture and/or around the outline sub.

My script:

Code:
mask=MaskHS(30,30, 20,5).mt_expand().BilinearResize(last.width, last.height)
overlay(last, GreyScale().ColorYUV(cont_y=100), 0, 0, mask)
cheers

Last edited by Sm3n; 1st January 2017 at 16:11.
Sm3n is offline  
Old 31st December 2016, 18:16   #2760  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
Quote:
Originally Posted by LigH View Post
Except for the case that the clip has too small dimensions for the Info text to render completely; in that case it may indeed need a larger area than the original clip.
That's no longer an issue, technically; you can choose font and text size for Info() now.

(Although it was actually proposed because the default size made the output unreadable when dealing with 4K)

Last edited by qyot27; 31st December 2016 at 18:22.
qyot27 is offline  
Closed Thread

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 19:17.


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