Revision 704a2881

View differences:

libavcodec/vp5.c
41 41
    int rows, cols;
42 42

  
43 43
    vp56_init_range_decoder(&s->c, buf, buf_size);
44
    s->frames[VP56_FRAME_CURRENT].key_frame = !vp56_rac_get(c);
44
    s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);
45 45
    vp56_rac_get(c);
46 46
    vp56_init_dequant(s, vp56_rac_gets(c, 6));
47
    if (s->frames[VP56_FRAME_CURRENT].key_frame)
47
    if (s->framep[VP56_FRAME_CURRENT]->key_frame)
48 48
    {
49 49
        vp56_rac_gets(c, 8);
50 50
        if(vp56_rac_gets(c, 5) > 5)
......
145 145
            if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) {
146 146
                def_prob[node] = vp56_rac_gets_nn(c, 7);
147 147
                s->coeff_model_dccv[pt][node] = def_prob[node];
148
            } else if (s->frames[VP56_FRAME_CURRENT].key_frame) {
148
            } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
149 149
                s->coeff_model_dccv[pt][node] = def_prob[node];
150 150
            }
151 151

  
......
156 156
                    if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) {
157 157
                        def_prob[node] = vp56_rac_gets_nn(c, 7);
158 158
                        s->coeff_model_ract[pt][ct][cg][node] = def_prob[node];
159
                    } else if (s->frames[VP56_FRAME_CURRENT].key_frame) {
159
                    } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
160 160
                        s->coeff_model_ract[pt][ct][cg][node] = def_prob[node];
161 161
                    }
162 162

  
libavcodec/vp56.c
326 326
                    int stride, int x, int y)
327 327
{
328 328
    int plane = vp56_b6to3[b];
329
    uint8_t *dst= s->frames[VP56_FRAME_CURRENT].data[plane]+s->block_offset[b];
329
    uint8_t *dst=s->framep[VP56_FRAME_CURRENT]->data[plane]+s->block_offset[b];
330 330
    uint8_t *src_block;
331 331
    int src_offset;
332 332
    int overlap_offset = 0;
......
337 337

  
338 338
    if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
339 339
        (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY
340
         && !s->frames[VP56_FRAME_CURRENT].key_frame))
340
         && !s->framep[VP56_FRAME_CURRENT]->key_frame))
341 341
        deblock_filtering = 0;
342 342

  
343 343
    dx = s->mv[b].x / s->vp56_coord_div[b];
......
400 400
    vp56_frame_t ref_frame;
401 401
    int b, plan, off;
402 402

  
403
    if (s->frames[VP56_FRAME_CURRENT].key_frame)
403
    if (s->framep[VP56_FRAME_CURRENT]->key_frame)
404 404
        mb_type = VP56_MB_INTRA;
405 405
    else
406 406
        mb_type = vp56_decode_mv(s, row, col);
......
412 412

  
413 413
    vp56_add_predictors_dc(s, ref_frame);
414 414

  
415
    frame_current = &s->frames[VP56_FRAME_CURRENT];
416
    frame_ref = &s->frames[ref_frame];
415
    frame_current = s->framep[VP56_FRAME_CURRENT];
416
    frame_ref = s->framep[ref_frame];
417 417

  
418 418
    switch (mb_type) {
419 419
        case VP56_MB_INTRA:
......
459 459

  
460 460
static int vp56_size_changed(AVCodecContext *avctx, vp56_context_t *s)
461 461
{
462
    int stride = s->frames[VP56_FRAME_CURRENT].linesize[0];
462
    int stride = s->framep[VP56_FRAME_CURRENT]->linesize[0];
463 463
    int i;
464 464

  
465 465
    s->plane_width[0] = s->avctx->coded_width;
......
468 468
    s->plane_height[1] = s->plane_height[2] = s->avctx->coded_height/2;
469 469

  
470 470
    for (i=0; i<3; i++)
471
        s->stride[i] = s->flip * s->frames[VP56_FRAME_CURRENT].linesize[i];
471
        s->stride[i] = s->flip * s->framep[VP56_FRAME_CURRENT]->linesize[i];
472 472

  
473 473
    s->mb_width = (s->avctx->coded_width+15) / 16;
474 474
    s->mb_height = (s->avctx->coded_height+15) / 16;
......
495 495
                      uint8_t *buf, int buf_size)
496 496
{
497 497
    vp56_context_t *s = avctx->priv_data;
498
    AVFrame *const p = &s->frames[VP56_FRAME_CURRENT];
498
    AVFrame *const p = s->framep[VP56_FRAME_CURRENT];
499 499
    AVFrame *picture = data;
500 500
    int mb_row, mb_col, mb_row_flip, mb_offset = 0;
501 501
    int block, y, uv, stride_y, stride_uv;
......
594 594
        }
595 595
    }
596 596

  
597
    if (s->frames[VP56_FRAME_PREVIOUS].data[0]
598
        && (s->frames[VP56_FRAME_PREVIOUS].data[0]
599
            != s->frames[VP56_FRAME_GOLDEN].data[0])) {
600
        avctx->release_buffer(avctx, &s->frames[VP56_FRAME_PREVIOUS]);
601
    }
597
    if (s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN])
598
        FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
599
                          s->framep[VP56_FRAME_UNUSED]);
600
    else if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
601
        avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
602 602
    if (p->key_frame || golden_frame) {
603
        if (s->frames[VP56_FRAME_GOLDEN].data[0])
604
            avctx->release_buffer(avctx, &s->frames[VP56_FRAME_GOLDEN]);
605
        s->frames[VP56_FRAME_GOLDEN] = *p;
603
        if (s->framep[VP56_FRAME_GOLDEN]->data[0])
604
            avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
605
        s->framep[VP56_FRAME_GOLDEN] = p;
606 606
    }
607
    s->frames[VP56_FRAME_PREVIOUS] = *p;
607
    FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT],
608
                      s->framep[VP56_FRAME_PREVIOUS]);
608 609

  
609 610
    *picture = *p;
610 611
    *data_size = sizeof(AVPicture);
611 612

  
612
    s->frames[VP56_FRAME_CURRENT].data[0] = NULL;
613 613
    return buf_size;
614 614
}
615 615

  
......
628 628
    avcodec_set_dimensions(s->avctx, 0, 0);
629 629

  
630 630
    for (i=0; i<3; i++)
631
        s->frames[i].data[0] = NULL;
631
        s->framep[i] = &s->frames[i];
632
    s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN];
632 633
    s->edge_emu_buffer_alloc = NULL;
633 634

  
634 635
    s->above_blocks = NULL;
......
656 657
    av_free(s->above_blocks);
657 658
    av_free(s->macroblocks);
658 659
    av_free(s->edge_emu_buffer_alloc);
659
    if (s->frames[VP56_FRAME_GOLDEN].data[0]
660
        && (s->frames[VP56_FRAME_PREVIOUS].data[0]
661
            != s->frames[VP56_FRAME_GOLDEN].data[0]))
662
        avctx->release_buffer(avctx, &s->frames[VP56_FRAME_GOLDEN]);
663
    if (s->frames[VP56_FRAME_PREVIOUS].data[0])
664
        avctx->release_buffer(avctx, &s->frames[VP56_FRAME_PREVIOUS]);
660
    if (s->framep[VP56_FRAME_GOLDEN]->data[0]
661
        && (s->framep[VP56_FRAME_PREVIOUS] != s->framep[VP56_FRAME_GOLDEN]))
662
        avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
663
    if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
664
        avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
665 665
    return 0;
666 666
}
libavcodec/vp56.h
73 73
    DSPContext dsp;
74 74
    ScanTable scantable;
75 75
    AVFrame frames[3];
76
    AVFrame *framep[4];
76 77
    uint8_t *edge_emu_buffer_alloc;
77 78
    uint8_t *edge_emu_buffer;
78 79
    vp56_range_coder_t c;
libavcodec/vp56data.h
30 30
    VP56_FRAME_CURRENT  = 0,
31 31
    VP56_FRAME_PREVIOUS = 1,
32 32
    VP56_FRAME_GOLDEN   = 2,
33
    VP56_FRAME_UNUSED   = 3,
33 34
} vp56_frame_t;
34 35

  
35 36
typedef enum {
libavcodec/vp6.c
50 50
    int res = 1;
51 51
    int separated_coeff = buf[0] & 1;
52 52

  
53
    s->frames[VP56_FRAME_CURRENT].key_frame = !(buf[0] & 0x80);
53
    s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
54 54
    vp56_init_dequant(s, (buf[0] >> 1) & 0x3F);
55 55

  
56
    if (s->frames[VP56_FRAME_CURRENT].key_frame) {
56
    if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
57 57
        sub_version = buf[1] >> 3;
58 58
        if (sub_version > 8)
59 59
            return 0;
......
205 205
            if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) {
206 206
                def_prob[node] = vp56_rac_gets_nn(c, 7);
207 207
                s->coeff_model_dccv[pt][node] = def_prob[node];
208
            } else if (s->frames[VP56_FRAME_CURRENT].key_frame) {
208
            } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
209 209
                s->coeff_model_dccv[pt][node] = def_prob[node];
210 210
            }
211 211

  
......
228 228
                    if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) {
229 229
                        def_prob[node] = vp56_rac_gets_nn(c, 7);
230 230
                        s->coeff_model_ract[pt][ct][cg][node] = def_prob[node];
231
                    } else if (s->frames[VP56_FRAME_CURRENT].key_frame) {
231
                    } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
232 232
                        s->coeff_model_ract[pt][ct][cg][node] = def_prob[node];
233 233
                    }
234 234

  

Also available in: Unified diff