Revision 5d211e03

View differences:

libavcodec/libvo-amrwbenc.c
27 27
    "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, "
28 28
    "18.25k, 19.85k, 23.05k, or 23.85k\n";
29 29

  
30
typedef struct AMRWB_bitrates {
31
    int rate;
32
    int mode;
33
} AMRWB_bitrates;
34

  
35 30
typedef struct AMRWBContext {
36 31
    void  *state;
37 32
    int    mode;
......
41 36
static int getWBBitrateMode(int bitrate)
42 37
{
43 38
    /* make the correspondance between bitrate and mode */
44
    static const AMRWB_bitrates rates[] = { { 6600, 0},
45
                               { 8850, 1},
46
                               {12650, 2},
47
                               {14250, 3},
48
                               {15850, 4},
49
                               {18250, 5},
50
                               {19850, 6},
51
                               {23050, 7},
52
                               {23850, 8}, };
39
    static const int rates[] = {  6600,  8850, 12650, 14250, 15850, 18250,
40
                                 19850, 23050, 23850 };
53 41
    int i;
54 42

  
55 43
    for (i = 0; i < 9; i++)
56
        if (rates[i].rate == bitrate)
57
            return rates[i].mode;
44
        if (rates[i] == bitrate)
45
            return i;
58 46
    /* no bitrate matching, return an error */
59 47
    return -1;
60 48
}

Also available in: Unified diff