Revision 713f4904

View differences:

libavcodec/vc1dec.c
187 187
    }
188 188
}
189 189

  
190
/** Put block onto picture
191
 */
192
static void vc1_put_block(VC1Context *v, DCTELEM block[6][64])
193
{
194
    uint8_t *Y;
195
    int ys, us, vs;
196
    DSPContext *dsp = &v->s.dsp;
197

  
198
    if(v->rangeredfrm) {
199
        int i, j, k;
200
        for(k = 0; k < 6; k++)
201
            for(j = 0; j < 8; j++)
202
                for(i = 0; i < 8; i++)
203
                    block[k][i + j*8] = (block[k][i + j*8] - 64) << 1;
204

  
205
    }
206
    ys = v->s.current_picture.linesize[0];
207
    us = v->s.current_picture.linesize[1];
208
    vs = v->s.current_picture.linesize[2];
209
    Y = v->s.dest[0];
210

  
211
    dsp->put_pixels_clamped(block[0], Y, ys);
212
    dsp->put_pixels_clamped(block[1], Y + 8, ys);
213
    Y += ys * 8;
214
    dsp->put_pixels_clamped(block[2], Y, ys);
215
    dsp->put_pixels_clamped(block[3], Y + 8, ys);
216

  
217
    if(!(v->s.flags & CODEC_FLAG_GRAY)) {
218
        dsp->put_pixels_clamped(block[4], v->s.dest[1], us);
219
        dsp->put_pixels_clamped(block[5], v->s.dest[2], vs);
220
    }
221
}
222

  
223 190
/** Do motion compensation over 1 macroblock
224 191
 * Mostly adapted hpel_motion and qpel_motion from mpegvideo.c
225 192
 */
......
2627 2594
        s->mb_x = 0;
2628 2595
        ff_init_block_index(s);
2629 2596
        for(; s->mb_x < s->mb_width; s->mb_x++) {
2597
            uint8_t *dst[6];
2630 2598
            ff_update_block_index(s);
2599
            dst[0] = s->dest[0];
2600
            dst[1] = dst[0] + 8;
2601
            dst[2] = s->dest[0] + s->linesize * 8;
2602
            dst[3] = dst[2] + 8;
2603
            dst[4] = s->dest[1];
2604
            dst[5] = s->dest[2];
2631 2605
            s->dsp.clear_blocks(s->block[0]);
2632 2606
            mb_pos = s->mb_x + s->mb_y * s->mb_width;
2633 2607
            s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
......
2651 2625

  
2652 2626
                vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2);
2653 2627

  
2628
                if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue;
2654 2629
                v->vc1dsp.vc1_inv_trans_8x8(s->block[k]);
2655 2630
                if(v->pq >= 9 && v->overlap) {
2656
                    for(j = 0; j < 64; j++) s->block[k][j] += 128;
2631
                    if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] <<= 1;
2632
                    s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize);
2633
                } else {
2634
                    if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] = (s->block[k][j] - 64) << 1;
2635
                    s->dsp.put_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize);
2657 2636
                }
2658 2637
            }
2659 2638

  
2660
            vc1_put_block(v, s->block);
2661 2639
            if(v->pq >= 9 && v->overlap) {
2662 2640
                if(s->mb_x) {
2663 2641
                    v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize);

Also available in: Unified diff