Mercurial > libavcodec.hg
comparison bitstream.c @ 9158:0d5eed0f1b45 libavcodec
Fix unaligned access in ff_copy_bits()
| author | mru |
|---|---|
| date | Mon, 09 Mar 2009 23:27:38 +0000 |
| parents | e9d9d946f213 |
| children | 18dffa8f2382 |
comparison
equal
deleted
inserted
replaced
| 9157:33477a19f89e | 9158:0d5eed0f1b45 |
|---|---|
| 81 int i; | 81 int i; |
| 82 | 82 |
| 83 if(length==0) return; | 83 if(length==0) return; |
| 84 | 84 |
| 85 if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){ | 85 if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){ |
| 86 for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i])); | 86 for(i=0; i<words; i++) put_bits(pb, 16, AV_RB16(&srcw[i])); |
| 87 }else{ | 87 }else{ |
| 88 for(i=0; put_bits_count(pb)&31; i++) | 88 for(i=0; put_bits_count(pb)&31; i++) |
| 89 put_bits(pb, 8, src[i]); | 89 put_bits(pb, 8, src[i]); |
| 90 flush_put_bits(pb); | 90 flush_put_bits(pb); |
| 91 memcpy(pbBufPtr(pb), src+i, 2*words-i); | 91 memcpy(pbBufPtr(pb), src+i, 2*words-i); |
| 92 skip_put_bytes(pb, 2*words-i); | 92 skip_put_bytes(pb, 2*words-i); |
| 93 } | 93 } |
| 94 | 94 |
| 95 put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits)); | 95 put_bits(pb, bits, AV_RB16(&srcw[words])>>(16-bits)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 /* VLC decoding */ | 98 /* VLC decoding */ |
| 99 | 99 |
| 100 //#define DEBUG_VLC | 100 //#define DEBUG_VLC |
