From fe455f3328ca1ae4b71a345f50936d19f30e5c5f Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 6 Feb 2004 15:27:31 +0000 Subject: [PATCH] get_bit_count -> put_bits_count Originally committed as revision 2752 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/asv1.c | 4 ++-- libavcodec/common.c | 2 +- libavcodec/common.h | 2 +- libavcodec/ffv1.c | 4 ++-- libavcodec/h263.c | 12 ++++++------ libavcodec/h264.c | 2 +- libavcodec/huffyuv.c | 2 +- libavcodec/mjpeg.c | 8 ++++---- libavcodec/mpeg12.c | 2 +- libavcodec/mpegvideo.c | 26 +++++++++++++------------- libavcodec/mpegvideo.h | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c index b84b02475e..87b13c637b 100644 --- a/libavcodec/asv1.c +++ b/libavcodec/asv1.c @@ -519,10 +519,10 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, emms_c(); align_put_bits(&a->pb); - while(get_bit_count(&a->pb)&31) + while(put_bits_count(&a->pb)&31) put_bits(&a->pb, 8, 0); - size= get_bit_count(&a->pb)/32; + size= put_bits_count(&a->pb)/32; if(avctx->codec_id == CODEC_ID_ASV1) a->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size); diff --git a/libavcodec/common.c b/libavcodec/common.c index 6bca53f1e6..cf52d98cca 100644 --- a/libavcodec/common.c +++ b/libavcodec/common.c @@ -64,7 +64,7 @@ void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) #if 1 /* return the number of bits output */ -int get_bit_count(PutBitContext *s) +int put_bits_count(PutBitContext *s) { #ifdef ALT_BITSTREAM_WRITER return s->index; diff --git a/libavcodec/common.h b/libavcodec/common.h index 48d923169b..2167ebc2b2 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -288,7 +288,7 @@ typedef struct PutBitContext { void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size); -int get_bit_count(PutBitContext *s); /* XXX: change function name */ +int put_bits_count(PutBitContext *s); void align_put_bits(PutBitContext *s); void flush_put_bits(PutBitContext *s); void put_string(PutBitContext * pbc, char *s); diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 3ac7a6a557..fb2aaa7371 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -409,7 +409,7 @@ static inline void encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], i } } -// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)get_bit_count(&s->pb)); +// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)put_bits_count(&s->pb)); if(run_mode == 0) put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); @@ -689,7 +689,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return put_cabac_terminate(c, 1); }else{ flush_put_bits(&f->pb); //nicer padding FIXME - return used_count + (get_bit_count(&f->pb)+7)/8; + return used_count + (put_bits_count(&f->pb)+7)/8; } } diff --git a/libavcodec/h263.c b/libavcodec/h263.c index de9110a4e2..6a57805bda 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -1972,7 +1972,7 @@ void h263_encode_init(MpegEncContext *s) // ff_mpeg4_stuffing(&s->pb); ? flush_put_bits(&s->pb); - s->avctx->extradata_size= (get_bit_count(&s->pb)+7)>>3; + s->avctx->extradata_size= (put_bits_count(&s->pb)+7)>>3; } break; @@ -2146,7 +2146,7 @@ void ff_mpeg4_stuffing(PutBitContext * pbc) { int length; put_bits(pbc, 1, 0); - length= (-get_bit_count(pbc))&7; + length= (-put_bits_count(pbc))&7; if(length) put_bits(pbc, length, (1<pb2 ); - const int tex_pb_len= get_bit_count(&s->tex_pb); - const int bits= get_bit_count(&s->pb); + const int pb2_len = put_bits_count(&s->pb2 ); + const int tex_pb_len= put_bits_count(&s->tex_pb); + const int bits= put_bits_count(&s->pb); if(s->pict_type==I_TYPE){ put_bits(&s->pb, 19, DC_MARKER); @@ -2992,7 +2992,7 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s) ff_copy_bits(&s->pb, s->pb2_buffer , pb2_len); ff_copy_bits(&s->pb, s->tex_pb_buffer, tex_pb_len); - s->last_bits= get_bit_count(&s->pb); + s->last_bits= put_bits_count(&s->pb); } #endif //CONFIG_ENCODERS diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 43ed13e99f..3f60e35e86 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1070,7 +1070,7 @@ static int encode_nal(H264Context *h, uint8_t *dst, uint8_t *src, int length, in static void encode_rbsp_trailing(PutBitContext *pb){ int length; put_bits(pb, 1, 1); - length= (-get_bit_count(pb))&7; + length= (-put_bits_count(pb))&7; if(length) put_bits(pb, length, 0); } diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index d180d6aeee..4047a6a938 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -1049,7 +1049,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, } emms_c(); - size= (get_bit_count(&s->pb)+31)/32; + size= (put_bits_count(&s->pb)+31)/32; if((s->flags&CODEC_FLAG_PASS1) && (s->picture_number&31)==0){ int j; diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index 1a948aa56f..ca64fb2b13 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -477,7 +477,7 @@ void mjpeg_picture_header(MpegEncContext *s) static void escape_FF(MpegEncContext *s, int start) { - int size= get_bit_count(&s->pb) - start*8; + int size= put_bits_count(&s->pb) - start*8; int i, ff_count; uint8_t *buf= s->pb.buf + start; int align= (-(size_t)(buf))&3; @@ -533,7 +533,7 @@ static void escape_FF(MpegEncContext *s, int start) void mjpeg_picture_trailer(MpegEncContext *s) { - int pad= (-get_bit_count(&s->pb))&7; + int pad= (-put_bits_count(&s->pb))&7; put_bits(&s->pb, pad,0xFF>>(8-pad)); flush_put_bits(&s->pb); @@ -651,7 +651,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in mjpeg_picture_header(s); - s->header_bits= get_bit_count(&s->pb); + s->header_bits= put_bits_count(&s->pb); if(avctx->pix_fmt == PIX_FMT_RGBA32){ int x, y, i; @@ -770,7 +770,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in flush_put_bits(&s->pb); return pbBufPtr(&s->pb) - s->pb.buf; -// return (get_bit_count(&f->pb)+7)/8; +// return (put_bits_count(&f->pb)+7)/8; } #endif //CONFIG_ENCODERS diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 3edad5b802..a66ea134ca 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -379,7 +379,7 @@ void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) s->gop_picture_number) & 0x3ff); put_bits(&s->pb, 3, s->pict_type); - s->vbv_delay_ptr= s->pb.buf + get_bit_count(&s->pb)/8; + s->vbv_delay_ptr= s->pb.buf + put_bits_count(&s->pb)/8; put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */ // RAL: Forward f_code also needed for B frames diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 3dd5443cd5..30ab390e3a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -3734,10 +3734,10 @@ static inline void encode_mb_hq(MpegEncContext *s, MpegEncContext *backup, MpegE encode_mb(s, motion_x, motion_y); - score= get_bit_count(&s->pb); + score= put_bits_count(&s->pb); if(s->data_partitioning){ - score+= get_bit_count(&s->pb2); - score+= get_bit_count(&s->tex_pb); + score+= put_bits_count(&s->pb2); + score+= put_bits_count(&s->tex_pb); } if(s->avctx->mb_decision == FF_MB_DECISION_RD){ @@ -4012,7 +4012,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) if(s->current_picture.key_frame) s->picture_in_gop_number=0; - s->last_bits= get_bit_count(&s->pb); + s->last_bits= put_bits_count(&s->pb); switch(s->out_format) { case FMT_MJPEG: mjpeg_picture_header(s); @@ -4041,7 +4041,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) default: assert(0); } - bits= get_bit_count(&s->pb); + bits= put_bits_count(&s->pb); s->header_bits= bits - s->last_bits; s->last_bits= bits; s->mv_bits=0; @@ -4134,11 +4134,11 @@ static void encode_picture(MpegEncContext *s, int picture_number) align_put_bits(&s->pb); flush_put_bits(&s->pb); - assert((get_bit_count(&s->pb)&7) == 0); + assert((put_bits_count(&s->pb)&7) == 0); current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob; if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ - int r= get_bit_count(&s->pb)/8 + s->picture_number + s->codec_id + s->mb_x + s->mb_y; + int r= put_bits_count(&s->pb)/8 + s->picture_number + s->codec_id + s->mb_x + s->mb_y; int d= 100 / s->avctx->error_rate; if(r % d == 0){ current_packet_size=0; @@ -4169,7 +4169,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) } if(s->flags&CODEC_FLAG_PASS1){ - int bits= get_bit_count(&s->pb); + int bits= put_bits_count(&s->pb); s->misc_bits+= bits - s->last_bits; s->last_bits= bits; } @@ -4394,23 +4394,23 @@ static void encode_picture(MpegEncContext *s, int picture_number) copy_context_after_encode(s, &best_s, -1); - pb_bits_count= get_bit_count(&s->pb); + pb_bits_count= put_bits_count(&s->pb); flush_put_bits(&s->pb); ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); s->pb= backup_s.pb; if(s->data_partitioning){ - pb2_bits_count= get_bit_count(&s->pb2); + pb2_bits_count= put_bits_count(&s->pb2); flush_put_bits(&s->pb2); ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); s->pb2= backup_s.pb2; - tex_pb_bits_count= get_bit_count(&s->tex_pb); + tex_pb_bits_count= put_bits_count(&s->tex_pb); flush_put_bits(&s->tex_pb); ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); s->tex_pb= backup_s.tex_pb; } - s->last_bits= get_bit_count(&s->pb); + s->last_bits= put_bits_count(&s->pb); #ifdef CONFIG_RISKY if (s->out_format == FMT_H263 && s->pict_type!=B_TYPE) @@ -4574,7 +4574,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) } if(s->loop_filter) ff_h263_loop_filter(s); -//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, get_bit_count(&s->pb)); +//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb)); } } emms_c(); diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 88e2f6d50b..aeeb8866a6 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -749,7 +749,7 @@ static inline void ff_update_block_index(MpegEncContext *s){ } static inline int get_bits_diff(MpegEncContext *s){ - const int bits= get_bit_count(&s->pb); + const int bits= put_bits_count(&s->pb); const int last= s->last_bits; s->last_bits = bits;