Commit 371e1654 authored by Reimar Döffinger's avatar Reimar Döffinger

Try to set AVFrame.reference to correct values.

I am not sure these new values are correct, not am I sure
the semantics are a good idea since we do not seem to make any
use of them but they caused a lot of confusion, but this
seems to make things closer to matching the documentation.
Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent fb228883
......@@ -821,7 +821,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
p->reference= 1;
p->reference= 3;
if (avctx->reget_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
......@@ -841,7 +841,7 @@ static int decode_frame(AVCodecContext *avctx,
}
}else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
if(!f->last_picture.data[0]){
f->last_picture.reference= 1;
f->last_picture.reference= 3;
if(avctx->get_buffer(avctx, &f->last_picture) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
......
......@@ -65,7 +65,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
AascContext *s = avctx->priv_data;
int compr, i, stride;
s->frame.reference = 1;
s->frame.reference = 3;
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");
......
......@@ -45,7 +45,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return -1;
avcodec_get_frame_defaults(&s->frame);
s->frame.reference = 1;
s->frame.reference = 3;
buf = avctx->extradata + 16*8;
for (i = 0; i < 256; i++)
......
......@@ -63,7 +63,7 @@ avs_decode_frame(AVCodecContext * avctx,
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
p->reference = 1;
p->reference = 3;
p->pict_type = AV_PICTURE_TYPE_P;
p->key_frame = 0;
......
......@@ -40,7 +40,7 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
{
BethsoftvidContext *vid = avctx->priv_data;
avcodec_get_frame_defaults(&vid->frame);
vid->frame.reference = 1;
vid->frame.reference = 3;
vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
avctx->pix_fmt = PIX_FMT_PAL8;
......
......@@ -61,7 +61,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
if (bfi->frame.data[0])
avctx->release_buffer(avctx, &bfi->frame);
bfi->frame.reference = 1;
bfi->frame.reference = 3;
if (avctx->get_buffer(avctx, &bfi->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -130,7 +130,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
c93->currentpic ^= 1;
newpic->reference = 1;
newpic->reference = 3;
newpic->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
if (avctx->reget_buffer(avctx, newpic)) {
......
......@@ -427,7 +427,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
s->data = buf;
s->size = buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame)) {
......
......@@ -149,7 +149,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->get_buffer(avctx, &c->pic) < 0) {
......
......@@ -175,7 +175,7 @@ static int cmv_decode_frame(AVCodecContext *avctx,
FFSWAP(AVFrame, s->last_frame, s->last2_frame);
FFSWAP(AVFrame, s->frame, s->last_frame);
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
if (avctx->get_buffer(avctx, &s->frame)<0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -277,7 +277,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &t->last_frame);
}
t->frame.reference = 1;
t->frame.reference = 3;
if (!t->frame.data[0]) {
if (avctx->get_buffer(avctx, &t->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -289,7 +289,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
/* shuffle */
FFSWAP(AVFrame, s->frame, s->last_frame);
if (!s->frame.data[0]) {
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
s->frame.linesize[0] = s->width;
......
......@@ -160,7 +160,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
unsigned char *pixels;
unsigned int pixel_limit;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......@@ -478,7 +478,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
int pixel;
unsigned int pixel_limit;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......
......@@ -172,7 +172,7 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
}
f->reference = 1;
f->reference = 3;
f->buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
......@@ -215,7 +215,7 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
}
f->reference = 1;
f->reference = 3;
f->buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
......@@ -243,7 +243,7 @@ static int decode_frame(AVCodecContext *avctx,
*/
avctx->pix_fmt = PIX_FMT_YUVJ420P;
planes = 3;
f->reference = 1;
f->reference = 3;
f->buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
......@@ -288,7 +288,7 @@ static int decode_frame(AVCodecContext *avctx,
/* Virtually the same as version 4, but is for RGB24 */
avctx->pix_fmt = PIX_FMT_BGR24;
planes = 3;
f->reference = 1;
f->reference = 3;
f->buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
......
......@@ -302,7 +302,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if ((err = extract_header(avctx, NULL)) < 0)
return err;
s->frame.reference = 1;
s->frame.reference = 3;
return 0;
}
......
......@@ -146,7 +146,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
AVFrame * const p= (AVFrame*)&s->picture;
int start;
p->reference = 1;
p->reference = 3;
p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, p)) {
av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......
......@@ -238,7 +238,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
if (ctx->pic.data[0])
avctx->release_buffer(avctx, &ctx->pic);
ctx->pic.reference = 1;
ctx->pic.reference = 3;
ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
if (avctx->get_buffer(avctx, &ctx->pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -351,7 +351,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
return -1;
}
ctx->buf_ptrs[ctx->cur_index].reference = 1;
ctx->buf_ptrs[ctx->cur_index].reference = 3;
ctx->buf_ptrs[ctx->cur_index].pict_type = is_pframe ? AV_PICTURE_TYPE_P:AV_PICTURE_TYPE_I;
if(ff_thread_get_buffer(avctx, &ctx->buf_ptrs[ctx->cur_index])) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -59,7 +59,7 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&s->frame);
s->frame.reference = 1;
s->frame.reference = 3;
return 0;
}
......
......@@ -241,7 +241,7 @@ static int mp_decode_frame(AVCodecContext *avctx,
GetBitContext gb;
int i, count1, count2, sz;
mp->frame.reference = 1;
mp->frame.reference = 3;
mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &mp->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......
......@@ -86,7 +86,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
s->buf = buf;
s->size = buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
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");
......
......@@ -296,7 +296,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
s->buf = buf;
s->size = buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
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(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......
......@@ -506,7 +506,7 @@ static int decode_frame(AVCodecContext *avctx,
if(p->data[0])
avctx->release_buffer(avctx, p);
p->reference= 1;
p->reference= 3;
if(avctx->get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto fail;
......
......@@ -442,7 +442,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
s->buf = buf;
s->size = buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
if (avctx->reget_buffer(avctx, &s->frame)) {
......
......@@ -250,7 +250,7 @@ static int rpza_decode_frame(AVCodecContext *avctx,
s->buf = buf;
s->size = buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
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");
......
......@@ -367,7 +367,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(buf_size <= 769)
return 0;
smk->pic.reference = 1;
smk->pic.reference = 3;
smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if(avctx->reget_buffer(avctx, &smk->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -443,7 +443,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
s->buf = buf;
s->size = buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
if (avctx->reget_buffer(avctx, &s->frame)) {
......
......@@ -1701,7 +1701,7 @@ static int frame_start(SnowContext *s){
}
}
s->current_picture.reference= 1;
s->current_picture.reference= 3;
if(s->avctx->get_buffer(s->avctx, &s->current_picture) < 0){
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
......
......@@ -231,7 +231,7 @@ static int seqvideo_decode_frame(AVCodecContext *avctx,
SeqVideoContext *seq = avctx->priv_data;
seq->frame.reference = 1;
seq->frame.reference = 3;
seq->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &seq->frame)) {
av_log(seq->avctx, AV_LOG_ERROR, "tiertexseqvideo: reget_buffer() failed\n");
......
......@@ -859,7 +859,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
if (truemotion1_decode_header(s) == -1)
return -1;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
......
......@@ -767,7 +767,7 @@ static int decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
return -1;
}
p->reference = 1;
p->reference = 3;
p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if(avctx->reget_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -81,7 +81,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
if(avctx->get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -225,7 +225,7 @@ static int ulti_decode_frame(AVCodecContext *avctx,
int skip;
int tmp;
s->frame.reference = 1;
s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......
......@@ -297,7 +297,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
......@@ -205,7 +205,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.reference = 3;
if(avctx->get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
......
......@@ -421,7 +421,7 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx,
if (buf_size < 16)
return buf_size;
s->frame.reference = 1;
s->frame.reference = 3;
if (avctx->get_buffer(avctx, &s->frame)) {
av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
return -1;
......
......@@ -293,7 +293,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
const uint8_t *src = buf;
int dx, dy, w, h, depth, enc, chunks, res, size_left;
c->pic.reference = 1;
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if(avctx->reget_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
......
......@@ -529,7 +529,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
if (!is_alpha) {
p->reference = 1;
p->reference = 3;
if (avctx->get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
......
......@@ -378,7 +378,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
int ftype;
int ret;
s->pic.reference = 1;
s->pic.reference = 3;
s->pic.buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
......
......@@ -404,7 +404,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
if(avctx->get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment