Jaded-Encoding-Thaumaturgy / vs-rgtools

RgTools and related functions
MIT License
9 stars 2 forks source link

gauss_blur: doesn't take force_h/v, but only errors sometimes #41

Open LightArrowsEXE opened 3 weeks ago

LightArrowsEXE commented 3 weeks ago

The following error is raised when the function is called via vsdeband.masked_deband

2024-10-04 01:19:55.068: root: ERROR: Traceback (most recent call last):
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vsengine\vpy.py", line 219, in _execute
    runpy.run_path(str(script), module.__dict__, module.__name__)
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 287, in run_path
    return _run_module_code(code, init_globals, run_name,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 98, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vspreview\core\vsenv.py", line 44, in _monkey_runpy_func
    glob_dict = orig_runpy_run_code(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "C:\Users\light\GitHub\Jaded-Encoding-Thaumaturgy\vs-rgtools\test.py", line 15, in <module>
    c = masked_deband(src)
        ^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vsdeband\funcs.py", line 97, in masked_deband
    deband_mask = deband_detail_mask(clip, sigma, rxsigma, pf_sigma, brz, rg_mode)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vsdeband\mask.py", line 20, in deband_detail_mask
    ret = retinex(
          ^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vsmasktools\spat_funcs.py", line 131, in retinex
    msr = norm_expr([luma_float, (gauss_blur(luma_float, i) for i in sigma)], expr_msr)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vsexprtools\funcs.py", line 105, in norm_expr
    clips = flatten_vnodes(clips, split_planes=split_planes)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vstools\functions\normalize.py", line 109, in flatten_vnodes
    nodes = list[vs.VideoNode](flatten(clips))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vstools\functions\normalize.py", line 91, in flatten
    yield from stg_flatten(items)
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\functions\normalize.py", line 92, in flatten
    for sub_x in flatten(val):
                 ^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\functions\normalize.py", line 92, in flatten
    for sub_x in flatten(val):
                 ^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\functions\normalize.py", line 90, in flatten
    for val in items:
               ^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vsmasktools\spat_funcs.py", line 131, in <genexpr>
    msr = norm_expr([luma_float, (gauss_blur(luma_float, i) for i in sigma)], expr_msr)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\GitHub\Jaded-Encoding-Thaumaturgy\vs-rgtools\vsrgtools\blur.py", line 226, in gauss_blur
    return _resize2_blur(clip)
           ^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\GitHub\Jaded-Encoding-Thaumaturgy\vs-rgtools\vsrgtools\blur.py", line 223, in _resize2_blur
    return Gaussian(sigma, taps).scale(plane, **{f'force_{k}': k in mode for k in 'hv'})  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 180, in _wrapper
    return self.function(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 323, in __call__
    return self.__get__(None, self)(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 318, in _wrapper
    return this.function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vskernels\kernels\complex.py", line 229, in scale
    return super().scale(
           ^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 180, in _wrapper
    return self.function(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 323, in __call__
    return self.__get__(None, self)(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 318, in _wrapper
    return this.function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vskernels\kernels\complex.py", line 68, in func
    return operation(clip, width, height, shift, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 180, in _wrapper
    return self.function(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 323, in __call__
    return self.__get__(None, self)(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 318, in _wrapper
    return this.function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vskernels\kernels\complex.py", line 207, in scale
    clip = Scaler.scale(self, clip, width, height, shift, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 180, in _wrapper
    return self.function(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 323, in __call__
    return self.__get__(None, self)(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 318, in _wrapper
    return this.function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vskernels\kernels\abstract.py", line 224, in scale
    return self.scale_function(clip, **_norm_props_enums(self.get_scale_args(clip, shift, width, height, **kwargs)))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\stgpytools\types\utils.py", line 180, in _wrapper
    return self.function(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\light\AppData\Local\Programs\Python\Python312\Lib\site-packages\vskernels\kernels\custom.py", line 50, in scale_function
    return core.resize2.Custom(clip, kernel, int(support), width, height, *args, **clean_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src\\cython\\vapoursynth.pyx", line 3091, in vapoursynth.Function.__call__
vapoursynth.Error: Custom: Function does not take argument(s) named force_h, force_v

However, no error is thrown when I call just gauss_blur directly, even though it should seemingly also pass those kwargs to resize2.

As far as I can tell, while there's a commit (https://github.com/Jaded-Encoding-Thaumaturgy/vapoursynth-resize2/commit/e8cd600346655bccb073aadc624875cb38741334) that adds these parameters to resize2, it's not actually accessible?

Setsugennoao commented 1 week ago

Was everything up to date? This was also necessary https://github.com/Jaded-Encoding-Thaumaturgy/vs-kernels/commit/053534032e13a7622cfa1ecf071aa9f12c1a341f