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
58b0b0dd
Commit
58b0b0dd
authored
22 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
fixing aspect
Originally committed as revision 1273 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
c9f99fef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavcodec/h263.c
+24
-17
24 additions, 17 deletions
libavcodec/h263.c
libavcodec/h263dec.c
+2
-2
2 additions, 2 deletions
libavcodec/h263dec.c
with
26 additions
and
19 deletions
libavcodec/h263.c
+
24
−
17
View file @
58b0b0dd
...
...
@@ -120,24 +120,25 @@ int h263_get_picture_format(int width, int height)
return
format
;
}
static
void
init_aspect_info
(
MpegEncContext
*
s
){
double
aspect
;
emms_c
();
//paranoia ;)
if
(
s
->
avctx
->
aspect_ratio
==
0
)
aspect
=
1
.
0
;
aspect
=
s
->
avctx
->
aspect_ratio
;
static
void
float_aspect_to_info
(
MpegEncContext
*
s
,
float
aspect
){
int
i
;
aspect
*=
s
->
height
/
(
double
)
s
->
width
;
//printf("%f\n", aspect);
if
(
aspect
==
0
)
aspect
=
1
.
0
;
ff_float2fraction
(
&
s
->
aspected_width
,
&
s
->
aspected_height
,
aspect
,
255
);
//printf("%d %d\n", s->aspected_width, s->aspected_height);
for
(
i
=
1
;
i
<
6
;
i
++
){
if
(
s
->
aspected_width
==
pixel_aspect
[
i
][
0
]
&&
s
->
aspected_height
==
pixel_aspect
[
i
][
1
]){
s
->
aspect_ratio_info
=
i
;
return
;
}
}
if
(
s
->
aspected_width
==
4
&&
s
->
aspected_height
==
3
)
s
->
aspect_ratio_info
=
FF_ASPECT_4_3_625
;
else
if
(
s
->
aspected_width
==
16
&&
s
->
aspected_height
==
9
)
s
->
aspect_ratio_info
=
FF_ASPECT_16_9_625
;
else
if
(
s
->
aspected_width
==
1
&&
s
->
aspected_height
==
1
)
s
->
aspect_ratio_info
=
FF_ASPECT_SQUARE
;
else
s
->
aspect_ratio_info
=
FF_ASPECT_EXTENDED
;
s
->
aspect_ratio_info
=
FF_ASPECT_EXTENDED
;
}
void
h263_encode_picture_header
(
MpegEncContext
*
s
,
int
picture_number
)
...
...
@@ -216,7 +217,7 @@ void h263_encode_picture_header(MpegEncContext * s, int picture_number)
if
(
format
==
7
)
{
/* Custom Picture Format (CPFMT) */
ini
t_aspect_info
(
s
);
floa
t_aspect_
to_
info
(
s
,
s
->
avctx
->
aspect_ratio
);
put_bits
(
&
s
->
pb
,
4
,
s
->
aspect_ratio_info
);
put_bits
(
&
s
->
pb
,
9
,(
s
->
width
>>
2
)
-
1
);
...
...
@@ -1527,7 +1528,7 @@ static void mpeg4_encode_vol_header(MpegEncContext * s)
put_bits
(
&
s
->
pb
,
4
,
vo_ver_id
);
/* is obj layer ver id */
put_bits
(
&
s
->
pb
,
3
,
1
);
/* is obj layer priority */
ini
t_aspect_info
(
s
);
floa
t_aspect_
to_
info
(
s
,
s
->
avctx
->
aspect_ratio
);
put_bits
(
&
s
->
pb
,
4
,
s
->
aspect_ratio_info
);
/* aspect ratio info */
if
(
s
->
aspect_ratio_info
==
FF_ASPECT_EXTENDED
)
...
...
@@ -3833,6 +3834,9 @@ int h263_decode_picture_header(MpegEncContext *s)
/* aspected dimensions */
s
->
aspected_width
=
get_bits
(
&
s
->
gb
,
8
);
s
->
aspected_height
=
get_bits
(
&
s
->
gb
,
8
);
}
else
{
s
->
aspected_width
=
pixel_aspect
[
s
->
aspect_ratio_info
][
0
];
s
->
aspected_height
=
pixel_aspect
[
s
->
aspect_ratio_info
][
1
];
}
}
else
{
width
=
h263_format
[
format
][
0
];
...
...
@@ -4098,6 +4102,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
if
(
s
->
aspect_ratio_info
==
FF_ASPECT_EXTENDED
){
s
->
aspected_width
=
get_bits
(
gb
,
8
);
// par_width
s
->
aspected_height
=
get_bits
(
gb
,
8
);
// par_height
}
else
{
s
->
aspected_width
=
pixel_aspect
[
s
->
aspect_ratio_info
][
0
];
s
->
aspected_height
=
pixel_aspect
[
s
->
aspect_ratio_info
][
1
];
}
if
((
s
->
vol_control_parameters
=
get_bits1
(
gb
)))
{
/* vol control parameter */
...
...
This diff is collapsed.
Click to expand it.
libavcodec/h263dec.c
+
2
−
2
View file @
58b0b0dd
...
...
@@ -495,10 +495,10 @@ retry:
/* FIXME: By the way H263 decoder is evolving it should have */
/* an H263EncContext */
if
(
s
->
aspected_height
)
new_aspect
=
(
float
)
s
->
aspected_width
/
(
float
)
s
->
aspected_height
;
new_aspect
=
s
->
aspected_width
*
s
->
width
/
(
float
)
(
s
->
height
*
s
->
aspected_height
)
;
else
new_aspect
=
0
;
if
(
s
->
width
!=
avctx
->
width
||
s
->
height
!=
avctx
->
height
||
ABS
(
new_aspect
-
avctx
->
aspect_ratio
)
>
0
.
001
)
{
/* H.263 could change picture size any time */
...
...
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