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. |
26th April 2017, 16:19 | #3321 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,309
|
I think that only runtime is affected. I'd like to see an "elegant" way to solve it, but either this way does not exist (unless we are breaking and rewriting the whole MT internal concepts - which I'm not willing to do ) or have to learn on and do more reverse engineering and experimenting.
|
26th April 2017, 16:28 | #3322 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Eval doesn't do this, but EvalOop does the exact same "last" reset as ScriptClip.
It leaves room for bugs -- but has anyone encountered a problem with Clip.Eval ? Which specific circumstance will be affected by that? |
26th April 2017, 17:01 | #3323 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,419
|
Quote:
I've long been in favor of changing the references in avisynth[_c].h to the avs/ subdir from <> to "" - it's not like plugins are going to need to rely on stuff in avs/ without also pulling in avisynth[_c].h as well. Or you know, at all, since avisynth[_c].h should be the single point of contact between the AviSynth+ API and the plugin. |
|
27th April 2017, 05:14 | #3325 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
FrameRateConverter plays weird in Avisynth+, even without MT. It plays a bunch of frames, pauses, then plays another bunch of frames, then pauses again, etc.
With MT, it stalls at low CPU usage, but first it would be good to debug the issue without MT. |
27th April 2017, 07:46 | #3326 | Link | |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
Quote:
The main culprit is the Frame->GetWritePtr(). I forgot to change this to GetReadPtr after I deleted make writeable which I used earlier. Now it works OK. But wonder how it was working when I was just stepping frame by frame without crashing? Also problem of compiling under debug and script I pointed out on 14th and 15th April is unresolved. |
|
27th April 2017, 09:58 | #3327 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,309
|
Quote:
Could not reproduce. With and without imagesource. I'd need to have the same conditiones. So you are on 2420 x64 MT - Can it be reproduced w/o ImageSource on your machine (just a BlankClip with similar dimensions and format?) - Processor architecture (though no AVX2 code is used here) - Does it happen when encoding to e.g. x264 or when viewing from VirtualDub or AvsPMod? - Clip is of a single image or multiple frames? (e.g. ImageSource(...).Loop(20)) |
|
27th April 2017, 16:49 | #3328 | Link | |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
Quote:
To put in the TODO list. |
|
27th April 2017, 18:34 | #3330 | Link |
Soul Architect
Join Date: Apr 2014
Posts: 2,559
|
ScriptClip should be working now.
We just have to see whether "last" causes issues, not only with ScriptClip but with Eval and any other run-time expression evaluation. Is there any other issue with global variables? |
27th April 2017, 21:59 | #3331 | Link |
Registered User
Join Date: Dec 2008
Posts: 589
|
Not sure if something like this is already implemented or not in AviSynth+ but just saying it anyway.
Would there be any interest in adding "native" support for reading and writing PNG files? Seems like a good idea: they support up to 16 bit per channel, so it could store 8 bit, 10bit, 12bit .. all the way up to 16 bit and also supports grayscale. Yeah, it's only RGB but as far as I know, so is BMP and eBMP right? If speed is a concern (for ImageWriter) you can simply default to compression = 0 or 1 (just copy or ultra fast zlib compression) and the only added cpu cost would be the calculation of a 32bit checksum. It would be also possible to use a bunch of custom tags (the png format allows for that) like let's say xACy, xACb , xACr for example for planar formats and YCbCr or whatever Rec.2020 uses if it's different (too lazy to search now) .... and maybe store a default generic small image maybe with some text saying "this is a custom png file which stores the image information in custom chunks readable by Avisynth+ ) and the png format also allows and has text chunks where Avisynth+ could store some encoded data required to understand what it actually stored in the png file ( planar or interleaved, color space, full range/limited range etc) Could be a good replacement for that non-standard ebmp ps. Just checking the ImageWriter wiki page ... also noticed something... seems the function defaults to "c:" if the path is not specified. Windows would most likely block writing directly to C:\ by default (to protect itself and file system, perhaps it would be a good idea to use C:\AviSynth or %AviSynth_Install_Folder\Images instead Don't know how anyone thought the root of a drive to be a good default setting. Last edited by mariush; 27th April 2017 at 22:10. |
28th April 2017, 06:06 | #3333 | Link | |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
Quote:
Code:
#imagesource("c:\images\source1_z.jpg",end = 500) imagereader("c:\images\stamil.jpg",end = 100) #imagesource("C:\avi_plugins\DeNoise\grainnoise.png", end = 30).converttoYv12() #imagereader("C:\avi_plugins\varianslim\theoin.jpg", end = 1000) #colorbars() converttoYUY2() stackhorizontal(last,last) stackvertical(last,last) reduceby2() return(last) Still I can not understand what the problem is, for if I comment out reduceby2() it runs ok with the same input. The particular stamil.jpg image is 602 x 566. I use vdub to monitor output. My Samsung laptop runs with windows 10 home edition. Processor intel i7-4500U1.80Ghz 2.4Ghz, 8GB memory. |
|
28th April 2017, 10:09 | #3334 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,309
|
Thanks, the size the key.
Replaced ImageSource with ColorBars Code:
colorbars().Spline64Resize(610,566) EDIT: fixed (YUY2 HorizontalReduceBy2 did nothing if target width is not mod4) The constructor of HorizontalReduceBy2 is checking YUY2 clip if the width of source is mod4 (valid YUY2 target width should be mod2). Then it sets output vi.width, divides by 2. In GetFrame, it checks width again mod4, but the width here is already divided by 2. It was doing the reduce operation only if width is mod4, which is wrong, here the width is mod2 already (The whole checking is not needed, because it was pre-checked in constructor). Or else it did nothing, frame is undefined content. Last edited by pinterf; 28th April 2017 at 10:35. |
28th April 2017, 11:49 | #3335 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,309
|
Thanks, this is inconsistent, and we can call it bug, that was at the very beginning of the project. For a brand new project I'd choose nothing to scale, but keeping scripts easy to maintain is another aspect. Still I'd like to have an option for expert users providing parameters as-is, by something like "paramscale" in masktools.
|
28th April 2017, 14:06 | #3336 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
After thinking about it, I have no preference for or against autoscaling. One the one hand, it is convenient now, while adapting one's thinking in terms of 0-255 to deep color. On the other hand, it sets the current way of thinking into stone, forever.
In a few years people may instead think in terms of normalized (0-1) range, as strange as that may seem to us now. Maybe they will prefer 0-1023, 0-65535, or something else. Scaling a non-autoscaled argument is easily done by the user. Re-scaling an 0-255 autoscaled argument to a different source range is also easily done. So I don't care which it is. Here's an example of Levels (not currently autoscaling) with user-side scaling; changes in blue: Code:
################################## ### scale 0-255 Levels arguments to clip 'C' bit depth (AVS+) function ScaledLevels(clip C, \ int input_low, float gamma, int input_high, \ int output_low, int output_high, \ bool "coring", bool "dither") { return C.Levels( \ C.sb8x(input_low), \ gamma, \ C.sb8x(input_high), \ C.sb8x(output_low), \ C.sb8x(output_high), \ coring, dither) } Code:
### manual scaling of arguments from one bit depth to another ## version 28-Apr-2017, raffriff42 ####################################### ### scale a value from one bit depth to another ## ## @ bits_in - the bit depth being converted from ## @ bits_out - the bit depth being converted to ## @ cx - clamp output (cf. sbx below) ## @ returns float if not clamped; ## else returns int for int formats, float for float ## function sbf(int bits_in, int bits_out, float f, bool "cx") { clamp = Default(cx, false) fsi = getFullscale(bits_in) fso = getFullscale(bits_out) fsi1 = Float( (bits_in==32) ? 256.0/255.0 : fsi+1 ) fso1 = Float( (bits_out==32) ? 256.0/255.0 : fso+1 ) fr = (bits_in==bits_out) ? f : f * fso1 / fsi1 ## unclamped result fr = (clamp==false) ? fr : Min(Max(0.0, fr), fso) fr = (clamp==false) ? fr : (bits_out==32) ? fr : Round(fr) return fr } ####################################### ### scale a value from one bit depth to another; clamp output ## ## @ bits_in - the bit depth being converted from ## @ bits_out - the bit depth being converted to ## @ returns int for int formats, float for float ## function sbx(int bits_in, int bits_out, float f) { return sbf(bits_in, bits_out, f, true) } ####################################### ### scale an 8-bit value for target clip 'T'; clamp output ## ## @ T - clip with target bit depth ## @ returns int for int formats, float for float ## function sb8x(clip T, float f) { return sbf(8, T.BitsPerComponent, f, true) } ####################################### ### scale a 'normalized' (0 to 1) value for target clip 'T'; clamp output ## ## @ T - clip with target bit depth ## @ returns int for int formats, float for float ## function sbnx(clip T, float f) { return sbf(32, T.BitsPerComponent, f, true) } ####################################### ### scale a value from one bit depth to another; string result ## ## @ bits_in - the bit depth being converted from ## @ bits_out - the bit depth being converted to ## @ returns String, unclamped ## function sbs(int bits_in, int bits_out, float f, int "decimals") { decimals = Min(Max(0, Default(decimals, 4)), 8) return String(sbf(bits_in, bits_out, f), "%0."+String(decimals)+"f") } ####################################### ### scale an 8-bit value for target clip 'T'; string result ## @ T - clip with target bit depth (assume bits_in = 8) ## @ returns String, unclamped ## function sb8s(clip T, float f, int "decimals") { return sbs(8, T.BitsPerComponent, f, decimals) } ####################################### ### scale a 'normalized' (0 to 1) value for target clip 'T'; string result ## @ T - clip with target bit depth (assume bits_in = 8) ## @ returns String, unclamped ## function sbns(clip T, float f, int "decimals") { return sbs(32, T.BitsPerComponent, f, decimals) } ####################################### ### return integer fullscale value for given bit depth (mostly for internal use) function getFullscale(int bits) { return (bits==8) ? 255 \ : (bits==10) ? 1023 \ : (bits==12) ? 4095 \ : (bits==14) ? 16383 \ : (bits==16) ? 65535 \ : (bits==32) ? 1 \ : Assert(false, \ "getFullscale: 'bits' not one of (8|10|12|14|16|32)") } ## end Last edited by raffriff42; 28th April 2017 at 21:00. Reason: suggested filename 'argscale.avsi' |
28th April 2017, 19:50 | #3337 | Link |
partially-informed layman
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 314
|
Apologies for this but where's the user-friendly document that explains the AviSynth+ MT stuff like SetFilterMTMode() and Prefetch(), and the changes required in scripts? Can't find it anywhere. Google doesn't know. I seem to remember it was on a wiki.
|
28th April 2017, 20:56 | #3338 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
|
AviSynth Wiki
Multi-Threading (old MT() and v2.x-MT SetMTMode()) AviSynth+ — MT Notes (SetFilterMTMode() and Prefetch()) |
28th April 2017, 20:58 | #3339 | Link | |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Quote:
|
|
29th April 2017, 04:01 | #3340 | Link |
partially-informed layman
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 314
|
Thank you both. It was http://avisynth.nl/index.php/AviSynth%2B#MT_Notes that I was looking for.
|
Thread Tools | Search this Thread |
Display Modes | |
|
|