This matches the logic from the function of the same name in proresenc_kostya.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -298,18 +298,18 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks, · 297 unmodified lines | ||
| 298 | 298 | for (idx = scan[i]; idx < max_coeffs; idx += 64) { |
| 299 | 299 | int val = blocks[idx] / qmat[scan[i]]; |
| 300 | 300 | if (val) { |
| 301 | − encode_vlc_codeword(pb, ff_prores_run_to_cb[FFMIN(prev_run, 15)], run); | |
| 301 | + encode_vlc_codeword(pb, ff_prores_run_to_cb[prev_run], run); | |
| 302 | 302 | |
| 303 | − prev_run = run; | |
| 304 | − run = 0; | |
| 305 | 303 | level = FFABS(val); |
| 306 | 304 | code = level - 1; |
| 307 | 305 | |
| 308 | − encode_vlc_codeword(pb, ff_prores_level_to_cb[FFMIN(prev_level, 9)], code); | |
| 309 | − | |
| 310 | − prev_level = level; | |
| 306 | + encode_vlc_codeword(pb, ff_prores_level_to_cb[prev_level], code); | |
| 311 | 307 | |
| 312 | 308 | put_sbits(pb, 1, GET_SIGN(val)); |
| 309 | + | |
| 310 | + prev_run = FFMIN(run, 15); | |
| 311 | + prev_level = FFMIN(level, 9); | |
| 312 | + run = 0; | |
| 313 | 313 | } else { |
| 314 | 314 | ++run; |
| 315 | 315 | } |