Log in

View Full Version : Compiling RGSF


hello_hello
3rd February 2025, 00:29
I'm trying to compile RGSF (https://github.com/IFeelBloated/RGSF) on Linux. It'd be an understatement to say I'm new to this sort of thing. The following seems to work:

g++ -shared -o librgsf.so RGVS.cpp -O3 -march=native

but according to VS Edit the plugin won't load.

Failed to load /usr/lib/x86_64-linux-gnu/vapoursynth/librgsf.so. Error given: /usr/lib/x86_64-linux-gnu/vapoursynth/librgsf.so: undefined symbol: _Z12clenseCreatePK5VSMapPS_PvP6VSCorePK5VSAPI

Any help would be appreciated.
Thanks.

Julek
3rd February 2025, 13:47
g++ -fPIC -c file1.cpp file2.cpp file3.cpp
g++ -march=native -shared -o libname.so file1.o file2.o file3.o

but if you want just RemoveGrain filter, you can use zsmooth:
https://github.com/adworacz/zsmooth

hello_hello
3rd February 2025, 17:35
Julek,
Unfortunately it's the Repair filter I'm after rather than RemoveGrain.
Thanks for the help though. I now have a working plugin.

I'd only been vaguely aware of zsmooth until now, but I wouldn't mind giving it a look. I've been using focus2.TemporlSoften2 in a function but it also requires the miscellaneous filters plugin for scene change detection. Would you mind sharing the incantations and spells required to download and compile zsmooth? It appears I'll need to install Zig first. Is that correct?

Cheers.

Julek
3rd February 2025, 18:50
current zsmooth uses zig-0.12 (https://github.com/adworacz/zsmooth/blob/a93294a502da2fad98b6a9ad1abb260f8bdcf22b/build.zig#L3) so you can download 0.12.1 here (https://ziglang.org/download/), extract in a folder and run:


git clone https://github.com/adworacz/zsmooth
cd ./zsmooth
path-to-zig build -Doptimize=ReleaseFast


you can do the same thing with vszip, but you'll need zig-0.14.0-dev
https://github.com/dnjulek/vapoursynth-zip

hello_hello
4th February 2025, 03:38
Thanks.

I really should have paid more attention to "current zsmooth uses zig-0.12", because I downloaded the latest version which wouldn't work.

error: no field named 'path' in union 'Build.LazyPath'

I got there eventually, but to think a year or two ago I could add a plugin by downloading a dll. :(

I discovered zsmooth.TemporalSoften also requires the misc filters plugin for scene change detection, which is fine as I have it installed, but I couldn't get the scene change detection to work. SCDetect doesn't need to be added to the script manually does it?

Cheers.

Julek
4th February 2025, 03:50
I don't know about zsmooth operation, you can ask it here:
https://forum.doom9.org/showthread.php?t=185465

Z2697
4th February 2025, 14:52
Do you specifically need the Floating Point support?

hello_hello
5th February 2025, 01:41
Yeah, that's the only reason for needing it.
To be more specific Repair is used in part of a function and ideally I'd like the function to support any bitdepth (half float is supported in a few places by converting it to full float and back as there's no other way around it, aside from converting to an integer bitdepth).

xyx98
6th February 2025, 07:26
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=vapoursynth-plugin-rgsf-git
You can find most vs plugin in aur.
Read PKGBUILD file for help when build on other linux.

hello_hello
13th February 2025, 06:16
xyx98,
Thanks for the info. I'm not sure I understand it all quite yet, but next time I'm in need of a plugin that I can't download via VSRepo I'll check it out.
Cheers.

elcoyote
14th February 2025, 23:58
I managed to compile that on mac using ChatGPT's help. I tested the plugin and it renders fine but i'm not sure how to properly test it.

my command is:

clang++ -dynamiclib -std=c++17 -target arm64-apple-macos -o RGVS.dylib \
RGVS.cpp RemoveGrain.cpp Repair.cpp VerticalCleaner.cpp Clense.cpp \
-I/opt/homebrew/include -L/opt/homebrew/lib -lvapoursynth

ChatGPT says' the command for linux would be:

g++ -shared -std=c++17 -o RGVS.so \
RGVS.cpp RemoveGrain.cpp Repair.cpp VerticalCleaner.cpp Clense.cpp \
-I/usr/include -L/usr/lib -lvapoursynth -fPIC

But I can't test if that actually works.

yuygfgg
2nd March 2025, 08:19
just do g++ -shared -o librgsf.so *.cpp -O3 -march=native

(librgsf.dylib if macos)

Adub
18th March 2025, 23:44
*Sigh* - I've got a issue open for adding Linux builds to simplify this for everyone: https://github.com/adworacz/zsmooth/issues/5

Feel free to add a thumbs up if you are effected.

I should be getting around to adding Linux builds in the next few weeks, and I'll be working on Repair + VerticalCleaner support as well.

Adub
31st March 2025, 03:02
Welp, I've started on implementing Repair.

It's looking like ~20x speedup over RGSF for many of the modes. No, that's not a typo.

I've got modes 1-4 done, will keep chugging on the rest.

hello_hello
31st March 2025, 06:07
I'm looking forward to it. :)

Selur
31st March 2025, 19:08
Yeah, got a bunch of scripts which use Repair that could use a speed boost. :)