mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
get_bit_count -> put_bits_count
Originally committed as revision 2752 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
de7ff1f774
commit
fe455f3328
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<<length)-1);
|
||||
}
|
||||
|
||||
@ -2972,9 +2972,9 @@ void ff_mpeg4_init_partitions(MpegEncContext *s)
|
||||
|
||||
void ff_mpeg4_merge_partitions(MpegEncContext *s)
|
||||
{
|
||||
const int pb2_len = get_bit_count(&s->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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user