Mercurial > libavcodec.hg
comparison bitstream.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 | 2a340aea762d |
comparison
equal
deleted
inserted
replaced
5228:3d124a8b7a76 | 5229:604a09d6cf2e |
---|---|
56 put_bits(pbc, 8, *s); | 56 put_bits(pbc, 8, *s); |
57 s++; | 57 s++; |
58 } | 58 } |
59 if(put_zero) | 59 if(put_zero) |
60 put_bits(pbc, 8, 0); | 60 put_bits(pbc, 8, 0); |
61 } | |
62 | |
63 void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) | |
64 { | |
65 const uint16_t *srcw= (uint16_t*)src; | |
66 int words= length>>4; | |
67 int bits= length&15; | |
68 int i; | |
69 | |
70 if(length==0) return; | |
71 | |
72 if(words < 16){ | |
73 for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i])); | |
74 }else if(put_bits_count(pb)&7){ | |
75 for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i])); | |
76 }else{ | |
77 for(i=0; put_bits_count(pb)&31; i++) | |
78 put_bits(pb, 8, src[i]); | |
79 flush_put_bits(pb); | |
80 memcpy(pbBufPtr(pb), src+i, 2*words-i); | |
81 skip_put_bytes(pb, 2*words-i); | |
82 } | |
83 | |
84 put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits)); | |
61 } | 85 } |
62 | 86 |
63 /* VLC decoding */ | 87 /* VLC decoding */ |
64 | 88 |
65 //#define DEBUG_VLC | 89 //#define DEBUG_VLC |