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
6c98398b
Commit
6c98398b
authored
Jun 22, 2016
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/get_bits: add a logging context to check_marker()
Based on
d338abb6
parent
7475a935
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
41 deletions
+43
-41
get_bits.h
libavcodec/get_bits.h
+3
-2
intelh263dec.c
libavcodec/intelh263dec.c
+2
-2
ituh263dec.c
libavcodec/ituh263dec.c
+7
-7
mpeg12dec.c
libavcodec/mpeg12dec.c
+3
-3
mpeg4videodec.c
libavcodec/mpeg4videodec.c
+28
-27
No files found.
libavcodec/get_bits.h
View file @
6c98398b
...
...
@@ -398,11 +398,12 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n)
}
}
static
inline
int
check_marker
(
GetBitContext
*
s
,
const
char
*
msg
)
static
inline
int
check_marker
(
void
*
logctx
,
GetBitContext
*
s
,
const
char
*
msg
)
{
int
bit
=
get_bits1
(
s
);
if
(
!
bit
)
av_log
(
NULL
,
AV_LOG_INFO
,
"Marker bit missing at %d of %d %s
\n
"
,
get_bits_count
(
s
)
-
1
,
s
->
size_in_bits
,
msg
);
av_log
(
logctx
,
AV_LOG_INFO
,
"Marker bit missing at %d of %d %s
\n
"
,
get_bits_count
(
s
)
-
1
,
s
->
size_in_bits
,
msg
);
return
bit
;
}
...
...
libavcodec/intelh263dec.c
View file @
6c98398b
...
...
@@ -39,7 +39,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
}
s
->
picture_number
=
get_bits
(
&
s
->
gb
,
8
);
/* picture timestamp */
if
(
check_marker
(
&
s
->
gb
,
"after picture_number"
)
!=
1
)
{
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"after picture_number"
)
!=
1
)
{
return
-
1
;
/* marker */
}
if
(
get_bits1
(
&
s
->
gb
)
!=
0
)
{
...
...
@@ -95,7 +95,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
if
(
format
==
6
){
int
ar
=
get_bits
(
&
s
->
gb
,
4
);
skip_bits
(
&
s
->
gb
,
9
);
// display width
check_marker
(
&
s
->
gb
,
"in dimensions"
);
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"in dimensions"
);
skip_bits
(
&
s
->
gb
,
9
);
// display height
if
(
ar
==
15
){
s
->
avctx
->
sample_aspect_ratio
.
num
=
get_bits
(
&
s
->
gb
,
8
);
// aspect ratio - width
...
...
libavcodec/ituh263dec.c
View file @
6c98398b
...
...
@@ -175,17 +175,17 @@ static int h263_decode_gob_header(MpegEncContext *s)
return
-
1
;
if
(
s
->
h263_slice_structured
){
if
(
check_marker
(
&
s
->
gb
,
"before MBA"
)
==
0
)
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"before MBA"
)
==
0
)
return
-
1
;
ff_h263_decode_mba
(
s
);
if
(
s
->
mb_num
>
1583
)
if
(
check_marker
(
&
s
->
gb
,
"after MBA"
)
==
0
)
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"after MBA"
)
==
0
)
return
-
1
;
s
->
qscale
=
get_bits
(
&
s
->
gb
,
5
);
/* SQUANT */
if
(
check_marker
(
&
s
->
gb
,
"after SQUANT"
)
==
0
)
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"after SQUANT"
)
==
0
)
return
-
1
;
skip_bits
(
&
s
->
gb
,
2
);
/* GFID */
}
else
{
...
...
@@ -904,7 +904,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
s
->
picture_number
=
(
s
->
picture_number
&~
0xFF
)
+
i
;
/* PTYPE starts here */
if
(
check_marker
(
&
s
->
gb
,
"in PTYPE"
)
!=
1
)
{
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"in PTYPE"
)
!=
1
)
{
return
-
1
;
}
if
(
get_bits1
(
&
s
->
gb
)
!=
0
)
{
...
...
@@ -1025,7 +1025,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
6-14 - reserved
*/
width
=
(
get_bits
(
&
s
->
gb
,
9
)
+
1
)
*
4
;
check_marker
(
&
s
->
gb
,
"in dimensions"
);
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"in dimensions"
);
height
=
get_bits
(
&
s
->
gb
,
9
)
*
4
;
ff_dlog
(
s
->
avctx
,
"
\n
H.263+ Custom picture: %dx%d
\n
"
,
width
,
height
);
if
(
s
->
aspect_ratio_info
==
FF_ASPECT_EXTENDED
)
{
...
...
@@ -1120,13 +1120,13 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
return
AVERROR_INVALIDDATA
;
if
(
s
->
h263_slice_structured
){
if
(
check_marker
(
&
s
->
gb
,
"SEPB1"
)
!=
1
)
{
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"SEPB1"
)
!=
1
)
{
return
-
1
;
}
ff_h263_decode_mba
(
s
);
if
(
check_marker
(
&
s
->
gb
,
"SEPB2"
)
!=
1
)
{
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"SEPB2"
)
!=
1
)
{
return
-
1
;
}
}
...
...
libavcodec/mpeg12dec.c
View file @
6c98398b
...
...
@@ -767,7 +767,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
s
->
last_mv
[
0
][
1
][
1
]
=
mpeg_decode_motion
(
s
,
s
->
mpeg_f_code
[
0
][
1
],
s
->
last_mv
[
0
][
0
][
1
]);
check_marker
(
&
s
->
gb
,
"after concealment_motion_vectors"
);
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"after concealment_motion_vectors"
);
}
else
{
/* reset mv prediction */
memset
(
s
->
last_mv
,
0
,
sizeof
(
s
->
last_mv
));
...
...
@@ -1439,7 +1439,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
s
->
height
|=
(
vert_size_ext
<<
12
);
bit_rate_ext
=
get_bits
(
&
s
->
gb
,
12
);
/* XXX: handle it */
s
->
bit_rate
+=
(
bit_rate_ext
<<
18
)
*
400LL
;
check_marker
(
&
s
->
gb
,
"after bit rate extension"
);
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"after bit rate extension"
);
s
->
avctx
->
rc_buffer_size
+=
get_bits
(
&
s
->
gb
,
8
)
*
1024
*
16
<<
10
;
s
->
low_delay
=
get_bits1
(
&
s
->
gb
);
...
...
@@ -2130,7 +2130,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
s
->
frame_rate_index
=
1
;
}
s
->
bit_rate
=
get_bits
(
&
s
->
gb
,
18
)
*
400LL
;
if
(
check_marker
(
&
s
->
gb
,
"in sequence header"
)
==
0
)
{
if
(
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"in sequence header"
)
==
0
)
{
return
AVERROR_INVALIDDATA
;
}
...
...
libavcodec/mpeg4videodec.c
View file @
6c98398b
...
...
@@ -196,13 +196,13 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
x
=
get_xbits
(
gb
,
length
);
if
(
!
(
ctx
->
divx_version
==
500
&&
ctx
->
divx_build
==
413
))
check_marker
(
gb
,
"before sprite_trajectory"
);
check_marker
(
s
->
avctx
,
gb
,
"before sprite_trajectory"
);
length
=
get_vlc2
(
gb
,
sprite_trajectory
.
table
,
SPRITE_TRAJ_VLC_BITS
,
3
);
if
(
length
>
0
)
y
=
get_xbits
(
gb
,
length
);
check_marker
(
gb
,
"after sprite_trajectory"
);
check_marker
(
s
->
avctx
,
gb
,
"after sprite_trajectory"
);
ctx
->
sprite_traj
[
i
][
0
]
=
d
[
i
][
0
]
=
x
;
ctx
->
sprite_traj
[
i
][
1
]
=
d
[
i
][
1
]
=
y
;
}
...
...
@@ -381,12 +381,13 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
}
static
int
decode_new_pred
(
Mpeg4DecContext
*
ctx
,
GetBitContext
*
gb
)
{
MpegEncContext
*
s
=
&
ctx
->
m
;
int
len
=
FFMIN
(
ctx
->
time_increment_bits
+
3
,
15
);
get_bits
(
gb
,
len
);
if
(
get_bits1
(
gb
))
get_bits
(
gb
,
len
);
check_marker
(
gb
,
"after new_pred"
);
check_marker
(
s
->
avctx
,
gb
,
"after new_pred"
);
return
0
;
}
...
...
@@ -445,9 +446,9 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
while
(
get_bits1
(
&
s
->
gb
)
!=
0
)
time_incr
++
;
check_marker
(
&
s
->
gb
,
"before time_increment in video packed header"
);
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"before time_increment in video packed header"
);
skip_bits
(
&
s
->
gb
,
ctx
->
time_increment_bits
);
/* time_increment */
check_marker
(
&
s
->
gb
,
"before vop_coding_type in video packed header"
);
check_marker
(
s
->
avctx
,
&
s
->
gb
,
"before vop_coding_type in video packed header"
);
skip_bits
(
&
s
->
gb
,
2
);
/* vop coding type */
// FIXME not rect stuff here
...
...
@@ -1685,7 +1686,7 @@ static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb)
hours
=
get_bits
(
gb
,
5
);
minutes
=
get_bits
(
gb
,
6
);
check_marker
(
gb
,
"in gop_header"
);
check_marker
(
s
->
avctx
,
gb
,
"in gop_header"
);
seconds
=
get_bits
(
gb
,
6
);
s
->
time_base
=
seconds
+
60
*
(
minutes
+
60
*
hours
);
...
...
@@ -1740,16 +1741,16 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
s
->
low_delay
=
get_bits1
(
gb
);
if
(
get_bits1
(
gb
))
{
/* vbv parameters */
get_bits
(
gb
,
15
);
/* first_half_bitrate */
check_marker
(
gb
,
"after first_half_bitrate"
);
check_marker
(
s
->
avctx
,
gb
,
"after first_half_bitrate"
);
get_bits
(
gb
,
15
);
/* latter_half_bitrate */
check_marker
(
gb
,
"after latter_half_bitrate"
);
check_marker
(
s
->
avctx
,
gb
,
"after latter_half_bitrate"
);
get_bits
(
gb
,
15
);
/* first_half_vbv_buffer_size */
check_marker
(
gb
,
"after first_half_vbv_buffer_size"
);
check_marker
(
s
->
avctx
,
gb
,
"after first_half_vbv_buffer_size"
);
get_bits
(
gb
,
3
);
/* latter_half_vbv_buffer_size */
get_bits
(
gb
,
11
);
/* first_half_vbv_occupancy */
check_marker
(
gb
,
"after first_half_vbv_occupancy"
);
check_marker
(
s
->
avctx
,
gb
,
"after first_half_vbv_occupancy"
);
get_bits
(
gb
,
15
);
/* latter_half_vbv_occupancy */
check_marker
(
gb
,
"after latter_half_vbv_occupancy"
);
check_marker
(
s
->
avctx
,
gb
,
"after latter_half_vbv_occupancy"
);
}
}
else
{
/* is setting low delay flag only once the smartest thing to do?
...
...
@@ -1774,7 +1775,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
skip_bits
(
gb
,
4
);
/* video_object_layer_shape_extension */
}
check_marker
(
gb
,
"before time_increment_resolution"
);
check_marker
(
s
->
avctx
,
gb
,
"before time_increment_resolution"
);
s
->
avctx
->
framerate
.
num
=
get_bits
(
gb
,
16
);
if
(
!
s
->
avctx
->
framerate
.
num
)
{
...
...
@@ -1786,7 +1787,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
if
(
ctx
->
time_increment_bits
<
1
)
ctx
->
time_increment_bits
=
1
;
check_marker
(
gb
,
"before fixed_vop_rate"
);
check_marker
(
s
->
avctx
,
gb
,
"before fixed_vop_rate"
);
if
(
get_bits1
(
gb
)
!=
0
)
/* fixed_vop_rate */
s
->
avctx
->
framerate
.
den
=
get_bits
(
gb
,
ctx
->
time_increment_bits
);
...
...
@@ -1799,11 +1800,11 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
if
(
ctx
->
shape
!=
BIN_ONLY_SHAPE
)
{
if
(
ctx
->
shape
==
RECT_SHAPE
)
{
check_marker
(
gb
,
"before width"
);
check_marker
(
s
->
avctx
,
gb
,
"before width"
);
width
=
get_bits
(
gb
,
13
);
check_marker
(
gb
,
"before height"
);
check_marker
(
s
->
avctx
,
gb
,
"before height"
);
height
=
get_bits
(
gb
,
13
);
check_marker
(
gb
,
"after height"
);
check_marker
(
s
->
avctx
,
gb
,
"after height"
);
if
(
width
&&
height
&&
/* they should be non zero but who knows */
!
(
s
->
width
&&
s
->
codec_tag
==
AV_RL32
(
"MP4S"
)))
{
if
(
s
->
width
&&
s
->
height
&&
...
...
@@ -1831,13 +1832,13 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
ctx
->
vol_sprite_usage
==
GMC_SPRITE
)
{
if
(
ctx
->
vol_sprite_usage
==
STATIC_SPRITE
)
{
skip_bits
(
gb
,
13
);
// sprite_width
check_marker
(
gb
,
"after sprite_width"
);
check_marker
(
s
->
avctx
,
gb
,
"after sprite_width"
);
skip_bits
(
gb
,
13
);
// sprite_height
check_marker
(
gb
,
"after sprite_height"
);
check_marker
(
s
->
avctx
,
gb
,
"after sprite_height"
);
skip_bits
(
gb
,
13
);
// sprite_left
check_marker
(
gb
,
"after sprite_left"
);
check_marker
(
s
->
avctx
,
gb
,
"after sprite_left"
);
skip_bits
(
gb
,
13
);
// sprite_top
check_marker
(
gb
,
"after sprite_top"
);
check_marker
(
s
->
avctx
,
gb
,
"after sprite_top"
);
}
ctx
->
num_sprite_warping_points
=
get_bits
(
gb
,
6
);
if
(
ctx
->
num_sprite_warping_points
>
3
)
{
...
...
@@ -1970,7 +1971,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
ctx
->
cplx_estimation_trash_p
+=
8
*
get_bits1
(
gb
);
/* inter4v_blocks */
ctx
->
cplx_estimation_trash_i
+=
8
*
get_bits1
(
gb
);
/* not coded blocks */
}
if
(
!
check_marker
(
gb
,
"in complexity estimation part 1"
))
{
if
(
!
check_marker
(
s
->
avctx
,
gb
,
"in complexity estimation part 1"
))
{
skip_bits_long
(
gb
,
pos
-
get_bits_count
(
gb
));
goto
no_cplx_est
;
}
...
...
@@ -1988,7 +1989,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
ctx
->
cplx_estimation_trash_p
+=
8
*
get_bits1
(
gb
);
/* halfpel2 */
ctx
->
cplx_estimation_trash_p
+=
8
*
get_bits1
(
gb
);
/* halfpel4 */
}
if
(
!
check_marker
(
gb
,
"in complexity estimation part 2"
))
{
if
(
!
check_marker
(
s
->
avctx
,
gb
,
"in complexity estimation part 2"
))
{
skip_bits_long
(
gb
,
pos
-
get_bits_count
(
gb
));
goto
no_cplx_est
;
}
...
...
@@ -2262,7 +2263,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
while
(
get_bits1
(
gb
)
!=
0
)
time_incr
++
;
check_marker
(
gb
,
"before time_increment"
);
check_marker
(
s
->
avctx
,
gb
,
"before time_increment"
);
if
(
ctx
->
time_increment_bits
==
0
||
!
(
show_bits
(
gb
,
ctx
->
time_increment_bits
+
1
)
&
1
))
{
...
...
@@ -2341,7 +2342,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
pts
=
AV_NOPTS_VALUE
;
ff_dlog
(
s
->
avctx
,
"MPEG4 PTS: %"
PRId64
"
\n
"
,
pts
);
check_marker
(
gb
,
"before vop_coded"
);
check_marker
(
s
->
avctx
,
gb
,
"before vop_coded"
);
/* vop coded */
if
(
get_bits1
(
gb
)
!=
1
)
{
...
...
@@ -2366,11 +2367,11 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
if
(
ctx
->
shape
!=
RECT_SHAPE
)
{
if
(
ctx
->
vol_sprite_usage
!=
1
||
s
->
pict_type
!=
AV_PICTURE_TYPE_I
)
{
skip_bits
(
gb
,
13
);
/* width */
check_marker
(
gb
,
"after width"
);
check_marker
(
s
->
avctx
,
gb
,
"after width"
);
skip_bits
(
gb
,
13
);
/* height */
check_marker
(
gb
,
"after height"
);
check_marker
(
s
->
avctx
,
gb
,
"after height"
);
skip_bits
(
gb
,
13
);
/* hor_spat_ref */
check_marker
(
gb
,
"after hor_spat_ref"
);
check_marker
(
s
->
avctx
,
gb
,
"after hor_spat_ref"
);
skip_bits
(
gb
,
13
);
/* ver_spat_ref */
}
skip_bits1
(
gb
);
/* change_CR_disable */
...
...
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