This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Custom script/filter additons?
#1
I'm wrote some code so that users could add filters/scripts to Hybrid. (in Avisynth&Vapoursynth)
The idea is, that a user could take for example Avisynths KillPulse and write a 'simple' xml file like:
<CustomScript name="KillPulse" version="0.0.1">
  <General> <!-- General Avisynt Script Description-->
    <FileName>KillPulse.dll</FileName>
    <Architecture>Avisynth</Architecture>  <!-- What type of script it is: 'Avisynth' or 'Vapoursynth' -->
    <Architecture_BitDepth>32</Architecture_BitDepth> <!-- BitDepth of the dlls used. Can be: '32' or '32,64' or '64' -->
    <Description>KillPulse is a pulse noise reduction plug-in for AviSynth. Similar to DePulse.</Description>
    <FilterQueueAfter>DePulse</FilterQueueAfter>
  </General>
  <Function>
    <FunctionName>KillPulse</FunctionName>
    <Supported_ColorSpace>YUY2</Supported_ColorSpace> <!-- Supported input color spaces. Can be a single Avisynth or Vapoursynth color space, 'all' or a comma separated list of them -->
    <Supports_Interlaced>true</Supports_Interlaced> <!-- Whether the script supports interlaced input. Can be 'true' or 'false' -->
    <Output_ColorSpace>unchanged</Output_ColorSpace> <!-- The output color space. Can be: a specific ColorSpace or 'unchanged' -->
    <FilterBitDepth>8</FilterBitDepth> <!-- -1 all bitdepth are supported -->
    <FilterOutputBitDepth>-1</FilterOutputBitDepth> <!-- -1 <> same as input -->
    <Output_Interlaced>unchanged</Output_Interlaced> <!-- Whether the output is interlaced. Can be: 'unchanged', 'true', 'false' -->
    <Category>Other</Category>
    <Parameters>
      <Parameter>
        <Name>clip</Name>
        <Type>clip</Type>
      </Parameter>
      <Parameter>
        <Name>times</Name>
        <Type>int</Type> <!-- Type of the parameter. Can be: int/float/double/string/string_list/clip -->
        <Default>2</Default> <!-- default value; must be set, unless type is clip-->
        <Minimum>1</Minimum> <!-- minimum value; must be set for int/float/double -->
        <Maximum>5</Maximum> <!-- the maximum value; must be set for int/float/double -->
        <Step>1</Step> <!-- the maximum value; must be set for int/float/double -->
        <UI>
          <LabelText>Times</LabelText>
          <Position>
            <row>0</row> <!-- Position in the UI, can be 0-2 -->
          </Position>
          <Description>The number of times the filter is applied. The greater the number of times, the heavier it becomes.
          Range: 1-5 (default 2)</Description> <!-- tool tip of the parameter -->
        </UI>
      </Parameter>
      <Parameter>
        <Name>motion </Name>
        <Type>int</Type> <!-- Type of the parameter. Can be: int/float/double/string/string_list/clip -->
        <Default>10</Default> <!-- default value; must be set, unless type is clip-->
        <Minimum>0</Minimum> <!-- minimum value; must be set for int/float/double -->
        <Maximum>255</Maximum> <!-- the maximum value; must be set for int/float/double -->
        <Step>1</Step> <!-- the maximum value; must be set for int/float/double -->
        <UI>
          <LabelText>Motion</LabelText>
          <Position>
            <row>1</row> <!-- Position in the UI, can be 0-2 -->
          </Position>
          <Description>Either motion judgment = "difference in brightness from previous frame" or "difference in brightness from subsequent frame".
          If it is less than this number, do not apply the filter to that dot. Prevents collapse of telops and reduces wasteful processing.
          Range: 0-255 (default 10) </Description> <!-- tool tip of the parameter -->
        </UI>
      </Parameter>
      <Parameter>
        <Name>complex</Name>
        <Type>int</Type> <!-- Type of the parameter. Can be: int/float/double/string/string_list/clip -->
        <Default>20</Default> <!-- default value; must be set, unless type is clip-->
        <Minimum>0</Minimum> <!-- minimum value; must be set for int/float/double -->
        <Maximum>255</Maximum> <!-- the maximum value; must be set for int/float/double -->
        <Step>1</Step> <!-- the maximum value; must be set for int/float/double -->
        <UI>
          <LabelText>Complex</LabelText>
          <Position>
            <row>0</row> <!-- Position in the UI, can be 0-2 -->
          </Position>
          <Description>If the brightness is different from the pixels in the front and back (upper and lower) fields for d or more, it is determined as noise. (Common for white and black noise).
          Range: 0-255</Description> <!-- tool tip of the parameter -->
        </UI>
      </Parameter>
      <Parameter>
        <Name>complex2</Name>
        <Type>int</Type> <!-- Type of the parameter. Can be: int/float/double/string/string_list/clip -->
        <Default>20</Default> <!-- default value; must be set, unless type is clip-->
        <Minimum>0</Minimum> <!-- minimum value; must be set for int/float/double -->
        <Maximum>255</Maximum> <!-- the maximum value; must be set for int/float/double -->
        <Step>1</Step> <!-- the maximum value; must be set for int/float/double -->
        <UI>
          <LabelText>Complex2</LabelText>
          <Position>
            <row>0</row> <!-- Position in the UI, can be 0-2 -->
          </Position>
          <Description>Ancillary parameter of complex. The smaller the number, the more difficult it is to get noise, but it prevents the picture from falling apart.
          Range: 0-255 (default 20)</Description> <!-- tool tip of the parameter -->
        </UI>
      </Parameter>
      <Parameter>
        <Name>mode</Name>
        <Type>string_list</Type> <!-- Type of the parameter. Can be: int/float/double/string/string_list/clip -->
        <Default>Basic</Default> <!-- default value; must be set, unless type is clip-->
        <PossibleValues>Basic ### Median progressive + judgement ### Median interlace + judgment ### Median progressive ### Meidan interlace</PossibleValues>
        <IndexUse>true</IndexUse>
        <UI>
          <LabelText>Mode</LabelText>
          <Position>
            <row>2</row> <!-- Position in the UI, can be 0-2 -->
          </Position>
          <Description>    You can select from 5 types of filter modes, default is 0.
          0 : Basic mode. This is a filter mode that removes only pulse noise. Automatically supports interlaced & progressive.
          1 : Forcibly apply the median filter as progressive. Motion judgment is performed.
          2 : Forcibly apply median filter as interlace. Motion judgment is performed.
          3 : Forcibly apply the median filter as progressive. No motion judgment is made.
          4 : Forcibly apply median filter as interlace. No motion judgment is made.
          Picture breaks occur in modes other than 0. Please use it together with a function that applies a filter to a part of the image. </Description> <!-- tool tip of the parameter -->
        </UI>
      </Parameter>
    </Parameters>    
  </Function>
</CustomScript>
and Hybrid would add something like the attached image to the gui.

This would allow users to extend Hybrids filter support by their own, without really being able to program. Smile

Are there users interested in this? Would users share their xml files?

Theoretically, in the long run, the xml-structure might extend to support additional options and at some point most of the existing filters might be replaced with xml-files.


Cu Selur


Attached Files Thumbnail(s)
   
Reply
#2
Just to keep those, that are interested, up-to-date:
I wrote a bunch of .xml files to test the basic support:
  • Vapoursynth: WDFplus
  • Vapoursynth: abcxyz
  • Avisynth 32bit: DetailSharpen
  • Avisynth 32bit: KillPulse
  • Avisynth 32bit: LMFlicker
  • Avisynth 64bit: DePulse
  • Avisynth 64bit: FluxSmoothT
  • Avisynth 64bit: FluxSmoothST
Basic custom script/filter support, atm. does only support filters atm. which do not change resolution, frame count or frame rate.
I plan to add support for these at a later stage, but the 1st general support for adding support for filters through an .xml file works. Smile

Cu Selur
Reply
#3
Hello Selur,

   this new feature is very nice, it will allow to add easily custom filters and to extend Hybrid even further.

Thanks,
Dan

P.S.
It would be useful to extend the support to scripts that change resolution since it is a hot topic in AI development.
Reply
#4
Quote:It would be useful to extend the support to scripts that change resolution since it is a hot topic in AI development.
Will think about it, the problem with ai stuff is usually that it has tons of dependencies.
+ Don't know of any ai resizer that is available for Vapoursynth which Hybrid does not support. (when using the addons)

atm. I mainly added the feature to have a fast way to test stuff.

Cu Selur
Reply
#5
Hello! You may have already received a message about this but (at least in Hybrid 2024.01.12.1) tweaking settings for WDFPlus does not work correctly. Love the work, thank you!
[Image: C1Whikx.png]
Reply
#6
Will look into it (probably tomorrow after work) and report back.

Cu Selur
Reply
#7
Had a quick look, and I think I fixed the issue. I forgot to set a default value for the optional 'useIndex' option which indicates that a list of parameters is used and their index is needed. So what happend, is that Hybrid thought the values were indexes and thus it added the uninitialized index offset. Wink
-> send you a link to a dev version for testing.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)