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
3574a85c
Commit
3574a85c
authored
Mar 05, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace computations of remaining bits with calls to get_bits_left().
parent
b70feb40
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
18 additions
and
19 deletions
+18
-19
escape124.c
libavcodec/escape124.c
+1
-1
h261dec.c
libavcodec/h261dec.c
+1
-1
h263dec.c
libavcodec/h263dec.c
+1
-1
h264.c
libavcodec/h264.c
+3
-3
h264_ps.c
libavcodec/h264_ps.c
+2
-2
h264_sei.c
libavcodec/h264_sei.c
+1
-1
huffyuv.c
libavcodec/huffyuv.c
+2
-2
ituh263dec.c
libavcodec/ituh263dec.c
+2
-2
mjpegdec.c
libavcodec/mjpegdec.c
+4
-5
vp6.c
libavcodec/vp6.c
+1
-1
No files found.
libavcodec/escape124.c
View file @
3574a85c
...
@@ -49,7 +49,7 @@ typedef struct Escape124Context {
...
@@ -49,7 +49,7 @@ typedef struct Escape124Context {
}
Escape124Context
;
}
Escape124Context
;
static
int
can_safely_read
(
GetBitContext
*
gb
,
int
bits
)
{
static
int
can_safely_read
(
GetBitContext
*
gb
,
int
bits
)
{
return
get_bits_
count
(
gb
)
+
bits
<=
gb
->
size_in_
bits
;
return
get_bits_
left
(
gb
)
>=
bits
;
}
}
/**
/**
...
...
libavcodec/h261dec.c
View file @
3574a85c
...
@@ -265,7 +265,7 @@ static int h261_decode_mb(H261Context *h){
...
@@ -265,7 +265,7 @@ static int h261_decode_mb(H261Context *h){
while
(
h
->
mba_diff
==
MBA_STUFFING
);
// stuffing
while
(
h
->
mba_diff
==
MBA_STUFFING
);
// stuffing
if
(
h
->
mba_diff
<
0
){
if
(
h
->
mba_diff
<
0
){
if
(
get_bits_count
(
&
s
->
gb
)
+
7
>=
s
->
gb
.
size_in_bits
)
if
(
get_bits_left
(
&
s
->
gb
)
<=
7
)
return
SLICE_END
;
return
SLICE_END
;
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"illegal mba at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"illegal mba at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
...
...
libavcodec/h263dec.c
View file @
3574a85c
...
@@ -650,7 +650,7 @@ retry:
...
@@ -650,7 +650,7 @@ retry:
ret
=
decode_slice
(
s
);
ret
=
decode_slice
(
s
);
while
(
s
->
mb_y
<
s
->
mb_height
){
while
(
s
->
mb_y
<
s
->
mb_height
){
if
(
s
->
msmpeg4_version
){
if
(
s
->
msmpeg4_version
){
if
(
s
->
slice_height
==
0
||
s
->
mb_x
!=
0
||
(
s
->
mb_y
%
s
->
slice_height
)
!=
0
||
get_bits_
count
(
&
s
->
gb
)
>
s
->
gb
.
size_in_bits
)
if
(
s
->
slice_height
==
0
||
s
->
mb_x
!=
0
||
(
s
->
mb_y
%
s
->
slice_height
)
!=
0
||
get_bits_
left
(
&
s
->
gb
)
<
0
)
break
;
break
;
}
else
{
}
else
{
int
prev_x
=
s
->
mb_x
,
prev_y
=
s
->
mb_y
;
int
prev_x
=
s
->
mb_x
,
prev_y
=
s
->
mb_y
;
...
...
libavcodec/h264.c
View file @
3574a85c
...
@@ -3667,7 +3667,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -3667,7 +3667,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if
(
s
->
mb_y
>=
s
->
mb_height
){
if
(
s
->
mb_y
>=
s
->
mb_height
){
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
if
(
get_bits_count
(
&
s
->
gb
)
==
s
->
gb
.
size_in_bits
)
{
if
(
get_bits_left
(
&
s
->
gb
)
==
0
)
{
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
ER_MB_END
&
part_mask
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
ER_MB_END
&
part_mask
);
return
0
;
return
0
;
...
@@ -3679,9 +3679,9 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -3679,9 +3679,9 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
}
}
}
}
if
(
get_bits_count
(
&
s
->
gb
)
>=
s
->
gb
.
size_in_bits
&&
s
->
mb_skip_run
<=
0
){
if
(
get_bits_left
(
&
s
->
gb
)
<=
0
&&
s
->
mb_skip_run
<=
0
){
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
if
(
get_bits_count
(
&
s
->
gb
)
==
s
->
gb
.
size_in_bits
)
{
if
(
get_bits_left
(
&
s
->
gb
)
==
0
)
{
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
ER_MB_END
&
part_mask
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
ER_MB_END
&
part_mask
);
if
(
s
->
mb_x
>
lf_x_start
)
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
);
if
(
s
->
mb_x
>
lf_x_start
)
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
);
...
...
libavcodec/h264_ps.c
View file @
3574a85c
...
@@ -227,8 +227,8 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
...
@@ -227,8 +227,8 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
sps
->
num_reorder_frames
=
get_ue_golomb
(
&
s
->
gb
);
sps
->
num_reorder_frames
=
get_ue_golomb
(
&
s
->
gb
);
get_ue_golomb
(
&
s
->
gb
);
/*max_dec_frame_buffering*/
get_ue_golomb
(
&
s
->
gb
);
/*max_dec_frame_buffering*/
if
(
s
->
gb
.
size_in_bits
<
get_bits_count
(
&
s
->
gb
))
{
if
(
get_bits_left
(
&
s
->
gb
)
<
0
)
{
av_log
(
h
->
s
.
avctx
,
AV_LOG_ERROR
,
"Overread VUI by %d bits
\n
"
,
get_bits_count
(
&
s
->
gb
)
-
s
->
gb
.
size_in_bits
);
av_log
(
h
->
s
.
avctx
,
AV_LOG_ERROR
,
"Overread VUI by %d bits
\n
"
,
-
get_bits_left
(
&
s
->
gb
)
);
sps
->
num_reorder_frames
=
0
;
sps
->
num_reorder_frames
=
0
;
sps
->
bitstream_restriction_flag
=
0
;
sps
->
bitstream_restriction_flag
=
0
;
}
}
...
...
libavcodec/h264_sei.c
View file @
3574a85c
...
@@ -164,7 +164,7 @@ static int decode_buffering_period(H264Context *h){
...
@@ -164,7 +164,7 @@ static int decode_buffering_period(H264Context *h){
int
ff_h264_decode_sei
(
H264Context
*
h
){
int
ff_h264_decode_sei
(
H264Context
*
h
){
MpegEncContext
*
const
s
=
&
h
->
s
;
MpegEncContext
*
const
s
=
&
h
->
s
;
while
(
get_bits_count
(
&
s
->
gb
)
+
16
<
s
->
gb
.
size_in_bits
)
{
while
(
get_bits_left
(
&
s
->
gb
)
>
16
)
{
int
size
,
type
;
int
size
,
type
;
type
=
0
;
type
=
0
;
...
...
libavcodec/huffyuv.c
View file @
3574a85c
...
@@ -718,7 +718,7 @@ static void decode_422_bitstream(HYuvContext *s, int count){
...
@@ -718,7 +718,7 @@ static void decode_422_bitstream(HYuvContext *s, int count){
count
/=
2
;
count
/=
2
;
if
(
count
>=
(
get_bits_left
(
&
s
->
gb
))
/
(
31
*
4
)){
if
(
count
>=
(
get_bits_left
(
&
s
->
gb
))
/
(
31
*
4
)){
for
(
i
=
0
;
i
<
count
&&
get_bits_count
(
&
s
->
gb
)
<
s
->
gb
.
size_in_bits
;
i
++
)
{
for
(
i
=
0
;
i
<
count
&&
get_bits_left
(
&
s
->
gb
)
>
0
;
i
++
)
{
READ_2PIX
(
s
->
temp
[
0
][
2
*
i
],
s
->
temp
[
1
][
i
],
1
);
READ_2PIX
(
s
->
temp
[
0
][
2
*
i
],
s
->
temp
[
1
][
i
],
1
);
READ_2PIX
(
s
->
temp
[
0
][
2
*
i
+
1
],
s
->
temp
[
2
][
i
],
2
);
READ_2PIX
(
s
->
temp
[
0
][
2
*
i
+
1
],
s
->
temp
[
2
][
i
],
2
);
}
}
...
@@ -736,7 +736,7 @@ static void decode_gray_bitstream(HYuvContext *s, int count){
...
@@ -736,7 +736,7 @@ static void decode_gray_bitstream(HYuvContext *s, int count){
count
/=
2
;
count
/=
2
;
if
(
count
>=
(
get_bits_left
(
&
s
->
gb
))
/
(
31
*
2
)){
if
(
count
>=
(
get_bits_left
(
&
s
->
gb
))
/
(
31
*
2
)){
for
(
i
=
0
;
i
<
count
&&
get_bits_count
(
&
s
->
gb
)
<
s
->
gb
.
size_in_bits
;
i
++
)
{
for
(
i
=
0
;
i
<
count
&&
get_bits_left
(
&
s
->
gb
)
>
0
;
i
++
)
{
READ_2PIX
(
s
->
temp
[
0
][
2
*
i
],
s
->
temp
[
0
][
2
*
i
+
1
],
0
);
READ_2PIX
(
s
->
temp
[
0
][
2
*
i
],
s
->
temp
[
0
][
2
*
i
+
1
],
0
);
}
}
}
else
{
}
else
{
...
...
libavcodec/ituh263dec.c
View file @
3574a85c
...
@@ -852,8 +852,8 @@ end:
...
@@ -852,8 +852,8 @@ end:
{
{
int
v
=
show_bits
(
&
s
->
gb
,
16
);
int
v
=
show_bits
(
&
s
->
gb
,
16
);
if
(
get_bits_count
(
&
s
->
gb
)
+
16
>
s
->
gb
.
size_in_bits
)
{
if
(
get_bits_left
(
&
s
->
gb
)
<
16
)
{
v
>>=
get_bits_count
(
&
s
->
gb
)
+
16
-
s
->
gb
.
size_in_bits
;
v
>>=
16
-
get_bits_left
(
&
s
->
gb
)
;
}
}
if
(
v
==
0
)
if
(
v
==
0
)
...
...
libavcodec/mjpegdec.c
View file @
3574a85c
...
@@ -854,9 +854,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
...
@@ -854,9 +854,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
if
(
s
->
restart_interval
&&
!
s
->
restart_count
)
if
(
s
->
restart_interval
&&
!
s
->
restart_count
)
s
->
restart_count
=
s
->
restart_interval
;
s
->
restart_count
=
s
->
restart_interval
;
if
(
get_bits_
count
(
&
s
->
gb
)
>
s
->
gb
.
size_in_bits
)
{
if
(
get_bits_
left
(
&
s
->
gb
)
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"overread %d
\n
"
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"overread %d
\n
"
,
get_bits_count
(
&
s
->
gb
)
-
s
->
gb
.
size_in_bits
);
-
get_bits_left
(
&
s
->
gb
)
);
return
-
1
;
return
-
1
;
}
}
for
(
i
=
0
;
i
<
nb_components
;
i
++
)
{
for
(
i
=
0
;
i
<
nb_components
;
i
++
)
{
...
@@ -1147,7 +1147,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
...
@@ -1147,7 +1147,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len
=
get_bits
(
&
s
->
gb
,
16
);
len
=
get_bits
(
&
s
->
gb
,
16
);
if
(
len
<
5
)
if
(
len
<
5
)
return
-
1
;
return
-
1
;
if
(
8
*
len
+
get_bits_count
(
&
s
->
gb
)
>
s
->
gb
.
size_in_bits
)
if
(
8
*
len
>
get_bits_left
(
&
s
->
gb
)
)
return
-
1
;
return
-
1
;
id
=
get_bits_long
(
&
s
->
gb
,
32
);
id
=
get_bits_long
(
&
s
->
gb
,
32
);
...
@@ -1288,8 +1288,7 @@ out:
...
@@ -1288,8 +1288,7 @@ out:
static
int
mjpeg_decode_com
(
MJpegDecodeContext
*
s
)
static
int
mjpeg_decode_com
(
MJpegDecodeContext
*
s
)
{
{
int
len
=
get_bits
(
&
s
->
gb
,
16
);
int
len
=
get_bits
(
&
s
->
gb
,
16
);
if
(
len
>=
2
&&
if
(
len
>=
2
&&
8
*
len
-
16
<=
get_bits_left
(
&
s
->
gb
))
{
8
*
len
-
16
+
get_bits_count
(
&
s
->
gb
)
<=
s
->
gb
.
size_in_bits
)
{
char
*
cbuf
=
av_malloc
(
len
-
1
);
char
*
cbuf
=
av_malloc
(
len
-
1
);
if
(
cbuf
)
{
if
(
cbuf
)
{
int
i
;
int
i
;
...
...
libavcodec/vp6.c
View file @
3574a85c
...
@@ -387,7 +387,7 @@ static void vp6_parse_coeff_huffman(VP56Context *s)
...
@@ -387,7 +387,7 @@ static void vp6_parse_coeff_huffman(VP56Context *s)
if
(
coeff_idx
)
if
(
coeff_idx
)
break
;
break
;
}
else
{
}
else
{
if
(
get_bits_
count
(
&
s
->
gb
)
>=
s
->
gb
.
size_in_bits
)
if
(
get_bits_
left
(
&
s
->
gb
)
<=
0
)
return
;
return
;
coeff
=
get_vlc2
(
&
s
->
gb
,
vlc_coeff
->
table
,
9
,
3
);
coeff
=
get_vlc2
(
&
s
->
gb
,
vlc_coeff
->
table
,
9
,
3
);
if
(
coeff
==
0
)
{
if
(
coeff
==
0
)
{
...
...
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