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
945f15b7
Commit
945f15b7
authored
Dec 06, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg1&2 aspect decoding
Originally committed as revision 1318 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
706fc4de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
10 deletions
+50
-10
mpeg12.c
libavcodec/mpeg12.c
+22
-10
mpeg12data.h
libavcodec/mpeg12data.h
+28
-0
No files found.
libavcodec/mpeg12.c
View file @
945f15b7
...
...
@@ -1431,8 +1431,9 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
static
void
mpeg_decode_sequence_extension
(
MpegEncContext
*
s
)
{
int
horiz_size_ext
,
vert_size_ext
;
int
bit_rate_ext
,
vbv_buf_ext
,
low_delay
;
int
bit_rate_ext
,
vbv_buf_ext
;
int
frame_rate_ext_n
,
frame_rate_ext_d
;
float
aspect
;
skip_bits
(
&
s
->
gb
,
8
);
/* profil and level */
s
->
progressive_sequence
=
get_bits1
(
&
s
->
gb
);
/* progressive_sequence */
...
...
@@ -1445,7 +1446,7 @@ static void mpeg_decode_sequence_extension(MpegEncContext *s)
s
->
bit_rate
=
((
s
->
bit_rate
/
400
)
|
(
bit_rate_ext
<<
12
))
*
400
;
skip_bits1
(
&
s
->
gb
);
/* marker */
vbv_buf_ext
=
get_bits
(
&
s
->
gb
,
8
);
low_delay
=
get_bits1
(
&
s
->
gb
);
s
->
low_delay
=
get_bits1
(
&
s
->
gb
);
frame_rate_ext_n
=
get_bits
(
&
s
->
gb
,
2
);
frame_rate_ext_d
=
get_bits
(
&
s
->
gb
,
5
);
if
(
frame_rate_ext_d
>=
1
)
...
...
@@ -1453,6 +1454,10 @@ static void mpeg_decode_sequence_extension(MpegEncContext *s)
dprintf
(
"sequence extension
\n
"
);
s
->
mpeg2
=
1
;
s
->
avctx
->
sub_id
=
2
;
/* indicates mpeg2 found */
aspect
=
mpeg2_aspect
[
s
->
aspect_ratio_info
];
if
(
aspect
>
0
.
0
)
s
->
avctx
->
aspect_ratio
=
s
->
width
/
(
aspect
*
s
->
height
);
else
if
(
aspect
<
0
.
0
)
s
->
avctx
->
aspect_ratio
=
-
1
.
0
/
aspect
;
}
static
void
mpeg_decode_quant_matrix_extension
(
MpegEncContext
*
s
)
...
...
@@ -1706,12 +1711,18 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
Mpeg1Context
*
s1
=
avctx
->
priv_data
;
MpegEncContext
*
s
=
&
s1
->
mpeg_enc_ctx
;
int
width
,
height
,
i
,
v
,
j
;
float
aspect
;
init_get_bits
(
&
s
->
gb
,
buf
,
buf_size
);
width
=
get_bits
(
&
s
->
gb
,
12
);
height
=
get_bits
(
&
s
->
gb
,
12
);
skip_bits
(
&
s
->
gb
,
4
);
s
->
aspect_ratio_info
=
get_bits
(
&
s
->
gb
,
4
);
if
(
!
s
->
mpeg2
){
aspect
=
mpeg1_aspect
[
s
->
aspect_ratio_info
];
if
(
aspect
!=
0
.
0
)
avctx
->
aspect_ratio
=
width
/
(
aspect
*
height
);
}
s
->
frame_rate_index
=
get_bits
(
&
s
->
gb
,
4
);
if
(
s
->
frame_rate_index
==
0
)
return
-
1
;
...
...
@@ -1896,15 +1907,16 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
s
->
buffer
,
input_size
);
break
;
default:
/* skip b frames if we dont have reference frames */
if
(
s2
->
last_picture
.
data
[
0
]
==
NULL
&&
s2
->
pict_type
==
B_TYPE
)
break
;
/* skip b frames if we are in a hurry */
if
(
avctx
->
hurry_up
&&
s2
->
pict_type
==
B_TYPE
)
break
;
/* skip everything if we are in a hurry>=5 */
if
(
avctx
->
hurry_up
>=
5
)
break
;
if
(
start_code
>=
SLICE_MIN_START_CODE
&&
start_code
<=
SLICE_MAX_START_CODE
)
{
/* skip b frames if we dont have reference frames */
if
(
s2
->
last_picture
.
data
[
0
]
==
NULL
&&
s2
->
pict_type
==
B_TYPE
)
break
;
/* skip b frames if we are in a hurry */
if
(
avctx
->
hurry_up
&&
s2
->
pict_type
==
B_TYPE
)
break
;
/* skip everything if we are in a hurry>=5 */
if
(
avctx
->
hurry_up
>=
5
)
break
;
ret
=
mpeg_decode_slice
(
avctx
,
picture
,
start_code
,
s
->
buffer
,
input_size
);
if
(
ret
==
DECODE_SLICE_EOP
)
{
...
...
libavcodec/mpeg12data.h
View file @
945f15b7
...
...
@@ -411,4 +411,32 @@ UINT8 ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qsc
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
};
static
const
float
mpeg1_aspect
[
16
]
=
{
0
.
0000
,
1
.
0000
,
0
.
6735
,
0
.
7031
,
0
.
7615
,
0
.
8055
,
0
.
8437
,
0
.
8935
,
0
.
9157
,
0
.
9815
,
1
.
0255
,
1
.
06
95
,
1
.
0950
,
1
.
1575
,
1
.
2015
,
};
static
const
float
mpeg2_aspect
[
16
]
=
{
0
,
1
.
0
,
-
3
.
0
/
4
.
0
,
-
9
.
0
/
16
.
0
,
-
1
.
0
/
2
.
21
,
};
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