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
4f8a30b1
Commit
4f8a30b1
authored
11 years ago
by
Dmitry Kovalev
Browse files
Options
Download
Patches
Plain Diff
Converting vpx_temporal_scalable_patterns to use VpxVideoWriter.
Change-Id: I69e868295b9798ba1599a411926de0891680032f
parent
9e41de4d
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
examples/vpx_temporal_scalable_patterns.c
+25
-22
examples/vpx_temporal_scalable_patterns.c
with
27 additions
and
22 deletions
examples.mk
+
2
−
0
View file @
4f8a30b1
...
@@ -73,6 +73,8 @@ endif
...
@@ -73,6 +73,8 @@ endif
EXAMPLES-$(CONFIG_ENCODERS)
+=
vpx_temporal_scalable_patterns.c
EXAMPLES-$(CONFIG_ENCODERS)
+=
vpx_temporal_scalable_patterns.c
vpx_temporal_scalable_patterns.SRCS
+=
ivfenc.c ivfenc.h
vpx_temporal_scalable_patterns.SRCS
+=
ivfenc.c ivfenc.h
vpx_temporal_scalable_patterns.SRCS
+=
tools_common.c tools_common.h
vpx_temporal_scalable_patterns.SRCS
+=
tools_common.c tools_common.h
vpx_temporal_scalable_patterns.SRCS
+=
video_common.h
vpx_temporal_scalable_patterns.SRCS
+=
video_writer.h video_writer.c
vpx_temporal_scalable_patterns.GUID
=
B18C08F2-A439-4502-A78E-849BE3D60947
vpx_temporal_scalable_patterns.GUID
=
B18C08F2-A439-4502-A78E-849BE3D60947
vpx_temporal_scalable_patterns.DESCRIPTION
=
Temporal Scalability Encoder
vpx_temporal_scalable_patterns.DESCRIPTION
=
Temporal Scalability Encoder
EXAMPLES-$(CONFIG_VP8_DECODER)
+=
simple_decoder.c
EXAMPLES-$(CONFIG_VP8_DECODER)
+=
simple_decoder.c
...
...
This diff is collapsed.
Click to expand it.
examples/vpx_temporal_scalable_patterns.c
+
25
−
22
View file @
4f8a30b1
...
@@ -12,18 +12,17 @@
...
@@ -12,18 +12,17 @@
// encoding scheme based on temporal scalability for video applications
// encoding scheme based on temporal scalability for video applications
// that benefit from a scalable bitstream.
// that benefit from a scalable bitstream.
#include
<stdarg.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#define VPX_CODEC_DISABLE_COMPAT 1
#include
"./ivfenc.h"
#include
"./tools_common.h"
#include
"./vpx_config.h"
#include
"vpx/vp8cx.h"
#include
"vpx/vp8cx.h"
#include
"vpx/vpx_encoder.h"
#include
"vpx/vpx_encoder.h"
#include
"./tools_common.h"
#include
"./video_writer.h"
static
const
char
*
exec_name
;
static
const
char
*
exec_name
;
void
usage_exit
()
{
void
usage_exit
()
{
...
@@ -341,7 +340,7 @@ static void set_temporal_layer_pattern(int layering_mode,
...
@@ -341,7 +340,7 @@ static void set_temporal_layer_pattern(int layering_mode,
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
FILE
*
outfile
[
VPX_TS_MAX_LAYERS
];
VpxVideoWriter
*
outfile
[
VPX_TS_MAX_LAYERS
];
vpx_codec_ctx_t
codec
;
vpx_codec_ctx_t
codec
;
vpx_codec_enc_cfg_t
cfg
;
vpx_codec_enc_cfg_t
cfg
;
int
frame_cnt
=
0
;
int
frame_cnt
=
0
;
...
@@ -378,14 +377,14 @@ int main(int argc, char **argv) {
...
@@ -378,14 +377,14 @@ int main(int argc, char **argv) {
if
(
strncmp
(
codec_type
,
"vp9"
,
3
)
==
0
)
{
if
(
strncmp
(
codec_type
,
"vp9"
,
3
)
==
0
)
{
#if CONFIG_VP9_ENCODER
#if CONFIG_VP9_ENCODER
interface
=
vpx_codec_vp9_cx
;
interface
=
vpx_codec_vp9_cx
;
fourcc
=
0x30395056
;
fourcc
=
VP9_FOURCC
;
#else
#else
die
(
"Encoder vp9 selected but not configured"
);
die
(
"Encoder vp9 selected but not configured"
);
#endif
#endif
}
else
{
}
else
{
#if CONFIG_VP8_ENCODER
#if CONFIG_VP8_ENCODER
interface
=
vpx_codec_vp8_cx
;
interface
=
vpx_codec_vp8_cx
;
fourcc
=
0x30385056
;
fourcc
=
VP8_FOURCC
;
#else
#else
die
(
"Encoder vp8 selected but not configured"
);
die
(
"Encoder vp8 selected but not configured"
);
#endif
#endif
...
@@ -427,7 +426,7 @@ int main(int argc, char **argv) {
...
@@ -427,7 +426,7 @@ int main(int argc, char **argv) {
cfg
.
g_timebase
.
den
=
strtol
(
argv
[
7
],
NULL
,
0
);
cfg
.
g_timebase
.
den
=
strtol
(
argv
[
7
],
NULL
,
0
);
for
(
i
=
9
;
i
<
9
+
mode_to_num_layers
[
layering_mode
];
++
i
)
{
for
(
i
=
9
;
i
<
9
+
mode_to_num_layers
[
layering_mode
];
++
i
)
{
cfg
.
ts_target_bitrate
[
i
-
9
]
=
strtol
(
argv
[
i
],
NULL
,
0
);
cfg
.
ts_target_bitrate
[
i
-
9
]
=
strtol
(
argv
[
i
],
NULL
,
0
);
}
}
// Real time parameters.
// Real time parameters.
...
@@ -466,11 +465,18 @@ int main(int argc, char **argv) {
...
@@ -466,11 +465,18 @@ int main(int argc, char **argv) {
// Open an output file for each stream.
// Open an output file for each stream.
for
(
i
=
0
;
i
<
cfg
.
ts_number_layers
;
++
i
)
{
for
(
i
=
0
;
i
<
cfg
.
ts_number_layers
;
++
i
)
{
char
file_name
[
512
];
char
file_name
[
PATH_MAX
];
VpxVideoInfo
info
;
info
.
codec_fourcc
=
fourcc
;
info
.
frame_width
=
cfg
.
g_w
;
info
.
frame_height
=
cfg
.
g_h
;
info
.
time_base
.
numerator
=
cfg
.
g_timebase
.
num
;
info
.
time_base
.
denominator
=
cfg
.
g_timebase
.
den
;
snprintf
(
file_name
,
sizeof
(
file_name
),
"%s_%d.ivf"
,
argv
[
2
],
i
);
snprintf
(
file_name
,
sizeof
(
file_name
),
"%s_%d.ivf"
,
argv
[
2
],
i
);
if
(
!
(
outfile
[
i
]
=
fopen
(
file_name
,
"wb"
)))
outfile
[
i
]
=
vpx_video_writer_open
(
file_name
,
kContainerIVF
,
&
info
);
if
(
!
outfile
[
i
])
die
(
"Failed to open %s for writing"
,
file_name
);
die
(
"Failed to open %s for writing"
,
file_name
);
ivf_write_file_header
(
outfile
[
i
],
&
cfg
,
fourcc
,
0
);
}
}
// No spatial layers in this encoder.
// No spatial layers in this encoder.
cfg
.
ss_number_layers
=
1
;
cfg
.
ss_number_layers
=
1
;
...
@@ -520,9 +526,8 @@ int main(int argc, char **argv) {
...
@@ -520,9 +526,8 @@ int main(int argc, char **argv) {
case
VPX_CODEC_CX_FRAME_PKT
:
case
VPX_CODEC_CX_FRAME_PKT
:
for
(
i
=
cfg
.
ts_layer_id
[
frame_cnt
%
cfg
.
ts_periodicity
];
for
(
i
=
cfg
.
ts_layer_id
[
frame_cnt
%
cfg
.
ts_periodicity
];
i
<
cfg
.
ts_number_layers
;
++
i
)
{
i
<
cfg
.
ts_number_layers
;
++
i
)
{
ivf_write_frame_header
(
outfile
[
i
],
pts
,
pkt
->
data
.
frame
.
sz
);
vpx_video_writer_write_frame
(
outfile
[
i
],
pkt
->
data
.
frame
.
buf
,
(
void
)
fwrite
(
pkt
->
data
.
frame
.
buf
,
1
,
pkt
->
data
.
frame
.
sz
,
pkt
->
data
.
frame
.
sz
,
pts
);
outfile
[
i
]);
++
frames_in_layer
[
i
];
++
frames_in_layer
[
i
];
}
}
break
;
break
;
...
@@ -534,15 +539,13 @@ int main(int argc, char **argv) {
...
@@ -534,15 +539,13 @@ int main(int argc, char **argv) {
pts
+=
frame_duration
;
pts
+=
frame_duration
;
}
}
fclose
(
input_ctx
.
file
);
fclose
(
input_ctx
.
file
);
printf
(
"Processed %d frames:
\n
"
,
frame_cnt
-
1
);
printf
(
"Processed %d frames:
\n
"
,
frame_cnt
-
1
);
if
(
vpx_codec_destroy
(
&
codec
))
{
if
(
vpx_codec_destroy
(
&
codec
))
die_codec
(
&
codec
,
"Failed to destroy codec"
);
die_codec
(
&
codec
,
"Failed to destroy codec"
);
}
// Try to rewrite the output file headers with the actual frame count.
// Try to rewrite the output file headers with the actual frame count.
for
(
i
=
0
;
i
<
cfg
.
ts_number_layers
;
++
i
)
{
for
(
i
=
0
;
i
<
cfg
.
ts_number_layers
;
++
i
)
if
(
!
fseek
(
outfile
[
i
],
0
,
SEEK_SET
))
vpx_video_writer_close
(
outfile
[
i
]);
ivf_write_file_header
(
outfile
[
i
],
&
cfg
,
fourcc
,
frame_cnt
);
fclose
(
outfile
[
i
]);
}
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
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