Revision 57783884

View differences:

libavcodec/vp3.c
158 158
    int macroblock_height;
159 159

  
160 160
    int fragment_count;
161
    int fragment_width;
162
    int fragment_height;
161
    int fragment_width[2];
162
    int fragment_height[2];
163 163

  
164 164
    Vp3Fragment *all_fragments;
165 165
    int fragment_start[3];
......
266 266
    for (plane = 0; plane < 3; plane++) {
267 267
        int sb_width    = plane ? s->c_superblock_width  : s->y_superblock_width;
268 268
        int sb_height   = plane ? s->c_superblock_height : s->y_superblock_height;
269
        int frag_width  = s->fragment_width  >> !!plane;
270
        int frag_height = s->fragment_height >> !!plane;
269
        int frag_width  = s->fragment_width[!!plane];
270
        int frag_height = s->fragment_height[!!plane];
271 271

  
272 272
        for (sb_y = 0; sb_y < sb_height; sb_y++)
273 273
            for (sb_x = 0; sb_x < sb_width; sb_x++)
......
559 559
                /* coding modes are only stored if the macroblock has at least one
560 560
                 * luma block coded, otherwise it must be INTER_NO_MV */
561 561
                for (k = 0; k < 4; k++) {
562
                    current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X;
562
                    current_fragment = BLOCK_Y*s->fragment_width[0] + BLOCK_X;
563 563
                    if (s->all_fragments[current_fragment].coding_method != MODE_COPY)
564 564
                        break;
565 565
                }
......
578 578
                s->macroblock_coding[current_macroblock] = coding_mode;
579 579
                for (k = 0; k < 4; k++) {
580 580
                    current_fragment =
581
                        BLOCK_Y*s->fragment_width + BLOCK_X;
581
                        BLOCK_Y*s->fragment_width[0] + BLOCK_X;
582 582
                    if (s->all_fragments[current_fragment].coding_method !=
583 583
                        MODE_COPY)
584 584
                        s->all_fragments[current_fragment].coding_method =
......
586 586
                }
587 587
                for (k = 0; k < 2; k++) {
588 588
                    current_fragment = s->fragment_start[k+1] +
589
                        mb_y*(s->fragment_width>>1) + mb_x;
589
                        mb_y*s->fragment_width[1] + mb_x;
590 590
                    if (s->all_fragments[current_fragment].coding_method !=
591 591
                        MODE_COPY)
592 592
                        s->all_fragments[current_fragment].coding_method =
......
668 668
                /* fetch 4 vectors from the bitstream, one for each
669 669
                 * Y fragment, then average for the C fragment vectors */
670 670
                for (k = 0; k < 4; k++) {
671
                    current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X;
671
                    current_fragment = BLOCK_Y*s->fragment_width[0] + BLOCK_X;
672 672
                    if (s->all_fragments[current_fragment].coding_method != MODE_COPY) {
673 673
                        if (coding_mode == 0) {
674 674
                            motion_x[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
......
720 720
            /* assign the motion vectors to the correct fragments */
721 721
            for (k = 0; k < 4; k++) {
722 722
                current_fragment =
723
                    BLOCK_Y*s->fragment_width + BLOCK_X;
723
                    BLOCK_Y*s->fragment_width[0] + BLOCK_X;
724 724
                if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
725 725
                    s->all_fragments[current_fragment].motion_x = motion_x[k];
726 726
                    s->all_fragments[current_fragment].motion_y = motion_y[k];
......
735 735
                }
736 736
            for (k = 0; k < 2; k++) {
737 737
                current_fragment = s->fragment_start[k+1] +
738
                    mb_y*(s->fragment_width>>1) + mb_x;
738
                    mb_y*s->fragment_width[1] + mb_x;
739 739
                    s->all_fragments[current_fragment].motion_x = motion_x[0];
740 740
                    s->all_fragments[current_fragment].motion_y = motion_y[0];
741 741
            }
......
941 941
        0, residual_eob_run);
942 942

  
943 943
    /* reverse prediction of the Y-plane DC coefficients */
944
    reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height);
944
    reverse_dc_prediction(s, 0, s->fragment_width[0], s->fragment_height[0]);
945 945

  
946 946
    /* unpack the C plane DC coefficients */
947 947
    residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0,
......
953 953
    if (!(s->avctx->flags & CODEC_FLAG_GRAY))
954 954
    {
955 955
        reverse_dc_prediction(s, s->fragment_start[1],
956
            s->fragment_width / 2, s->fragment_height / 2);
956
            s->fragment_width[1], s->fragment_height[1]);
957 957
        reverse_dc_prediction(s, s->fragment_start[2],
958
            s->fragment_width / 2, s->fragment_height / 2);
958
            s->fragment_width[1], s->fragment_height[1]);
959 959
    }
960 960

  
961 961
    /* fetch the AC table indexes */
......
1158 1158
    int x, y;
1159 1159
    int *bounding_values= s->bounding_values_array+127;
1160 1160

  
1161
    int width           = s->fragment_width  >> !!plane;
1162
    int height          = s->fragment_height >> !!plane;
1161
    int width           = s->fragment_width[!!plane];
1162
    int height          = s->fragment_height[!!plane];
1163 1163
    int fragment        = s->fragment_start        [plane] + ystart * width;
1164 1164
    int stride          = s->current_frame.linesize[plane];
1165 1165
    uint8_t *plane_data = s->current_frame.data    [plane];
......
1316 1316
        int slice_height      = sb_y + (plane ? 1 : 2);
1317 1317
        int slice_width       = plane ? s->c_superblock_width : s->y_superblock_width;
1318 1318

  
1319
        int fragment_width    = s->fragment_width  >> !!plane;
1320
        int fragment_height   = s->fragment_height >> !!plane;
1319
        int fragment_width    = s->fragment_width[!!plane];
1320
        int fragment_height   = s->fragment_height[!!plane];
1321 1321
        int fragment_start    = s->fragment_start[plane];
1322 1322

  
1323 1323
        if (!s->flipped_image) stride = -stride;
......
1510 1510
    s->macroblock_height = (s->height + 15) / 16;
1511 1511
    s->macroblock_count = s->macroblock_width * s->macroblock_height;
1512 1512

  
1513
    s->fragment_width = s->width / FRAGMENT_PIXELS;
1514
    s->fragment_height = s->height / FRAGMENT_PIXELS;
1513
    s->fragment_width[0] = s->width / FRAGMENT_PIXELS;
1514
    s->fragment_height[0] = s->height / FRAGMENT_PIXELS;
1515
    s->fragment_width[1]  = s->fragment_width[0]  >> 1;
1516
    s->fragment_height[1] = s->fragment_height[0] >> 1;
1515 1517

  
1516 1518
    /* fragment count covers all 8x8 blocks for all 3 planes */
1517
    s->fragment_count = s->fragment_width * s->fragment_height * 3 / 2;
1518
    s->fragment_start[1] = s->fragment_width * s->fragment_height;
1519
    s->fragment_start[2] = s->fragment_width * s->fragment_height * 5 / 4;
1519
    s->fragment_count = s->fragment_width[0] * s->fragment_height[0] * 3 / 2;
1520
    s->fragment_start[1] = s->fragment_width[0] * s->fragment_height[0];
1521
    s->fragment_start[2] = s->fragment_width[0] * s->fragment_height[0] * 5 / 4;
1520 1522

  
1521 1523
    s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
1522 1524
    s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int));

Also available in: Unified diff