Commit ae2c33b0 authored by Paul B Mahol's avatar Paul B Mahol Committed by Michael Niedermayer

cosmetics: remove superfluous curly brackets

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 0e465c1a
......@@ -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 */
......
......@@ -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))
......
......@@ -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)
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
......
......@@ -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.
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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++)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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,
......
......@@ -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:
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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. */
......
......@@ -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));
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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,
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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);
......
......@@ -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");
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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];
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment