diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-03-22 20:22:39 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-23 03:09:07 +0100 |
commit | ae2c33b0c28ec9dd2c78538062798f6dace6b20b (patch) | |
tree | 4da5beb4b30645d5878e898e598b9a50671b09a9 | |
parent | 0e465c1a81fda00a6e00645e99e4cc82144176ed (diff) | |
download | ffmpeg-ae2c33b0c28ec9dd2c78538062798f6dace6b20b.tar.gz |
cosmetics: remove superfluous curly brackets
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
68 files changed, 68 insertions, 136 deletions
diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index 294c537f4e..09aaf0c5f9 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -308,9 +308,8 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, /* any frames to encode? */ if (c->mc_lifetime) { req_size = charset_size + c->mc_lifetime*(screen_size + colram_size); - if ((ret = ff_alloc_packet2(avctx, pkt, req_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, req_size)) < 0) return ret; - } buf = pkt->data; /* calc optimal new charset + charmaps */ diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 09f92be24e..cf4aef9b03 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -574,9 +574,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, do { int frame_bits; - if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels))) return ret; - } init_put_bits(&s->pb, avpkt->data, avpkt->size); if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT)) diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index 8ef073afd3..20ac301a43 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -437,9 +437,8 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, ff_ac3_quantize_mantissas(s); - if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) return ret; - } ff_ac3_output_frame(s, avpkt->data); if (frame->pts != AV_NOPTS_VALUE) diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index d2a17c5586..e46e6f240b 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -494,9 +494,8 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8; else pkt_size = avctx->block_align; - if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size))) return ret; - } dst = avpkt->data; switch(avctx->codec->id) { diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index d82cae39f0..ca472e0f9d 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -139,9 +139,8 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int ch, out_size, ret; out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE; - if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0) return ret; - } dst = avpkt->data; if (!c->header_parsed) { diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index a545b095e4..0194e2fecc 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -552,9 +552,8 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, else max_frame_size = s->max_coded_frame_size; - if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size))) return ret; - } /* use verbatim mode for compression_level 0 */ s->verbatim = !s->compression_level; diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c index ea7f052171..3af6900f20 100644 --- a/libavcodec/asv1.c +++ b/libavcodec/asv1.c @@ -473,9 +473,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int mb_x, mb_y; if ((ret = ff_alloc_packet2(avctx, pkt, a->mb_height*a->mb_width*MAX_MB_SIZE + - FF_MIN_BUFFER_SIZE)) < 0) { + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } init_put_bits(&a->pb, pkt->data, pkt->size); diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index 865744e0e0..158bc01685 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -120,9 +120,8 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt, #define SIZE_BITMAPINFOHEADER 40 hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2); n_bytes = n_bytes_image + hsize; - if ((ret = ff_alloc_packet2(avctx, pkt, n_bytes)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, n_bytes)) < 0) return ret; - } buf = pkt->data; bytestream_put_byte(&buf, 'B'); // BITMAPFILEHEADER.bfType bytestream_put_byte(&buf, 'M'); // do. diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index 688906f0f5..4e70ccd13f 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -146,9 +146,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, { 0xCB2A0000, 0xCB250000 }, }; - if ((ret = ff_alloc_packet2(avctx, pkt, 32*avctx->height*avctx->width/4)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, 32*avctx->height*avctx->width/4)) < 0) return ret; - } avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->key_frame = 1; diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 22640ebee7..3a297bf649 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -910,9 +910,8 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt, int offset, i, ret; uint8_t *buf; - if ((ret = ff_alloc_packet2(avctx, pkt, ctx->cid_table->frame_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, ctx->cid_table->frame_size)) < 0) return ret; - } buf = pkt->data; dnxhd_load_picture(ctx, frame); diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c index b9c3c30821..6e06a09c74 100644 --- a/libavcodec/dpxenc.c +++ b/libavcodec/dpxenc.c @@ -117,9 +117,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, size = avctx->height * avctx->width * 4; else size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); - if ((ret = ff_alloc_packet2(avctx, pkt, size + HEADER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, size + HEADER_SIZE)) < 0) return ret; - } buf = pkt->data; memset(buf, 0, HEADER_SIZE); diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 5312f34c4b..309846a598 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -1286,9 +1286,8 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt, s->sys = avpriv_dv_codec_profile(c); if (!s->sys || dv_init_dynamic_tables(s->sys)) return -1; - if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size)) < 0) { + if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size)) < 0) return ret; - } c->pix_fmt = s->sys->pix_fmt; s->picture = *frame; diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index f371c37676..b251c8bf87 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1155,9 +1155,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int i, ret; if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*((8*2+1+1)*4)/8 - + FF_MIN_BUFFER_SIZE)) < 0) { + + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } ff_init_range_encoder(c, pkt->data, pkt->size); ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 8b67fee4f1..1858dacba3 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1254,9 +1254,8 @@ static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, frame_bytes = encode_frame(s); } - if ((ret = ff_alloc_packet2(avctx, avpkt, frame_bytes))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, frame_bytes))) return ret; - } out_bytes = write_frame(s, avpkt); diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c index 042331c773..fd7f5c7276 100644 --- a/libavcodec/flashsv2enc.c +++ b/libavcodec/flashsv2enc.c @@ -834,9 +834,8 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, *p = *pict; - if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + FF_MIN_BUFFER_SIZE)) < 0) { + if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + FF_MIN_BUFFER_SIZE)) < 0) return res; - } /* First frame needs to be a keyframe */ if (avctx->frame_number == 0) diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index 1d0f5fb943..0392c61e19 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -228,9 +228,8 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, I_frame = 1; } - if ((res = ff_alloc_packet2(avctx, pkt, s->image_width * s->image_height * 3)) < 0) { + if ((res = ff_alloc_packet2(avctx, pkt, s->image_width * s->image_height * 3)) < 0) return res; - } pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16, pfptr, &I_frame); diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c index 0aa17fb579..3833e36447 100644 --- a/libavcodec/g722enc.c +++ b/libavcodec/g722enc.c @@ -366,9 +366,8 @@ static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int nb_samples, out_size, ret; out_size = (frame->nb_samples + 1) / 2; - if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) return ret; - } nb_samples = frame->nb_samples - (frame->nb_samples & 1); diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 6841b11c9e..329e2b95d3 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -361,9 +361,8 @@ static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int i, ret, out_size; out_size = (frame->nb_samples * c->code_size + 7) / 8; - if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) return ret; - } init_put_bits(&pb, avpkt->data, avpkt->size); for (i = 0; i < frame->nb_samples; i++) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index b8d7f1ac41..ba777cbbea 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -164,9 +164,8 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *outbuf_ptr, *end; int ret; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } outbuf_ptr = pkt->data; end = pkt->data + pkt->size; diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 67c9d98d52..cca4fea3c5 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -1281,9 +1281,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, AVFrame * const p= &s->picture; int i, j, size = 0, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } *p = *pict; p->pict_type= AV_PICTURE_TYPE_I; diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index f201c2cc49..56ccd9ef9c 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -927,9 +927,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int tileno, ret; J2kEncoderContext *s = avctx->priv_data; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } // init: s->buf = s->buf_start = pkt->data; diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index 4b8bedb9f4..aadea77eb6 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -251,9 +251,8 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt, comps = 3; if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*comps*4 + - FF_MIN_BUFFER_SIZE)) < 0) { + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } buf2 = av_malloc(pkt->size); diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c index 854968b452..8236781c76 100644 --- a/libavcodec/lclenc.c +++ b/libavcodec/lclenc.c @@ -78,9 +78,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int zret; // Zlib return code int max_size = deflateBound(&c->zstream, avctx->width * avctx->height * 3); - if ((ret = ff_alloc_packet2(avctx, pkt, max_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, max_size)) < 0) return ret; - } *p = *pict; p->pict_type= AV_PICTURE_TYPE_I; diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index 06152d9383..cf76dcc710 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -184,9 +184,8 @@ static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int num_samples = frame ? frame->nb_samples : 0; void *samples = frame ? frame->data[0] : NULL; - if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels))) return ret; - } bytes_written = faacEncEncode(s->faac_handle, samples, num_samples * avctx->channels, diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index cbb284b9b0..f93b6e1ea0 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -100,9 +100,8 @@ static int libgsm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, gsm_signal *samples = (gsm_signal *)frame->data[0]; struct gsm_state *state = avctx->priv_data; - if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align))) return ret; - } switch(avctx->codec_id) { case CODEC_ID_GSM: diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index b8c32bc477..43f76c85b6 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -255,9 +255,8 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, av_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, s->buffer_index); if (len <= s->buffer_index) { - if ((ret = ff_alloc_packet2(avctx, avpkt, len))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, len))) return ret; - } memcpy(avpkt->data, s->buffer, len); s->buffer_index -= len; memmove(s->buffer, s->buffer + len, s->buffer_index); diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 36fc899d79..c97291ae79 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -244,9 +244,8 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, s->enc_bitrate = avctx->bit_rate; } - if ((ret = ff_alloc_packet2(avctx, avpkt, 32))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, 32))) return ret; - } if (frame) { if (frame->nb_samples < avctx->frame_size) { diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index 3f3bb32738..a7f876029b 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -381,9 +381,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk pkt_size = p_frame_output->size; if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0) pkt_size += p_schro_params->enc_buf_size; - if ((ret = ff_alloc_packet2(avccontext, pkt, pkt_size)) < 0) { + if ((ret = ff_alloc_packet2(avccontext, pkt, pkt_size)) < 0) goto error; - } memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size); avccontext->coded_frame->key_frame = p_frame_output->key_frame; diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c index 2a690defee..b9e9c03505 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -267,9 +267,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, /* write output if all frames for the packet have been encoded */ if (s->pkt_frame_count == s->frames_per_packet) { s->pkt_frame_count = 0; - if ((ret = ff_alloc_packet2(avctx, avpkt, speex_bits_nbytes(&s->bits)))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, speex_bits_nbytes(&s->bits)))) return ret; - } ret = speex_bits_write(&s->bits, avpkt->data, avpkt->size); speex_bits_reset(&s->bits); diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 732c24ab5e..8cdfaaac74 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -328,9 +328,8 @@ static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt, } /* Copy ogg_packet content out to buffer */ - if ((ret = ff_alloc_packet2(avc_context, pkt, o_packet.bytes)) < 0) { + if ((ret = ff_alloc_packet2(avc_context, pkt, o_packet.bytes)) < 0) return ret; - } memcpy(pkt->data, o_packet.packet, o_packet.bytes); // HACK: assumes no encoder delay, this is true until libtheora becomes diff --git a/libavcodec/libutvideoenc.cpp b/libavcodec/libutvideoenc.cpp index dccfa6b807..9ddd0c1962 100644 --- a/libavcodec/libutvideoenc.cpp +++ b/libavcodec/libutvideoenc.cpp @@ -130,9 +130,8 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *dst; /* Alloc buffer */ - if ((ret = ff_alloc_packet2(avctx, pkt, utv->buf_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, utv->buf_size)) < 0) return ret; - } dst = pkt->data; diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 807083332d..8f7c581b95 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -161,9 +161,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return ret; } - if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels)))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels)))) return ret; - } input.Buffer = samples; input.Length = 2 * avctx->channels * avctx->frame_size; diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index b70ec0541f..ff08a81816 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -117,9 +117,8 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const int16_t *samples = (const int16_t *)frame->data[0]; int size, ret; - if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) return ret; - } if (s->last_bitrate != avctx->bit_rate) { s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index cbbe2688f1..db65d160a3 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -353,9 +353,8 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); - if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes))) return ret; - } av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL); avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos); diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index f7bdf825ad..39da64ca14 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -87,9 +87,8 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt, for (i = 0; i < nnal; i++) size += nals[i].i_payload; - if ((ret = ff_alloc_packet2(ctx, pkt, size)) < 0) { + if ((ret = ff_alloc_packet2(ctx, pkt, size)) < 0) return ret; - } p = pkt->data; /* Write the SEI as part of the first frame. */ diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index 158430d05e..3bca9456f1 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -385,9 +385,8 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, xvid_enc_frame_t xvid_enc_frame; xvid_enc_stats_t xvid_enc_stats; - if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } /* Start setting up the frame */ memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame)); diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 162a679d51..733e5e9a0b 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -57,9 +57,8 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt, max_pkt_size += mb_width * mb_height * 3 * 4 * s->mjpeg_hsample[0] * s->mjpeg_vsample[0]; } - if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) return ret; - } init_put_bits(&s->pb, pkt->data, pkt->size); diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 5a4dc2af37..38f440cfdb 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -751,9 +751,8 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } compute_bit_allocation(s, smr, bit_alloc, &padding); - if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE))) return ret; - } init_put_bits(&s->pb, avpkt->data, avpkt->size); diff --git a/libavcodec/msvideo1enc.c b/libavcodec/msvideo1enc.c index b4ba4be4ec..aa3c26a62d 100644 --- a/libavcodec/msvideo1enc.c +++ b/libavcodec/msvideo1enc.c @@ -76,9 +76,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int i, j, k, x, y, ret; int skips = 0; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } dst= buf= pkt->data; *p = *pict; diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 9587fe3a2b..59e08848f6 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -401,9 +401,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, s->last_frame = 1; } - if ((ret = ff_alloc_packet2(avctx, avpkt, NELLY_BLOCK_LEN))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, NELLY_BLOCK_LEN))) return ret; - } encode_block(s, avpkt->data, avpkt->size); /* Get the next frame pts/duration */ diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c index 27d135f8dc..3c36c5be86 100644 --- a/libavcodec/pamenc.c +++ b/libavcodec/pamenc.c @@ -88,9 +88,8 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return -1; } - if ((ret = ff_alloc_packet2(avctx, pkt, n*h + 200)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, n*h + 200)) < 0) return ret; - } *p = *pict; p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 72a4e2aebb..51910483fe 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -96,9 +96,8 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, n = frame->nb_samples * avctx->channels; samples = (const short *)frame->data[0]; - if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size))) return ret; - } dst = avpkt->data; switch(avctx->codec->id) { diff --git a/libavcodec/pcxenc.c b/libavcodec/pcxenc.c index 27af2aa9dd..01c1b64ee2 100644 --- a/libavcodec/pcxenc.c +++ b/libavcodec/pcxenc.c @@ -153,9 +153,8 @@ static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, line_bytes = (line_bytes + 1) & ~1; max_pkt_size = 128 + avctx->height * 2 * line_bytes * nplanes + (pal ? 256*3 + 1 : 0); - if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) return ret; - } buf = pkt->data; buf_end = pkt->data + pkt->size; diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 7ec80de6f3..1b23b13dbe 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -292,9 +292,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, + FF_MIN_BUFFER_SIZE; if (max_packet_size > INT_MAX) return AVERROR(ENOMEM); - if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) < 0) return ret; - } s->bytestream_start = s->bytestream = pkt->data; diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c index 99c579a647..254703fadd 100644 --- a/libavcodec/pnmenc.c +++ b/libavcodec/pnmenc.c @@ -34,9 +34,8 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if ((ret = ff_alloc_packet2(avctx, pkt, avpicture_get_size(avctx->pix_fmt, avctx->width, - avctx->height) + 200)) < 0) { + avctx->height) + 200)) < 0) return ret; - } *p = *pict; p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index bd96b52d2a..d35909bcf0 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -494,9 +494,8 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + FF_MIN_BUFFER_SIZE; //FIXME choose tighter limit - if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } buf = pkt->data; pic_size = prores_encode_picture(avctx, pict, buf + header_size + 8, diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 4bbfe274a5..86037d3807 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -700,9 +700,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, pkt_size = ctx->frame_size + FF_MIN_BUFFER_SIZE; - if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0) return ret; - } orig_buf = pkt->data; diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c index 565766b356..8fc455afa5 100644 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@ -310,9 +310,8 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, *p = *pict; - if ((ret = ff_alloc_packet2(avctx, pkt, s->max_buf_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, s->max_buf_size)) < 0) return ret; - } if (avctx->gop_size == 0 || (s->avctx->frame_number % avctx->gop_size) == 0) { /* I-Frame */ diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c index 331b072013..92c9ce31f6 100644 --- a/libavcodec/r210enc.c +++ b/libavcodec/r210enc.c @@ -43,9 +43,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *src_line; uint8_t *dst; - if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height)) < 0) return ret; - } avctx->coded_frame->reference = 0; avctx->coded_frame->key_frame = 1; diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 4b2db2dcbe..9d74380cc6 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -458,9 +458,8 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (ractx->last_frame) return 0; - if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) return ret; - } /** * Since the LPC coefficients are calculated on a frame centered over the diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index 6bc072442c..0b1cd21eb0 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -171,9 +171,8 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, else data_size = avctx->channels * avctx->frame_size; - if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) return ret; - } out = avpkt->data; bytestream_put_byte(&out, stereo ? 0x21 : 0x20); diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index f439e0c599..bf9210fa4a 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -1020,9 +1020,8 @@ static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt, /* 138 bits max per 8x8 block + * 256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */ size = ((enc->width * enc->height / 64) * 138 + 7) / 8 + 256 * (6 + 4) + 8; - if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) return ret; - } enc->out_buf = pkt->data; /* Check for I frame */ diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c index 0f317c7d30..35796a58a9 100644 --- a/libavcodec/sgienc.c +++ b/libavcodec/sgienc.c @@ -113,9 +113,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, else // assume ff_rl_encode() produces at most 2x size of input length += tablesize * 2 + depth * height * (2 * width + 1); - if ((ret = ff_alloc_packet2(avctx, pkt, bytes_per_channel * length)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, bytes_per_channel * length)) < 0) return ret; - } buf = pkt->data; end_buf = pkt->data + pkt->size; diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 6cddec0d41..73d87bede6 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -1614,9 +1614,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t rc_header_bak[sizeof(s->header_state)]; uint8_t rc_block_bak[sizeof(s->block_state)]; - if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } ff_init_range_encoder(c, pkt->data, pkt->size); ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 35965fb472..d372af92eb 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -505,9 +505,8 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, AVFrame temp; int i, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, s->y_block_width*s->y_block_height*MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE) < 0)) { + if ((ret = ff_alloc_packet2(avctx, pkt, s->y_block_width*s->y_block_height*MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE) < 0)) return ret; - } if(avctx->pix_fmt != PIX_FMT_YUV410P){ av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c index b4ad932a61..8056685b36 100644 --- a/libavcodec/targaenc.c +++ b/libavcodec/targaenc.c @@ -86,9 +86,8 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, return AVERROR(EINVAL); } picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); - if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45)) < 0) return ret; - } /* zero out the header and only set applicable fields */ memset(pkt->data, 0, 12); diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index e206cd3231..fa86c48569 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -305,9 +305,8 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, strips = (s->height - 1) / s->rps + 1; if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * s->bpp * 2 + - avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) { + avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) return ret; - } ptr = pkt->data; s->buf_start = pkt->data; s->buf = &ptr; diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index fd544bfd6d..2cc1e0d17f 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -57,9 +57,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const uint16_t *v = (const uint16_t*)pic->data[2]; PutByteContext p; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->height * stride)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->height * stride)) < 0) return ret; - } bytestream2_init_writer(&p, pkt->data, pkt->size); diff --git a/libavcodec/v308enc.c b/libavcodec/v308enc.c index c728b01f67..d5c5fb02c2 100644 --- a/libavcodec/v308enc.c +++ b/libavcodec/v308enc.c @@ -48,9 +48,8 @@ static int v308_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *y, *u, *v; int i, j, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 3)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 3)) < 0) return ret; - } dst = pkt->data; avctx->coded_frame->reference = 0; diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c index 39b16a6cff..878180793c 100644 --- a/libavcodec/v408enc.c +++ b/libavcodec/v408enc.c @@ -43,9 +43,8 @@ static int v408_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *y, *u, *v, *a; int i, j, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0) return ret; - } dst = pkt->data; avctx->coded_frame->reference = 0; diff --git a/libavcodec/v410enc.c b/libavcodec/v410enc.c index e278ac4e27..1d4699bd77 100644 --- a/libavcodec/v410enc.c +++ b/libavcodec/v410enc.c @@ -49,9 +49,8 @@ static int v410_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint32_t val; int i, j, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0) return ret; - } dst = pkt->data; avctx->coded_frame->reference = 0; diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c index bb6ad2c9e4..6d8f9ffc75 100644 --- a/libavcodec/vorbisenc.c +++ b/libavcodec/vorbisenc.c @@ -1030,9 +1030,8 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt, return 0; samples = 1 << (venc->log2_blocksize[0] - 1); - if ((ret = ff_alloc_packet2(avccontext, avpkt, 8192))) { + if ((ret = ff_alloc_packet2(avccontext, avpkt, 8192))) return ret; - } init_put_bits(&pb, avpkt->data, avpkt->size); diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index 431344c542..9b89f35036 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -371,9 +371,8 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, } } - if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) return ret; - } #if 1 total_gain= 128; diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c index 378a36c711..bade9e77e6 100644 --- a/libavcodec/xbmenc.c +++ b/libavcodec/xbmenc.c @@ -41,9 +41,8 @@ static int xbm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, linesize = (avctx->width + 7) / 8; size = avctx->height * (linesize * 7 + 2) + 110; - if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) return ret; - } buf = pkt->data; ptr = p->data[0]; diff --git a/libavcodec/xwdenc.c b/libavcodec/xwdenc.c index d8001e4ac9..0dd3d0ae33 100644 --- a/libavcodec/xwdenc.c +++ b/libavcodec/xwdenc.c @@ -148,9 +148,8 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, header_size = XWD_HEADER_SIZE + WINDOW_NAME_SIZE; out_size = header_size + ncolors * XWD_CMAP_SIZE + avctx->height * lsize; - if ((ret = ff_alloc_packet2(avctx, pkt, out_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, out_size)) < 0) return ret; - } buf = pkt->data; avctx->coded_frame->key_frame = 1; diff --git a/libavcodec/y41penc.c b/libavcodec/y41penc.c index 05bac7d685..aafae8ee8d 100644 --- a/libavcodec/y41penc.c +++ b/libavcodec/y41penc.c @@ -48,9 +48,8 @@ static int y41p_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *y, *u, *v; int i, j, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 1.5)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 1.5)) < 0) return ret; - } avctx->coded_frame->reference = 0; avctx->coded_frame->key_frame = 1; diff --git a/libavcodec/yuv4enc.c b/libavcodec/yuv4enc.c index 2a5af8fdae..102e410ff7 100644 --- a/libavcodec/yuv4enc.c +++ b/libavcodec/yuv4enc.c @@ -42,9 +42,8 @@ static int yuv4_encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *y, *u, *v; int i, j, ret; - if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0) return ret; - } dst = pkt->data; avctx->coded_frame->reference = 0; diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c index 3453d69a82..7723e7255b 100644 --- a/libavcodec/zmbvenc.c +++ b/libavcodec/zmbvenc.c @@ -228,9 +228,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } pkt_size = c->zstream.total_out + 1 + 6*keyframe; - if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0) { + if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0) return ret; - } buf = pkt->data; fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0); |