Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
df46372e
Commit
df46372e
authored
Jan 15, 2014
by
Dmitry Kovalev
Browse files
Cleaning up ivf-related code.
Change-Id: I80f3e197562f3424acddbff786a5d0d209fbd666
parent
3c113452
Changes
2
Hide whitespace changes
Inline
Side-by-side
ivfdec.c
View file @
df46372e
...
...
@@ -13,6 +13,25 @@
#include
<stdio.h>
#include
<stdlib.h>
static
void
fix_framerate
(
int
*
num
,
int
*
den
)
{
// Some versions of vpxenc used 1/(2*fps) for the timebase, so
// we can guess the framerate using only the timebase in this
// case. Other files would require reading ahead to guess the
// timebase, like we do for webm.
if
(
*
num
<
1000
)
{
// Correct for the factor of 2 applied to the timebase in the encoder.
if
(
*
num
&
1
)
*
den
*=
2
;
else
*
num
/=
2
;
}
else
{
// Don't know FPS for sure, and don't have readahead code
// (yet?), so just default to 30fps.
*
num
=
30
;
*
den
=
1
;
}
}
int
file_is_ivf
(
struct
VpxInputContext
*
input_ctx
)
{
char
raw_hdr
[
32
];
int
is_ivf
=
0
;
...
...
@@ -32,27 +51,8 @@ int file_is_ivf(struct VpxInputContext *input_ctx) {
input_ctx
->
height
=
mem_get_le16
(
raw_hdr
+
14
);
input_ctx
->
framerate
.
numerator
=
mem_get_le32
(
raw_hdr
+
16
);
input_ctx
->
framerate
.
denominator
=
mem_get_le32
(
raw_hdr
+
20
);
/* Some versions of vpxenc used 1/(2*fps) for the timebase, so
* we can guess the framerate using only the timebase in this
* case. Other files would require reading ahead to guess the
* timebase, like we do for webm.
*/
if
(
input_ctx
->
framerate
.
numerator
<
1000
)
{
/* Correct for the factor of 2 applied to the timebase in the
* encoder.
*/
if
(
input_ctx
->
framerate
.
numerator
&
1
)
input_ctx
->
framerate
.
denominator
<<=
1
;
else
input_ctx
->
framerate
.
numerator
>>=
1
;
}
else
{
/* Don't know FPS for sure, and don't have readahead code
* (yet?), so just default to 30fps.
*/
input_ctx
->
framerate
.
numerator
=
30
;
input_ctx
->
framerate
.
denominator
=
1
;
}
fix_framerate
(
&
input_ctx
->
framerate
.
numerator
,
&
input_ctx
->
framerate
.
denominator
);
}
}
...
...
ivfenc.c
View file @
df46372e
...
...
@@ -41,9 +41,6 @@ void ivf_write_frame_header(FILE *outfile, const struct vpx_codec_cx_pkt *pkt) {
char
header
[
12
];
vpx_codec_pts_t
pts
;
if
(
pkt
->
kind
!=
VPX_CODEC_CX_FRAME_PKT
)
return
;
pts
=
pkt
->
data
.
frame
.
pts
;
mem_put_le32
(
header
,
(
int
)
pkt
->
data
.
frame
.
sz
);
mem_put_le32
(
header
+
4
,
pts
&
0xFFFFFFFF
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment