Commit 74be5e8e authored by vaclav's avatar vaclav
Browse files

merge duplicated functions thr_f() and check_bounds()

parent 49bed955
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ void bands_and_bit_alloc(

            /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */
            bit_fracf = ( -0.125f * Diff_len + 76.0f ) / 100;
            check_bounds( &bit_fracf, 0.50f, 0.75f );
            bit_fracf = check_bounds( bit_fracf, 0.50f, 0.75f );

            /* Adjusment of the bitrate between LF and HF base on the content type */
            /* 1 = new GSC bit alloc
@@ -236,7 +236,7 @@ void bands_and_bit_alloc(
                nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f;
            }
            nb_bands_max = (int16_t) ( nb_bands_max * nb_bands_adj + 0.5f );
            check_bounds_s( &nb_bands_max, 5, nb_tot_bands );
            nb_bands_max = check_bounds_s( nb_bands_max, 5, nb_tot_bands );

            bit_fracf *= SWB_bit_budget;

+1 −1
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ static float acos_clip(
{
    float ph;

    check_bounds( &v, -1.0f, 1.0f );
    v = check_bounds( v, -1.0f, 1.0f );

    ph = acosf( v );

+6 −4
Original line number Diff line number Diff line
@@ -2486,14 +2486,16 @@ float lin_interp(
    const int16_t flag_sat                                      /* i  : flag to indicate whether to apply saturation */
);

void check_bounds(
    float *value,                                               /* i/o: Input value / Adjusted value            */
/*! r: Adjusted value */
float check_bounds(
    const float value,                                          /* i  : Input value                             */
    const float low,                                            /* i  : Low limit                               */
    const float high                                            /* i  : High limit                              */
);

void check_bounds_s(
    int16_t *value,                                             /* i/o: Input value / Adjusted value            */
/*! r: Adjusted value */
int16_t check_bounds_s(
    const int16_t value,                                        /* i  : Input value                             */
    const int16_t low,                                          /* i  : Low limit                               */
    const int16_t high                                          /* i  : High limit                              */
);
+19 −12
Original line number Diff line number Diff line
@@ -510,32 +510,39 @@ float lin_interp(
 * Ensure the input value is within the given limits
 *-------------------------------------------------------------------*/

void check_bounds(
    float *value,    /* i/o: Input value / Adjusted value   */
/*! r: Adjusted value */
float check_bounds(
    const float value, /* i  : Input value                    */
    const float low,   /* i  : Low limit                      */
    const float high   /* i  : High limit                     */
)
{
    *value = min( max( *value, low ), high );
    float value_adj;

    return;
    value_adj = min( max( value, low ), high );

    return value_adj;
}


/*-------------------------------------------------------------------*
 * check_bounds_s()
 *
 * Ensure the input value is within the given limits
 *-------------------------------------------------------------------*/

void check_bounds_s(
    int16_t *value,    /* i/o: Input value / Adjusted value */
/*! r: Adjusted value */
int16_t check_bounds_s(
    const int16_t value, /* i  : Input value                  */
    const int16_t low,   /* i  : Low limit                    */
    const int16_t high   /* i  : High limit                   */
)
{
    *value = min( max( *value, low ), high );
    int16_t value_adj;

    return;
    value_adj = min( max( value, low ), high );

    return value_adj;
}


+0 −7
Original line number Diff line number Diff line
@@ -261,13 +261,6 @@ void AGC_dec(
    const int16_t n /* i  : vector size                                     */
);

/*! r: thresholded value */
float thr_f(
    const float x,     /* i  : input value                                     */
    const float x_min, /* i  : lower thresholod                                */
    const float x_max  /* o  : upper threshold                                 */
);

/*! r: index of the maximum value in the input vector */
int16_t maximum(
    const float *vec,   /* i  : input vector                                    */
Loading