[FFmpeg-cvslog] libvo-amrwbenc: Don't explicitly store bitrate modes in the bitrate table

Martin Storsjö git at videolan.org
Thu Apr 14 03:24:37 CEST 2011


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Apr 13 00:42:24 2011 +0300| [5d211e034eebbbbb006d236d810ebf0516484b51] | committer: Martin Storsjö

libvo-amrwbenc: Don't explicitly store bitrate modes in the bitrate table

The bitrate modes are equal to the array indices.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d211e034eebbbbb006d236d810ebf0516484b51
---

 libavcodec/libvo-amrwbenc.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c
index 8ef4f81..aa89b7f 100644
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@ -27,11 +27,6 @@ static const char wb_bitrate_unsupported[] =
     "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, "
     "18.25k, 19.85k, 23.05k, or 23.85k\n";
 
-typedef struct AMRWB_bitrates {
-    int rate;
-    int mode;
-} AMRWB_bitrates;
-
 typedef struct AMRWBContext {
     void  *state;
     int    mode;
@@ -41,20 +36,13 @@ typedef struct AMRWBContext {
 static int getWBBitrateMode(int bitrate)
 {
     /* make the correspondance between bitrate and mode */
-    static const AMRWB_bitrates rates[] = { { 6600, 0},
-                               { 8850, 1},
-                               {12650, 2},
-                               {14250, 3},
-                               {15850, 4},
-                               {18250, 5},
-                               {19850, 6},
-                               {23050, 7},
-                               {23850, 8}, };
+    static const int rates[] = {  6600,  8850, 12650, 14250, 15850, 18250,
+                                 19850, 23050, 23850 };
     int i;
 
     for (i = 0; i < 9; i++)
-        if (rates[i].rate == bitrate)
-            return rates[i].mode;
+        if (rates[i] == bitrate)
+            return i;
     /* no bitrate matching, return an error */
     return -1;
 }



More information about the ffmpeg-cvslog mailing list