Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Paul B Mahol <onemda@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] libswresample: avoid s16p internal processing format
Date: Thu, 12 Jan 2023 17:09:18 +0100
Message-ID: <CAPYw7P7JLE=0QW6_WBu6pLtp5VP2uCCb-HU1NmxDtZJBbY2UvQ@mail.gmail.com> (raw)
In-Reply-To: <20230112154136.GM1949656@pb2>

On 1/12/23, Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Thu, Jan 12, 2023 at 03:20:06PM +0100, Paul B Mahol wrote:
>> On 1/8/23, Michael Niedermayer <michael@niedermayer.cc> wrote:
>> > On Fri, Jan 06, 2023 at 07:04:59PM +0100, Paul B Mahol wrote:
>> >> On Fri, Jan 6, 2023 at 7:01 PM Paul B Mahol <onemda@gmail.com> wrote:
>> >>
>> >> >
>> >> >
>> >> > On Fri, Jan 6, 2023 at 6:25 PM Michael Niedermayer
>> >> > <michael@niedermayer.cc>
>> >> > wrote:
>> >> >
>> >> >> On Thu, Jan 05, 2023 at 11:08:25PM +0100, Paul B Mahol wrote:
>> >> >> > On Thu, Jan 5, 2023 at 9:53 PM Michael Niedermayer <
>> >> >> michael@niedermayer.cc>
>> >> >> > wrote:
>> >> >> >
>> >> >> > > On Thu, Jan 05, 2023 at 01:44:10PM +0100, Paul B Mahol wrote:
>> >> >> > > > Patch attached.
>> >> >> > >
>> >> >> > > >  swresample.c |    3 ++-
>> >> >> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
>> >> >> > > > eee7a0685b44aa867562138a2e2437ecb8844612
>> >> >> > > 0001-libswresample-swresample-avoid-s16p-internal-transfe.patch
>> >> >> > > > From 9c4cd60e2dd41cf98d693c8251f4cfade0807073 Mon Sep 17
>> >> >> > > > 00:00:00
>> >> >> 2001
>> >> >> > > > From: Paul B Mahol <onemda@gmail.com>
>> >> >> > > > Date: Thu, 5 Jan 2023 13:40:12 +0100
>> >> >> > > > Subject: [PATCH] libswresample/swresample: avoid s16p
>> >> >> > > > internal
>> >> >> transfer
>> >> >> > > format
>> >> >> > > >
>> >> >> > > > Instead use float one by default for sample rate conversions.
>> >> >> > > > The s16p internal transfer format produces visible and
>> >> >> > > > hearable
>> >> >> > > > quantization artifacts.
>> >> >> > >
>> >> >> > > When does this occur and why?
>> >> >> > >
>> >> >> >
>> >> >> > It occurs always. Just compare output with 16bit and
>> >> >> > int32/float/double.
>> >> >> > Look at other people report on internet.
>> >> >> > Look at src.infinitewave.ca
>> >> >>
>> >> >> src.infinitewave.ca uses 32bit none of what it shows should touch
>> >> >> the
>> >> >> codepath
>> >> >> you change.
>> >> >>
>> >> >> if we look at src.infinitewave.ca for swr we see 2 types of
>> >> >> artifacts
>> >> >> 1. Aliassing which is at maybe -120db with the actual signal at 0db
>> >> >>    i would like to see some evidence that a human can hear this
>> >> >>
>> >> >
>> >> > For s16p<->s16p it is much lower, around -78dB thus this patch.
>> >> >
>> >> > Also for others and reports for swr its is lower than exact -120dB
>> >> >
>> >> >
>> >> > 2. Reflection and attenuation at the transition frequency
>> >> >> With linear filters there is a tradeof between attenuation of the
>> >> >> passband, reflection of frequencies beyond, latency and so on
>> >> >> You can have a perfect sharp cutoff with no attenuation and no
>> >> >> refelection
>> >> >> that requires a infinitly long filter. And while this looks best in
>> >> >> this
>> >> >> frequency plot, does it actually sound best ? If you can hear
>> >> >> -120db
>> >> >> signals you surely would then also hear the ringing long before a
>> >> >> gunshot
>> >> >> from such long filter.
>> >> >>
>> >> >
>> >> One can always change linear FIR to be min phase FIR kernel.
>> >
>> > I certainly would welcome a wider range of filters in swr, if you want
>> > to
>> > add
>> > any low delay sinc approximation or in fact i would welcome any filter
>> > you want to add.
>>
>> There is that afdelaysrc filter patch on ML to add FIR coefficient
>> generation for fractional delay audio filter that can be also used as
>> a interpolation FIR filter. And to me it seems better at same number
>> of taps than already used/available ones in soxr and swr.
>
> Please add improvments into swr, if you have any!
>
>
>>
>> Also I have done prototype of resampling filter using afir filter via
>> custom filters in filtergraph and it operates at similar speeds like
>> soxr (in these very non optimized approach) and providing better/wider
>> frequency output at highest band.
>
> Can it be added into swr ?

It will use libavutil/tx.h for convolution.

But I need first to research more and write actual code that does
out/in sample rate ratio factorization and do lot of benchmarks
comparing normal ratios with very big ones and make sure that approach
is always faster than swr/soxr and at same time providing better/same
quality.
Also need to add min phase version of filter and compare what
performance/latency it can bring at all.

>
> thx
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Awnsering whenever a program halts or runs forever is
> On a turing machine, in general impossible (turings halting problem).
> On any real computer, always possible as a real computer has a finite
> number
> of states N, and will either halt in less than N cycles or never halt.
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-01-12 16:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 12:44 Paul B Mahol
2023-01-05 20:53 ` Michael Niedermayer
2023-01-05 22:08   ` Paul B Mahol
2023-01-06 17:25     ` Michael Niedermayer
2023-01-06 18:01       ` Paul B Mahol
2023-01-06 18:04         ` Paul B Mahol
2023-01-08 14:52           ` Michael Niedermayer
2023-01-08 15:27             ` Paul B Mahol
2023-01-12 14:20             ` Paul B Mahol
2023-01-12 15:41               ` Michael Niedermayer
2023-01-12 16:09                 ` Paul B Mahol [this message]
2023-01-12 19:49                   ` Michael Niedermayer
2023-01-08 14:45         ` Michael Niedermayer
2023-01-08 15:18           ` Paul B Mahol
2023-01-12 15:37             ` Michael Niedermayer
2023-01-09 10:41           ` Tobias Rapp
2023-01-09 12:25             ` Paul B Mahol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPYw7P7JLE=0QW6_WBu6pLtp5VP2uCCb-HU1NmxDtZJBbY2UvQ@mail.gmail.com' \
    --to=onemda@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git