[FFmpeg-devel] [PATCH] swresample/rematrix: fix mixing of center channels
James Almer
jamrial at gmail.com
Mon Jan 13 20:51:07 EET 2025
On 1/13/2025 12:49 AM, Michael Niedermayer wrote:
> Hi James
>
> On Sun, Jan 12, 2025 at 06:52:55PM -0300, James Almer wrote:
>> On 1/12/2025 6:25 PM, Michael Niedermayer wrote:
>>> Hi
>>>
>>> On Sat, Jan 11, 2025 at 11:13:30AM -0300, James Almer wrote:
>>>> With this, the output from
>>>>
>>>> ffmpeg -i $fate-samples/ac3/monsters_inc_5.1_448_small.ac3 -af aresample,aformat=channel_layouts=mono -f s16le -
>>>>
>>>> matches the one from
>>>>
>>>> ffmpeg -downmix mono -i $fate-samples/ac3/monsters_inc_5.1_448_small.ac3 -f s16le -
>>>>
>>>> When testing with tiny_psnr.
>>>>
>>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>>> ---
>>>> libswresample/rematrix.c | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> This worsense test results:
>>
>> What test is this, and how is it read?
>
> its just tests/swresample
>
> and a dumb script that tries to compare its output to spot cases that worsen
Is this any better? (Also makes the above command line match)
> diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
> index b9bf4dcac0..af89c30451 100644
> --- a/libswresample/rematrix.c
> +++ b/libswresample/rematrix.c
> @@ -217,7 +217,7 @@ av_cold int swr_build_matrix2(const AVChannelLayout *in_layout, const AVChannelL
> matrix[FRONT_CENTER][ FRONT_LEFT]+= M_SQRT1_2;
> matrix[FRONT_CENTER][FRONT_RIGHT]+= M_SQRT1_2;
> if (av_channel_layout_index_from_channel(&in_ch_layout, AV_CHAN_FRONT_CENTER) >= 0)
> - matrix[FRONT_CENTER][ FRONT_CENTER] = center_mix_level*sqrt(2);
> + matrix[FRONT_CENTER][ FRONT_CENTER] += center_mix_level*sqrt(2);
> }else
> av_assert0(0);
> }
> @@ -334,7 +334,7 @@ av_cold int swr_build_matrix2(const AVChannelLayout *in_layout, const AVChannelL
> matrix[TOP_FRONT_CENTER][TOP_FRONT_LEFT ] += M_SQRT1_2;
> matrix[TOP_FRONT_CENTER][TOP_FRONT_RIGHT] += M_SQRT1_2;
> if (av_channel_layout_index_from_channel(&in_ch_layout, AV_CHAN_TOP_FRONT_CENTER) >= 0)
> - matrix[TOP_FRONT_CENTER][TOP_FRONT_CENTER] = center_mix_level * sqrt(2);
> + matrix[TOP_FRONT_CENTER][TOP_FRONT_CENTER] += center_mix_level * sqrt(2);
> } else if (av_channel_layout_index_from_channel(&out_ch_layout, AV_CHAN_FRONT_LEFT) >= 0) {
> if (av_channel_layout_index_from_channel(&in_ch_layout, AV_CHAN_FRONT_LEFT) >= 0) {
> matrix[FRONT_LEFT ][TOP_FRONT_LEFT ] += M_SQRT1_2;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250113/abc5383a/attachment.sig>
More information about the ffmpeg-devel
mailing list