Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
fe455f33
Commit
fe455f33
authored
Feb 06, 2004
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_bit_count -> put_bits_count
Originally committed as revision 2752 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
de7ff1f7
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
33 deletions
+33
-33
asv1.c
libavcodec/asv1.c
+2
-2
common.c
libavcodec/common.c
+1
-1
common.h
libavcodec/common.h
+1
-1
ffv1.c
libavcodec/ffv1.c
+2
-2
h263.c
libavcodec/h263.c
+6
-6
h264.c
libavcodec/h264.c
+1
-1
huffyuv.c
libavcodec/huffyuv.c
+1
-1
mjpeg.c
libavcodec/mjpeg.c
+4
-4
mpeg12.c
libavcodec/mpeg12.c
+1
-1
mpegvideo.c
libavcodec/mpegvideo.c
+13
-13
mpegvideo.h
libavcodec/mpegvideo.h
+1
-1
No files found.
libavcodec/asv1.c
View file @
fe455f33
...
...
@@ -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
);
...
...
libavcodec/common.c
View file @
fe455f33
...
...
@@ -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
;
...
...
libavcodec/common.h
View file @
fe455f33
...
...
@@ -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
);
...
...
libavcodec/ffv1.c
View file @
fe455f33
...
...
@@ -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
;
}
}
...
...
libavcodec/h263.c
View file @
fe455f33
...
...
@@ -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
...
...
libavcodec/h264.c
View file @
fe455f33
...
...
@@ -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
);
}
...
...
libavcodec/huffyuv.c
View file @
fe455f33
...
...
@@ -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
;
...
...
libavcodec/mjpeg.c
View file @
fe455f33
...
...
@@ -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
...
...
libavcodec/mpeg12.c
View file @
fe455f33
...
...
@@ -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
...
...
libavcodec/mpegvideo.c
View file @
fe455f33
...
...
@@ -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
();
...
...
libavcodec/mpegvideo.h
View file @
fe455f33
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment