From patchwork Tue Jul 26 19:41:05 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: 34775 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp2848035pzb; Tue, 26 Jul 2022 12:41:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sPx2m34PLPY4Xv+Pr86p1PWdJI9Up2qeDyavusc/USZVJZyObcDSjbL9vJWUlwQ5+bzlsl X-Received: by 2002:a17:906:846d:b0:72f:3901:de1c with SMTP id hx13-20020a170906846d00b0072f3901de1cmr15119866ejc.199.1658864489438; Tue, 26 Jul 2022 12:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658864489; cv=none; d=google.com; s=arc-20160816; b=uA/nRXPnAWU5Bvg3jsHYQvCuBBD2N9rS4E6G0hza1NmFNeMfZZamMoe9gLRWGLZAo4 DwpQnOK1CQqJ9GvC+Nj5e1TSQZTKF4+40N5sW8h/snsl4GvNQ9oFD23YtkzJmx1+WwCR nEPVDJ4/HNdN6rSAR6pMUNgydYk1nBsfDvKA8pvT7k5EksijZgW2GX1Nm3fARDkubRja 8W/HkcGhfDnaFLx0YooqXMU0iAXoJGsCdfP8tIyZdo3FoQIUS5HRQIJFqQugFKZF/XkV V44BOHTo8Vy+P3tvzDstgJES36Bw+RdYEBo5IjC8kz3pAufafIjcYSzl0ZpM3znocZMT nDAQ== 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=tgmc9XdlYPGZ0QMHr+Q0L+qoH1L1B1alCJ+48EX0SJM=; b=A5SXuU9F9l6QCmYvC8JJ/9/OG4ES4w2LDqYhUEvuvO4kEuSD0ozyIX8/hbZ4goJv8W l8nmaa8kdFLzjQKByJpLlI2DkCCPE1CSq4+q3ZGBScOWgzlyLukOVsZzMxahblZ1/GAq mdi17a55SDfqDeLH1AHvLlHwTavuT8R94a4jirD2bJYSwVd453i90wABfmjsQX2ZaF25 05ZLirvO2y6RuidPRGqWA6EVQvn4ebpMHqLUG30+cs+4G90TJm1vg4pYrT2c2WdDt34w t3toRR19hiIq8yPihrCiE3azOC+0yzEDqJ18i/rV91aIqnyP1R17tWcPK53VxGED3pFa XysA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=eXJhUB0R; 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 s3-20020a056402520300b0043bca1b6462si16185763edd.44.2022.07.26.12.41.28; Tue, 26 Jul 2022 12:41:29 -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=eXJhUB0R; 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 F381E68B871; Tue, 26 Jul 2022 22:41:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F2DB68B6AB for ; Tue, 26 Jul 2022 22:41:18 +0300 (EEST) Received: by mail-ej1-f45.google.com with SMTP id sz17so27991540ejc.9 for ; Tue, 26 Jul 2022 12:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=snyWT6ug0z/ePE3Gb/jq66lDKLqiO7PKzcUuIXreREE=; b=eXJhUB0Ro3G2qzfG1TcZi0pYZks1Hhsi/KMAE6ZVLPFEPA7DjIhaiWtFSzgffxh9wN 3Scja/kOSmKKYAD5Zos7nQ3gNzcY9XGOI5PXHiad364WjCLkuc8HCdwApYthWBMqCH/+ ta2uGG0qkoDisfN3tt+iPlK2ioHRhY77CF01vn+I8bb+454sQr+wjuE+jxHnkOE4bzBq VqSstHRVchf43Tf9QWOxxkop2cKqUy0Z6P0Sr5TL5NI14g5s5qPmfjygLyNrW2Af76EC Am4iDu8gz1XgkYv4gVzJVqytWEZv1/7UbvY6LoqE4IdyDNj5xT0nqsnfyMc6tvcB+DVh mxIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=snyWT6ug0z/ePE3Gb/jq66lDKLqiO7PKzcUuIXreREE=; b=bqfXF19BpWv2meFp5+RlfXT2uoaSP5yQrnaZYx+/oiVufNki7SLIvu2v56G+YHsGva fLNkT5qpeITty2iv7+iwSomtUJdquPQsLViKZhdn3YmWqIGdSng4XE6p/fDX0oDR0riH +TVliu+YsI/PL6kIv+TuGwwY6owvXOhdX7cDjzmyYvEloujcT6OGcGzRXUkeaYrTJj3k iLpqbhPv8c6Z170O2sIbhfR4LDItMmMqxK7Alqxyk3X833u1julFcwmQ3uB20d4ki9HG seemMIpnLi0O4DEstJ+ZjXG7lLNkYkMFDdfr3aeDkdQ2Dp4GjbVaCTRDImidM6h3O8QQ RvXg== X-Gm-Message-State: AJIora8SBvqIDf7Z9y0t14y0pAeUOQv525skFpMUhJ0gqcXP4Bsqx/qc pNtDTxzLk+L3ci/QXSxFi1YuxRlHuSSgEQ== X-Received: by 2002:a17:906:98c8:b0:72b:408f:f499 with SMTP id zd8-20020a17090698c800b0072b408ff499mr15137679ejb.736.1658864477418; Tue, 26 Jul 2022 12:41:17 -0700 (PDT) Received: from localhost.localdomain (92-64-99-37.biz.kpn.net. [92.64.99.37]) by smtp.googlemail.com with ESMTPSA id l12-20020aa7cacc000000b0043bc300c499sm8817341edt.79.2022.07.26.12.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:41:16 -0700 (PDT) From: Martijn van Beurden To: ffmpeg-devel@ffmpeg.org Date: Tue, 26 Jul 2022 21:41:05 +0200 Message-Id: <20220726194107.316153-1-mvanb1@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 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: 1zmxg9+fpqgu 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. The decoding patch has been send in for review earlier, but didn't get any feedback yet, so I'm sending it in again, unchanged, this time with a patch for encoding too. 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 | 499 ++++++++++++++++++++++++++++++++-------- libavcodec/get_bits.h | 12 + libavcodec/mathops.h | 9 + libavcodec/put_bits.h | 7 + libavcodec/put_golomb.h | 19 +- 7 files changed, 668 insertions(+), 130 deletions(-)