diff options
Diffstat (limited to 'libavcodec/wmv2enc.c')
-rw-r--r-- | libavcodec/wmv2enc.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c index 256c4e546f..869b3c7fe4 100644 --- a/libavcodec/wmv2enc.c +++ b/libavcodec/wmv2enc.c @@ -1,20 +1,20 @@ /* - * Copyright (c) 2002 The Libav Project + * Copyright (c) 2002 The FFmpeg Project * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -60,7 +60,9 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx){ ff_wmv2_common_init(w); avctx->extradata_size= 4; - avctx->extradata= av_mallocz(avctx->extradata_size + 10); + avctx->extradata= av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + if (!avctx->extradata) + return AVERROR(ENOMEM); encode_ext_header(w); return 0; @@ -84,10 +86,10 @@ int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number) w->abt_type=0; w->j_type=0; - assert(s->flipflop_rounding); + av_assert0(s->flipflop_rounding); if (s->pict_type == AV_PICTURE_TYPE_I) { - assert(s->no_rounding==1); + av_assert0(s->no_rounding==1); if(w->j_type_bit) put_bits(&s->pb, 1, w->j_type); if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table); @@ -169,10 +171,12 @@ void ff_wmv2_encode_mb(MpegEncContext * s, ff_wmv2_inter_table[w->cbp_table_index][cbp + 64][1], ff_wmv2_inter_table[w->cbp_table_index][cbp + 64][0]); + s->misc_bits += get_bits_diff(s); /* motion vector */ ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); ff_msmpeg4_encode_motion(s, motion_x - pred_x, motion_y - pred_y); + s->mv_bits += get_bits_diff(s); } else { /* compute cbp */ cbp = 0; @@ -203,11 +207,16 @@ void ff_wmv2_encode_mb(MpegEncContext * s, s->h263_aic_dir=0; put_bits(&s->pb, ff_table_inter_intra[s->h263_aic_dir][1], ff_table_inter_intra[s->h263_aic_dir][0]); } + s->misc_bits += get_bits_diff(s); } for (i = 0; i < 6; i++) { ff_msmpeg4_encode_block(s, block[i], i); } + if (s->mb_intra) + s->i_tex_bits += get_bits_diff(s); + else + s->p_tex_bits += get_bits_diff(s); } AVCodec ff_wmv2_encoder = { |