Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
9c7c8ff6
Commit
9c7c8ff6
authored
Feb 13, 2014
by
Dmitry Kovalev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calling vpx_img_read() from vp9_spatial_scalable_encoder.
Change-Id: I18ce84eb50283a05e149ff8211d9dc424d379b4d
parent
56f27522
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
vp9_spatial_scalable_encoder.c
vp9_spatial_scalable_encoder.c
+15
-12
No files found.
vp9_spatial_scalable_encoder.c
View file @
9c7c8ff6
...
...
@@ -75,10 +75,10 @@ static const uint32_t default_spatial_layers = 5;
static
const
uint32_t
default_kf_dist
=
100
;
typedef
struct
{
char
*
output_filename
;
const
char
*
input_filename
;
const
char
*
output_filename
;
uint32_t
frames_to_code
;
uint32_t
frames_to_skip
;
struct
VpxInputContext
input_ctx
;
}
AppInput
;
static
const
char
*
exec_name
;
...
...
@@ -94,8 +94,10 @@ void usage_exit() {
static
void
parse_command_line
(
int
argc
,
const
char
**
argv_
,
AppInput
*
app_input
,
SvcContext
*
svc_ctx
,
vpx_codec_enc_cfg_t
*
enc_cfg
)
{
struct
arg
arg
;
char
**
argv
,
**
argi
,
**
argj
;
struct
arg
arg
=
{
0
};
char
**
argv
=
NULL
;
char
**
argi
=
NULL
;
char
**
argj
=
NULL
;
vpx_codec_err_t
res
;
// initialize SvcContext with parameters that will be passed to vpx_svc_init
...
...
@@ -162,7 +164,7 @@ static void parse_command_line(int argc, const char **argv_,
if
(
argv
[
0
]
==
NULL
||
argv
[
1
]
==
0
)
{
usage_exit
();
}
app_input
->
input_
ctx
.
filename
=
argv
[
0
];
app_input
->
input_filename
=
argv
[
0
];
app_input
->
output_filename
=
argv
[
1
];
free
(
argv
);
...
...
@@ -196,6 +198,7 @@ int main(int argc, const char **argv) {
vpx_codec_err_t
res
;
int
pts
=
0
;
/* PTS starts at 0 */
int
frame_duration
=
1
;
/* 1 timebase tick per frame */
FILE
*
infile
=
NULL
;
memset
(
&
svc_ctx
,
0
,
sizeof
(
svc_ctx
));
svc_ctx
.
log_print
=
1
;
...
...
@@ -206,8 +209,8 @@ int main(int argc, const char **argv) {
if
(
!
vpx_img_alloc
(
&
raw
,
VPX_IMG_FMT_I420
,
enc_cfg
.
g_w
,
enc_cfg
.
g_h
,
32
))
die
(
"Failed to allocate image %dx%d
\n
"
,
enc_cfg
.
g_w
,
enc_cfg
.
g_h
);
if
(
!
(
app_input
.
input_ctx
.
file
=
fopen
(
app_input
.
input_
ctx
.
filename
,
"rb"
)))
die
(
"Failed to open %s for reading
\n
"
,
app_input
.
input_
ctx
.
filename
);
if
(
!
(
in
file
=
fopen
(
app_input
.
input_filename
,
"rb"
)))
die
(
"Failed to open %s for reading
\n
"
,
app_input
.
input_filename
);
// Initialize codec
if
(
vpx_svc_init
(
&
svc_ctx
,
&
codec
,
vpx_codec_vp9_cx
(),
&
enc_cfg
)
!=
...
...
@@ -229,13 +232,13 @@ int main(int argc, const char **argv) {
die
(
"Failed to open %s for writing
\n
"
,
app_input
.
output_filename
);
// skip initial frames
for
(
i
=
0
;
i
<
app_input
.
frames_to_skip
;
++
i
)
{
read_yuv_frame
(
&
app_input
.
input_ctx
,
&
raw
);
}
for
(
i
=
0
;
i
<
app_input
.
frames_to_skip
;
++
i
)
vpx_img_read
(
&
raw
,
infile
);
// Encode frames
while
(
frame_cnt
<
app_input
.
frames_to_code
)
{
if
(
read_yuv_frame
(
&
app_input
.
input_ctx
,
&
raw
))
break
;
if
(
!
vpx_img_read
(
&
raw
,
infile
))
break
;
res
=
vpx_svc_encode
(
&
svc_ctx
,
&
codec
,
&
raw
,
pts
,
frame_duration
,
VPX_DL_REALTIME
);
...
...
@@ -255,7 +258,7 @@ int main(int argc, const char **argv) {
printf
(
"Processed %d frames
\n
"
,
frame_cnt
);
fclose
(
app_input
.
input_ctx
.
file
);
fclose
(
in
file
);
if
(
vpx_codec_destroy
(
&
codec
))
die_codec
(
&
codec
,
"Failed to destroy codec"
);
vpx_video_writer_close
(
writer
);
...
...
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