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

Thread Tools Search this Thread Display Modes
Old 8th June 2023, 10:41   #2561  |  Link
Registered User
Join Date: Jan 2014
Posts: 2,243
Avisynth+ 3.7.3 test 11 (20230608 - r3996)

Change log (including test9 changes)
20230608 3.7.3 WIP
- Add "bold"=true (linux/NO_WIN_GDI: false), "italic"=false, "noaa"=false parameters to 
  "ShowFrameNumber", "ShowCRC32", "ShowSMPTE", "ShowTime" filters.
  As noted below, "italic" and "noaa" parameters are ineffective in NO_WIN_GDI builds (e.g. Linux)
- Add "noaa" parameter to SubTitle and Info. Setting it true will disable antialiasing.
  Useful when someone would use "VCR OSD Mono" as-is, without beautifying the outlines,
  as it as mentioned in https://forum.doom9.org/showthread.php?t=184627
- Address #358, plus "noaa"
  - add "bold", "italic" and "noaa" boolean parameters to "SubTitle" and "Info"
  - add "italic" and "noaa" boolean parameter to "Text" ("bold" already existed)
    "italic" and "noaa" is provided only to match the parameter list with SubTitle.

  SubTitle: to mimic former working method, defaults are "bold"=true, "italic"=false, "noaa"=false
  Text: "bold"=false (as before); "italic" is not handled at all, either true or false, it does not affect output. 
        "italic" and "noaa" parameters exist only because on non-Windows systems "Subtitle" is aliased to "Text"
        (Each Subtitle parameter must exist in "Text" as well)
- Fix #360: plane fill wrongly assumed that pitch is rowsize, which is not the case after a Crop
  It would result in crash e.g. in HistogramRGBParade, when an aligned Crop was immediately followed by a GreyScale().
- Enhancement: much quicker YV24 to RGB32/RGB24 conversion when AVX2 instruction set is supported. (+50% fps at i7-11700)
- UserDefined2Resize got an 's' parameter (to the existing b and c): support, default value = 2.3
  (following DTL2020's addition in jpsdr's MT resizer repo, UserDefined2ResizeMT filter)
  Now, as we have already three variable parameters to the optional chroma resamplers in ConvertToXX 
  converters, ConvertToXX family got a new float 'param3' parameter which is passed to UV resizer as 
  's', if "userdefined2" is specified as chroma resampler.
  If param3 is not used in a resizer but is defined, then it is simply ignored.
  Such as "ConvertToYV24" parameter signature: c[interlaced]b[matrix]s[ChromaInPlacement]s[chromaresample]s[param1]f[param2]f[param3]f
  e.g.: ConvertToYV24(chromaresample="userdefined2", param1=126, param2=22, param3=2.25)
  see also description at **test6**, which was updated with this parameter as well.
  s (support) param - controls the 'support' of filter to use by resampler engine. Float value in valid range from
  1.5 to 15. Default 2.3. It allows to fine tune resampling result between partially non-linear but more sharper and less
  residual ringing (at low b and c values) and more linear processing with wider 'peaking' used. Setting too high 
  in common use cases (about > 5) may visibly degrade resampler performance (fps) without any visible output changes.
  Recommended adjustment range - between 2 and 3.
  b=126 c=22 - medium soft, almost no ringing.
  b=102 c=2 - sharper, small local peaking.
  b=70 c=-30 s=2 - sharper, thinner 'peaking'.
  b=70 c=-30 s=2.5 - a bit softer, more thick 'peaking'. 
  b=82 c=20 - sharp but lots of far ringing. Not for using.

- Fix #350 ConvertXXX to accept YV411 clip's frame property _ChromaLocation set to 'left' 
  (and 'topleft' and 'bottomleft' which give the same result) instead of giving an error message.
- Fix #348 bitrol/bitror functions return incorrect results when first argument is negative.
  Regression since the asm code of Avisynth 2.6 classic was ported to C in Avisynth+ project.
- "Info": if channel mask exists, then 
  - its friendly name
  - otherwise the number of channels and the channel combinations
  is displayed under "AudioLength: x".

  SetChannelMask("stereo") --> "Channel mask: stereo"
  SetChannelMask("stereo+LFE") --> "Channel mask: 2.1"  because the combination resulted in another known channel combo name
  SetChannelMask("mono+LFE") --> "Channel mask: 2 channels (FC+LFE)" because the combination is unknown

- Add SetChannel parameter: channel string syntax: (similar to ffmpeg)
  a channel number followed by "c" for getting the default layout for a given number of channels.
  E.g. SetChannelMask("3c") will set "2.1" because this is the default choice for 3 channels
- Add SetChannel parameter: channel string syntax:
  a simple number is treated as the actual numeric mask.
  E.g. SetChannelMask("3") will set "stereo" because 3=1+2 that is "FL+FR" that is "stereo"
- SetChannelMask string version: If string is other than "" then its set to known. It has a single string parameter.
  SetChannelMask("mono") -> mask is known: "mono"
  SetChannelMask("")  -> mask is unknown
- Add "speaker_all" to accepted layout mask strings

- Fix possible crash of LLVM builds (clang-cl, Intel nextgen) on pre-AVX (SSE4-only) CPUs.
  (Prevent static initialization from avx2 source modules, which cause running AVX instructions on DLL load)
- ConvertToMono, GetLeftChannel, GetRightChannel: sets channel layout AVS_SPEAKER_FRONT_CENTER (mono)
- GetChannel, GetChannels, MergeChannels will set default channel layout if channel count is 1 to 8
  For defaults see VfW section below
- New Script function: SetChannelMask: string version. 

    SetChannelMask(clip, string ChannelDescriptor) (parameters compulsory, no names must be set) (test10)

  Accepts predefined channel string or channel layout names or their combination, in ffmpeg style.
  Numerical indexes or channel counts are not allowed.
  String is case sensitive!
  E.g. "stereo+LFE+TC" or "FL+LR" or "5.1(side)"
  Individual Speaker Channels:
    "FL",  front left
    "FR",  front right
    "FC",  front center
    "LFE", low frequency
    "BL",  back left
    "BR",  back right
    "FLC", front left-of-center
    "FRC", front right-of-center
    "BC",  back center
    "SL",  side left
    "SR",  side right
    "TC",  top center
    "TFL", top front left
    "TFC", top front center
    "TFR", top front right
    "TBL", top back left
    "TBC", top back center
    "TBR", top back right
- AudioDub will inherit channel layout setting from the audio clip.
- VfW output channel guess (when ChannelMask is not specified) changed at some points.
  Default number of channels to channel layout guess was modified to match of ffmpeg
    3 channels: Surround to 2.1
    4 channels: Quad to 4.0
    6 channels: 6.1(back) to 6.1
  This follows ffmpeg defaults
  Present rules:
    const   chnls  name    layout
    0x00004 1      mono    -- -- FC
    0x00003 2      stereo  FL FR
    0x0000B 3      2.1     FL FR    LFE
    0x00107 4      4.0     FL FR FC --  -- -- -- -- BC
    0x00037 5      5.0     FL FR FC --  BL BR
    0x0003F 6      5.1     FL FR FC LFE BL BR
    0x0070F 7      6.1     FL FR FC LFE -- -- -- -- BC SL SR
    0x0063F 8      7.1     FL FR FC LFE BL BR -- -- -- SL SR

- Add initial audio channel mask (channel layout) support (CPP and C interface, script function)
  It still belongs to V10 changes (there were only tests since then), but it can be discussed if not.
  Technically it is done by using another 18+2 bits in the Clip's VideoInfo.image_type field.
  Due to lack of enough bits in this VideoInfo field, the mapping between the original dwChannelMask 
  and Avisynth's internal values are not 1:1, but all information is kept however.
  This is because not 32 but only 18 (strictly: 18+1) bits are defining speaker locations, so
  the remaining bits of our existing 'image_type' field can be used for this purpose.
  Thus 20 new bits are occupied.
  - 1 bit: marks if channel mask is valid or not
  - 18 bits for the actually defined WAVE_FORMAT_EXTENSIBLE dwChannelMask definitions 
  - 1 bit for the special SPEAKER_ALL value

  Programmers can check AvsChannelMask and AvsImageTypeFlags in avisynth.h and avisynth_c.h

  - new C++ interface functions
    - Check for existence:
        bool VideoInfo::IsChannelMaskKnown()
    - Setting:
        void VideoInfo::SetChannelMask(bool isChannelMaskKnown, unsigned int dwChannelMask)
      Re-maps and stores channel mask into image_type, sets the 'has channel mask' flag as well
      Note: this data can be set independently from the actual NumChannels number!
    - Retrieving:
        unsigned int VideoInfo::GetChannelMask()
   - new C interface functions
       bool avs_is_channel_mask_known(const AVS_VideoInfo * p);
       void avs_set_channel_mask(const AVS_VideoInfo * p, bool isChannelMaskKnown, unsigned int dwChannelMask);
       unsigned int avs_get_channel_mask(const AVS_VideoInfo * p);
       Like when establishing BFF, TFF and fieldbased flags from 'image_type', technically 'image_type' can 
       be manipulated directly. See SetChannelMask and GetChannelMask in Avisynth source for 
       image_type <-> dwChannelMask conversion.
       I guess once ffmpeg will support it, it will read (or not read) channel masks such a way.

   - new Script functions
       bool IsChannelMaskKnown(clip)
       int GetChannelMask(clip)
       SetChannelMask(clip, bool known, int dwChannelMask) (parameters are compulsory, dont't use parameter name)
       SetChannelMask(clip, string ChannelDescriptor) (test10)
       dwChannelMask must contain the combination of up to 18 positions or 0x80000000 for SPEAKER_ALL.

   VfW export rules (included the existing sequence)
     1.) OPT_UseWaveExtensible global variable must be 'true'
         if VideoInfo::IsChannelMaskKnown is true, then fill WAVEFORMATEXTENSIBLE struct
     2.) *new*new*new*
         Is channel mask defined in Avisynth's VideoInfo? (VideoInfo::IsChannelMaskKnown() is true)
         Yes -> return VideoInfo::GetChannelMask()
     3.) No-> (Channel mask not defined in VideoInfo, guess it or set from variable)
     3.1)Guess channel layout:
         For 0 to 8 channels there is a predefined 'guess map':
           #of channels dwChannelMask
           0            0,
           1            0x00004, // 1   -- -- Cf
           2            0x00003, // 2   Lf Rf
           3            0x00007, // 3   Lf Rf Cf
           4            0x00033, // 4   Lf Rf -- -- Lr Rr
           5            0x00037, // 5   Lf Rf Cf -- Lr Rr
           6            0x0003F, // 5.1 Lf Rf Cf Sw Lr Rr
           7            0x0013F, // 6.1 Lf Rf Cf Sw Lr Rr -- -- Cr
           8            0x0063F, // 7.1 Lf Rf Cf Sw Lr Rr -- -- -- Ls Rs
         For 9-18 channels: 
           sets first 9-18 bits in dwChannelMask
           SPEAKER_ALL (dword msb bit is 1)
      3.2) if OPT_dwChannelMask global variable is defined and is different from 0, then use it.

      E.g. VirtualDub2 is using VfW, so after opening the script, ended with SetChannelMask(true, $0063F),
      one can check the value File|File Info menu, under "compression" line (e.g.PCM, chmask 63f).
      SetChannels does not check against NumChannels, so you can set the 7.1 constant for a stereo
      if you wish. Microsoft's documentation mentions the cases of what an application can do with 
      less or more than necessary defined speaker bits.
  - What to do about GetChannels, MixAudio, ConvertToMono? To be discussed.
    KillAudio will call SetChannelMask(false, 0), nevertheless.
pinterf is offline   Reply With Quote
Old Yesterday, 00:17   #2562  |  Link
Registered User
Join Date: Oct 2018
Location: Germany
Posts: 895
Thanks for the new version.
Live and let live
gispos is offline   Reply With Quote
Old Yesterday, 01:56   #2563  |  Link
HeartlessS Usurer
StainlessS's Avatar
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,698
Lotsa changes there, yeah dude, thanx P.
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; Yesterday at 04:05.
StainlessS is offline   Reply With Quote

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 05:26.

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