From patchwork Sat Sep 3 09:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martijn van Beurden X-Patchwork-Id: 34802 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp1458276pzh; Sat, 3 Sep 2022 02:22:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR7kAxYr74XWK8jCUEQPtfi3Z/41clfwZHiUeqIxok9Zdq2VonrHLORV6lxynea7evjg3F17 X-Received: by 2002:a05:6402:84d:b0:435:a764:9aad with SMTP id b13-20020a056402084d00b00435a7649aadmr38024144edz.332.1662196921727; Sat, 03 Sep 2022 02:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662196921; cv=none; d=google.com; s=arc-20160816; b=OCOuSf8CDAfqrbyvWCVYvhQMJP/KFA3LGqZKVtvqZv+IN12kaq8ogSaO0UcmWOFOg4 hGuGbYOTHd8ja1Bi41kDKj+p8LrBqR8b7wXbWZIRxWRMyST/0F1f6mjH6FD5wUCcPQmc x7v+uxQXhhsuWxrHCZgGSR06Q11nK2sHtDzMUqy3avW99ixKFp+uVAez8h6CkEVtPMTz 8vD3D3zrPnFAkiseU6Kc2pOBxn1KIgmcLaOV6mM9r8kbNIHQU26yQzKe35LuVTVF9tGK KFdqDcbDCIMNTnXMYRQPsEodxxxH7C9smBMPqxdK/YIr9h7szCkWEV1yocVil9wSUmtg PdWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=6SCm7WsvyidYY+ftwtxIYqhQG5hlVR9J8qlzguEx92U=; b=fnv0cssDOxI4jZJH0ktBoOhQE02EkkgOHkWi1pAwtX/xmvy7VuU+rD51Zg3GZ9ze1F CjnTN05qG4yo0sSGagLw1qXTmAYkgU+GnS2FQ+daXkitUFIXv2YipKnKda0jErZOwQqm 0BIDb9Qp9Wd//tdUfX0JG++SVK8LGsk3cK+F2utBDiyLRXH1KvkT5sepYUb7hOA1mSNx lzJO2AIL3n44WqT6YFwbUmOkC/qILj2vPK5Squm03j3AMAZfG0Un7oBD8Wxae/lBM1W9 C/OKJ6oOomuxcrF9y4RYFsgQ8e/be3mX5As4iz4FSvynB4HiEWDs4mS/XqumX7A6NKlH TmHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Nfl0zWA2; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m5-20020a509305000000b00445f3dd3861si3031419eda.313.2022.09.03.02.22.01; Sat, 03 Sep 2022 02:22:01 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=Nfl0zWA2; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A71E68B9C3; Sat, 3 Sep 2022 12:21:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A9A968B680 for ; Sat, 3 Sep 2022 12:21:52 +0300 (EEST) Received: by mail-ej1-f49.google.com with SMTP id y3so8089319ejc.1 for ; Sat, 03 Sep 2022 02:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=7r41T/z4ac2tLJyY26PX6eDWllldu86rQHaQwMzBvLc=; b=Nfl0zWA2B8XxuBkoNZZipthM3/ywbDVyprneXtxWUYoEwIMGzJhtToNDNcBxDsYX5K cxuvei4Rf0RmCcvQFBTVzMdvZTppBw3ha4MsYE3Rpjr1LCp3BlTt/70omWG+ONWbPOKT uNDgRcjRtySO1B97hUv34p9PU/HMYosWvc9wzqzUIdHSeJ86Rj1Ialzyv2K+MB29nqZb Qz2zu5GQkhU/jn40VPwUJ4CJKAH0W+CVqmxSaVSBBjVh45PYX6AGSHiv8qVoe3Ozvj84 zttRHc+U1gjX2u0rH+GYFdMI/+PAOUVI1t5k2ylsSOSEHQAvX1yvzr5FgTteJlXznkX1 hbJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=7r41T/z4ac2tLJyY26PX6eDWllldu86rQHaQwMzBvLc=; b=70NCk3Y7jaHQrjTDvwnTyAKYpk/v5i/FBZTdMlYnu2AhrPCGeDvmNaEYyxqGjc7i4h 8AgYAGN2/TOuf9I7S3jWXkFZzi8BXqowaNwv3s+pE8ydcE3a+gcJOWJ9szI68bWCb1jQ RvU3oqA9Rns/O5J9ko+Pdg9YEKGZuAQqv/7eiFSnNC2RH1MQnkzSmVcOfNSygIV6Gtu6 Go02IgczBhAwUnNHmGwr+3zNvy/TCeQF/X1d6KDlIKEl5lkLvmjjGVF8TGuFxekccU6m vN9831VSJQY8EyIQwYWev2TzcNA33fz4HDEdwKIJ2quc6zRr0jXgUX8DHKbmeFvstGNv ncrQ== X-Gm-Message-State: ACgBeo3AOi6avTkBSfatKj3m0RtB7HUIB8akkn1fANDX/adDtq7qPxuG uA4jFFGsC1UC4ZTLAAitJ7555cvdXq9jhA== X-Received: by 2002:a17:907:7d8c:b0:731:65f6:1f28 with SMTP id oz12-20020a1709077d8c00b0073165f61f28mr28143044ejc.91.1662196911125; Sat, 03 Sep 2022 02:21:51 -0700 (PDT) Received: from localhost.localdomain (92-64-99-37.biz.kpn.net. [92.64.99.37]) by smtp.googlemail.com with ESMTPSA id vs7-20020a170907138700b0074b4e77ccc6sm2242594ejb.151.2022.09.03.02.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Sep 2022 02:21:50 -0700 (PDT) From: Martijn van Beurden To: ffmpeg-devel@ffmpeg.org Date: Sat, 3 Sep 2022 11:21:42 +0200 Message-Id: <20220903092144.569716-1-mvanb1@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 0/2] 32bps FLAC patches 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 Cc: Martijn van Beurden Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: l0F8JFdlgeMm Recently libFLAC gained the ability (not in any released version yet though) to create FLAC files containing 32-bit int PCM samples. To keep complexity reasonable, the choice was made to limit residuals to 32-bit integers, which the encoder must make sure of. In case the encoder cannot find any predictor of which the residuals fit this limit, it must default to using a verbatim subframe. Tests have shown that this does not happen often (<0.1% of subframes on a music corpus of various styles). See also discussion here: https://github.com/ietf-wg-cellar/flac-specification/pull/148 These two patches implement decoding and encoding following this format. Changes since v1: fix copy-paste error in encoder, several invocations of lpc_encode_choose_datapath used wrong parameters, making FATE fail as compression was less than it should be Changes since v2: Rebased decoder part as it didn't apply anymore Changes since v3: Moved put_golomb part to flacenc.c (as it is now quite specific to FLAC) and renamed put_sbits64 to put_sbits63 (and changed assert accordingly) Martijn van Beurden (2): libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM libavcodec/flac.c | 4 +- libavcodec/flacdec.c | 248 +++++++++++++++++-- libavcodec/flacenc.c | 519 ++++++++++++++++++++++++++++++++-------- libavcodec/get_bits.h | 12 + libavcodec/mathops.h | 9 + libavcodec/put_bits.h | 7 + libavcodec/put_golomb.h | 14 -- 7 files changed, 674 insertions(+), 139 deletions(-)