[FFmpeg-cvslog] r9503 - in trunk/libavcodec: bitstream.c bitstream.h mpegvideo.h mpegvideo_enc.c
aurel
subversion
Fri Jul 6 16:13:25 CEST 2007
Author: aurel
Date: Fri Jul 6 16:13:25 2007
New Revision: 9503
Log:
move ff_copy_bits to bitstream.c
Modified:
trunk/libavcodec/bitstream.c
trunk/libavcodec/bitstream.h
trunk/libavcodec/mpegvideo.h
trunk/libavcodec/mpegvideo_enc.c
Modified: trunk/libavcodec/bitstream.c
==============================================================================
--- trunk/libavcodec/bitstream.c (original)
+++ trunk/libavcodec/bitstream.c Fri Jul 6 16:13:25 2007
@@ -60,6 +60,30 @@ void ff_put_string(PutBitContext * pbc,
put_bits(pbc, 8, 0);
}
+void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
+{
+ const uint16_t *srcw= (uint16_t*)src;
+ int words= length>>4;
+ int bits= length&15;
+ int i;
+
+ if(length==0) return;
+
+ if(words < 16){
+ for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i]));
+ }else if(put_bits_count(pb)&7){
+ for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i]));
+ }else{
+ for(i=0; put_bits_count(pb)&31; i++)
+ put_bits(pb, 8, src[i]);
+ flush_put_bits(pb);
+ memcpy(pbBufPtr(pb), src+i, 2*words-i);
+ skip_put_bytes(pb, 2*words-i);
+ }
+
+ put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits));
+}
+
/* VLC decoding */
//#define DEBUG_VLC
Modified: trunk/libavcodec/bitstream.h
==============================================================================
--- trunk/libavcodec/bitstream.h (original)
+++ trunk/libavcodec/bitstream.h Fri Jul 6 16:13:25 2007
@@ -137,6 +137,7 @@ static inline void flush_put_bits(PutBit
void align_put_bits(PutBitContext *s);
void ff_put_string(PutBitContext * pbc, char *s, int put_zero);
+void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length);
/* bit input */
/* buffer, buffer_end and size_in_bits must be present and used by every reader */
Modified: trunk/libavcodec/mpegvideo.h
==============================================================================
--- trunk/libavcodec/mpegvideo.h (original)
+++ trunk/libavcodec/mpegvideo.h Fri Jul 6 16:13:25 2007
@@ -717,7 +717,6 @@ void MPV_common_init_armv4l(MpegEncConte
void MPV_common_init_ppc(MpegEncContext *s);
#endif
extern void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w);
-void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length);
void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
Modified: trunk/libavcodec/mpegvideo_enc.c
==============================================================================
--- trunk/libavcodec/mpegvideo_enc.c (original)
+++ trunk/libavcodec/mpegvideo_enc.c Fri Jul 6 16:13:25 2007
@@ -1734,30 +1734,6 @@ static av_always_inline void encode_mb(M
else encode_mb_internal(s, motion_x, motion_y, 16, 8);
}
-void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
-{
- const uint16_t *srcw= (uint16_t*)src;
- int words= length>>4;
- int bits= length&15;
- int i;
-
- if(length==0) return;
-
- if(words < 16){
- for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i]));
- }else if(put_bits_count(pb)&7){
- for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i]));
- }else{
- for(i=0; put_bits_count(pb)&31; i++)
- put_bits(pb, 8, src[i]);
- flush_put_bits(pb);
- memcpy(pbBufPtr(pb), src+i, 2*words-i);
- skip_put_bytes(pb, 2*words-i);
- }
-
- put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits));
-}
-
static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){
int i;
More information about the ffmpeg-cvslog
mailing list