#include "dsputil.h"
#include "get_bits.h"
#include "bytestream.h"
+#include "internal.h"
#include "golomb.h"
#include "dirac_arith.h"
#include "mpeg12data.h"
s->blmotion = av_malloc(sbwidth * sbheight * 16 * sizeof(*s->blmotion));
s->edge_emu_buffer_base = av_malloc((w+64)*MAX_BLOCKSIZE);
- s->mctmp = av_malloc((w+64+MAX_BLOCKSIZE) * (h*MAX_BLOCKSIZE) * sizeof(*s->mctmp));
+ s->mctmp = av_malloc((w+64+MAX_BLOCKSIZE) * (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
s->mcscratch = av_malloc((w+64)*MAX_BLOCKSIZE);
- if (!s->sbsplit || !s->blmotion)
+ if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch)
return AVERROR(ENOMEM);
return 0;
}
}
/* fixme: v/h _edge_pos */
- if ((unsigned)x > FFMAX(p->width +EDGE_WIDTH/2 - p->xblen, 0) ||
- (unsigned)y > FFMAX(p->height+EDGE_WIDTH/2 - p->yblen, 0)) {
+ if (x + p->xblen > p->width +EDGE_WIDTH/2 ||
+ y + p->yblen > p->height+EDGE_WIDTH/2 ||
+ x < 0 || y < 0) {
for (i = 0; i < nplanes; i++) {
ff_emulated_edge_mc(s->edge_emu_buffer[i], src[i], p->stride,
p->xblen, p->yblen, x, y,
for (j = 0; j < MAX_FRAMES; j++)
if (!s->all_frames[j].avframe.data[0]) {
s->ref_pics[i] = &s->all_frames[j];
- s->avctx->get_buffer(s->avctx, &s->ref_pics[i]->avframe);
+ ff_get_buffer(s->avctx, &s->ref_pics[i]->avframe);
break;
}
}
return 0;
}
-static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *data_size)
+static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
{
DiracFrame *out = s->delay_frames[0];
int i, out_idx = 0;
if (out) {
out->avframe.reference ^= DELAYED_PIC_REF;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)picture = out->avframe;
}
pic->avframe.key_frame = s->num_refs == 0; /* [DIRAC_STD] is_intra() */
pic->avframe.pict_type = s->num_refs + 1; /* Definition of AVPictureType in avutil.h */
- if (avctx->get_buffer(avctx, &pic->avframe) < 0) {
+ if (ff_get_buffer(avctx, &pic->avframe) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
return 0;
}
-static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt)
+static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
{
DiracContext *s = avctx->priv_data;
DiracFrame *picture = data;
}
s->current_picture = NULL;
- *data_size = 0;
+ *got_frame = 0;
/* end of stream, so flush delayed pics */
if (buf_size == 0)
- return get_delayed_pic(s, (AVFrame *)data, data_size);
+ return get_delayed_pic(s, (AVFrame *)data, got_frame);
for (;;) {
/*[DIRAC_STD] Here starts the code from parse_info() defined in 9.6
if (delayed_frame) {
delayed_frame->avframe.reference ^= DELAYED_PIC_REF;
*(AVFrame*)data = delayed_frame->avframe;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
}
} else if (s->current_picture->avframe.display_picture_number == s->frame_number) {
/* The right frame at the right time :-) */
*(AVFrame*)data = s->current_picture->avframe;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
}
- if (*data_size)
+ if (*got_frame)
s->frame_number = picture->avframe.display_picture_number + 1;
return buf_idx;