[FFmpeg-soc] [soc]: r4914 - amr/amrnbdec.c

cmcq subversion at mplayerhq.hu
Mon Aug 3 17:50:15 CEST 2009


Author: cmcq
Date: Mon Aug  3 17:50:15 2009
New Revision: 4914

Log:
Avoid right-shifting a negative number (undefined behavior in C99)
This also removes one subtraction so it's not just pedantic

Modified:
   amr/amrnbdec.c

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Mon Aug  3 17:41:31 2009	(r4913)
+++ amr/amrnbdec.c	Mon Aug  3 17:50:15 2009	(r4914)
@@ -414,9 +414,9 @@ static void decode_pitch_lag(int *lag_in
                 *lag_frac = 0;
             } else if (pitch_index < 12) {
                 // 1/3 fractional precision for [search_range_min+3 1/3, search_range_min+5 2/3]
-                *lag_int  = (((pitch_index - 5) * 10923) >> 15 ) - 1;
-                *lag_frac = pitch_index - *lag_int * 3 - 9;
-                *lag_int += search_range_min + 5;
+                *lag_int  = (pitch_index + 1) * 10923 >> 15;
+                *lag_frac = pitch_index - *lag_int * 3;
+                *lag_int += search_range_min + 2;
             } else {
                 // integer only precision for [search_range_min+6, search_range_min+9]
                 *lag_int  = pitch_index + search_range_min - 6;


More information about the FFmpeg-soc mailing list