- /* decode a VLC into a token */
- token = get_vlc2(gb, vlc_table, 11, 3);
- /* use the token to get a zero run, a coefficient, and an eob run */
- if ((unsigned) token <= 6U) {
- eob_run = eob_run_base[token];
- if (eob_run_get_bits[token])
- eob_run += get_bits(gb, eob_run_get_bits[token]);
-
- // record only the number of blocks ended in this plane,
- // any spill will be recorded in the next plane.
- if (eob_run > num_coeffs - coeff_i) {
- dct_tokens[j++] = TOKEN_EOB(num_coeffs - coeff_i);
- blocks_ended += num_coeffs - coeff_i;
- eob_run -= num_coeffs - coeff_i;
- coeff_i = num_coeffs;
- } else {
- dct_tokens[j++] = TOKEN_EOB(eob_run);
- blocks_ended += eob_run;
- coeff_i += eob_run;
- eob_run = 0;
- }
- } else if (token >= 0) {
- bits_to_get = coeff_get_bits[token];
- if (bits_to_get)
- bits_to_get = get_bits(gb, bits_to_get);
- coeff = coeff_tables[token][bits_to_get];
-
- zero_run = zero_run_base[token];
- if (zero_run_get_bits[token])
- zero_run += get_bits(gb, zero_run_get_bits[token]);
-
- if (zero_run) {
- dct_tokens[j++] = TOKEN_ZERO_RUN(coeff, zero_run);
- } else {
- // Save DC into the fragment structure. DC prediction is
- // done in raster order, so the actual DC can't be in with
- // other tokens. We still need the token in dct_tokens[]
- // however, or else the structure collapses on itself.
- if (!coeff_index)
- all_fragments[coded_fragment_list[coeff_i]].dc = coeff;
-
- dct_tokens[j++] = TOKEN_COEFF(coeff);
- }
-
- if (coeff_index + zero_run > 64) {
- av_log(s->avctx, AV_LOG_DEBUG, "Invalid zero run of %d with"
- " %d coeffs left\n", zero_run, 64-coeff_index);
- zero_run = 64 - coeff_index;
- }
-
- // zero runs code multiple coefficients,
- // so don't try to decode coeffs for those higher levels
- for (i = coeff_index+1; i <= coeff_index+zero_run; i++)
- s->num_coded_frags[plane][i]--;
- coeff_i++;
+ /* decode a VLC into a token */
+ token = get_vlc2(gb, vlc_table, 11, 3);
+ /* use the token to get a zero run, a coefficient, and an eob run */
+ if ((unsigned) token <= 6U) {
+ eob_run = eob_run_base[token];
+ if (eob_run_get_bits[token])
+ eob_run += get_bits(gb, eob_run_get_bits[token]);
+
+ // record only the number of blocks ended in this plane,
+ // any spill will be recorded in the next plane.
+ if (eob_run > num_coeffs - coeff_i) {
+ dct_tokens[j++] = TOKEN_EOB(num_coeffs - coeff_i);
+ blocks_ended += num_coeffs - coeff_i;
+ eob_run -= num_coeffs - coeff_i;
+ coeff_i = num_coeffs;