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 3rd January 2018, 20:40   #3841  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,410
Quick question: when creating a NewVideoFrame, is pitch guaranteed to always be rowsize rounded up to a 32-byte boundary?
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 3rd January 2018, 22:19   #3842  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,762
Quote:
Originally Posted by davidhorman View Post
Quick question: when creating a NewVideoFrame, is pitch guaranteed to always be rowsize rounded up to a 32-byte boundary?
Nope. If you end up running in vapoursynth's compatibility it can be 64 byte alignment too. Sometimes. There are also some cpu cache reasons to avoid row sizes that are a certain multiple. So a future implementation may pad the rowsize to avoid that.

Don't assume anything, it'll break future compatibility.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 3rd January 2018, 22:53   #3843  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,410
But it will be consistent for a particular clip? So if I call NewVideoFrame(vi), get the pitch, and immediately discard the frame, is it safe to assume the pitch will be the same for all future frames created?

I'm trying to be extremely efficient with something.
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 3rd January 2018, 23:02   #3844  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,762
Quote:
Originally Posted by davidhorman View Post
But it will be consistent for a particular clip? So if I call NewVideoFrame(vi), get the pitch, and immediately discard the frame, is it safe to assume the pitch will be the same for all future frames created?

I'm trying to be extremely efficient with something.
In vapoursynth it's guaranteed that the stride/pitch is the same. For all frames if they have the same type.

I checked the Avisynth source and the stride will always be the same there too. For NewVideoFrame, not for frames returned from GetFrame obviously.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 4th January 2018, 13:36   #3845  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 935
Since r2544 the frame alignment is 64 bytes, and pitch/stride size is padded to 64 as well, independently of possible AVX512 support.
pinterf is offline   Reply With Quote
Old 4th January 2018, 19:12   #3846  |  Link
bilditup1
Registered User
 
bilditup1's Avatar
 
Join Date: Feb 2004
Location: NYC
Posts: 122
Does the KAISER patch have any implications for avs performance?
bilditup1 is offline   Reply With Quote
Old 4th January 2018, 19:37   #3847  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 5,309
It will probably delay every call to a Windows system function which switches from user space to kernel space.
__________________

German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is online now   Reply With Quote
Old 10th January 2018, 09:02   #3848  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 935
There was no change, what happens when you call Eval with the clip as the first parameter? (not tried, I hope syntax is OK)
Code:
  AVSValue eval_args[] = { clip, env->SaveString("Subtitle(\"Hello world!\")") };
  AVSValue val = env->Invoke("Eval", AVSValue(eval_args, 2));
pinterf is offline   Reply With Quote
Old 11th January 2018, 08:51   #3849  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 935
Quote:
Originally Posted by Stephen R. Savage View Post
Eval does not take a clip argument: http://avisynth.nl/index.php/Internal_functions#Eval. The issue seems to be variable scoping.
Then it's not documented.
This other form is for OOP notation, that is clip.Eval("....").
Saves current "last", sets "last" to clip, calls Eval then restores previous "last".
https://github.com/pinterf/AviSynthP...cript.cpp#L191
https://github.com/pinterf/AviSynthP...cript.cpp#L416

But I agree, this is scoping problem, similar to the earlier (still not solved) issue with conditional/runtime functions setting "current_frame" and "last" in a multithreading environment.
pinterf is offline   Reply With Quote
Old 11th January 2018, 13:29   #3850  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,380
Quote:
Originally Posted by Stephen R. Savage View Post
Eval does not take a clip argument: http://avisynth.nl/index.php/Internal_functions#Eval. The issue seems to be variable scoping.
This was added in Avisynth 2.6.0 Alpha 5.

Quote:
Originally Posted by IanB View Post
Here is the 5th official release of Avisynth 2.6

========================
Changelist

Additions
* Added Eval(clip, string name, string) alias for oop processing of argument.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 11th January 2018, 18:33   #3851  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 935
Thanks to raffriff42, who provided me a nice skeleton page, Expr got an info page.
It's still ugly, I'll format it properly when I'm fiddling out how to do that. Now I only poured some infos there.
Enjoy (or not ) http://avisynth.nl/index.php?title=Expr
pinterf is offline   Reply With Quote
Old 11th January 2018, 23:49   #3852  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,410
With a YUVA clip, IsY() and IsYUV() seem to return false. Is that intended behaviour? I've been relying on https://forum.doom9.org/showthread.php?p=1783714 as a reference on colour spaces, but it's not clear on this point.

---

Also that page makes reference to ComponentCount but the latest avisynth.h only seems to have NumComponents...? Is the latter the eventual form of the former, I guess?

If anybody ever thinks of it, HasY(), HasU(), HasG(), HasA() etc would be awesome...
__________________
My AviSynth filters / I'm the Doctor

Last edited by davidhorman; 12th January 2018 at 00:23.
davidhorman is offline   Reply With Quote
Old 12th January 2018, 00:29   #3853  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,376
YUV444P8 is YUV but not YUVA or Y-only
YUVA444P8 is YUVA but not YUV or Y-only
Y8 is Y and YUV but not YUVA

I tried to create a hierarchy (tree view) on the Avisynthplus_color_formats page.
See also the Clip_properties page.

HasA() exists and it's called HasAlpha.
HasU() does not exist, but you can call try { ExtractU } catch { ...}

Last edited by raffriff42; 12th January 2018 at 00:48.
raffriff42 is offline   Reply With Quote
Old 12th January 2018, 00:38   #3854  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,410
Thanks - seems a little messy but I think it's clearer. Do all Y-only formats return IsYUV()=true? Or just Y8?
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 12th January 2018, 01:23   #3855  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,376
All the tests hold true regardless of bit depth.

If you want more confusion, consider that the new RGB(A) formats are planar; you can't call ConvertBits(x) on an RGB32 clip, you must call ConvertToPlanarRGBA first. I have posted a utilities script, called Utils-r41.avsi, that (among other things) hides this complexity behind To16bit and ToHibit(bits)
raffriff42 is offline   Reply With Quote
Old 12th January 2018, 03:33   #3856  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 937
Quote:
Originally Posted by raffriff42 View Post
I tried to create a hierarchy (tree view) on the Avisynthplus_color_formats page.
See also the Clip_properties page.
Two nitpicks:
There's a typo on YUVA444P claiming classic AviSynth has it.

The YUV422P10 entry is showing v210's data. IMO, v210 being interleaved and VfW-only should only be mentioned in the footnotes at the bottom, not in the table itself. The notes column could read like:
Code:
aka P210 (special-case: V210 output available via override§)
(or 'global OPT_Enable_V210()' instead of 'override'). But as it is right now, it's highly misleading since YUV422P10 is planar, is used internally in AviSynth+, and isn't VfW-only.


Quote:
If you want more confusion, consider that the new RGB(A) formats are planar; you can't call ConvertBits(x) on an RGB32 clip, you must call ConvertToPlanarRGBA first. I have posted a utilities script, called Utils-r41.avsi, that (among other things) hides this complexity behind To16bit and ToHibit(bits)
Well, for ConvertBits(16) you'd get RGBA64 - and as far as I'm aware, that should preserve the alpha. The question is whether RGBA64 is actually useful, or whether most destination programs expect 16-bit planar RGBA if working with >8bit and alpha.
qyot27 is offline   Reply With Quote
Old 12th January 2018, 04:39   #3857  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,376
qyot27, thanks for fact-checking, I'll fix.

>for ConvertBits(16) you'd get RGBA64
IIRC I used to get an error trying that, but you're right, it works.
raffriff42 is offline   Reply With Quote
Old 12th January 2018, 10:15   #3858  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,410
Quote:
Originally Posted by raffriff42 View Post
HasA() exists and it's called HasAlpha.
I don't see it in the avisynth.h dated 20171207. I'll use NumComponents()==4, it seems like that should work.
__________________
My AviSynth filters / I'm the Doctor

Last edited by davidhorman; 12th January 2018 at 10:20.
davidhorman is offline   Reply With Quote
Old 12th January 2018, 10:41   #3859  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 935
Quote:
Originally Posted by davidhorman View Post
I don't see it in the avisynth.h dated 20171207. I'll use NumComponents()==4, it seems like that should work.
HasAlpha is an Avisynth+ script function and has no direct mapping to a VideoInfo helper function.
https://github.com/pinterf/AviSynthP...ript.cpp#L1400
pinterf is offline   Reply With Quote
Old 12th January 2018, 15:41   #3860  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 935
Quote:
Originally Posted by pinterf View Post
Don't know if vmovntdqa reg,reg is valid or not but it seems to be not. The crash occurs in merge_avx2:

Code:
      00070	8d 40 20	 lea	 eax, DWORD PTR [eax+32]

      ; 70   :       __m256i src1  = _mm256_stream_load_si256(reinterpret_cast<__m256i*>(p1+x));

      00073	c5 fe 6f 40 e0	 vmovdqu ymm0, YMMWORD PTR [eax-32]
      00078	c4 e2 7d 2a c8	 vmovntdqa ymm1, ymm0            ****CRASH HERE! ILLEGAL INSTRUCTION VS15.5.1!!!****

      ; 71   :       __m256i src2  = _mm256_stream_load_si256(const_cast<__m256i*>(reinterpret_cast<const __m256i*>(p2+x)));
      0007d	c5 fe 6f 44 02 e0		 vmovdqu ymm0, YMMWORD PTR [edx+eax-32]
      00083	c4 e2 7d 2a c0	 vmovntdqa ymm0, ymm0
Will update to 15.5.2 and see what happens.

EDIT:
With VS 15.5.2 the code still fails. Replaced stream_load with normal load, it's O.K.
Two weeks ago I have reported it and made a minimal project for MS which still exhibited the problem. And they fixed. One less bug.
https://developercommunity.visualstu...tream-loa.html
pinterf 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 20:41.


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