Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
a61f8265
Commit
a61f8265
authored
22 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
better padding bug detection
Originally committed as revision 1039 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
ec6a3752
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavcodec/h263dec.c
+36
-3
36 additions, 3 deletions
libavcodec/h263dec.c
libavcodec/mpegvideo.h
+1
-0
1 addition, 0 deletions
libavcodec/mpegvideo.h
with
37 additions
and
3 deletions
libavcodec/h263dec.c
+
36
−
3
View file @
a61f8265
...
@@ -208,7 +208,9 @@ static int decode_slice(MpegEncContext *s){
...
@@ -208,7 +208,9 @@ static int decode_slice(MpegEncContext *s){
s
->
error_status_table
[
xy
]
|=
AC_END
;
s
->
error_status_table
[
xy
]
|=
AC_END
;
if
(
!
s
->
partitioned_frame
)
if
(
!
s
->
partitioned_frame
)
s
->
error_status_table
[
xy
]
|=
MV_END
|
DC_END
;
s
->
error_status_table
[
xy
]
|=
MV_END
|
DC_END
;
s
->
padding_bug_score
--
;
if
(
++
s
->
mb_x
>=
s
->
mb_width
){
if
(
++
s
->
mb_x
>=
s
->
mb_width
){
s
->
mb_x
=
0
;
s
->
mb_x
=
0
;
ff_draw_horiz_band
(
s
);
ff_draw_horiz_band
(
s
);
...
@@ -237,6 +239,35 @@ static int decode_slice(MpegEncContext *s){
...
@@ -237,6 +239,35 @@ static int decode_slice(MpegEncContext *s){
assert
(
s
->
mb_x
==
0
&&
s
->
mb_y
==
s
->
mb_height
);
assert
(
s
->
mb_x
==
0
&&
s
->
mb_y
==
s
->
mb_height
);
/* try to detect the padding bug */
if
(
s
->
codec_id
==
CODEC_ID_MPEG4
&&
(
s
->
workaround_bugs
&
FF_BUG_AUTODETECT
)
&&
s
->
gb
.
size
*
8
-
get_bits_count
(
&
s
->
gb
)
>=
0
&&
s
->
gb
.
size
*
8
-
get_bits_count
(
&
s
->
gb
)
<
48
&&
!
s
->
resync_marker
&&
!
s
->
data_partitioning
){
const
int
bits_count
=
get_bits_count
(
&
s
->
gb
);
const
int
bits_left
=
s
->
gb
.
size
*
8
-
bits_count
;
if
(
bits_left
==
0
||
bits_left
>
8
){
s
->
padding_bug_score
++
;
}
else
{
int
v
=
show_bits
(
&
s
->
gb
,
8
);
v
|=
0x7F
>>
(
7
-
(
bits_count
&
7
));
if
(
v
==
0x7F
)
s
->
padding_bug_score
--
;
else
s
->
padding_bug_score
++
;
}
if
(
s
->
padding_bug_score
>
-
2
)
s
->
workaround_bugs
|=
FF_BUG_NO_PADDING
;
else
s
->
workaround_bugs
&=
~
FF_BUG_NO_PADDING
;
}
// handle formats which dont have unique end markers
// handle formats which dont have unique end markers
if
(
s
->
msmpeg4_version
||
(
s
->
workaround_bugs
&
FF_BUG_NO_PADDING
)){
//FIXME perhaps solve this more cleanly
if
(
s
->
msmpeg4_version
||
(
s
->
workaround_bugs
&
FF_BUG_NO_PADDING
)){
//FIXME perhaps solve this more cleanly
int
left
=
s
->
gb
.
size
*
8
-
get_bits_count
(
&
s
->
gb
);
int
left
=
s
->
gb
.
size
*
8
-
get_bits_count
(
&
s
->
gb
);
...
@@ -262,7 +293,7 @@ static int decode_slice(MpegEncContext *s){
...
@@ -262,7 +293,7 @@ static int decode_slice(MpegEncContext *s){
return
0
;
return
0
;
}
}
fprintf
(
stderr
,
"slice end not reached but screenspace end (%d left %06X)
\n
"
,
fprintf
(
stderr
,
"slice end not reached but screenspace end (%d left %06X)
\n
"
,
s
->
gb
.
size
*
8
-
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size
*
8
-
get_bits_count
(
&
s
->
gb
),
show_bits
(
&
s
->
gb
,
24
));
show_bits
(
&
s
->
gb
,
24
));
...
@@ -341,7 +372,8 @@ uint64_t time= rdtsc();
...
@@ -341,7 +372,8 @@ uint64_t time= rdtsc();
s
->
workaround_bugs
|=
FF_BUG_UMP4
;
s
->
workaround_bugs
|=
FF_BUG_UMP4
;
s
->
workaround_bugs
|=
FF_BUG_AC_VLC
;
s
->
workaround_bugs
|=
FF_BUG_AC_VLC
;
}
}
//printf("padding_bug_score: %d\n", s->padding_bug_score);
#if 0
if(s->divx_version==500)
if(s->divx_version==500)
s->workaround_bugs|= FF_BUG_NO_PADDING;
s->workaround_bugs|= FF_BUG_NO_PADDING;
...
@@ -354,6 +386,7 @@ uint64_t time= rdtsc();
...
@@ -354,6 +386,7 @@ uint64_t time= rdtsc();
if(s->lavc_build && s->lavc_build<4609) //FIXME not sure about the version num but a 4609 file seems ok
if(s->lavc_build && s->lavc_build<4609) //FIXME not sure about the version num but a 4609 file seems ok
s->workaround_bugs|= FF_BUG_NO_PADDING;
s->workaround_bugs|= FF_BUG_NO_PADDING;
#endif
}
}
...
...
This diff is collapsed.
Click to expand it.
libavcodec/mpegvideo.h
+
1
−
0
View file @
a61f8265
...
@@ -404,6 +404,7 @@ typedef struct MpegEncContext {
...
@@ -404,6 +404,7 @@ typedef struct MpegEncContext {
INT16
(
*
field_mv_table
)[
2
][
2
];
/* used for interlaced b frame decoding */
INT16
(
*
field_mv_table
)[
2
][
2
];
/* used for interlaced b frame decoding */
INT8
(
*
field_select_table
)[
2
];
/* wtf, no really another table for interlaced b frames */
INT8
(
*
field_select_table
)[
2
];
/* wtf, no really another table for interlaced b frames */
int
t_frame
;
/* time distance of first I -> B, used for interlaced b frames */
int
t_frame
;
/* time distance of first I -> B, used for interlaced b frames */
int
padding_bug_score
;
/* used to detect the VERY common padding bug in MPEG4 */
/* divx specific, used to workaround (many) bugs in divx5 */
/* divx specific, used to workaround (many) bugs in divx5 */
int
divx_version
;
int
divx_version
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment