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
6c9b82b6
Commit
6c9b82b6
authored
Nov 30, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mpeg4videodec: move bug workaround code into seperate function
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
ee9d53e5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
104 deletions
+115
-104
h263dec.c
libavcodec/h263dec.c
+1
-104
mpeg4video.h
libavcodec/mpeg4video.h
+1
-0
mpeg4videodec.c
libavcodec/mpeg4videodec.c
+113
-0
No files found.
libavcodec/h263dec.c
View file @
6c9b82b6
...
@@ -491,111 +491,8 @@ retry:
...
@@ -491,111 +491,8 @@ retry:
avctx
->
has_b_frames
=
!
s
->
low_delay
;
avctx
->
has_b_frames
=
!
s
->
low_delay
;
if
(
s
->
xvid_build
==
-
1
&&
s
->
divx_version
==
-
1
&&
s
->
lavc_build
==
-
1
)
{
if
(
ff_mpeg4_workaround_bugs
(
avctx
)
==
1
)
if
(
s
->
stream_codec_tag
==
AV_RL32
(
"XVID"
)
||
s
->
codec_tag
==
AV_RL32
(
"XVID"
)
||
s
->
codec_tag
==
AV_RL32
(
"XVIX"
)
||
s
->
codec_tag
==
AV_RL32
(
"RMP4"
)
||
s
->
codec_tag
==
AV_RL32
(
"ZMP4"
)
||
s
->
codec_tag
==
AV_RL32
(
"SIPP"
))
s
->
xvid_build
=
0
;
}
if
(
s
->
xvid_build
==
-
1
&&
s
->
divx_version
==
-
1
&&
s
->
lavc_build
==
-
1
)
if
(
s
->
codec_tag
==
AV_RL32
(
"DIVX"
)
&&
s
->
vo_type
==
0
&&
s
->
vol_control_parameters
==
0
)
s
->
divx_version
=
400
;
// divx 4
if
(
s
->
xvid_build
>=
0
&&
s
->
divx_version
>=
0
)
{
s
->
divx_version
=
s
->
divx_build
=
-
1
;
}
if
(
s
->
workaround_bugs
&
FF_BUG_AUTODETECT
)
{
if
(
s
->
codec_tag
==
AV_RL32
(
"XVIX"
))
s
->
workaround_bugs
|=
FF_BUG_XVID_ILACE
;
if
(
s
->
codec_tag
==
AV_RL32
(
"UMP4"
))
s
->
workaround_bugs
|=
FF_BUG_UMP4
;
if
(
s
->
divx_version
>=
500
&&
s
->
divx_build
<
1814
)
s
->
workaround_bugs
|=
FF_BUG_QPEL_CHROMA
;
if
(
s
->
divx_version
>
502
&&
s
->
divx_build
<
1814
)
s
->
workaround_bugs
|=
FF_BUG_QPEL_CHROMA2
;
if
(
s
->
xvid_build
<=
3U
)
s
->
padding_bug_score
=
256
*
256
*
256
*
64
;
if
(
s
->
xvid_build
<=
1U
)
s
->
workaround_bugs
|=
FF_BUG_QPEL_CHROMA
;
if
(
s
->
xvid_build
<=
12U
)
s
->
workaround_bugs
|=
FF_BUG_EDGE
;
if
(
s
->
xvid_build
<=
32U
)
s
->
workaround_bugs
|=
FF_BUG_DC_CLIP
;
#define SET_QPEL_FUNC(postfix1, postfix2) \
s->dsp.put_ ## postfix1 = ff_put_ ## postfix2; \
s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \
s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
if
(
s
->
lavc_build
<
4653U
)
s
->
workaround_bugs
|=
FF_BUG_STD_QPEL
;
if
(
s
->
lavc_build
<
4655U
)
s
->
workaround_bugs
|=
FF_BUG_DIRECT_BLOCKSIZE
;
if
(
s
->
lavc_build
<
4670U
)
s
->
workaround_bugs
|=
FF_BUG_EDGE
;
if
(
s
->
lavc_build
<=
4712U
)
s
->
workaround_bugs
|=
FF_BUG_DC_CLIP
;
if
(
s
->
divx_version
>=
0
)
s
->
workaround_bugs
|=
FF_BUG_DIRECT_BLOCKSIZE
;
if
(
s
->
divx_version
==
501
&&
s
->
divx_build
==
20020416
)
s
->
padding_bug_score
=
256
*
256
*
256
*
64
;
if
(
s
->
divx_version
<
500U
)
s
->
workaround_bugs
|=
FF_BUG_EDGE
;
if
(
s
->
divx_version
>=
0
)
s
->
workaround_bugs
|=
FF_BUG_HPEL_CHROMA
;
}
if
(
s
->
workaround_bugs
&
FF_BUG_STD_QPEL
)
{
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
5
],
qpel16_mc11_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
7
],
qpel16_mc31_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
9
],
qpel16_mc12_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
11
],
qpel16_mc32_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
13
],
qpel16_mc13_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
15
],
qpel16_mc33_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
5
],
qpel8_mc11_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
7
],
qpel8_mc31_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
9
],
qpel8_mc12_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
11
],
qpel8_mc32_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
13
],
qpel8_mc13_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
15
],
qpel8_mc33_old_c
)
}
if
(
avctx
->
debug
&
FF_DEBUG_BUGS
)
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s
\n
"
,
s
->
workaround_bugs
,
s
->
lavc_build
,
s
->
xvid_build
,
s
->
divx_version
,
s
->
divx_build
,
s
->
divx_packed
?
"p"
:
""
);
#if HAVE_MMX
if
(
s
->
codec_id
==
AV_CODEC_ID_MPEG4
&&
s
->
xvid_build
>=
0
&&
avctx
->
idct_algo
==
FF_IDCT_AUTO
&&
(
av_get_cpu_flags
()
&
AV_CPU_FLAG_MMX
))
{
avctx
->
idct_algo
=
FF_IDCT_XVIDMMX
;
ff_dct_common_init
(
s
);
goto
retry
;
goto
retry
;
}
#endif
/* After H263 & mpeg4 header decode we have the height, width,
/* After H263 & mpeg4 header decode we have the height, width,
* and other parameters. So then we could init the picture.
* and other parameters. So then we could init the picture.
...
...
libavcodec/mpeg4video.h
View file @
6c9b82b6
...
@@ -119,6 +119,7 @@ int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
...
@@ -119,6 +119,7 @@ int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
int
ff_mpeg4_decode_video_packet_header
(
Mpeg4DecContext
*
ctx
);
int
ff_mpeg4_decode_video_packet_header
(
Mpeg4DecContext
*
ctx
);
void
ff_mpeg4_init_direct_mv
(
MpegEncContext
*
s
);
void
ff_mpeg4_init_direct_mv
(
MpegEncContext
*
s
);
void
ff_mpeg4videodec_static_init
(
void
);
void
ff_mpeg4videodec_static_init
(
void
);
int
ff_mpeg4_workaround_bugs
(
AVCodecContext
*
avctx
);
/**
/**
*
*
...
...
libavcodec/mpeg4videodec.c
View file @
6c9b82b6
...
@@ -2095,6 +2095,119 @@ static int decode_user_data(MpegEncContext *s, GetBitContext *gb)
...
@@ -2095,6 +2095,119 @@ static int decode_user_data(MpegEncContext *s, GetBitContext *gb)
return
0
;
return
0
;
}
}
int
ff_mpeg4_workaround_bugs
(
AVCodecContext
*
avctx
)
{
Mpeg4DecContext
*
ctx
=
avctx
->
priv_data
;
MpegEncContext
*
s
=
&
ctx
->
m
;
if
(
s
->
xvid_build
==
-
1
&&
s
->
divx_version
==
-
1
&&
s
->
lavc_build
==
-
1
)
{
if
(
s
->
stream_codec_tag
==
AV_RL32
(
"XVID"
)
||
s
->
codec_tag
==
AV_RL32
(
"XVID"
)
||
s
->
codec_tag
==
AV_RL32
(
"XVIX"
)
||
s
->
codec_tag
==
AV_RL32
(
"RMP4"
)
||
s
->
codec_tag
==
AV_RL32
(
"ZMP4"
)
||
s
->
codec_tag
==
AV_RL32
(
"SIPP"
))
s
->
xvid_build
=
0
;
}
if
(
s
->
xvid_build
==
-
1
&&
s
->
divx_version
==
-
1
&&
s
->
lavc_build
==
-
1
)
if
(
s
->
codec_tag
==
AV_RL32
(
"DIVX"
)
&&
s
->
vo_type
==
0
&&
s
->
vol_control_parameters
==
0
)
s
->
divx_version
=
400
;
// divx 4
if
(
s
->
xvid_build
>=
0
&&
s
->
divx_version
>=
0
)
{
s
->
divx_version
=
s
->
divx_build
=
-
1
;
}
if
(
s
->
workaround_bugs
&
FF_BUG_AUTODETECT
)
{
if
(
s
->
codec_tag
==
AV_RL32
(
"XVIX"
))
s
->
workaround_bugs
|=
FF_BUG_XVID_ILACE
;
if
(
s
->
codec_tag
==
AV_RL32
(
"UMP4"
))
s
->
workaround_bugs
|=
FF_BUG_UMP4
;
if
(
s
->
divx_version
>=
500
&&
s
->
divx_build
<
1814
)
s
->
workaround_bugs
|=
FF_BUG_QPEL_CHROMA
;
if
(
s
->
divx_version
>
502
&&
s
->
divx_build
<
1814
)
s
->
workaround_bugs
|=
FF_BUG_QPEL_CHROMA2
;
if
(
s
->
xvid_build
<=
3U
)
s
->
padding_bug_score
=
256
*
256
*
256
*
64
;
if
(
s
->
xvid_build
<=
1U
)
s
->
workaround_bugs
|=
FF_BUG_QPEL_CHROMA
;
if
(
s
->
xvid_build
<=
12U
)
s
->
workaround_bugs
|=
FF_BUG_EDGE
;
if
(
s
->
xvid_build
<=
32U
)
s
->
workaround_bugs
|=
FF_BUG_DC_CLIP
;
#define SET_QPEL_FUNC(postfix1, postfix2) \
s->dsp.put_ ## postfix1 = ff_put_ ## postfix2; \
s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \
s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
if
(
s
->
lavc_build
<
4653U
)
s
->
workaround_bugs
|=
FF_BUG_STD_QPEL
;
if
(
s
->
lavc_build
<
4655U
)
s
->
workaround_bugs
|=
FF_BUG_DIRECT_BLOCKSIZE
;
if
(
s
->
lavc_build
<
4670U
)
s
->
workaround_bugs
|=
FF_BUG_EDGE
;
if
(
s
->
lavc_build
<=
4712U
)
s
->
workaround_bugs
|=
FF_BUG_DC_CLIP
;
if
(
s
->
divx_version
>=
0
)
s
->
workaround_bugs
|=
FF_BUG_DIRECT_BLOCKSIZE
;
if
(
s
->
divx_version
==
501
&&
s
->
divx_build
==
20020416
)
s
->
padding_bug_score
=
256
*
256
*
256
*
64
;
if
(
s
->
divx_version
<
500U
)
s
->
workaround_bugs
|=
FF_BUG_EDGE
;
if
(
s
->
divx_version
>=
0
)
s
->
workaround_bugs
|=
FF_BUG_HPEL_CHROMA
;
}
if
(
s
->
workaround_bugs
&
FF_BUG_STD_QPEL
)
{
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
5
],
qpel16_mc11_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
7
],
qpel16_mc31_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
9
],
qpel16_mc12_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
11
],
qpel16_mc32_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
13
],
qpel16_mc13_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
0
][
15
],
qpel16_mc33_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
5
],
qpel8_mc11_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
7
],
qpel8_mc31_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
9
],
qpel8_mc12_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
11
],
qpel8_mc32_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
13
],
qpel8_mc13_old_c
)
SET_QPEL_FUNC
(
qpel_pixels_tab
[
1
][
15
],
qpel8_mc33_old_c
)
}
if
(
avctx
->
debug
&
FF_DEBUG_BUGS
)
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s
\n
"
,
s
->
workaround_bugs
,
s
->
lavc_build
,
s
->
xvid_build
,
s
->
divx_version
,
s
->
divx_build
,
s
->
divx_packed
?
"p"
:
""
);
#if HAVE_MMX
if
(
s
->
codec_id
==
AV_CODEC_ID_MPEG4
&&
s
->
xvid_build
>=
0
&&
avctx
->
idct_algo
==
FF_IDCT_AUTO
&&
(
av_get_cpu_flags
()
&
AV_CPU_FLAG_MMX
))
{
avctx
->
idct_algo
=
FF_IDCT_XVIDMMX
;
ff_dct_common_init
(
s
);
return
1
;
}
#endif
return
0
;
}
static
int
decode_vop_header
(
Mpeg4DecContext
*
ctx
,
GetBitContext
*
gb
)
static
int
decode_vop_header
(
Mpeg4DecContext
*
ctx
,
GetBitContext
*
gb
)
{
{
MpegEncContext
*
s
=
&
ctx
->
m
;
MpegEncContext
*
s
=
&
ctx
->
m
;
...
...
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