Commit 3dffc062 authored by vaillancour's avatar vaillancour
Browse files

fix possible undefined behaviour

parent 5dad1b0e
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1413,7 +1413,7 @@ void non_linearity(
    }

#ifdef NONBE_1328_FIX_NON_LINEARITY
    sc_factor = (float) ( 1 << ( 13 - norm_s( j + 1 ) ) ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = (float) ( 1 << max( 13 - norm_s( j + 1 ), 0 ) ); /* Adapt the scaling factor allowed depending of max position  */
    sc_factor = max( sc_factor, 2.0f );

    if ( *prev_scale <= 0.0 || *prev_scale > sc_factor * scale )
@@ -1477,7 +1477,7 @@ void non_linearity(
    }

#ifdef NONBE_1328_FIX_NON_LINEARITY
    sc_factor = (float) ( 1 << ( 12 - norm_s( j - length / 2 + 1 ) ) ); /* allowed intra frame jump is smaller */
    sc_factor = (float) ( 1 << max( 12 - norm_s( j - length / 2 + 1 ), 0 ) ); /* allowed intra frame jump is smaller */
    sc_factor = max( sc_factor, 2.0f );

    if ( *prev_scale <= 0.0 || *prev_scale > sc_factor * scale )