* [FFmpeg-devel] [PATCH] swresample: try to fix regression
@ 2023-02-08 17:37 Paul B Mahol
2023-02-08 21:53 ` Martin Storsjö
0 siblings, 1 reply; 2+ messages in thread
From: Paul B Mahol @ 2023-02-08 17:37 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 27 bytes --]
This one should pass FATE.
[-- Attachment #2: 0001-swresample-do-not-attempt-to-rematrix-if-channel-map.patch --]
[-- Type: text/x-patch, Size: 2283 bytes --]
From ca54f241756e764f70c919acd0c99c811762dcb1 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Wed, 8 Feb 2023 18:35:38 +0100
Subject: [PATCH] swresample: do not attempt to rematrix if channel map is
provided
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
libavfilter/af_pan.c | 6 +-----
libswresample/swresample.c | 4 ++--
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 80c194b066..067f646805 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -313,9 +313,7 @@ static int config_props(AVFilterLink *link)
pan->channel_map[i] = ch_id;
}
- av_opt_set_chlayout(pan->swr, "ichl", &link->ch_layout, 0);
- av_opt_set_chlayout(pan->swr, "ochl", &pan->out_channel_layout, 0);
- av_opt_set_int(pan->swr, "uch", link->ch_layout.nb_channels, 0);
+ av_opt_set_int(pan->swr, "uch", pan->nb_output_channels, 0);
swr_set_channel_mapping(pan->swr, pan->channel_map);
} else {
// renormalize
@@ -335,8 +333,6 @@ static int config_props(AVFilterLink *link)
for (j = 0; j < link->ch_layout.nb_channels; j++)
pan->gain[i][j] /= t;
}
- av_opt_set_chlayout(pan->swr, "ichl", &link->ch_layout, 0);
- av_opt_set_chlayout(pan->swr, "ochl", &pan->out_channel_layout, 0);
swr_set_matrix(pan->swr, pan->gain[0], pan->gain[1] - pan->gain[0]);
}
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 5884f8d533..7c8d9bfc97 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -312,9 +312,9 @@ av_cold int swr_init(struct SwrContext *s){
if (s->out_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
av_channel_layout_default(&s->out_ch_layout, s->out.ch_count);
- s->rematrix = av_channel_layout_compare(&s->out_ch_layout, &s->in_ch_layout) ||
+ s->rematrix = !s->channel_map && (av_channel_layout_compare(&s->out_ch_layout, &s->in_ch_layout) ||
s->rematrix_volume!=1.0 ||
- s->rematrix_custom;
+ s->rematrix_custom);
if(s->int_sample_fmt == AV_SAMPLE_FMT_NONE){
if( av_get_bytes_per_sample(s-> in_sample_fmt) <= 2
--
2.39.1
[-- 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] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] swresample: try to fix regression
2023-02-08 17:37 [FFmpeg-devel] [PATCH] swresample: try to fix regression Paul B Mahol
@ 2023-02-08 21:53 ` Martin Storsjö
0 siblings, 0 replies; 2+ messages in thread
From: Martin Storsjö @ 2023-02-08 21:53 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 8 Feb 2023, Paul B Mahol wrote:
> This one should pass FATE.
>
> diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
> index 80c194b066..067f646805 100644
> --- a/libavfilter/af_pan.c
> +++ b/libavfilter/af_pan.c
> @@ -313,9 +313,7 @@ static int config_props(AVFilterLink *link)
> pan->channel_map[i] = ch_id;
> }
>
> - av_opt_set_chlayout(pan->swr, "ichl", &link->ch_layout, 0);
> - av_opt_set_chlayout(pan->swr, "ochl", &pan->out_channel_layout, 0);
> - av_opt_set_int(pan->swr, "uch", link->ch_layout.nb_channels, 0);
> + av_opt_set_int(pan->swr, "uch", pan->nb_output_channels, 0);
> swr_set_channel_mapping(pan->swr, pan->channel_map);
> } else {
> // renormalize
> @@ -335,8 +333,6 @@ static int config_props(AVFilterLink *link)
> for (j = 0; j < link->ch_layout.nb_channels; j++)
> pan->gain[i][j] /= t;
> }
> - av_opt_set_chlayout(pan->swr, "ichl", &link->ch_layout, 0);
> - av_opt_set_chlayout(pan->swr, "ochl", &pan->out_channel_layout, 0);
> swr_set_matrix(pan->swr, pan->gain[0], pan->gain[1] - pan->gain[0]);
> }
>
This bit looks like a straight revert of the commit that broke fate, so
that's probably ok.
> diff --git a/libswresample/swresample.c b/libswresample/swresample.c
> index 5884f8d533..7c8d9bfc97 100644
> --- a/libswresample/swresample.c
> +++ b/libswresample/swresample.c
> @@ -312,9 +312,9 @@ av_cold int swr_init(struct SwrContext *s){
> if (s->out_ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
> av_channel_layout_default(&s->out_ch_layout, s->out.ch_count);
>
> - s->rematrix = av_channel_layout_compare(&s->out_ch_layout, &s->in_ch_layout) ||
> + s->rematrix = !s->channel_map && (av_channel_layout_compare(&s->out_ch_layout, &s->in_ch_layout) ||
> s->rematrix_volume!=1.0 ||
> - s->rematrix_custom;
> + s->rematrix_custom);
>
> if(s->int_sample_fmt == AV_SAMPLE_FMT_NONE){
> if( av_get_bytes_per_sample(s-> in_sample_fmt) <= 2
I really can't say about this part of the patch though...
Can we maybe just do it in two parts - revert the patch that broke fate
and find someone other than me to comment on the swresample bit?
// Martin
_______________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2023-02-08 21:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 17:37 [FFmpeg-devel] [PATCH] swresample: try to fix regression Paul B Mahol
2023-02-08 21:53 ` Martin Storsjö
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