Mercurial > libavcodec.hg
comparison mpegvideo_enc.c @ 5229:604a09d6cf2e libavcodec
move ff_copy_bits to bitstream.c
author | aurel |
---|---|
date | Fri, 06 Jul 2007 14:13:25 +0000 |
parents | 470601203f44 |
children | 101f20612a94 |
comparison
equal
deleted
inserted
replaced
5228:3d124a8b7a76 | 5229:604a09d6cf2e |
---|---|
1730 | 1730 |
1731 static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y) | 1731 static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y) |
1732 { | 1732 { |
1733 if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6); | 1733 if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6); |
1734 else encode_mb_internal(s, motion_x, motion_y, 16, 8); | 1734 else encode_mb_internal(s, motion_x, motion_y, 16, 8); |
1735 } | |
1736 | |
1737 void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) | |
1738 { | |
1739 const uint16_t *srcw= (uint16_t*)src; | |
1740 int words= length>>4; | |
1741 int bits= length&15; | |
1742 int i; | |
1743 | |
1744 if(length==0) return; | |
1745 | |
1746 if(words < 16){ | |
1747 for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i])); | |
1748 }else if(put_bits_count(pb)&7){ | |
1749 for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i])); | |
1750 }else{ | |
1751 for(i=0; put_bits_count(pb)&31; i++) | |
1752 put_bits(pb, 8, src[i]); | |
1753 flush_put_bits(pb); | |
1754 memcpy(pbBufPtr(pb), src+i, 2*words-i); | |
1755 skip_put_bytes(pb, 2*words-i); | |
1756 } | |
1757 | |
1758 put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits)); | |
1759 } | 1735 } |
1760 | 1736 |
1761 static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){ | 1737 static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){ |
1762 int i; | 1738 int i; |
1763 | 1739 |