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
426b8061
Commit
426b8061
authored
Dec 06, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aspect ratio encoding for mpeg1
Originally committed as revision 1319 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
945f15b7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
mpeg12.c
libavcodec/mpeg12.c
+17
-2
No files found.
libavcodec/mpeg12.c
View file @
426b8061
...
@@ -131,8 +131,12 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
...
@@ -131,8 +131,12 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
{
{
unsigned
int
vbv_buffer_size
;
unsigned
int
vbv_buffer_size
;
unsigned
int
fps
,
v
;
unsigned
int
fps
,
v
;
int
n
;
int
n
,
i
;
UINT64
time_code
;
UINT64
time_code
;
float
best_aspect_error
=
1E10
;
float
aspect_ratio
=
s
->
avctx
->
aspect_ratio
;
if
(
aspect_ratio
==
0
.
0
)
aspect_ratio
=
s
->
width
/
(
float
)
s
->
height
;
//pixel aspect 1:1 (VGA)
if
(
s
->
current_picture
.
key_frame
)
{
if
(
s
->
current_picture
.
key_frame
)
{
/* mpeg1 header repeated every gop */
/* mpeg1 header repeated every gop */
...
@@ -154,7 +158,18 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
...
@@ -154,7 +158,18 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
put_bits
(
&
s
->
pb
,
12
,
s
->
width
);
put_bits
(
&
s
->
pb
,
12
,
s
->
width
);
put_bits
(
&
s
->
pb
,
12
,
s
->
height
);
put_bits
(
&
s
->
pb
,
12
,
s
->
height
);
put_bits
(
&
s
->
pb
,
4
,
1
);
/* 1/1 aspect ratio */
for
(
i
=
1
;
i
<
15
;
i
++
){
float
error
=
mpeg1_aspect
[
i
]
-
s
->
width
/
(
s
->
height
*
aspect_ratio
);
error
=
ABS
(
error
);
if
(
error
<
best_aspect_error
){
best_aspect_error
=
error
;
s
->
aspect_ratio_info
=
i
;
}
}
put_bits
(
&
s
->
pb
,
4
,
s
->
aspect_ratio_info
);
put_bits
(
&
s
->
pb
,
4
,
s
->
frame_rate_index
);
put_bits
(
&
s
->
pb
,
4
,
s
->
frame_rate_index
);
v
=
s
->
bit_rate
/
400
;
v
=
s
->
bit_rate
/
400
;
if
(
v
>
0x3ffff
)
if
(
v
>
0x3ffff
)
...
...
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