Skip to content

Commit

Permalink
Don't clip floating point samples
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmarsev committed Oct 17, 2014
1 parent d7e2fcf commit 5ca2d59
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/bs2b.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 ) );
Expand All @@ -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 ) );
Expand All @@ -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 ];

Expand All @@ -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 ];

Expand Down Expand Up @@ -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 ];

Expand Down

0 comments on commit 5ca2d59

Please sign in to comment.