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

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th September 2024, 23:06   #341  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,821
Quote:
Originally Posted by LigH View Post
Does anyone know a source template for an AviSynth audio plugin that I might try to implement it myself, despite having hardly any practical experience in C/C++ coding? For someone with experience, I guess it might only take a weekend...
Is Vapoursynth, but maybe it can be helpfull too (not much code) https://github.com/dubhater/vapoursynth-damb
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 24th September 2024, 23:11   #342  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
Sorry, no, VapourSynth is based on Python, which I know even less than C.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 25th September 2024, 16:14   #343  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,821
Quote:
Originally Posted by LigH View Post
Sorry, no, VapourSynth is based on Python, which I know even less than C.
But the plugin is written in cpp...
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 27th September 2024, 12:19   #344  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
But it is for a VapourSynth plugin interface. The AviSynth plugin interface is probably different, I would assume.

I saw that the AviSynthPlus repo comes with sources of the Shibatch Sampling Rate Converter (SSRC), that might be a convenient base to derive from.
But I also noticed that I won't be able to do that, with all the C++ interface syntax I am not used to, and related compiler control files...
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 1st October 2024, 09:04   #345  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 816
Quote:
Originally Posted by LigH View Post
But it is for a VapourSynth plugin interface. The AviSynth plugin interface is probably different, I would assume.
AviSynth in VapourSynt is a mod of old version V3.
I am annoyed by plugins in ffmpeg AviSynth/VapourSynt opened as shared AviSynth/VapourSynt DLL.
In AviSynth_c you have all the functions you can open but warmigs are.
Code:
avisynth_c.cpp: In function 'int avs_is_yv24(const AVS_VideoInfo*)':
avisynth_c.cpp:66:63: warning: bitwise operation between different enumeration types '<unnamed enum>' and '<unnamed enum>' is deprecated [-Wdeprecated-enum-enum-conversion]
   66 |   return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV24 & AVS_CS_PLANAR_FILTER);
      |                                                   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Stream audio
Code:
static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st)
{
    AviSynthContext *avs = (AviSynthContext *)s->priv_data;

    st->codecpar->codec_type            = AVMEDIA_TYPE_AUDIO;
    st->codecpar->sample_rate           = avs->vi->audio_samples_per_second;
    st->codecpar->ch_layout.nb_channels = avs->vi->nchannels;
    st->duration                        = avs->vi->num_audio_samples;
    avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second);

    if (avs_get_version(avs->clip) >= 10)
        av_channel_layout_from_mask(&st->codecpar->ch_layout,
                                    avs_get_channel_mask(avs->vi));

    switch (avs->vi->sample_type) {
    case AVS_SAMPLE_INT8:
        st->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
        break;
    case AVS_SAMPLE_INT16:
        st->codecpar->codec_id = PCM(S16);
        break;
    case AVS_SAMPLE_INT24:
        st->codecpar->codec_id = PCM(S24);
        break;
    case AVS_SAMPLE_INT32:
        st->codecpar->codec_id = PCM(S32);
        break;
    case AVS_SAMPLE_FLOAT:
        st->codecpar->codec_id = PCM(F32);
        break;
    default:
        av_log(s, AV_LOG_ERROR,
               "unknown AviSynth sample type %d\n", avs->vi->sample_type);
        avs->error = 1;
        return AVERROR_UNKNOWN;
    }
    return 0;
}
Modyfity cpp plugin ffmpeg static avisynth
https://www.sendspace.com/file/znalx3

Last edited by Jamaika; 1st October 2024 at 11:00.
Jamaika is offline   Reply With Quote
Old 1st October 2024, 09:09   #346  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
Would you be able to help me building an audio plugin?

So far I already asked 3 people and did not get one reply yet.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 10th October 2024, 14:25   #347  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
A little teaser of what I would like to get implemented as AviSynth audio plugin; it already works as CLI application:



I wrote that in FreePascal (Lazarus). I cannot write it in C++.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 10th October 2024 at 14:28.
LigH is offline   Reply With Quote
Old 14th October 2024, 06:30   #348  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
I am now halfway successful. Could build plugins in MSYS2/MinGW and GCC 14.2 (M-AB-S interactive shell).

Only flaw: Despite linker flags containing parameters to statically link some GCC libs, the resulting plugins still depend on them.

CMakeCache contains
Code:
CMAKE_MODULE_LINKER_FLAGS:STRING=-D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++
CMAKE_SHARED_LINKER_FLAGS:STRING=-D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++
According to AVSmeter, the 32-bit plugin misses libgcc_s_dw2-1.dll, the 64-bit plugin misses libgcc_s_seh-1.dll
_

PS: Even when adding those (and libwinpthread-1.dll) to the plugins directory, it is still not useable as AviSynth plugin.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 14th October 2024 at 07:51.
LigH is offline   Reply With Quote
Old 14th October 2024, 12:40   #349  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
It has been done. In MSVC it worked.

AudioBoost plugin: binaries / min. docs / repo

Might replace dimzon's AudioLimiter.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 14th October 2024 at 16:05.
LigH is offline   Reply With Quote
Old 15th October 2024, 08:44   #350  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,750
Hi LigH, congrats !

I did not test it yet, so just a tip about the wording to avoid ambiguities:
In audio the terms "Limiter, Compressor" are reserved for devices/algorithms which regulate gain and avoid distortion at any cost
(the regulation phase excluded, here a carefully chosen lookahead/time constant combo may serve to make distortion unnoticeable)

Going from the graphs you published I would guess that your algo remaps sample values, not gain,
so can be seen now as a soft clipper with selectable curves which is in any case nice to have.

I see arbitrary curves coming, or introduction of a sidechain input.
In the end you will be on the way to LigH's Arbitrary Audio Modulator allowing stranger audio FX like ring modulation etc.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 15th October 2024 at 08:53.
Emulgator is online now   Reply With Quote
Old 15th October 2024, 09:44   #351  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 816
What does it mean?
[avisynth @ 0000023dbcab78e0] Input audio sample format must be float.
I have no idea how to use it.
AudioBoost(4.0, 0.95, 1, true)

#define SAMPLE_FLOAT ???
Jamaika is offline   Reply With Quote
Old 15th October 2024, 09:46   #352  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
http://avisynth.nl/index.php/ConvertAudio
Code:
ConvertAudioToFloat()
AudioBoost()
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 15th October 2024, 10:14   #353  |  Link
Jamaika
Registered User
 
Join Date: Jul 2015
Posts: 816
I don't know if it works correctly but you can test it.
https://www.sendspace.com/file/1vnpbw

AVISource("AudioBoost.avi")

# resize the dimensions of the video frame to 320x240
LanczosResize(320, 240)
ConvertAudioToFloat()
AudioBoost(4.0, 0.95, 1, true)
Jamaika is offline   Reply With Quote
Old 15th October 2024, 19:39   #354  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,823
Is there any modern filter to dehalo properly?

I have tried many and some don't accept YV24 or they simply work so and so.

Any help is welcome.

P.S: Tried FineDehalo and DeHaloAlpha and, oh my god, parameters are such a mess for me.
__________________
@turment on Telegram

Last edited by tormento; 15th October 2024 at 21:14.
tormento is offline   Reply With Quote
Old 18th October 2024, 02:43   #355  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 214
Quote:
Originally Posted by tormento View Post
Is there any modern filter to dehalo properly?
Code:
FFT3DFilter(sigma=0, bt=-1, dehalo=0.5)
If bt=-1 doesn't work use bt=1
takla is offline   Reply With Quote
Old 18th October 2024, 12:03   #356  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
LOL, I never noticed that ff3dfilter has a dehalo option. (okay, at least on it's own without masking it does not seem that useful)
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 18th October 2024 at 12:17.
Selur is offline   Reply With Quote
Old 18th October 2024, 13:19   #357  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 214
Quote:
Originally Posted by Selur View Post
(okay, at least on it's own without masking it does not seem that useful)
🤷 I found it useful when I used it in the past, where every other DeHalo overcomplicated things for a worse result.
takla is offline   Reply With Quote
Old 18th October 2024, 13:36   #358  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,503
Did a few tests and to me DeHalo_alpha and FineDeHalo both worked better on my sources.
Did you use some masking? Or did you use cartoon/anime content, where fine details are often a rare thing?
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 18th October 2024, 13:47   #359  |  Link
takla
Registered User
 
Join Date: May 2018
Posts: 214
Quote:
Originally Posted by Selur View Post
Did you use some masking? Or did you use cartoon/anime content, where fine details are often a rare thing?
No masking. The source was real world camera footage of a PAL TV show. The ringing was very bad. I think they used early digital cameras. The dehalo from FFT3DFilter produced a gloomy like image which I much preferred.

I think I also denoised chroma (for DeRainbow) so FFT3D really came in handy here.

I'd share a clip, but I need to rebuild my desktop, which will take me some months. (Waiting for Black Friday or similar good deal on some parts)

Last edited by takla; 18th October 2024 at 13:50.
takla is offline   Reply With Quote
Old 22nd October 2024, 22:08   #360  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,157
AudioBoost 0.2 is now available with both interfaces (C++/2.6-MSVC and C/2.5).
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 22nd October 2024 at 22:16.
LigH is offline   Reply With Quote
Reply

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 19:07.


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