+ }
+ s->num_kf_coded_fragment[plane] = num_coded_frags;
+ } else
+ num_coded_frags = s->num_kf_coded_fragment[plane];
+ } else {
+ for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) {
+ if (get_bits_left(gb) < plane0_num_coded_frags >> 2) {
+ return AVERROR_INVALIDDATA;
+ }
+ /* iterate through all 16 fragments in a superblock */
+ for (j = 0; j < 16; j++) {
+ /* if the fragment is in bounds, check its coding status */
+ current_fragment = s->superblock_fragments[i * 16 + j];
+ if (current_fragment != -1) {
+ int coded = s->superblock_coding[i];
+
+ if (coded == SB_PARTIALLY_CODED) {
+ /* fragment may or may not be coded; this is the case
+ * that cares about the fragment coding runs */
+ if (current_run-- == 0) {
+ bit ^= 1;
+ current_run = get_vlc2(gb, s->fragment_run_length_vlc.table, 5, 2);
+ }
+ coded = bit;
+ }