From b6335c9f5ba92a87dad33f2ccd292ff37b397afa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 14 Feb 2004 01:25:41 +0000 Subject: [PATCH] ff_copy_bits() optimization Originally committed as revision 2777 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpegvideo.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 6c483dcc81..519fa5c735 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -3732,21 +3732,26 @@ void ff_mpeg_flush(AVCodecContext *avctx){ #ifdef CONFIG_ENCODERS void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) { + const uint16_t *srcw= src; int words= length>>4; int bits= length&15; int i; if(length==0) return; - if(put_bits_count(pb)&7){ - for(i=0; i>(16-bits)); + put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits)); } static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){