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
7af75e6c
Commit
7af75e6c
authored
Sep 26, 2003
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h263 stuffing decode fix
Originally committed as revision 2304 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
d42f74b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
49 deletions
+43
-49
h263.c
libavcodec/h263.c
+31
-21
h263data.h
libavcodec/h263data.h
+12
-28
No files found.
libavcodec/h263.c
View file @
7af75e6c
...
...
@@ -40,7 +40,7 @@
//#include <assert.h>
#define INTRA_MCBPC_VLC_BITS 6
#define INTER_MCBPC_VLC_BITS
6
#define INTER_MCBPC_VLC_BITS
7
#define CBPY_VLC_BITS 6
#define MV_VLC_BITS 9
#define DC_VLC_BITS 9
...
...
@@ -2428,10 +2428,10 @@ void h263_decode_init_vlc(MpegEncContext *s)
if
(
!
done
)
{
done
=
1
;
init_vlc
(
&
intra_MCBPC_vlc
,
INTRA_MCBPC_VLC_BITS
,
8
,
init_vlc
(
&
intra_MCBPC_vlc
,
INTRA_MCBPC_VLC_BITS
,
9
,
intra_MCBPC_bits
,
1
,
1
,
intra_MCBPC_code
,
1
,
1
);
init_vlc
(
&
inter_MCBPC_vlc
,
INTER_MCBPC_VLC_BITS
,
2
5
,
init_vlc
(
&
inter_MCBPC_vlc
,
INTER_MCBPC_VLC_BITS
,
2
8
,
inter_MCBPC_bits
,
1
,
1
,
inter_MCBPC_code
,
1
,
1
);
init_vlc
(
&
cbpy_vlc
,
CBPY_VLC_BITS
,
16
,
...
...
@@ -2871,12 +2871,14 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
return
mb_num
-
1
;
}
cbpc
=
get_vlc2
(
&
s
->
gb
,
intra_MCBPC_vlc
.
table
,
INTRA_MCBPC_VLC_BITS
,
1
);
do
{
cbpc
=
get_vlc2
(
&
s
->
gb
,
intra_MCBPC_vlc
.
table
,
INTRA_MCBPC_VLC_BITS
,
2
);
if
(
cbpc
<
0
){
fprintf
(
stderr
,
"cbpc corrupted at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
}
}
while
(
cbpc
==
8
);
s
->
cbp_table
[
xy
]
=
cbpc
&
3
;
s
->
current_picture
.
mb_type
[
xy
]
=
MB_TYPE_INTRA
;
s
->
mb_intra
=
1
;
...
...
@@ -2903,6 +2905,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
int16_t
*
const
mot_val
=
s
->
motion_val
[
s
->
block_index
[
0
]];
const
int
stride
=
s
->
block_wrap
[
0
]
*
2
;
do
{
bits
=
show_bits
(
&
s
->
gb
,
17
);
if
(
bits
==
MOTION_MARKER
){
return
mb_num
-
1
;
...
...
@@ -2927,15 +2930,14 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
ff_clean_intra_table_entries
(
s
);
continue
;
}
cbpc
=
get_vlc2
(
&
s
->
gb
,
inter_MCBPC_vlc
.
table
,
INTER_MCBPC_VLC_BITS
,
2
);
if
(
cbpc
<
0
){
fprintf
(
stderr
,
"cbpc corrupted at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
}
if
(
cbpc
>
20
)
cbpc
+=
3
;
else
if
(
cbpc
==
20
)
fprintf
(
stderr
,
"Stuffing !"
);
}
while
(
cbpc
==
20
);
s
->
cbp_table
[
xy
]
=
cbpc
&
(
8
+
3
);
//8 is dquant
s
->
mb_intra
=
((
cbpc
&
4
)
!=
0
);
...
...
@@ -3234,6 +3236,7 @@ int ff_h263_decode_mb(MpegEncContext *s,
const
int
xy
=
s
->
mb_x
+
s
->
mb_y
*
s
->
mb_stride
;
if
(
s
->
pict_type
==
P_TYPE
||
s
->
pict_type
==
S_TYPE
)
{
do
{
if
(
get_bits1
(
&
s
->
gb
))
{
/* skip mb */
s
->
mb_intra
=
0
;
...
...
@@ -3259,12 +3262,11 @@ int ff_h263_decode_mb(MpegEncContext *s,
}
cbpc
=
get_vlc2
(
&
s
->
gb
,
inter_MCBPC_vlc
.
table
,
INTER_MCBPC_VLC_BITS
,
2
);
//fprintf(stderr, "\tCBPC: %d", cbpc);
if
(
cbpc
<
0
)
if
(
cbpc
<
0
){
fprintf
(
stderr
,
"cbpc damaged at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
if
(
cbpc
>
20
)
cbpc
+=
3
;
else
if
(
cbpc
==
20
)
fprintf
(
stderr
,
"Stuffing !"
);
}
}
while
(
cbpc
==
20
);
dquant
=
cbpc
&
8
;
s
->
mb_intra
=
((
cbpc
&
4
)
!=
0
);
...
...
@@ -3501,9 +3503,14 @@ int ff_h263_decode_mb(MpegEncContext *s,
}
s
->
current_picture
.
mb_type
[
xy
]
=
mb_type
;
}
else
{
/* I-Frame */
cbpc
=
get_vlc2
(
&
s
->
gb
,
intra_MCBPC_vlc
.
table
,
INTRA_MCBPC_VLC_BITS
,
1
);
if
(
cbpc
<
0
)
do
{
cbpc
=
get_vlc2
(
&
s
->
gb
,
intra_MCBPC_vlc
.
table
,
INTRA_MCBPC_VLC_BITS
,
2
);
if
(
cbpc
<
0
){
fprintf
(
stderr
,
"I cbpc damaged at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
}
}
while
(
cbpc
==
8
);
dquant
=
cbpc
&
4
;
s
->
mb_intra
=
1
;
intra
:
...
...
@@ -3520,7 +3527,10 @@ intra:
s
->
ac_pred
=
0
;
cbpy
=
get_vlc2
(
&
s
->
gb
,
cbpy_vlc
.
table
,
CBPY_VLC_BITS
,
1
);
if
(
cbpy
<
0
)
return
-
1
;
if
(
cbpy
<
0
){
fprintf
(
stderr
,
"I cbpy damaged at %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
}
cbp
=
(
cbpc
&
3
)
|
(
cbpy
<<
2
);
if
(
dquant
)
{
change_qscale
(
s
,
quant_tab
[
get_bits
(
&
s
->
gb
,
2
)]);
...
...
libavcodec/h263data.h
View file @
7af75e6c
...
...
@@ -5,46 +5,30 @@
/* intra MCBPC, mb_type = (intra), then (intraq) */
const
uint8_t
intra_MCBPC_code
[
8
]
=
{
1
,
1
,
2
,
3
,
1
,
1
,
2
,
3
};
const
uint8_t
intra_MCBPC_bits
[
8
]
=
{
1
,
3
,
3
,
3
,
4
,
6
,
6
,
6
};
const
uint8_t
intra_MCBPC_code
[
9
]
=
{
1
,
1
,
2
,
3
,
1
,
1
,
2
,
3
,
1
};
const
uint8_t
intra_MCBPC_bits
[
9
]
=
{
1
,
3
,
3
,
3
,
4
,
6
,
6
,
6
,
9
};
/* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */
/* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */
const
uint8_t
inter_MCBPC_code
[
2
5
]
=
{
const
uint8_t
inter_MCBPC_code
[
2
8
]
=
{
1
,
3
,
2
,
5
,
3
,
4
,
3
,
3
,
3
,
7
,
6
,
5
,
4
,
4
,
3
,
2
,
2
,
5
,
4
,
5
,
1
,
/* Stuffing */
1
,
0
,
0
,
0
,
/* Stuffing */
2
,
12
,
14
,
15
,
};
const
uint8_t
inter_MCBPC_bits
[
2
5
]
=
{
1
,
4
,
4
,
6
,
5
,
8
,
8
,
7
,
3
,
7
,
7
,
9
,
6
,
9
,
9
,
9
,
3
,
7
,
7
,
8
,
9
,
/* Stuffing */
11
,
13
,
13
,
13
,
const
uint8_t
inter_MCBPC_bits
[
2
8
]
=
{
1
,
4
,
4
,
6
,
/* inter */
5
,
8
,
8
,
7
,
/* intra */
3
,
7
,
7
,
9
,
/* interQ */
6
,
9
,
9
,
9
,
/* intraQ */
3
,
7
,
7
,
8
,
/* inter4 */
9
,
0
,
0
,
0
,
/* Stuffing */
11
,
13
,
13
,
13
,
/* inter4Q*/
};
/* This is the old table
static const uint8_t inter_MCBPC_code[20] = {
1, 3, 2, 5,
3, 4, 3, 3,
0, 1, 2, 3,
4, 4, 3, 2,
2, 5, 4, 5,
};
static const uint8_t inter_MCBPC_bits[20] = {
1, 4, 4, 6,
5, 8, 8, 7,
12, 12, 12, 12,
6, 9, 9, 9,
3, 7, 7, 8,
};*/
const
uint8_t
cbpy_tab
[
16
][
2
]
=
{
{
3
,
4
},
{
5
,
5
},
{
4
,
5
},
{
9
,
4
},
{
3
,
5
},
{
7
,
4
},
{
2
,
6
},
{
11
,
4
},
...
...
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