mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-04 19:48:19 +00:00
kmvc: use fixed sized arrays in the context
Avoid some boilerplate code to dynamically allocate and then free the
buffers.
(cherry picked from commit 8f68977054
)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Conflicts:
libavcodec/kmvc.c
This commit is contained in:
parent
c9d8424395
commit
e22a5d490d
@ -46,7 +46,7 @@ typedef struct KmvcContext {
|
|||||||
int palsize;
|
int palsize;
|
||||||
uint32_t pal[MAX_PALSIZE];
|
uint32_t pal[MAX_PALSIZE];
|
||||||
uint8_t *cur, *prev;
|
uint8_t *cur, *prev;
|
||||||
uint8_t *frm0, *frm1;
|
uint8_t frm0[320 * 200], frm1[320 * 200];
|
||||||
GetByteContext g;
|
GetByteContext g;
|
||||||
} KmvcContext;
|
} KmvcContext;
|
||||||
|
|
||||||
@ -367,8 +367,6 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->frm0 = av_mallocz(320 * 200);
|
|
||||||
c->frm1 = av_mallocz(320 * 200);
|
|
||||||
c->cur = c->frm0;
|
c->cur = c->frm0;
|
||||||
c->prev = c->frm1;
|
c->prev = c->frm1;
|
||||||
|
|
||||||
@ -401,30 +399,12 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
|||||||
return 0;
|
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 = {
|
AVCodec ff_kmvc_decoder = {
|
||||||
.name = "kmvc",
|
.name = "kmvc",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.id = CODEC_ID_KMVC,
|
.id = CODEC_ID_KMVC,
|
||||||
.priv_data_size = sizeof(KmvcContext),
|
.priv_data_size = sizeof(KmvcContext),
|
||||||
.init = decode_init,
|
.init = decode_init,
|
||||||
.close = decode_end,
|
|
||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
|
.long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
|
||||||
|
Loading…
Reference in New Issue
Block a user