Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
afad1a84
Commit
afad1a84
authored
11 years ago
by
Dmitry Kovalev
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Calling vpx_img_read() from vp9_spatial_scalable_encoder."
parents
fb8c246b
9c7c8ff6
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
nextgen
nextgenv2
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9_spatial_scalable_encoder.c
+15
-12
vp9_spatial_scalable_encoder.c
with
15 additions
and
12 deletions
vp9_spatial_scalable_encoder.c
+
15
−
12
View file @
afad1a84
...
@@ -75,10 +75,10 @@ static const uint32_t default_spatial_layers = 5;
...
@@ -75,10 +75,10 @@ static const uint32_t default_spatial_layers = 5;
static
const
uint32_t
default_kf_dist
=
100
;
static
const
uint32_t
default_kf_dist
=
100
;
typedef
struct
{
typedef
struct
{
char
*
output_filename
;
const
char
*
input_filename
;
const
char
*
output_filename
;
uint32_t
frames_to_code
;
uint32_t
frames_to_code
;
uint32_t
frames_to_skip
;
uint32_t
frames_to_skip
;
struct
VpxInputContext
input_ctx
;
}
AppInput
;
}
AppInput
;
static
const
char
*
exec_name
;
static
const
char
*
exec_name
;
...
@@ -94,8 +94,10 @@ void usage_exit() {
...
@@ -94,8 +94,10 @@ void usage_exit() {
static
void
parse_command_line
(
int
argc
,
const
char
**
argv_
,
static
void
parse_command_line
(
int
argc
,
const
char
**
argv_
,
AppInput
*
app_input
,
SvcContext
*
svc_ctx
,
AppInput
*
app_input
,
SvcContext
*
svc_ctx
,
vpx_codec_enc_cfg_t
*
enc_cfg
)
{
vpx_codec_enc_cfg_t
*
enc_cfg
)
{
struct
arg
arg
;
struct
arg
arg
=
{
0
};
char
**
argv
,
**
argi
,
**
argj
;
char
**
argv
=
NULL
;
char
**
argi
=
NULL
;
char
**
argj
=
NULL
;
vpx_codec_err_t
res
;
vpx_codec_err_t
res
;
// initialize SvcContext with parameters that will be passed to vpx_svc_init
// 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_,
...
@@ -162,7 +164,7 @@ static void parse_command_line(int argc, const char **argv_,
if
(
argv
[
0
]
==
NULL
||
argv
[
1
]
==
0
)
{
if
(
argv
[
0
]
==
NULL
||
argv
[
1
]
==
0
)
{
usage_exit
();
usage_exit
();
}
}
app_input
->
input_
ctx
.
filename
=
argv
[
0
];
app_input
->
input_filename
=
argv
[
0
];
app_input
->
output_filename
=
argv
[
1
];
app_input
->
output_filename
=
argv
[
1
];
free
(
argv
);
free
(
argv
);
...
@@ -196,6 +198,7 @@ int main(int argc, const char **argv) {
...
@@ -196,6 +198,7 @@ int main(int argc, const char **argv) {
vpx_codec_err_t
res
;
vpx_codec_err_t
res
;
int
pts
=
0
;
/* PTS starts at 0 */
int
pts
=
0
;
/* PTS starts at 0 */
int
frame_duration
=
1
;
/* 1 timebase tick per frame */
int
frame_duration
=
1
;
/* 1 timebase tick per frame */
FILE
*
infile
=
NULL
;
memset
(
&
svc_ctx
,
0
,
sizeof
(
svc_ctx
));
memset
(
&
svc_ctx
,
0
,
sizeof
(
svc_ctx
));
svc_ctx
.
log_print
=
1
;
svc_ctx
.
log_print
=
1
;
...
@@ -206,8 +209,8 @@ int main(int argc, const char **argv) {
...
@@ -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
))
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
);
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"
)))
if
(
!
(
in
file
=
fopen
(
app_input
.
input_filename
,
"rb"
)))
die
(
"Failed to open %s for reading
\n
"
,
app_input
.
input_
ctx
.
filename
);
die
(
"Failed to open %s for reading
\n
"
,
app_input
.
input_filename
);
// Initialize codec
// Initialize codec
if
(
vpx_svc_init
(
&
svc_ctx
,
&
codec
,
vpx_codec_vp9_cx
(),
&
enc_cfg
)
!=
if
(
vpx_svc_init
(
&
svc_ctx
,
&
codec
,
vpx_codec_vp9_cx
(),
&
enc_cfg
)
!=
...
@@ -229,13 +232,13 @@ int main(int argc, const char **argv) {
...
@@ -229,13 +232,13 @@ int main(int argc, const char **argv) {
die
(
"Failed to open %s for writing
\n
"
,
app_input
.
output_filename
);
die
(
"Failed to open %s for writing
\n
"
,
app_input
.
output_filename
);
// skip initial frames
// skip initial frames
for
(
i
=
0
;
i
<
app_input
.
frames_to_skip
;
++
i
)
{
for
(
i
=
0
;
i
<
app_input
.
frames_to_skip
;
++
i
)
read_yuv_frame
(
&
app_input
.
input_ctx
,
&
raw
);
vpx_img_read
(
&
raw
,
infile
);
}
// Encode frames
// Encode frames
while
(
frame_cnt
<
app_input
.
frames_to_code
)
{
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
,
res
=
vpx_svc_encode
(
&
svc_ctx
,
&
codec
,
&
raw
,
pts
,
frame_duration
,
VPX_DL_REALTIME
);
VPX_DL_REALTIME
);
...
@@ -255,7 +258,7 @@ int main(int argc, const char **argv) {
...
@@ -255,7 +258,7 @@ int main(int argc, const char **argv) {
printf
(
"Processed %d frames
\n
"
,
frame_cnt
);
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"
);
if
(
vpx_codec_destroy
(
&
codec
))
die_codec
(
&
codec
,
"Failed to destroy codec"
);
vpx_video_writer_close
(
writer
);
vpx_video_writer_close
(
writer
);
...
...
This diff is collapsed.
Click to expand it.
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!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets