Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] libswresample: avoid s16p internal processing format
@ 2023-01-05 12:44 Paul B Mahol
  2023-01-05 20:53 ` Michael Niedermayer
  0 siblings, 1 reply; 17+ messages in thread
From: Paul B Mahol @ 2023-01-05 12:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 16 bytes --]

Patch attached.

[-- Attachment #2: 0001-libswresample-swresample-avoid-s16p-internal-transfe.patch --]
[-- Type: text/x-patch, Size: 1208 bytes --]

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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libswresample/swresample.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 5884f8d533..e6151bc335 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -318,7 +318,8 @@ av_cold int swr_init(struct SwrContext *s){
 
     if(s->int_sample_fmt == AV_SAMPLE_FMT_NONE){
         if(   av_get_bytes_per_sample(s-> in_sample_fmt) <= 2
-           && av_get_bytes_per_sample(s->out_sample_fmt) <= 2){
+           && av_get_bytes_per_sample(s->out_sample_fmt) <= 2
+           && s->out_sample_rate==s->in_sample_rate) {
             s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
         }else if(   av_get_bytes_per_sample(s-> in_sample_fmt) <= 2
            && !s->rematrix
-- 
2.37.2


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-01-12 19:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 12:44 [FFmpeg-devel] [PATCH] libswresample: avoid s16p internal processing format 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
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

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