Merge commit 'd6604b29ef544793479d7fb4e05ef6622bb3e534'

* commit 'd6604b29ef544793479d7fb4e05ef6622bb3e534':
  Gather all coded_frame allocations and free functions to a single place

Conflicts:
	libavcodec/a64multienc.c
	libavcodec/asvenc.c
	libavcodec/cljrenc.c
	libavcodec/dpxenc.c
	libavcodec/dvenc.c
	libavcodec/gif.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libopenjpegenc.c
	libavcodec/libtheoraenc.c
	libavcodec/libvpxenc.c
	libavcodec/mpegvideo_enc.c
	libavcodec/nvenc.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/sunrastenc.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/v210enc.c
	libavcodec/v410enc.c
	libavcodec/xbmenc.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
pull/140/head
Michael Niedermayer 9 years ago
commit b1fad7ac20
  1. 16
      libavcodec/aliaspixenc.c
  2. 6
      libavcodec/asvenc.c
  3. 13
      libavcodec/avuienc.c
  4. 11
      libavcodec/bmpenc.c
  5. 6
      libavcodec/dnxhdenc.c
  6. 11
      libavcodec/dvenc.c
  7. 5
      libavcodec/ffv1enc.c
  8. 8
      libavcodec/flashsvenc.c
  9. 7
      libavcodec/gif.c
  10. 5
      libavcodec/huffyuvenc.c
  11. 11
      libavcodec/jpeglsenc.c
  12. 6
      libavcodec/lclenc.c
  13. 8
      libavcodec/libopenjpegenc.c
  14. 6
      libavcodec/libschroedingerenc.c
  15. 4
      libavcodec/libspeexenc.c
  16. 6
      libavcodec/libtheoraenc.c
  17. 2
      libavcodec/libutvideoenc.cpp
  18. 7
      libavcodec/libvpxenc.c
  19. 6
      libavcodec/libx264.c
  20. 8
      libavcodec/libx265.c
  21. 6
      libavcodec/libxavs.c
  22. 4
      libavcodec/libxvid.c
  23. 5
      libavcodec/ljpegenc.c
  24. 3
      libavcodec/mpegvideo_enc.c
  25. 10
      libavcodec/nvenc.c
  26. 11
      libavcodec/pamenc.c
  27. 11
      libavcodec/pcxenc.c
  28. 5
      libavcodec/pngenc.c
  29. 14
      libavcodec/pnmenc.c
  30. 4
      libavcodec/proresenc_anatoliy.c
  31. 5
      libavcodec/proresenc_kostya.c
  32. 6
      libavcodec/qsvenc.c
  33. 8
      libavcodec/qtrleenc.c
  34. 22
      libavcodec/r210enc.c
  35. 11
      libavcodec/rawenc.c
  36. 4
      libavcodec/roqvideoenc.c
  37. 11
      libavcodec/sgienc.c
  38. 6
      libavcodec/snowenc.c
  39. 7
      libavcodec/sunrastenc.c
  40. 4
      libavcodec/svq1enc.c
  41. 11
      libavcodec/targaenc.c
  42. 6
      libavcodec/tiffenc.c
  43. 12
      libavcodec/utils.c
  44. 9
      libavcodec/utvideoenc.c
  45. 12
      libavcodec/v210enc.c
  46. 9
      libavcodec/v308enc.c
  47. 8
      libavcodec/v408enc.c
  48. 15
      libavcodec/v410enc.c
  49. 5
      libavcodec/xfaceenc.c
  50. 8
      libavcodec/y41penc.c
  51. 9
      libavcodec/yuv4enc.c
  52. 8
      libavcodec/zmbvenc.c

@ -27,14 +27,6 @@
#define ALIAS_HEADER_SIZE 10
static av_cold int encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *frame, int *got_packet)
{
@ -114,20 +106,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_alias_pix_encoder = {
.name = "alias_pix",
.long_name = NULL_IF_CONFIG_SMALL("Alias/Wavefront PIX image"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_ALIAS_PIX,
.init = encode_init,
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_BGR24, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
},

@ -363,8 +363,7 @@ AVCodec ff_asv1_encoder = {
.encode2 = encode_frame,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};
#endif
@ -379,7 +378,6 @@ AVCodec ff_asv2_encoder = {
.encode2 = encode_frame,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};
#endif

@ -44,11 +44,6 @@ static av_cold int avui_encode_init(AVCodecContext *avctx)
AV_WB32(avctx->extradata + 48, avctx->height);
memcpy(avctx->extradata + 52, "\0\0\0\x1\0\0\0\x20\0\0\0\x2", 12);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
@ -99,13 +94,6 @@ static int avui_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int avui_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_avui_encoder = {
.name = "avui",
.long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"),
@ -113,7 +101,6 @@ AVCodec ff_avui_encoder = {
.id = AV_CODEC_ID_AVUI,
.init = avui_encode_init,
.encode2 = avui_encode_frame,
.close = avui_encode_close,
.capabilities = CODEC_CAP_EXPERIMENTAL,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_UYVY422, AV_PIX_FMT_NONE },
};

@ -60,10 +60,6 @@ static av_cold int bmp_encode_init(AVCodecContext *avctx){
return AVERROR(EINVAL);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
@ -163,12 +159,6 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int bmp_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_bmp_encoder = {
.name = "bmp",
.long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"),
@ -176,7 +166,6 @@ AVCodec ff_bmp_encoder = {
.id = AV_CODEC_ID_BMP,
.init = bmp_encode_init,
.encode2 = bmp_encode_frame,
.close = bmp_encode_close,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR24,
AV_PIX_FMT_RGB565, AV_PIX_FMT_RGB555, AV_PIX_FMT_RGB444,

@ -388,10 +388,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale,
ctx->m.mb_num * sizeof(uint8_t), fail);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
@ -1138,8 +1134,6 @@ static av_cold int dnxhd_encode_end(AVCodecContext *avctx)
for (i = 1; i < avctx->thread_count; i++)
av_freep(&ctx->thread[i]);
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -65,10 +65,6 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
return ret;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
dv_vlc_map_tableinit();
memset(&fdsp,0, sizeof(fdsp));
@ -743,12 +739,6 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,
return 0;
}
static int dvvideo_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_dvvideo_encoder = {
.name = "dvvideo",
.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
@ -757,7 +747,6 @@ AVCodec ff_dvvideo_encoder = {
.priv_data_size = sizeof(DVVideoContext),
.init = dvvideo_encode_init,
.encode2 = dvvideo_encode_frame,
.close = dvvideo_encode_close,
.capabilities = CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV422P,

@ -853,10 +853,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
if ((ret = ffv1_allocate_initial_states(s)) < 0)
return ret;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
if (!s->transparency)
@ -1332,7 +1328,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
ffv1_close(avctx);
return 0;
}

@ -98,8 +98,6 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx)
av_freep(&s->previous_frame);
av_freep(&s->tmpblock);
av_frame_free(&avctx->coded_frame);
return 0;
}
@ -131,12 +129,6 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
flashsv_encode_end(avctx);
return AVERROR(ENOMEM);
}
return 0;
}

@ -221,11 +221,6 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "GIF does not support resolutions above 65535x65535\n");
return AVERROR(EINVAL);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
@ -320,8 +315,6 @@ static int gif_encode_close(AVCodecContext *avctx)
{
GIFContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&s->lzw);
av_freep(&s->buf);
av_frame_free(&s->last_frame);

@ -228,8 +228,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
s->version = 2;
avctx->coded_frame = av_frame_alloc();
if (!avctx->extradata || !avctx->coded_frame)
if (!avctx->extradata)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
@ -1037,8 +1036,6 @@ static av_cold int encode_end(AVCodecContext *avctx)
av_freep(&avctx->extradata);
av_freep(&avctx->stats_out);
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -412,18 +412,8 @@ memfail:
return AVERROR(ENOMEM);
}
static av_cold int encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
static av_cold int encode_init_ls(AVCodecContext *ctx)
{
ctx->coded_frame = av_frame_alloc();
if (!ctx->coded_frame)
return AVERROR(ENOMEM);
ctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
ctx->coded_frame->key_frame = 1;
@ -444,7 +434,6 @@ AVCodec ff_jpegls_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_JPEGLS,
.init = encode_init_ls,
.close = encode_close,
.capabilities = CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
.encode2 = encode_picture_ls,
.pix_fmts = (const enum AVPixelFormat[]) {

@ -135,10 +135,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (!avctx->extradata)
return AVERROR(ENOMEM);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
@ -183,8 +179,6 @@ static av_cold int encode_end(AVCodecContext *avctx)
av_freep(&avctx->extradata);
deflateEnd(&c->zstream);
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -242,18 +242,11 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
goto fail;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
goto fail;
}
return 0;
fail:
opj_image_destroy(ctx->image);
ctx->image = NULL;
av_frame_free(&avctx->coded_frame);
return err;
}
@ -608,7 +601,6 @@ static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
opj_image_destroy(ctx->image);
ctx->image = NULL;
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -159,10 +159,6 @@ static av_cold int libschroedinger_encode_init(AVCodecContext *avctx)
avctx->width,
avctx->height);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
if (!avctx->gop_size) {
schro_encoder_setting_set_double(p_schro_params->encoder,
"gop_structure",
@ -436,8 +432,6 @@ static int libschroedinger_encode_close(AVCodecContext *avctx)
/* Free the video format structure. */
av_freep(&p_schro_params->format);
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -244,8 +244,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
below with speex_header_free() */
header_data = speex_header_to_packet(&s->header, &header_size);
/* allocate extradata and coded_frame */
avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
/* allocate extradata */
avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata) {
speex_header_free(header_data);
speex_encoder_destroy(s->enc_state);

@ -267,11 +267,6 @@ static av_cold int encode_init(AVCodecContext* avc_context)
th_comment_clear(&t_comment);
/* Set up the output AVFrame */
avc_context->coded_frame = av_frame_alloc();
if (!avc_context->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
@ -363,7 +358,6 @@ static av_cold int encode_close(AVCodecContext* avc_context)
th_encode_free(h->t_state);
av_freep(&h->stats);
av_frame_free(&avc_context->coded_frame);
av_freep(&avc_context->stats_out);
av_freep(&avc_context->extradata);
avc_context->extradata_size = 0;

@ -81,7 +81,6 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
flags = ((avctx->prediction_method + 1) << 8) | (avctx->thread_count - 1);
avctx->priv_data = utv;
avctx->coded_frame = av_frame_alloc();
/* Alloc extradata buffer */
info = (UtVideoExtra *)av_malloc(sizeof(*info));
@ -211,7 +210,6 @@ static av_cold int utvideo_encode_close(AVCodecContext *avctx)
{
UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&avctx->extradata);
av_freep(&utv->buffer);

@ -265,7 +265,6 @@ static av_cold int vp8_free(AVCodecContext *avctx)
if (ctx->is_alpha)
vpx_codec_destroy(&ctx->encoder_alpha);
av_freep(&ctx->twopass_stats.buf);
av_frame_free(&avctx->coded_frame);
av_freep(&avctx->stats_out);
free_frame_list(ctx->coded_frame_list);
return 0;
@ -640,12 +639,6 @@ static av_cold int vpx_init(AVCodecContext *avctx,
vpx_img_wrap(&ctx->rawimg_alpha, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
(unsigned char*)1);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
vp8_free(avctx);
return AVERROR(ENOMEM);
}
return 0;
}

@ -321,8 +321,6 @@ static av_cold int X264_close(AVCodecContext *avctx)
x4->enc = NULL;
}
av_frame_free(&avctx->coded_frame);
return 0;
}
@ -708,10 +706,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (!x4->enc)
return AVERROR_EXTERNAL;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
x264_nal_t *nal;
uint8_t *p;

@ -66,8 +66,6 @@ static av_cold int libx265_encode_close(AVCodecContext *avctx)
{
libx265Context *ctx = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
ctx->api->param_free(ctx->params);
if (ctx->encoder)
@ -92,12 +90,6 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
return AVERROR(ENOSYS);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
ctx->params = ctx->api->param_alloc();
if (!ctx->params) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate x265 param structure.\n");

@ -207,8 +207,6 @@ static av_cold int XAVS_close(AVCodecContext *avctx)
if (x4->enc)
xavs_encoder_close(x4->enc);
av_frame_free(&avctx->coded_frame);
return 0;
}
@ -357,10 +355,6 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
if (!(x4->pts_buffer = av_mallocz_array((avctx->max_b_frames+1), sizeof(*x4->pts_buffer))))
return AVERROR(ENOMEM);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
/* TAG: Do we have GLOBAL HEADER in AVS */
/* We Have PPS and SPS in AVS */
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER && 0) {

@ -680,9 +680,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
}
x->encoder_handle = xvid_enc_create.handle;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
@ -818,7 +815,6 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx)
x->encoder_handle = NULL;
}
av_frame_free(&avctx->coded_frame);
av_freep(&avctx->extradata);
if (x->twopassbuffer) {
av_freep(&x->twopassbuffer);

@ -265,7 +265,6 @@ static av_cold int ljpeg_encode_close(AVCodecContext *avctx)
{
LJpegEncContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&s->scratch);
return 0;
@ -286,10 +285,6 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;

@ -1617,8 +1617,7 @@ static void frame_end(MpegEncContext *s)
if (s->pict_type!= AV_PICTURE_TYPE_B)
s->last_non_b_pict_type = s->pict_type;
s->avctx->coded_frame = s->current_picture_ptr->f;
av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
}
static void update_noise_reduction(MpegEncContext *s)

@ -563,12 +563,6 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
if (!nvenc_dyload_nvenc(avctx))
return AVERROR_EXTERNAL;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
res = AVERROR(ENOMEM);
goto error;
}
ctx->last_dts = AV_NOPTS_VALUE;
ctx->encode_config.version = NV_ENC_CONFIG_VER;
@ -1051,8 +1045,6 @@ error:
if (ctx->cu_context)
dl_fn->cu_ctx_destroy(ctx->cu_context);
av_frame_free(&avctx->coded_frame);
nvenc_unload_nvenc(avctx);
ctx->nvencoder = NULL;
@ -1086,8 +1078,6 @@ static av_cold int nvenc_encode_close(AVCodecContext *avctx)
nvenc_unload_nvenc(avctx);
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -129,29 +129,18 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int pam_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
return 0;
}
static av_cold int pam_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_pam_encoder = {
.name = "pam",
.long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PAM,
.init = pam_encode_init,
.close = pam_encode_close,
.encode2 = pam_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA,

@ -35,22 +35,12 @@ static const uint32_t monoblack_pal[16] = { 0x000000, 0xFFFFFF };
static av_cold int pcx_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
return 0;
}
static av_cold int pcx_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
/**
* PCX run-length encoder
* @param dst output buffer
@ -216,7 +206,6 @@ AVCodec ff_pcx_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PCX,
.init = pcx_encode_init,
.close = pcx_encode_close,
.encode2 = pcx_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_RGB24,

@ -627,10 +627,6 @@ static av_cold int png_enc_init(AVCodecContext *avctx)
avctx->bits_per_coded_sample = 8;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
@ -713,7 +709,6 @@ static av_cold int png_enc_close(AVCodecContext *avctx)
PNGEncContext *s = avctx->priv_data;
deflateEnd(&s->zstream);
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -120,22 +120,12 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int pnm_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
return 0;
}
static av_cold int pnm_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
#if CONFIG_PGM_ENCODER
AVCodec ff_pgm_encoder = {
.name = "pgm",
@ -143,7 +133,6 @@ AVCodec ff_pgm_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PGM,
.init = pnm_encode_init,
.close = pnm_encode_close,
.encode2 = pnm_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE
@ -158,7 +147,6 @@ AVCodec ff_pgmyuv_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PGMYUV,
.init = pnm_encode_init,
.close = pnm_encode_close,
.encode2 = pnm_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_NONE
@ -173,7 +161,6 @@ AVCodec ff_ppm_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PPM,
.init = pnm_encode_init,
.close = pnm_encode_close,
.encode2 = pnm_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB48BE, AV_PIX_FMT_NONE
@ -188,7 +175,6 @@ AVCodec ff_pbm_encoder = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_PBM,
.init = pnm_encode_init,
.close = pnm_encode_close,
.encode2 = pnm_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_MONOWHITE,
AV_PIX_FMT_NONE },

@ -590,9 +590,6 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
scale_mat(QMAT_CHROMA[avctx->profile], ctx->qmat_chroma[i - 1], i);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
@ -602,7 +599,6 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
static av_cold int prores_encode_close(AVCodecContext *avctx)
{
ProresContext* ctx = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&ctx->fill_y);
return 0;

@ -1092,8 +1092,6 @@ static av_cold int encode_close(AVCodecContext *avctx)
ProresContext *ctx = avctx->priv_data;
int i;
av_frame_free(&avctx->coded_frame);
if (ctx->tdata) {
for (i = 0; i < avctx->thread_count; i++)
av_freep(&ctx->tdata[i].nodes);
@ -1127,9 +1125,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
int interlaced = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
avctx->bits_per_raw_sample = 10;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;

@ -254,10 +254,6 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
return ret;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
q->avctx = avctx;
return 0;
@ -535,7 +531,5 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
av_fifo_free(q->async_fifo);
q->async_fifo = NULL;
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -67,8 +67,6 @@ static av_cold int qtrle_encode_end(AVCodecContext *avctx)
{
QtrleEncContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
avpicture_free(&s->previous_frame);
av_free(s->rlecode_table);
av_free(s->length_table);
@ -128,12 +126,6 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
+ s->avctx->height*2 /* skip code+rle end */
+ s->logical_width/MAX_RLE_BULK + 1 /* rle codes */;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
qtrle_encode_end(avctx);
return AVERROR(ENOMEM);
}
return 0;
}

@ -24,16 +24,6 @@
#include "internal.h"
#include "bytestream.h"
static av_cold int encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pic, int *got_packet)
{
@ -78,12 +68,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
#if CONFIG_R210_ENCODER
AVCodec ff_r210_encoder = {
@ -91,9 +75,7 @@ AVCodec ff_r210_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_R210,
.init = encode_init,
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE },
};
#endif
@ -103,9 +85,7 @@ AVCodec ff_r10k_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_R10K,
.init = encode_init,
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE },
};
#endif
@ -115,9 +95,7 @@ AVCodec ff_avrp_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_AVRP,
.init = encode_init,
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE },
};
#endif

@ -35,10 +35,6 @@ static av_cold int raw_encode_init(AVCodecContext *avctx)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
if(!avctx->codec_tag)
@ -71,18 +67,11 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int raw_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_rawvideo_encoder = {
.name = "rawvideo",
.long_name = NULL_IF_CONFIG_SMALL("raw video"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_RAWVIDEO,
.init = raw_encode_init,
.close = raw_encode_close,
.encode2 = raw_encode,
};

@ -979,7 +979,6 @@ static av_cold int roq_encode_end(AVCodecContext *avctx)
av_frame_free(&enc->current_frame);
av_frame_free(&enc->last_frame);
av_frame_free(&enc->avctx->coded_frame);
av_freep(&enc->tmpData);
av_freep(&enc->this_motion4);
@ -1020,8 +1019,7 @@ static av_cold int roq_encode_init(AVCodecContext *avctx)
enc->last_frame = av_frame_alloc();
enc->current_frame = av_frame_alloc();
avctx->coded_frame = av_frame_alloc();
if (!enc->last_frame || !enc->current_frame || !avctx->coded_frame) {
if (!enc->last_frame || !enc->current_frame) {
roq_encode_end(avctx);
return AVERROR(ENOMEM);
}

@ -37,10 +37,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
@ -206,12 +202,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_sgi_encoder = {
.name = "sgi",
.long_name = NULL_IF_CONFIG_SMALL("SGI image"),
@ -219,7 +209,6 @@ AVCodec ff_sgi_encoder = {
.id = AV_CODEC_ID_SGI,
.init = encode_init,
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA,
AV_PIX_FMT_RGB48LE, AV_PIX_FMT_RGB48BE,

@ -122,8 +122,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, s->avctx->me_sub_cmp);
s->input_picture = av_frame_alloc();
avctx->coded_frame = av_frame_alloc();
if (!s->input_picture || !avctx->coded_frame)
if (!s->input_picture)
return AVERROR(ENOMEM);
if ((ret = ff_snow_get_buffer(s, s->input_picture)) < 0)
@ -1852,7 +1851,7 @@ redo_frame:
emms_c();
pkt->size = ff_rac_terminate(c);
if (avctx->coded_frame->key_frame)
if (s->current_picture->key_frame)
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
@ -1866,7 +1865,6 @@ static av_cold int encode_end(AVCodecContext *avctx)
ff_snow_common_end(s);
ff_rate_control_uninit(&s->m);
av_frame_free(&s->input_picture);
av_frame_free(&avctx->coded_frame);
av_freep(&avctx->stats_out);
return 0;

@ -199,12 +199,6 @@ static int sunrast_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return 0;
}
static av_cold int sunrast_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
static const AVCodecDefault sunrast_defaults[] = {
{ "coder", "rle" },
{ NULL },
@ -217,7 +211,6 @@ AVCodec ff_sunrast_encoder = {
.id = AV_CODEC_ID_SUNRAST,
.priv_data_size = sizeof(SUNRASTContext),
.init = sunrast_encode_init,
.close = sunrast_encode_close,
.encode2 = sunrast_encode_frame,
.defaults = sunrast_defaults,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24,

@ -504,7 +504,6 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
av_frame_free(&s->current_picture);
av_frame_free(&s->last_picture);
av_frame_free(&avctx->coded_frame);
return 0;
}
@ -518,10 +517,9 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
ff_me_cmp_init(&s->mecc, avctx);
ff_mpegvideoencdsp_init(&s->m.mpvencdsp, avctx);
avctx->coded_frame = av_frame_alloc();
s->current_picture = av_frame_alloc();
s->last_picture = av_frame_alloc();
if (!avctx->coded_frame || !s->current_picture || !s->last_picture) {
if (!s->current_picture || !s->last_picture) {
svq1_encode_end(avctx);
return AVERROR(ENOMEM);
}

@ -172,29 +172,18 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int targa_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
return 0;
}
static av_cold int targa_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_targa_encoder = {
.name = "targa",
.long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_TARGA,
.init = targa_encode_init,
.close = targa_encode_close,
.encode2 = targa_encode_frame,
.pix_fmts = (const enum AVPixelFormat[]){
AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_RGB555LE, AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8,

@ -521,11 +521,6 @@ fail:
static av_cold int encode_init(AVCodecContext *avctx)
{
TiffEncoderContext *s = avctx->priv_data;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
s->avctx = avctx;
@ -537,7 +532,6 @@ static av_cold int encode_close(AVCodecContext *avctx)
{
TiffEncoderContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&s->strip_sizes);
av_freep(&s->strip_offsets);
av_freep(&s->yuv_line);

@ -1529,6 +1529,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (av_codec_is_encoder(avctx->codec)) {
int i;
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
ret = AVERROR(ENOMEM);
goto free_and_end;
}
if (avctx->codec->sample_fmts) {
for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
@ -1751,6 +1756,8 @@ free_and_end:
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
av_frame_free(&avctx->coded_frame);
av_dict_free(&tmp);
av_freep(&avctx->priv_data);
if (avctx->internal) {
@ -2882,7 +2889,6 @@ av_cold int avcodec_close(AVCodecContext *avctx)
ff_thread_free(avctx);
if (avctx->codec && avctx->codec->close)
avctx->codec->close(avctx);
avctx->coded_frame = NULL;
avctx->internal->byte_buffer_size = 0;
av_freep(&avctx->internal->byte_buffer);
av_frame_free(&avctx->internal->to_free);
@ -2901,8 +2907,10 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
av_freep(&avctx->priv_data);
if (av_codec_is_encoder(avctx->codec))
if (av_codec_is_encoder(avctx->codec)) {
av_freep(&avctx->extradata);
av_frame_free(&avctx->coded_frame);
}
avctx->codec = NULL;
avctx->active_thread_type = 0;

@ -48,7 +48,6 @@ static av_cold int utvideo_encode_close(AVCodecContext *avctx)
UtvideoContext *c = avctx->priv_data;
int i;
av_frame_free(&avctx->coded_frame);
av_freep(&c->slice_bits);
for (i = 0; i < 4; i++)
av_freep(&c->slice_buffer[i]);
@ -154,14 +153,6 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
utvideo_encode_close(avctx);
return AVERROR(ENOMEM);
}
/* extradata size is 4 * 32bit */
avctx->extradata_size = 16;

@ -91,10 +91,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
s->pack_line_8 = v210_planar_pack_8_c;
@ -213,13 +209,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_v210_encoder = {
.name = "v210",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
@ -228,6 +217,5 @@ AVCodec ff_v210_encoder = {
.priv_data_size = sizeof(V210EncContext),
.init = encode_init,
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE },
};

@ -31,13 +31,6 @@ static av_cold int v308_encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
@ -77,8 +70,6 @@ static int v308_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int v308_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -26,12 +26,6 @@
static av_cold int v408_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
@ -82,8 +76,6 @@ static int v408_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int v408_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -32,13 +32,6 @@ static av_cold int v410_encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
@ -79,13 +72,6 @@ static int v410_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return 0;
}
static av_cold int v410_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
AVCodec ff_v410_encoder = {
.name = "v410",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"),
@ -93,6 +79,5 @@ AVCodec ff_v410_encoder = {
.id = AV_CODEC_ID_V410,
.init = v410_encode_init,
.encode2 = v410_encode_frame,
.close = v410_encode_close,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE },
};

@ -126,9 +126,6 @@ static void encode_block(char *bitmap, int w, int h, int level, ProbRangesQueue
static av_cold int xface_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
return 0;
@ -223,8 +220,6 @@ static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int xface_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -30,14 +30,8 @@ static av_cold int y41p_encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
avctx->coded_frame = av_frame_alloc();
avctx->bits_per_coded_sample = 12;
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
@ -84,8 +78,6 @@ static int y41p_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int y41p_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -25,13 +25,6 @@
static av_cold int yuv4_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
@ -74,8 +67,6 @@ static int yuv4_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
static av_cold int yuv4_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}

@ -259,8 +259,6 @@ static av_cold int encode_end(AVCodecContext *avctx)
deflateEnd(&c->zstream);
av_freep(&c->prev);
av_frame_free(&avctx->coded_frame);
return 0;
}
@ -324,12 +322,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
return -1;
}
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
encode_end(avctx);
return AVERROR(ENOMEM);
}
return 0;
}

Loading…
Cancel
Save