Avoid some boilerplate code to dynamically allocate and then free the
buffers.
(cherry picked from commit 8f689770548c86151071ef976cf9b6998ba21c2a)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Conflicts:
libavcodec/kmvc.c
... | ... |
@@ -46,7 +46,7 @@ typedef struct KmvcContext { |
46 | 46 |
int palsize; |
47 | 47 |
uint32_t pal[MAX_PALSIZE]; |
48 | 48 |
uint8_t *cur, *prev; |
49 |
- uint8_t *frm0, *frm1; |
|
49 |
+ uint8_t frm0[320 * 200], frm1[320 * 200]; |
|
50 | 50 |
GetByteContext g; |
51 | 51 |
} KmvcContext; |
52 | 52 |
|
... | ... |
@@ -367,8 +367,6 @@ static av_cold int decode_init(AVCodecContext * avctx) |
367 | 367 |
return -1; |
368 | 368 |
} |
369 | 369 |
|
370 |
- c->frm0 = av_mallocz(320 * 200); |
|
371 |
- c->frm1 = av_mallocz(320 * 200); |
|
372 | 370 |
c->cur = c->frm0; |
373 | 371 |
c->prev = c->frm1; |
374 | 372 |
|
... | ... |
@@ -401,30 +399,12 @@ static av_cold int decode_init(AVCodecContext * avctx) |
401 | 401 |
return 0; |
402 | 402 |
} |
403 | 403 |
|
404 |
- |
|
405 |
- |
|
406 |
-/* |
|
407 |
- * Uninit kmvc decoder |
|
408 |
- */ |
|
409 |
-static av_cold int decode_end(AVCodecContext * avctx) |
|
410 |
-{ |
|
411 |
- KmvcContext *const c = avctx->priv_data; |
|
412 |
- |
|
413 |
- av_freep(&c->frm0); |
|
414 |
- av_freep(&c->frm1); |
|
415 |
- if (c->pic.data[0]) |
|
416 |
- avctx->release_buffer(avctx, &c->pic); |
|
417 |
- |
|
418 |
- return 0; |
|
419 |
-} |
|
420 |
- |
|
421 | 404 |
AVCodec ff_kmvc_decoder = { |
422 | 405 |
.name = "kmvc", |
423 | 406 |
.type = AVMEDIA_TYPE_VIDEO, |
424 | 407 |
.id = CODEC_ID_KMVC, |
425 | 408 |
.priv_data_size = sizeof(KmvcContext), |
426 | 409 |
.init = decode_init, |
427 |
- .close = decode_end, |
|
428 | 410 |
.decode = decode_frame, |
429 | 411 |
.capabilities = CODEC_CAP_DR1, |
430 | 412 |
.long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"), |