diff options
Diffstat (limited to 'libavcodec/wmv2enc.c')
-rw-r--r-- | libavcodec/wmv2enc.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c index e4e51d3..62e99c0 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 */ @@ -62,7 +62,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; @@ -85,10 +87,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); @@ -171,10 +173,12 @@ void ff_wmv2_encode_mb(MpegEncContext *s, int16_t block[6][64], 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; @@ -207,12 +211,19 @@ void ff_wmv2_encode_mb(MpegEncContext *s, int16_t block[6][64], 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); } +FF_MPV_GENERIC_CLASS(wmv2) + AVCodec ff_wmv2_encoder = { .name = "wmv2", .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"), @@ -224,4 +235,5 @@ AVCodec ff_wmv2_encoder = { .close = ff_mpv_encode_end, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, + .priv_class = &wmv2_class, }; |