aboutsummaryrefslogtreecommitdiff
path: root/gst-libs/ext/libav/libavcodec/kmvc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/ext/libav/libavcodec/kmvc.c')
-rw-r--r--gst-libs/ext/libav/libavcodec/kmvc.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/gst-libs/ext/libav/libavcodec/kmvc.c b/gst-libs/ext/libav/libavcodec/kmvc.c
index a6bb13b..4ed7811 100644
--- a/gst-libs/ext/libav/libavcodec/kmvc.c
+++ b/gst-libs/ext/libav/libavcodec/kmvc.c
@@ -29,6 +29,8 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
+#include "libavutil/common.h"
#define KMVC_KEYFRAME 0x80
#define KMVC_PALETTE 0x40
@@ -46,7 +48,7 @@ typedef struct KmvcContext {
int palsize;
uint32_t pal[MAX_PALSIZE];
uint8_t *cur, *prev;
- uint8_t *frm0, *frm1;
+ uint8_t frm0[320 * 200], frm1[320 * 200];
GetByteContext g;
} KmvcContext;
@@ -55,7 +57,7 @@ typedef struct BitBuf {
int bitbuf;
} BitBuf;
-#define BLK(data, x, y) data[(x) + (y) * 320]
+#define BLK(data, x, y) data[av_clip((x) + (y) * 320, 0, 320 * 200 -1)]
#define kmvc_init_getbits(bb, g) bb.bits = 7; bb.bitbuf = bytestream2_get_byte(g);
@@ -367,8 +369,6 @@ static av_cold int decode_init(AVCodecContext * avctx)
return -1;
}
- c->frm0 = av_mallocz(320 * 200);
- c->frm1 = av_mallocz(320 * 200);
c->cur = c->frm0;
c->prev = c->frm1;
@@ -401,30 +401,12 @@ static av_cold int decode_init(AVCodecContext * avctx)
return 0;
}
-
-
-/*
- * Uninit kmvc decoder
- */
-static av_cold int decode_end(AVCodecContext * avctx)
-{
- KmvcContext *const c = avctx->priv_data;
-
- av_freep(&c->frm0);
- av_freep(&c->frm1);
- if (c->pic.data[0])
- avctx->release_buffer(avctx, &c->pic);
-
- return 0;
-}
-
AVCodec ff_kmvc_decoder = {
.name = "kmvc",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_KMVC,
.priv_data_size = sizeof(KmvcContext),
.init = decode_init,
- .close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),