Revision 57d473f4

View differences:

libavcodec/wavpack.c
114 114
    return neg ? -res : res;
115 115
}
116 116

  
117
static inline int get_unary(GetBitContext *gb){
118
    int r=0;
119
    while(get_bits1(gb) && r<33)r++;
120
    return r;
121
}
122

  
123 117
// macros for manipulating median values
124 118
#define GET_MED(n) ((median[n] >> 4) + 1)
125 119
#define DEC_MED(n) median[n] -= ((median[n] + (128>>n) - 2) / (128>>n)) * 2
......
165 159
            if(ctx->zeroes)
166 160
                return 0;
167 161
        }else{
168
            t = get_unary(gb);
162
            t = get_unary(gb, 0, 33);
169 163
            if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));
170 164
            ctx->zeroes = t;
171 165
            if(ctx->zeroes){
......
184 178
        t = 0;
185 179
        ctx->zero = 0;
186 180
    }else{
187
        t = get_unary(gb);
181
        t = get_unary(gb, 0, 33);
188 182
        if(get_bits_count(gb) >= ctx->data_size){
189 183
            *last = 1;
190 184
            return 0;
191 185
        }
192 186
        if(t == 16) {
193
            t2 = get_unary(gb);
187
            t2 = get_unary(gb, 0, 33);
194 188
            if(t2 < 2) t += t2;
195 189
            else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1));
196 190
        }

Also available in: Unified diff