Accepting request 1142856 from home:jonaski:branches:multimedia:libs

- Add libbs2b-clipping.patch to remove clipping of overloaded
  samples.
  Patch is taken from: https://github.com/alexmarsev/libbs2b
  For more details see:
  https://github.com/strawberrymusicplayer/strawberry/issues/1320

OBS-URL: https://build.opensuse.org/request/show/1142856
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/libbs2b?expand=0&rev=11
This commit is contained in:
Dave Plater 2024-01-31 05:45:13 +00:00 committed by Git OBS Bridge
parent af1e2d0254
commit 98c148cc2c
3 changed files with 102 additions and 1 deletions

91
libbs2b-clipping.patch Normal file
View File

@ -0,0 +1,91 @@
From 5ca2d59888df047f1e4b028e3a2fd5be8b5a7277 Mon Sep 17 00:00:00 2001
From: Alex Marsev <alex.marsev@gmail.com>
Date: Fri, 17 Oct 2014 11:09:04 +0300
Subject: [PATCH] Don't clip floating point samples
---
src/bs2b.c | 36 ------------------------------------
1 file changed, 36 deletions(-)
diff --git a/src/bs2b.c b/src/bs2b.c
index 623ca77..b87680c 100644
--- a/src/bs2b.c
+++ b/src/bs2b.c
@@ -350,12 +350,6 @@ void bs2b_cross_feed_d( t_bs2bdp bs2bdp, double *sample, int n )
{
cross_feed_d( bs2bdp, sample );
- /* Clipping of overloaded samples */
- if( sample[ 0 ] > 1.0 ) sample[ 0 ] = 1.0;
- if( sample[ 0 ] < -1.0 ) sample[ 0 ] = -1.0;
- if( sample[ 1 ] > 1.0 ) sample[ 1 ] = 1.0;
- if( sample[ 1 ] < -1.0 ) sample[ 1 ] = -1.0;
-
sample += 2;
} /* while */
} /* if */
@@ -374,12 +368,6 @@ void bs2b_cross_feed_dbe( t_bs2bdp bs2bdp, double *sample, int n )
cross_feed_d( bs2bdp, sample );
- /* Clipping of overloaded samples */
- if( sample[ 0 ] > 1.0 ) sample[ 0 ] = 1.0;
- if( sample[ 0 ] < -1.0 ) sample[ 0 ] = -1.0;
- if( sample[ 1 ] > 1.0 ) sample[ 1 ] = 1.0;
- if( sample[ 1 ] < -1.0 ) sample[ 1 ] = -1.0;
-
#ifndef WORDS_BIGENDIAN
int64swap( ( uint32_t * )sample );
int64swap( ( uint32_t * )( sample + 1 ) );
@@ -403,12 +391,6 @@ void bs2b_cross_feed_dle( t_bs2bdp bs2bdp, double *sample, int n )
cross_feed_d( bs2bdp, sample );
- /* Clipping of overloaded samples */
- if( sample[ 0 ] > 1.0 ) sample[ 0 ] = 1.0;
- if( sample[ 0 ] < -1.0 ) sample[ 0 ] = -1.0;
- if( sample[ 1 ] > 1.0 ) sample[ 1 ] = 1.0;
- if( sample[ 1 ] < -1.0 ) sample[ 1 ] = -1.0;
-
#ifdef WORDS_BIGENDIAN
int64swap( ( uint32_t * )sample );
int64swap( ( uint32_t * )( sample + 1 ) );
@@ -432,12 +414,6 @@ void bs2b_cross_feed_f( t_bs2bdp bs2bdp, float *sample, int n )
cross_feed_d( bs2bdp, sample_d );
- /* Clipping of overloaded samples */
- if( sample_d[ 0 ] > 1.0 ) sample_d[ 0 ] = 1.0;
- if( sample_d[ 0 ] < -1.0 ) sample_d[ 0 ] = -1.0;
- if( sample_d[ 1 ] > 1.0 ) sample_d[ 1 ] = 1.0;
- if( sample_d[ 1 ] < -1.0 ) sample_d[ 1 ] = -1.0;
-
sample[ 0 ] = ( float )sample_d[ 0 ];
sample[ 1 ] = ( float )sample_d[ 1 ];
@@ -464,12 +440,6 @@ void bs2b_cross_feed_fbe( t_bs2bdp bs2bdp, float *sample, int n )
cross_feed_d( bs2bdp, sample_d );
- /* Clipping of overloaded samples */
- if( sample_d[ 0 ] > 1.0 ) sample_d[ 0 ] = 1.0;
- if( sample_d[ 0 ] < -1.0 ) sample_d[ 0 ] = -1.0;
- if( sample_d[ 1 ] > 1.0 ) sample_d[ 1 ] = 1.0;
- if( sample_d[ 1 ] < -1.0 ) sample_d[ 1 ] = -1.0;
-
sample[ 0 ] = ( float )sample_d[ 0 ];
sample[ 1 ] = ( float )sample_d[ 1 ];
@@ -501,12 +471,6 @@ void bs2b_cross_feed_fle( t_bs2bdp bs2bdp, float *sample, int n )
cross_feed_d( bs2bdp, sample_d );
- /* Clipping of overloaded samples */
- if( sample_d[ 0 ] > 1.0 ) sample_d[ 0 ] = 1.0;
- if( sample_d[ 0 ] < -1.0 ) sample_d[ 0 ] = -1.0;
- if( sample_d[ 1 ] > 1.0 ) sample_d[ 1 ] = 1.0;
- if( sample_d[ 1 ] < -1.0 ) sample_d[ 1 ] = -1.0;
-
sample[ 0 ] = ( float )sample_d[ 0 ];
sample[ 1 ] = ( float )sample_d[ 1 ];

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jan 30 18:48:15 UTC 2024 - Jonas Kvinge <jonaski@opensuse.org>
- Add libbs2b-clipping.patch to remove clipping of overloaded
samples.
Patch is taken from: https://github.com/alexmarsev/libbs2b
For more details see:
https://github.com/strawberrymusicplayer/strawberry/issues/1320
-------------------------------------------------------------------
Wed Jun 15 13:55:43 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>

View File

@ -1,7 +1,7 @@
#
# spec file for package libbs2b
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,6 +26,7 @@ Group: System/Libraries
URL: http://bs2b.sourceforge.net/
Source0: https://downloads.sourceforge.net/project/bs2b/libbs2b/%{version}/libbs2b-%{version}.tar.bz2
Patch0: libbs2b-security.patch
Patch1: libbs2b-clipping.patch
Source99: baselibs.conf
BuildRequires: gcc-c++
BuildRequires: pkgconfig