Asd-g / AviSynthPlus-Scripts

34 stars 2 forks source link

CTools for avs+ in HBD #15

Closed jonashed closed 1 year ago

jonashed commented 1 year ago

Hello Asd-g hope you are well. An avs+ plugin called Ctools (personally I am mostly interested in the CDegrain and CTemporalsoften filters):

CTools

is written for 8 bit depth only and the author has not been online in doom9 forum for one year. I myself has no knowledge of coding in c or c++ but Im trying to figure out this to rewrite it for HBD (up to YUV444 16 bits). About CDegrain, this is the authors own words: "This filter is a degrain that blends stationary parts of the picture. It takes the chroma difference into account to reduce blending by using a block based approch."

My question is, if you would be willing to help guide me or if you can rewrite this plugin for HBD? Some people in the forum also express their wish for a Vapoursynthport of CTools. I do not know if porting to VS and then port to avs+ is better/easier. I can even give you a small donation for your efforts in a few days if you like.

Also I have a request for the CDegrain filter in the Ctools package, if it is possible to add a 'sClip' to this filter. My thoughts are as follows: CDegrain makes a temporal denoise/degrain only on static/non moving parts of the image but do not touch moving parts. My idea is to use an external clip like this example:

prefilt=fft3dfilter(sigma=3) smooth=blur(0.3) CDegrain(3,5,32,4,dClip=prefilt,sClip=smooth)

to filter only the parts that CDegrain do not touch (the moving parts) with the filter of your choice. Or maybe you have any better ideas.

Hope to hear from you and best regards, Jonas​

kedaitinh12 commented 1 year ago

About author's CTools. Reel.Deel said: "Sadly I don't think Ceppo is coming back; I believe he was discouraged after an argument on GitHub.". So i think don't need ask Ceppo if you want folk or edit this plugin

Asd-g commented 1 year ago

@jonashed, probably it's better to open issue in the original repo. If for any reason high bit support wouldn't be added, I could take a look.

jonashed commented 1 year ago

Thank you! I will write in the original repo.

kedaitinh12 commented 1 year ago

Here modify CDegrain, you can check this code @Asd-g https://forum.doom9.org/showthread.php?p=1981310#post1981310

ghost commented 1 year ago

if Asd-g kindly mods/optimize with comments (so that I can learn) a simple filter like CSharpen, I can do it in the evening to kill time and relax, but I will release 1 filter update at time.

ghost commented 1 year ago

@Asd-g do you know why this code compiles but doesn't work? If you could help me I would be pretty happy. https://pastebin.com/k0JZt9dt

kedaitinh12 commented 1 year ago

@Asd-g link above can't open correctly when click. Just copy and paste to new tab, the link will open correctly

Asd-g commented 1 year ago

@Asd-g do you know why this code compiles but doesn't work? If you could help me I would be pretty happy. https://pastebin.com/k0JZt9dt

It works by adding avs entry point:

AVSValue __cdecl create_csharpen(AVSValue args, void* user_data, IScriptEnvironment* env)
{
    return new CSharpen(args[0].AsClip(),
        args[1].AsInt(),
        args[2].AsInt(),
        args[3].AsBool(),
        args[4].AsBool(),
        args[5].AsBool(),
        env);
}

const AVS_Linkage* AVS_linkage;

extern "C" __declspec(dllexport)
const char* __stdcall AvisynthPluginInit3(IScriptEnvironment * env, const AVS_Linkage* const vectors)
{
    AVS_linkage = vectors;

    env->AddFunction("ttt", "c[nt]i[mode]i[y]b[u]b[v]b", create_csharpen, 0);

    return "tht";
}
kedaitinh12 commented 1 year ago

@Asd-g, any ideas for HBD and optimize speed?? Thanks

Asd-g commented 1 year ago

src->GetRowSize(...) should be src->GetRowSize(...) / vi.ComponentSize() (also same for the pitch) and the calculation should be adjusted for every bit depth (max: 255, 1023...) (templates should be used).

realfinder commented 1 year ago

seems Ceppo delete his account and also the project so here the archive like for it https://web.archive.org/web/20230118221708/https://github.com/CeppoTools/CTools

Asd-g commented 1 year ago

I can't open files and neither I can download the source code.

realfinder commented 1 year ago

CTools-master.zip

do you think it's better update CTools or tivtc? also both need to add option to Field Matching like IT http://avisynth.nl/index.php/IT which seems work best for Anime/Cartoons

Updating IT is excluded since it lack options/features more than both

kedaitinh12 commented 1 year ago

New ideas from Ceppo, he busy to add field matching to this plugin. If you update tivtc, can you add support to read frame property _FieldBased too https://forum.doom9.org/showthread.php?t=185104

realfinder commented 1 year ago

I did tried the New ideas from Ceppo but IT still work better in Anime mouth problem

Asd-g commented 9 months ago

I don't see license. @realfinder / @kedaitinh12 can you contact Ceppo and ask him to provide license?