Revision 704a2881 libavcodec/vp56.c

View differences:

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
}

Also available in: Unified diff