This makes the function closer to encode_dcs() in proresenc_kostya.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -270,24 +270,24 @@ static av_always_inline int get_level(int val) · 269 unmodified lines | ||
| 270 | 270 | static void encode_dc_coeffs(PutBitContext *pb, int16_t *in, |
| 271 | 271 | int blocks_per_slice, int *qmat) |
| 272 | 272 | { |
| 273 | − int prev_dc, code; | |
| 273 | + int prev_dc, codebook; | |
| 274 | 274 | int i, sign, idx; |
| 275 | − int new_dc, delta, diff_sign, new_code; | |
| 275 | + int new_dc, delta, diff_sign, code; | |
| 276 | 276 | |
| 277 | 277 | prev_dc = (in[0] - 0x4000) / qmat[0]; |
| 278 | − code = TO_GOLOMB(prev_dc); | |
| 279 | − encode_vlc_codeword(pb, FIRST_DC_CB, code); | |
| 278 | + codebook = TO_GOLOMB(prev_dc); | |
| 279 | + encode_vlc_codeword(pb, FIRST_DC_CB, codebook); | |
| 280 | 280 | |
| 281 | − code = 5; sign = 0; idx = 64; | |
| 281 | + codebook = 5; sign = 0; idx = 64; | |
| 282 | 282 | for (i = 1; i < blocks_per_slice; i++, idx += 64) { |
| 283 | 283 | new_dc = (in[idx] - 0x4000) / qmat[0]; |
| 284 | 284 | delta = new_dc - prev_dc; |
| 285 | 285 | diff_sign = DIFF_SIGN(delta, sign); |
| 286 | − new_code = TO_GOLOMB2(get_level(delta), diff_sign); | |
| 286 | + code = TO_GOLOMB2(get_level(delta), diff_sign); | |
| 287 | 287 | |
| 288 | − encode_vlc_codeword(pb, ff_prores_dc_codebook[FFMIN(code, 6)], new_code); | |
| 288 | + encode_vlc_codeword(pb, ff_prores_dc_codebook[FFMIN(codebook, 6)], code); | |
| 289 | 289 | |
| 290 | − code = new_code; | |
| 290 | + codebook = code; | |
| 291 | 291 | sign = delta >> 31; |
| 292 | 292 | prev_dc = new_dc; |
| 293 | 293 | } |