Revision 2a0dbb1e

View differences:

libavcodec/cinepak.c
57 57
    AVCodecContext *avctx;
58 58
    DSPContext dsp;
59 59
    AVFrame frame;
60
    AVFrame prev_frame;
61 60

  
62 61
    unsigned char *data;
63 62
    int size;
......
125 124
    uint8_t         *eod = (data + size);
126 125
    uint32_t         flag, mask;
127 126
    cvid_codebook_t *codebook;
128
    unsigned int     i, j, x, y;
127
    unsigned int     x, y;
129 128
    uint32_t         iy[4];
130 129
    uint32_t         iu[2];
131 130
    uint32_t         iv[2];
......
250 249
                    }
251 250

  
252 251
                }
253
            } else {
254
                /* copy from the previous frame */
255
                for (i = 0; i < 4; i++) {
256
                    for (j = 0; j < 4; j++) {
257
                        s->frame.data[0][iy[i] + j] =
258
                            s->prev_frame.data[0][iy[i] + j];
259
                    }
260
                }
261
                for (i = 0; i < 2; i++) {
262
                    for (j = 0; j < 2; j++) {
263
                        s->frame.data[1][iu[i] + j] =
264
                            s->prev_frame.data[1][iu[i] + j];
265
                        s->frame.data[2][iv[i] + j] =
266
                            s->prev_frame.data[2][iv[i] + j];
267
                    }
268
                }
269 252
            }
270 253

  
271 254
            iy[0] += 4;  iy[1] += 4;
......
397 380
    avctx->has_b_frames = 0;
398 381
    dsputil_init(&s->dsp, avctx);
399 382

  
400
    s->frame.data[0] = s->prev_frame.data[0] = NULL;
383
    s->frame.data[0] = NULL;
401 384

  
402 385
    return 0;
403 386
}
......
411 394
    s->data = buf;
412 395
    s->size = buf_size;
413 396

  
414
    if (avctx->get_buffer(avctx, &s->frame)) {
415
        av_log(avctx, AV_LOG_ERROR, "  Cinepak: get_buffer() failed\n");
397
    s->frame.reference = 1;
398
    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
399
                            FF_BUFFER_HINTS_REUSABLE;
400
    if (avctx->reget_buffer(avctx, &s->frame)) {
401
        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
416 402
        return -1;
417 403
    }
418 404

  
419 405
    cinepak_decode(s);
420 406

  
421
    if (s->prev_frame.data[0])
422
        avctx->release_buffer(avctx, &s->prev_frame);
423

  
424
    /* shuffle frames */
425
    s->prev_frame = s->frame;
426

  
427 407
    *data_size = sizeof(AVFrame);
428 408
    *(AVFrame*)data = s->frame;
429 409

  
......
435 415
{
436 416
    CinepakContext *s = (CinepakContext *)avctx->priv_data;
437 417

  
438
    if (s->prev_frame.data[0])
439
        avctx->release_buffer(avctx, &s->prev_frame);
418
    if (s->frame.data[0])
419
        avctx->release_buffer(avctx, &s->frame);
440 420

  
441 421
    return 0;
442 422
}

Also available in: Unified diff