Revision 15675ce6 libavcodec/vp3.c

View differences:

libavcodec/vp3.c
53 53
//FIXME split things out into their own arrays
54 54
typedef struct Vp3Fragment {
55 55
    Coeff *next_coeff;
56
    /* this is the macroblock that the fragment belongs to */
57
    uint16_t macroblock;
58 56
    uint8_t coding_method;
59 57
    int8_t motion_x;
60 58
    int8_t motion_y;
......
346 344
        }
347 345
    }
348 346

  
349
    /* initialize the macroblock <-> fragment mapping */
350
    current_fragment = 0;
351
    current_macroblock = 0;
352
    for (i = 0; i < s->fragment_height; i += 2) {
353

  
354
        for (j = 0; j < s->fragment_width; j += 2) {
355

  
356
            s->all_fragments[current_fragment].macroblock = current_macroblock;
357

  
358
            if (j + 1 < s->fragment_width) {
359
                s->all_fragments[current_fragment + 1].macroblock = current_macroblock;
360
            }
361

  
362
            if (i + 1 < s->fragment_height) {
363
                s->all_fragments[current_fragment + s->fragment_width].macroblock =
364
                    current_macroblock;
365
            }
366

  
367
            if ((j + 1 < s->fragment_width) && (i + 1 < s->fragment_height)) {
368
                s->all_fragments[current_fragment + s->fragment_width + 1].macroblock =
369
                    current_macroblock;
370
            }
371

  
372
            /* C planes */
373
            c_fragment = s->fragment_start[1] +
374
                (i * s->fragment_width / 4) + (j / 2);
375
            s->all_fragments[c_fragment].macroblock = s->macroblock_count;
376

  
377
            c_fragment = s->fragment_start[2] +
378
                (i * s->fragment_width / 4) + (j / 2);
379
            s->all_fragments[c_fragment].macroblock = s->macroblock_count;
380

  
381
            if (j + 2 <= s->fragment_width)
382
                current_fragment += 2;
383
            else
384
                current_fragment++;
385
            current_macroblock++;
386
        }
387

  
388
        current_fragment += s->fragment_width;
389
    }
390

  
391 347
    return 0;  /* successful path out */
392 348
}
393 349

  
......
623 579
                            first_c_fragment_seen = 1;
624 580
                        }
625 581
                        s->coded_fragment_list_index++;
626
                        s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV;
627 582
                    } else {
628 583
                        /* not coded; copy this fragment from the prior frame */
629 584
                        s->all_fragments[current_fragment].coding_method =
......
647 602
                        first_c_fragment_seen = 1;
648 603
                    }
649 604
                    s->coded_fragment_list_index++;
650
                    s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV;
651 605
                }
652 606
            }
653 607
        }
......
720 674
            for (j = 0; j < 4; j++) {
721 675
                int mb_x = 2*sb_x +   (j>>1);
722 676
                int mb_y = 2*sb_y + (((j>>1)+j)&1);
677
                int frags_coded = 0;
723 678
                current_macroblock = mb_y * s->macroblock_width + mb_x;
724 679

  
725
                if (mb_x >= s->macroblock_width || mb_y >= s->macroblock_height ||
726
                    (s->macroblock_coding[current_macroblock] == MODE_COPY))
680
                if (mb_x >= s->macroblock_width || mb_y >= s->macroblock_height)
727 681
                    continue;
728 682

  
729 683
#define BLOCK_X (2*mb_x + (k&1))
730 684
#define BLOCK_Y (2*mb_y + (k>>1))
685
                /* coding modes are only stored if the macroblock has at least one
686
                 * luma block coded, otherwise it must be INTER_NO_MV */
687
                for (k = 0; k < 4; k++) {
688
                    current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X;
689
                    if (s->all_fragments[current_fragment].coding_method != MODE_COPY)
690
                        break;
691
                }
692
                if (k == 4) {
693
                    s->macroblock_coding[current_macroblock] = MODE_INTER_NO_MV;
694
                    continue;
695
                }
731 696

  
732 697
                /* mode 7 means get 3 bits for each coding mode */
733 698
                if (scheme == 7)

Also available in: Unified diff