From patchwork Thu Dec 21 07:14:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 45264 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6623:b0:194:e134:edd4 with SMTP id n35csp241274pzh; Wed, 20 Dec 2023 23:14:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjWk45X9usb6abKqBrry9d2d2ABd1Bt9izRKrvPkKrCeQKjPzgvOs6dswsBYETsTkWKTmi X-Received: by 2002:a17:906:7f8d:b0:a24:20f:de83 with SMTP id f13-20020a1709067f8d00b00a24020fde83mr2203119ejr.62.1703142877937; Wed, 20 Dec 2023 23:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703142877; cv=none; d=google.com; s=arc-20160816; b=iOt0zBndxpY140PrXI9g8uK/cobhaODxt1v+zE4ZWwxh3wr2K5prrjB7y1w6cmDoZ3 j6FX0URAGnfK5LCqNYanHogof2nMEOluD/6VQbi6sGmOYusuym8qKhdJGioOo2n9EiV+ 5cILahKIMqLmYBhnvYGyzN+kUR1hMRaAozK5b8D+dJNtkQDS5eOejOyC20JDIrgcdsYg 9c+GU+ZNcZ7U2ijoW88iwv0XllcbW+lZSIFgpV/VaNkIsmLSM00HI3VhCiL8K0qHT9lS B1x6+t2HBMwbxa0gAwTbHeP/wN9nn2vj+j20RXmgMtPjk28d9p9MwXKceGe01oV5Iu8x JfBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=aCwnf6vR/B+5UNWSLWjJ5c0LWrpJqo2fDhnZXbAHdOw=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=c6saBzlwuiPR9L0xgWLd8XZa8MMHLp/ikp9zlrmSDAKmlIuHepFgwHFW82DTzvh48s rvr7hYyK/RUc/XHpksugEkT2kLUjfbSeGr2fmMtQiJyO/TNFtmNiGhWhzx1rk5/WHNJ7 +Yt2K6n0noQKLOqggGILYcdub8U69rdONTCtoeUn+rsci9NWBPSRcuFlbYiC/Jmak+1F No/rF4dI+5dtnBMkVxPXHsWvnwAmw7Xk2hjfNsBCZq3CmXgEeRxZG0n+iDIwlYYu4ZRz RwE+uDSx08IHmj2o8NUXk6Cvq34fDJ/EtIOqhlKJuW+uQL0u0dx/DYNd4OvUX6dzYbss jJsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m22-20020a17090607d600b00a232de45ef1si566381ejc.942.2023.12.20.23.14.33; Wed, 20 Dec 2023 23:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4DA2668C4DD; Thu, 21 Dec 2023 09:14:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E503468CDD8 for ; Thu, 21 Dec 2023 09:14:22 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4SwhWH5tBCz9sV7 for ; Thu, 21 Dec 2023 08:14:19 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Thu, 21 Dec 2023 12:44:04 +0530 Message-Id: <20231221071404.60922-1-ffmpeg@gyani.pro> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4SwhWH5tBCz9sV7 Subject: [FFmpeg-devel] [PATCH] avformat/riffenc: don't force WAVEFORMATEXTENSIBLE for flt/dbl LPCM X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: zl+3UKVIMI28 2c2a167ca7 forced WAVEFORMATEXTENSIBLE for all LPCM streams with greater than 16 bits per sample. However, WAVEFORMATEX allows IEEE Float samples or any depth where raw depth == coded depth, see Remarks section at https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatex and samples M1F1-float32-AFsp, M1F1-float64-AFsp at https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Samples.html There are hardware devices and likely software players requiring float samples that fail to qualify files with WAVEFORMATEXTENSIBLE headers. --- libavformat/riffenc.c | 2 +- tests/ref/acodec/pcm-f32le | 4 ++-- tests/ref/acodec/pcm-f64le | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 3325419b94..8accb69541 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -81,7 +81,7 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, av_channel_layout_compare(&par->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) || par->sample_rate > 48000 || par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM || - av_get_bits_per_sample(par->codec_id) > 16; + (av_get_bits_per_sample(par->codec_id) > 16 && par->codec_tag != 0x0003); if (waveformatextensible) avio_wl16(pb, 0xfffe); diff --git a/tests/ref/acodec/pcm-f32le b/tests/ref/acodec/pcm-f32le index c0fdd70cd2..c63a2c4b70 100644 --- a/tests/ref/acodec/pcm-f32le +++ b/tests/ref/acodec/pcm-f32le @@ -1,4 +1,4 @@ -653d82a64b7bd96ac193e105e9f92d4c *tests/data/fate/acodec-pcm-f32le.wav -2116880 tests/data/fate/acodec-pcm-f32le.wav +03ae40a19deacaca6e0c4ec08dd35956 *tests/data/fate/acodec-pcm-f32le.wav +2116858 tests/data/fate/acodec-pcm-f32le.wav 95e54b261530a1bcf6de6fe3b21dc5f6 *tests/data/fate/acodec-pcm-f32le.out.wav stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400 diff --git a/tests/ref/acodec/pcm-f64le b/tests/ref/acodec/pcm-f64le index 5c90e7bbbd..894d593ac1 100644 --- a/tests/ref/acodec/pcm-f64le +++ b/tests/ref/acodec/pcm-f64le @@ -1,4 +1,4 @@ -48b4cd378f47a50dc902aa03cc8280ed *tests/data/fate/acodec-pcm-f64le.wav -4233680 tests/data/fate/acodec-pcm-f64le.wav +69ffdb079600c53a00c5b0119b586a98 *tests/data/fate/acodec-pcm-f64le.wav +4233658 tests/data/fate/acodec-pcm-f64le.wav 95e54b261530a1bcf6de6fe3b21dc5f6 *tests/data/fate/acodec-pcm-f64le.out.wav stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400