From patchwork Mon May 3 08:04:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Urja Rannikko X-Patchwork-Id: 1473051 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=eMd/Gid5; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 ozlabs.org (Postfix) with ESMTPS id 4FYb8p57wSz9sCD for ; Mon, 3 May 2021 18:04:10 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 657EB84D58; Mon, 3 May 2021 08:04:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tMis1lkl2Q9T; Mon, 3 May 2021 08:04:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 6DB0B84D5A; Mon, 3 May 2021 08:04:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id DC3A71BF3F0 for ; Mon, 3 May 2021 08:04:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C9B3F40490 for ; Mon, 3 May 2021 08:04:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id atuQ-PNL2Pas for ; Mon, 3 May 2021 08:04:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8167A404D9 for ; Mon, 3 May 2021 08:04:04 +0000 (UTC) Received: by mail-wm1-x331.google.com with SMTP id g65so2767165wmg.2 for ; Mon, 03 May 2021 01:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HFcL119A6YLonzHYTd6DrWjnk5YD2V1cG6L6r3iZb0s=; b=eMd/Gid5g+7eHxWs/VBIXyyu1qtpW9Oxd7zw8hrwguqomoSW8uSvU9u+onaFPhCccB qex5ybXsg3Xa0BGl4Mlm9TcM3grndGLgthKJbE3Ji1IvpEk3LkuvYhOAW0krXD9bgFsV RQcy2Eoi7DULgEmG/zZdTNEnZt8WML5ayQZ1MXNzSevgEDb1iAE1qqg4tLAw45ZOPTj+ aICim+T7c/ZQruyZLi0lqU7YmOM5BjFsgGtFof4fD1uTN5370Aa9ETRDNUXArcMeHDNM 2+tXruh6vlU6alq4L3ZvcRoW6nNeUcb9OK591MS3Kbdq/sPCY0dGe4pMywx03OZMaRQu 18CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HFcL119A6YLonzHYTd6DrWjnk5YD2V1cG6L6r3iZb0s=; b=gI62onfZvTR+ZmtoyQPosgZQjyBrf2Tf9BB/HApislylav5OIEOOW8tNVP8YNp5Iox JuzPb9IBQ5UqSFhsvA9dtINuiEE0xxJovK1gJuy8XpvBcIEXSl/Dcti49jPy2BZwgxPk wGeEvjLqMtc0vluAfrfcM6OqnOYiTMi3+F31qmBN/CXutZQRViZPjRLkaSatD1Yd4TPy XubybTGsGqxxVIrlevFTvqge8jbRDBj6fep9wuw/3tiJndGdG73vO17o7aNMSzZYfYVs NG/FgpXU2XOjtKcS0Jv0haVeqN9Js1y2MZ1e+GCgV3r3lrmzml7tkAoAdoqJYW+OwXqD cd3g== X-Gm-Message-State: AOAM532qvU0R85EhczAd5FUYlrJAHO+pio5XF66pE65aXS/vGzgXZ0ZK 1hQw4PKD2p7qTSA9fpR/yeQKvkKTWQ== X-Google-Smtp-Source: ABdhPJz+tfTvJJ3h+9rmfPyUHj3IoSRR3JWLgcNdF/xCJkwVyEOrYK8/4ZCBTCFHhiMFiDpa5oLV8Q== X-Received: by 2002:a1c:7c03:: with SMTP id x3mr7844870wmc.168.1620029042493; Mon, 03 May 2021 01:04:02 -0700 (PDT) Received: from phenom.bananas ([83.146.165.172]) by smtp.gmail.com with ESMTPSA id y21sm6394581wmi.15.2021.05.03.01.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 01:04:01 -0700 (PDT) From: Urja Rannikko To: buildroot@buildroot.org Date: Mon, 3 May 2021 11:04:08 +0300 Message-Id: <20210503080408.2952261-1-urjaman@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [Buildroot] [RFNC] [PATCH] libsamplerate: add option to remove best quality, make much smaller X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Urja Rannikko Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Urja Rannikko --- Request For _No_ Comments. I made this before I heard that conditional patching will not do, so posting it as-is in case someone else wants to make the idea happen. I don't even know if the hook works yet (rebuild in progress lol), so it's just an idea. Consider this contribution in the public domain. --- package/libsamplerate/Config.in | 11 +++++++ .../hack_out_best_quality.condpatch | 31 +++++++++++++++++++ package/libsamplerate/libsamplerate.mk | 7 +++++ 3 files changed, 49 insertions(+) create mode 100644 package/libsamplerate/hack_out_best_quality.condpatch diff --git a/package/libsamplerate/Config.in b/package/libsamplerate/Config.in index b394fdb..73ec036 100644 --- a/package/libsamplerate/Config.in +++ b/package/libsamplerate/Config.in @@ -7,3 +7,14 @@ config BR2_PACKAGE_LIBSAMPLERATE 44.1kHz to the 48kHz sample rate used by DAT players. http://www.mega-nerd.com/SRC/ + +if BR2_PACKAGE_LIBSAMPLERATE + +config BR2_PACKAGE_LIBSAMPLERATE_REMOVE_SINC_BEST_QUALITY + bool "remove best quality sinc conversion (> 1 MB smaller)" + help + If you select this, SRC_SINC_BEST_QUALITY silently + maps to SRC_SINC_MEDIUM_QUALITY, but libsamplerate + is also significantly smaller. + +endif diff --git a/package/libsamplerate/hack_out_best_quality.condpatch b/package/libsamplerate/hack_out_best_quality.condpatch new file mode 100644 index 0000000..07ae473 --- /dev/null +++ b/package/libsamplerate/hack_out_best_quality.condpatch @@ -0,0 +1,31 @@ +diff --git a/src/src_sinc.c b/src/src_sinc.c +index 1871684..b592a10 100644 +--- a/src/src_sinc.c ++++ b/src/src_sinc.c +@@ -33,7 +33,6 @@ typedef float coeff_t ; + + #include "fastest_coeffs.h" + #include "mid_qual_coeffs.h" +-#include "high_qual_coeffs.h" + + typedef struct + { int sinc_magic_marker ; +@@ -190,17 +189,12 @@ sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) + break ; + + case SRC_SINC_MEDIUM_QUALITY : ++ case SRC_SINC_BEST_QUALITY : + temp_filter.coeffs = slow_mid_qual_coeffs.coeffs ; + temp_filter.coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 2 ; + temp_filter.index_inc = slow_mid_qual_coeffs.increment ; + break ; + +- case SRC_SINC_BEST_QUALITY : +- temp_filter.coeffs = slow_high_qual_coeffs.coeffs ; +- temp_filter.coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 2 ; +- temp_filter.index_inc = slow_high_qual_coeffs.increment ; +- break ; +- + default : + return SRC_ERR_BAD_CONVERTER ; + } ; diff --git a/package/libsamplerate/libsamplerate.mk b/package/libsamplerate/libsamplerate.mk index c107650..fde53e4 100644 --- a/package/libsamplerate/libsamplerate.mk +++ b/package/libsamplerate/libsamplerate.mk @@ -20,4 +20,11 @@ ifeq ($(BR2_PACKAGE_LIBSNDFILE),y) LIBSAMPLERATE_DEPENDENCIES += libsndfile endif +ifeq ($(BR2_PACKAGE_LIBSAMPLERATE_REMOVE_SINC_BEST_QUALITY),y) +define LIBSAMPLERATE_REMOVE_SINC_BEST_QUALITY_HOOK + (cd $(@D); patch -p1 < $(LIBSAMPLERATE_PKGDIR)/hack_out_best_quality.condpatch) +endef +LIBSAMPLERATE_POST_PATCH_HOOKS += LIBSAMPLERATE_REMOVE_SINC_BEST_QUALITY_HOOK +endif + $(eval $(autotools-package))