diff options
author | Roberto Togni <r_togni@tiscali.it> | 2004-05-08 01:34:33 +0400 |
---|---|---|
committer | Roberto Togni <r_togni@tiscali.it> | 2004-05-08 01:34:33 +0400 |
commit | 2a0dbb1efc1f019560ef72406771fd38962c3408 (patch) | |
tree | b95aceb1b6748fa354cfe796b03c23b20e88f790 /libavcodec/cinepak.c | |
parent | 14aa9da3d63fae1088fbf070fe6fa4c89f56d8b8 (diff) |
buffer hints, use reget_buffer, removed copy from previous frame
Originally committed as revision 3117 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cinepak.c')
-rw-r--r-- | libavcodec/cinepak.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 412db7f7e5..da9a8127f7 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -57,7 +57,6 @@ typedef struct CinepakContext { AVCodecContext *avctx; DSPContext dsp; AVFrame frame; - AVFrame prev_frame; unsigned char *data; int size; @@ -125,7 +124,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, uint8_t *eod = (data + size); uint32_t flag, mask; cvid_codebook_t *codebook; - unsigned int i, j, x, y; + unsigned int x, y; uint32_t iy[4]; uint32_t iu[2]; uint32_t iv[2]; @@ -250,22 +249,6 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip_t *strip, } } - } else { - /* copy from the previous frame */ - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - s->frame.data[0][iy[i] + j] = - s->prev_frame.data[0][iy[i] + j]; - } - } - for (i = 0; i < 2; i++) { - for (j = 0; j < 2; j++) { - s->frame.data[1][iu[i] + j] = - s->prev_frame.data[1][iu[i] + j]; - s->frame.data[2][iv[i] + j] = - s->prev_frame.data[2][iv[i] + j]; - } - } } iy[0] += 4; iy[1] += 4; @@ -397,7 +380,7 @@ s->palette_video = 0; avctx->has_b_frames = 0; dsputil_init(&s->dsp, avctx); - s->frame.data[0] = s->prev_frame.data[0] = NULL; + s->frame.data[0] = NULL; return 0; } @@ -411,19 +394,16 @@ static int cinepak_decode_frame(AVCodecContext *avctx, s->data = buf; s->size = buf_size; - if (avctx->get_buffer(avctx, &s->frame)) { - av_log(avctx, AV_LOG_ERROR, " Cinepak: get_buffer() failed\n"); + s->frame.reference = 1; + s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | + FF_BUFFER_HINTS_REUSABLE; + if (avctx->reget_buffer(avctx, &s->frame)) { + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } cinepak_decode(s); - if (s->prev_frame.data[0]) - avctx->release_buffer(avctx, &s->prev_frame); - - /* shuffle frames */ - s->prev_frame = s->frame; - *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; @@ -435,8 +415,8 @@ static int cinepak_decode_end(AVCodecContext *avctx) { CinepakContext *s = (CinepakContext *)avctx->priv_data; - if (s->prev_frame.data[0]) - avctx->release_buffer(avctx, &s->prev_frame); + if (s->frame.data[0]) + avctx->release_buffer(avctx, &s->frame); return 0; } |