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
4e7d3088
Commit
4e7d3088
authored
11 years ago
by
Dmitry Kovalev
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Using video writer API from vp9_spatial_scalable_encoder."
parents
e6d23c94
14db3bf5
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
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples.mk
+2
-0
examples.mk
vp9_spatial_scalable_encoder.c
+24
-22
vp9_spatial_scalable_encoder.c
with
26 additions
and
22 deletions
examples.mk
+
2
−
0
View file @
4e7d3088
...
...
@@ -58,6 +58,8 @@ UTILS-$(CONFIG_VP9_ENCODER) += vp9_spatial_scalable_encoder.c
vp9_spatial_scalable_encoder.SRCS
+=
args.c args.h
vp9_spatial_scalable_encoder.SRCS
+=
ivfenc.c ivfenc.h
vp9_spatial_scalable_encoder.SRCS
+=
tools_common.c tools_common.h
vp9_spatial_scalable_encoder.SRCS
+=
video_common.h
vp9_spatial_scalable_encoder.SRCS
+=
video_writer.h video_writer.c
vp9_spatial_scalable_encoder.GUID
=
4A38598D-627D-4505-9C7B-D4020C84100D
vp9_spatial_scalable_encoder.DESCRIPTION
=
Spatial Scalable Encoder
...
...
This diff is collapsed.
Click to expand it.
vp9_spatial_scalable_encoder.c
+
24
−
22
View file @
4e7d3088
...
...
@@ -18,9 +18,11 @@
#include
<stdlib.h>
#include
<string.h>
#include
<time.h>
#include
"./args.h"
#include
"./ivfenc.h"
#include
"./tools_common.h"
#include
"./video_writer.h"
#include
"vpx/svc_context.h"
#include
"vpx/vp8cx.h"
#include
"vpx/vpx_encoder.h"
...
...
@@ -183,7 +185,8 @@ static void parse_command_line(int argc, const char **argv_,
int
main
(
int
argc
,
const
char
**
argv
)
{
AppInput
app_input
=
{
0
};
FILE
*
outfile
;
VpxVideoWriter
*
writer
=
NULL
;
VpxVideoInfo
info
=
{
0
};
vpx_codec_ctx_t
codec
;
vpx_codec_enc_cfg_t
enc_cfg
;
SvcContext
svc_ctx
;
...
...
@@ -206,15 +209,24 @@ int main(int argc, const char **argv) {
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
(
!
(
outfile
=
fopen
(
app_input
.
output_filename
,
"wb"
)))
die
(
"Failed to open %s for writing
\n
"
,
app_input
.
output_filename
);
// Initialize codec
if
(
vpx_svc_init
(
&
svc_ctx
,
&
codec
,
vpx_codec_vp9_cx
(),
&
enc_cfg
)
!=
VPX_CODEC_OK
)
die
(
"Failed to initialize encoder
\n
"
);
ivf_write_file_header
(
outfile
,
&
enc_cfg
,
VP9_FOURCC
,
0
);
info
.
codec_fourcc
=
VP9_FOURCC
;
info
.
time_base
.
numerator
=
enc_cfg
.
g_timebase
.
num
;
info
.
time_base
.
denominator
=
enc_cfg
.
g_timebase
.
den
;
if
(
vpx_svc_get_layer_resolution
(
&
svc_ctx
,
svc_ctx
.
spatial_layers
-
1
,
(
unsigned
int
*
)
&
info
.
frame_width
,
(
unsigned
int
*
)
&
info
.
frame_height
)
!=
VPX_CODEC_OK
)
{
die
(
"Failed to get output resolution"
);
}
writer
=
vpx_video_writer_open
(
app_input
.
output_filename
,
kContainerIVF
,
&
info
);
if
(
!
writer
)
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
)
{
...
...
@@ -232,9 +244,10 @@ int main(int argc, const char **argv) {
die_codec
(
&
codec
,
"Failed to encode frame"
);
}
if
(
vpx_svc_get_frame_size
(
&
svc_ctx
)
>
0
)
{
ivf_write_frame_header
(
outfile
,
pts
,
vpx_svc_get_frame_size
(
&
svc_ctx
));
(
void
)
fwrite
(
vpx_svc_get_buffer
(
&
svc_ctx
),
1
,
vpx_svc_get_frame_size
(
&
svc_ctx
),
outfile
);
vpx_video_writer_write_frame
(
writer
,
vpx_svc_get_buffer
(
&
svc_ctx
),
vpx_svc_get_frame_size
(
&
svc_ctx
),
pts
);
}
++
frame_cnt
;
pts
+=
frame_duration
;
...
...
@@ -245,19 +258,8 @@ int main(int argc, const char **argv) {
fclose
(
app_input
.
input_ctx
.
file
);
if
(
vpx_codec_destroy
(
&
codec
))
die_codec
(
&
codec
,
"Failed to destroy codec"
);
// rewrite the output file headers with the actual frame count, and
// resolution of the highest layer
if
(
!
fseek
(
outfile
,
0
,
SEEK_SET
))
{
// get resolution of highest layer
if
(
VPX_CODEC_OK
!=
vpx_svc_get_layer_resolution
(
&
svc_ctx
,
svc_ctx
.
spatial_layers
-
1
,
&
enc_cfg
.
g_w
,
&
enc_cfg
.
g_h
))
{
die
(
"Failed to get output resolution"
);
}
ivf_write_file_header
(
outfile
,
&
enc_cfg
,
VP9_FOURCC
,
frame_cnt
);
}
fclose
(
outfile
);
vpx_video_writer_close
(
writer
);
vpx_img_free
(
&
raw
);
// display average size, psnr
...
...
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