Revision 85ab2904

View differences:

libavcodec/ac3enc.c
1096 1096
 */
1097 1097
static inline int sym_quant(int c, int e, int levels)
1098 1098
{
1099
    int v;
1100

  
1101
    if (c >= 0) {
1102
        v = (levels * (c << e)) >> 24;
1103
        v = (v + 1) >> 1;
1104
        v = (levels >> 1) + v;
1105
    } else {
1106
        v = (levels * ((-c) << e)) >> 24;
1107
        v = (v + 1) >> 1;
1108
        v = (levels >> 1) - v;
1109
    }
1099
    int v = ((((levels * c) >> (24 - e)) + 1) >> 1) + (levels >> 1);
1110 1100
    av_assert2(v >= 0 && v < levels);
1111 1101
    return v;
1112 1102
}

Also available in: Unified diff