Revision c83637b9

View differences:

libavcodec/vorbis_enc.c
1117 1117
    return average / (end - begin);
1118 1118
}
1119 1119

  
1120
static void floor_fit(venc_context_t * venc, floor_t * fc, float * coeffs, int * posts, int samples) {
1120
static void floor_fit(venc_context_t * venc, floor_t * fc, float * coeffs, uint_fast16_t * posts, int samples) {
1121 1121
    int range = 255 / fc->multiplier + 1;
1122 1122
    int i;
1123 1123
    float tot_average = 0.;
......
1141 1141
    return y0 +  (x - x0) * (y1 - y0) / (x1 - x0);
1142 1142
}
1143 1143

  
1144
static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, int * posts, float * floor, int samples) {
1144
static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
1145 1145
    int range = 255 / fc->multiplier + 1;
1146 1146
    int coded[fc->values]; // first 2 values are unused
1147 1147
    int i, counter;
1148
    int lx, ly;
1149 1148

  
1150 1149
    put_bits(pb, 1, 1); // non zero
1151 1150
    put_bits(pb, ilog(range - 1), posts[0]);
......
1208 1207
        }
1209 1208
    }
1210 1209

  
1211
    lx = 0;
1212
    ly = posts[0] * fc->multiplier; // sorted 0 is still 0
1213
    for (i = 1; i < fc->values; i++) {
1214
        int pos = fc->list[i].sort;
1215
        if (coded[pos]) {
1216
            render_line(lx, ly, fc->list[pos].x, posts[pos] * fc->multiplier, floor, samples);
1217
            lx = fc->list[pos].x;
1218
            ly = posts[pos] * fc->multiplier;
1219
        }
1220
        if (lx >= samples) break;
1221
    }
1222
    if (lx < samples) render_line(lx, ly, samples, ly, floor, samples);
1210
    ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded, fc->multiplier, floor, samples);
1223 1211
}
1224 1212

  
1225 1213
static float * put_vector(codebook_t * book, PutBitContext * pb, float * num) {
......
1419 1407

  
1420 1408
    for (i = 0; i < venc->channels; i++) {
1421 1409
        floor_t * fc = &venc->floors[mapping->floor[mapping->mux[i]]];
1422
        int posts[fc->values];
1410
        uint_fast16_t posts[fc->values];
1423 1411
        floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
1424 1412
        floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
1425 1413
    }

Also available in: Unified diff