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 1st December 2021, 16:36   #1621  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 1,550
Yes, lutxy, the lower block is for reference. Anyway I haven't updated GradePack for some months, so better test with ex_binarize(mode="otsu") for now. Will check test31.

Testing with test31:
Code:
expr("x 80 > 255 0 ?","",lut=1)
Ok with lut=0
__________________
[i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub

Last edited by Dogway; 1st December 2021 at 16:45.
Dogway is offline   Reply With Quote
Old Yesterday, 11:32   #1622  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,078
Next round with qyot27's interface additions
Avisynth+ 3.7.1 test build 32 (20211202)
Code:
20211202 WIP
------------
- Fix: MinMax runtime filter family: check plane existance (e.g. error when requesting RPlaneMinMaxDifference on YV12)
- Fix: prevent x64 debug AviSynth builds from crashing in VirtualDub2 (opened through CAVIStreamSynth)
- ExtractY/U/V/R/G/B/A, PlaneToY: delete _ChromaLocation property. Set _ColorRange property to "full" if source is Alpha plane
- AviSynth interface additions: extend queryable internal environment properties.
  Since Interface version 8 IScriptEnvironment::GetEnvProperty (Avisynth.h) and avs_get_env_property (avisynth_c.h)
  interface functions can query some specific internal properties of AviSynth core. Thread count, etc..
  These are mainly for internal use but some can be useful for plugins and external applications.
  Each requested property has an identification number, they are found in avisynth.h and avisynth_c.h

  This addition brought new properties to query: host system's endianness, interface version and bugfix subversion.
  Relevant enum names start with AEP_ (cpp) or AVS_AEP_ (c) (AEP stands for Avisynth Environment Property)
  
  Details:
  
  AEP_HOST_SYSTEM_ENDIANNESS (c++) AVS_AEP_HOST_SYSTEM_ENDIANNESS (c)
    Populated by 'little', 'big', or 'middle' based on what GCC and/or Clang report at compile time.

  AEP_INTERFACE_VERSION (c++) AVS_AEP_INTERFACE_VERSION (c)
    for requesting actual interface (main) version. An long awaited function. 
    So far the actual interface version could be queried only indirectly, with trial and error, by starting from e.g. 10 then
    going back one by one until CheckVersion() did not report an exception/error code. 

    Even for V8 interface this was a bit tricky, the only way to detect was the infamous
      has_at_least_v8 = true;
      try { env->CheckVersion(8); } catch (const AvisynthError&) { has_at_least_v8 = false; }
    method.
    
    Now (starting from interface version 8.1) a direct version query is supported as well.
    Of course this (one or two direct call only) is the future.
    Programs or plugins which would like to identify older systems still must rely partially on the CheckVersion method.

    CPP interface (through avisynth.h).

      IScriptEnvironment *env = ...
      int avisynth_if_ver = 6;
      int avisynth_bugfix_ver = 0;
      try { 
        avisynth_if_ver = env->GetEnvProperty(AEP_INTERFACE_VERSION); 
        avisynth_bugfix_ver = env->GetEnvProperty(AEP_INTERFACE_BUGFIX);      
      } 
      catch (const AvisynthError&) { 
        try { env->CheckVersion(8); avisynth_if_ver = 8; } catch (const AvisynthError&) { }
      }
      has_at_least_v8 = avisynth_if_ver >= 8; // frame properties, NewVideoFrameP, other V8 environment functions
      has_at_least_v8_1 = avisynth_if_ver > 8 || (avisynth_if_ver == 8 && avisynth_bugfix_ver >= 1);
      // 8.1: C interface frameprop access fixed, IsPropertyWritable/MakePropertyWritable support, extended GetEnvProperty queries
      has_at_least_v9 = avisynth_if_ver >= 9; // future

    C interface (through avisynth_c.h)

      AVS_ScriptEnvironment *env = ...
      int avisynth_if_ver = 6; // guessed minimum
      int avisynth_bugfix_ver = 0;
      int retval = avs_check_version(env, 8);
      if (retval == 0) {
        avisynth_if_ver = 8;
        // V8 at least, we have avs_get_env_property but AVS_AEP_INTERFACE_VERSION query may not be supported
        int retval = avs_get_env_property(env, AVS_AEP_INTERFACE_VERSION);
        if(env->error == 0) {
          avisynth_if_ver = retval;
          retval = avs_get_env_property(env, AVS_AEP_INTERFACE_BUGFIX);
          if(env->error == 0)
            avisynth_bugfix_ver = retval;
        }
      }
      has_at_least_v8 = avisynth_if_ver >= 8; // frame properties, NewVideoFrameP, other V8 environment functions
      has_at_least_v8_1 = avisynth_if_ver > 8 || (avisynth_if_ver == 8 && avisynth_bugfix_ver >= 1);
      // 8.1: C interface frameprop access fixed, IsPropertyWritable/MakePropertyWritable support, extended GetEnvProperty queries
      has_at_least_v9 = avisynth_if_ver >= 9; // future
 

  AEP_INTERFACE_BUGFIX (c++) AVS_AEP_INTERFACE_BUGFIX (c)
    Denotes situations where there isn't a breaking change to the API,
    but we need to identify when a particular change, fix or addition
    to various API-adjacent bits might have occurred.  Could also be
    used when any new functions get added.

    Since the number is modelled as 'changes since API bump' and
    intended to be used in conjunction with checking the main
    AVISYNTH_INTERFACE_VERSION, whenever the main INTERFACE_VERSION
    gets raised, the value of INTERFACE_BUGFIX should be reset to zero.

    The BUGFIX version is added here with already incremented once,
    both because the addition of AVISYNTH_INTERFACE_BUGFIX_VERSION
    itself would require it, but also because it's intended to signify
    the fix to the C interface allowing frame properties to be read
    back (which was the situation that spurred this define to exist
    in the first place).

- CMake build environment:
  While we do need the compiler to support C++17 features, we can 
  get by on older GCC using CMake 3.6 and -std=c++-1z with some other fixes.
  CMAKE_CXX_STANDARD can be raised intelligently to 17 based on whether we detect CMake 3.8 or higher.
- Add AVISYNTHPLUS_INTERFACE_BUGFIX_VERSION

- Avisynth programming interface V8.1 or V9(?)):
  Add 'MakePropertyWritable' to the IScriptEnvironment (CPP interface), avs_make_property_writable (C interface)
  Add 'VideoFrame::IsPropertyWritable' (CPP interface), avs_is_property_writable (C interface)
  (AviSynth interface version will be stepped to V9 in the release version?)

    bool env->MakePropertyWritable(PVideoFrame *);
    bool VideoFrame::IsPropertyWritable();
  
  'MakePropertyWritable' is similar to 'MakeWritable' but it does not copy all bytes of the frame content in order to have a writable property set.
  
  Reason: 'propSet' is a filter which does not alter frame content, but sets the given frame property in its each GetFrame.
  So far it used MakeWritable to obtain a safely modifiable copy of frame properties, however - as a side-effect - full copy of frame content was performed.
  (env->getFramePropsRW alone does not ensure a uniquely modifiable property set, it just obtains a pointer which can be used in the property setter functions)
  (Note: frame properties of frames obtained by NewVideoFrame, MakeWritable and SubFrame are still safe to modify)
- Expr: when actual bit depth is too large for building LUT table, fallback to realtime mode.
  lut_x 1D (realtime when 32 bit) 
  lut_xy 2D (realtime when 16 or 32 bits)
- Expr: allow 'f32' as internal autoscale target (was: i8, i10, i12, i14, i16 were accepted, only integers)
  affects: 'scale_inputs' when "int", "intf", "all", "allf"
  more on that (todo: refresh docs) http://avisynth.nl/index.php/Expr
- Expr: fix conversion factor (+correct chroma scaling) when integer-to-integer full-scale automatic range scaling was required
- New: Expr: new parameter integer 'lut'
  integer 'lut' (default 0)
    0: realtime expression
    1: expression is converted to 1D lut (lut_x)
    2: expression is converted to 2D lut (lut_xy)
   Valid bit depths: lut=1 : 8-16 bits. lut=2 : 8-14 bits. Note: a 14 bit 2D lut needs (2^14)*(2^14)*2 bytes buffer in memory per plane (~1GByte)
   In lut mode some keywords are forbidden in the expression: sx, sy, sxr, syr, frameno, time, relative pixel addressing
pinterf is offline   Reply With Quote
Old Yesterday, 16:40   #1623  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 1,550


Everything seems to be working fine now. A bit sad because I lost one month of notes and drafts (the AvsPmod session file got cleansed : (

In big scripts like ex_binarize(mode="otsu") I don't see speed improvements but probably this is expected.

While updating the functions I got into a situation where the yexpr needs "intf" scale_inputs, and uexpr/vexpr requires "none" (or for 32-bits "none" and "floatUV" respectively). I could work around this by for example adding i16 (for 16-bit inputs) to the chroma expr, but this was slow so I baked the expression when 32-bit is being fed in.

Code:
# normalize to full range and back for limited range sources
# works fine over int HBD types and 32-bit float.
rangePCc = tv ? "f32 x 255 240 / *" : "f32 x"
rangeTVc = tv ? "240 255 / * "      : "     "
Another issue I found is ExtractU() sometimes doesn't work for float inputs.
__________________
[i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub
Dogway is offline   Reply With Quote
Old Yesterday, 18:34   #1624  |  Link
gispos
Registered User
 
Join Date: Oct 2018
Location: Germany
Posts: 579
Quote:
Originally Posted by Dogway View Post
A bit sad because I lost one month of notes and drafts (the AvsPmod session file got cleansed : (
Due to an error in the program? or how did that happen?
If the files are so important (one month of work) then the best thing to do is to make backup copies of them.
__________________
Live and let live
gispos is offline   Reply With Quote
Old Yesterday, 19:03   #1625  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 1,550
I think it was my fault since I didn't enable avspmod's backups, but I'm not sure it works as I think it does.
I had a session from 24th of October, that's something.
I simply was writing something somewhere while avspmod launched, some letter got typed into the script editor and the last session got reset.
Is there an option for the current session to be stored as a "ghost" file (like Office does) until avspmod is closed?
__________________
[i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub
Dogway 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 03:45.


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