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
bb74a77c
Commit
bb74a77c
authored
10 years ago
by
Minghai Shang
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Download
Patches
Plain Diff
[spatial svc] Remove useless APIs and variables
Change-Id: If8cd3879aa2a498a2b1b97cedb88b2b3bd97f0ba
parent
3e7b04af
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
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
sandbox/Jingning/experimental
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
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
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
vpx/exports_enc
+0
-2
vpx/exports_enc
vpx/src/svc_encodeframe.c
+15
-67
vpx/src/svc_encodeframe.c
vpx/svc_context.h
+0
-9
vpx/svc_context.h
vpx/vp8cx.h
+0
-1
vpx/vp8cx.h
with
15 additions
and
79 deletions
vpx/exports_enc
+
0
−
2
View file @
bb74a77c
...
...
@@ -8,11 +8,9 @@ text vpx_codec_get_preview_frame
text vpx_codec_set_cx_data_buf
text vpx_svc_dump_statistics
text vpx_svc_encode
text vpx_svc_get_encode_frame_count
text vpx_svc_get_message
text vpx_svc_init
text vpx_svc_release
text vpx_svc_set_keyframe
text vpx_svc_set_options
text vpx_svc_set_quantizers
text vpx_svc_set_scale_factors
...
...
This diff is collapsed.
Click to expand it.
vpx/src/svc_encodeframe.c
+
15
−
67
View file @
bb74a77c
...
...
@@ -106,12 +106,8 @@ typedef struct SvcInternal {
int
kf_dist
;
// distance between keyframes
// state variables
int
encode_frame_count
;
int
psnr_pkt_received
;
int
frame_within_gop
;
int
layers
;
int
layer
;
int
is_keyframe
;
int
use_multiple_frame_contexts
;
char
message_buffer
[
2048
];
...
...
@@ -342,13 +338,14 @@ vpx_codec_err_t vpx_svc_set_scale_factors(SvcContext *svc_ctx,
return
VPX_CODEC_OK
;
}
void
assign_layer_bitrates
(
const
Svc
I
nte
rnal
*
const
si
,
void
assign_layer_bitrates
(
const
Svc
Co
nte
xt
*
svc_ctx
,
vpx_codec_enc_cfg_t
*
const
enc_cfg
)
{
int
i
;
const
SvcInternal
*
const
si
=
get_const_svc_internal
(
svc_ctx
);
if
(
si
->
bitrates
[
0
]
!=
0
)
{
enc_cfg
->
rc_target_bitrate
=
0
;
for
(
i
=
0
;
i
<
s
i
->
layers
;
++
i
)
{
for
(
i
=
0
;
i
<
s
vc_ctx
->
spatial_
layers
;
++
i
)
{
enc_cfg
->
ss_target_bitrate
[
i
]
=
(
unsigned
int
)
si
->
bitrates
[
i
];
enc_cfg
->
rc_target_bitrate
+=
si
->
bitrates
[
i
];
}
...
...
@@ -356,7 +353,7 @@ void assign_layer_bitrates(const SvcInternal *const si,
float
total
=
0
;
float
alloc_ratio
[
VPX_SS_MAX_LAYERS
]
=
{
0
};
for
(
i
=
0
;
i
<
s
i
->
layers
;
++
i
)
{
for
(
i
=
0
;
i
<
s
vc_ctx
->
spatial_
layers
;
++
i
)
{
if
(
si
->
scaling_factor_den
[
i
]
>
0
)
{
alloc_ratio
[
i
]
=
(
float
)(
si
->
scaling_factor_num
[
i
]
*
1
.
0
/
si
->
scaling_factor_den
[
i
]);
...
...
@@ -366,7 +363,7 @@ void assign_layer_bitrates(const SvcInternal *const si,
}
}
for
(
i
=
0
;
i
<
s
i
->
layers
;
++
i
)
{
for
(
i
=
0
;
i
<
s
vc_ctx
->
spatial_
layers
;
++
i
)
{
if
(
total
>
0
)
{
enc_cfg
->
ss_target_bitrate
[
i
]
=
(
unsigned
int
)
(
enc_cfg
->
rc_target_bitrate
*
alloc_ratio
[
i
]
/
total
);
...
...
@@ -445,12 +442,10 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
if
(
svc_ctx
->
temporal_layers
>
VPX_TS_MAX_LAYERS
)
svc_ctx
->
temporal_layers
=
VPX_TS_MAX_LAYERS
;
si
->
layers
=
svc_ctx
->
spatial_layers
;
assign_layer_bitrates
(
si
,
enc_cfg
);
assign_layer_bitrates
(
svc_ctx
,
enc_cfg
);
#if CONFIG_SPATIAL_SVC
for
(
i
=
0
;
i
<
s
i
->
layers
;
++
i
)
for
(
i
=
0
;
i
<
s
vc_ctx
->
spatial_
layers
;
++
i
)
enc_cfg
->
ss_enable_auto_alt_ref
[
i
]
=
si
->
enable_auto_alt_ref
[
i
];
#endif
...
...
@@ -464,24 +459,9 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
}
// modify encoder configuration
enc_cfg
->
ss_number_layers
=
s
i
->
layers
;
enc_cfg
->
ss_number_layers
=
s
vc_ctx
->
spatial_
layers
;
enc_cfg
->
ts_number_layers
=
svc_ctx
->
temporal_layers
;
// TODO(ivanmaltz): determine if these values need to be set explicitly for
// svc, or if the normal default/override mechanism can be used
enc_cfg
->
rc_dropframe_thresh
=
0
;
enc_cfg
->
rc_resize_allowed
=
0
;
if
(
enc_cfg
->
g_pass
==
VPX_RC_ONE_PASS
)
{
enc_cfg
->
rc_min_quantizer
=
33
;
enc_cfg
->
rc_max_quantizer
=
33
;
}
enc_cfg
->
rc_undershoot_pct
=
100
;
enc_cfg
->
rc_overshoot_pct
=
15
;
enc_cfg
->
rc_buf_initial_sz
=
500
;
enc_cfg
->
rc_buf_optimal_sz
=
600
;
enc_cfg
->
rc_buf_sz
=
1000
;
if
(
enc_cfg
->
g_error_resilient
==
0
&&
si
->
use_multiple_frame_contexts
==
0
)
enc_cfg
->
g_error_resilient
=
1
;
...
...
@@ -493,7 +473,6 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
}
vpx_codec_control
(
codec_ctx
,
VP9E_SET_SVC
,
1
);
vpx_codec_control
(
codec_ctx
,
VP8E_SET_TOKEN_PARTITIONS
,
1
);
return
VPX_CODEC_OK
;
}
...
...
@@ -505,10 +484,10 @@ vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
int
w
,
h
,
num
,
den
;
const
SvcInternal
*
const
si
=
get_const_svc_internal
(
svc_ctx
);
if
(
svc_ctx
==
NULL
||
si
==
NULL
||
width
==
NULL
||
height
==
NULL
)
{
if
(
svc_ctx
==
NULL
||
si
==
NULL
||
width
==
NULL
||
height
==
NULL
)
return
VPX_CODEC_INVALID_PARAM
;
if
(
layer
<
0
||
layer
>=
svc_ctx
->
spatial_layers
)
return
VPX_CODEC_INVALID_PARAM
;
}
if
(
layer
<
0
||
layer
>=
si
->
layers
)
return
VPX_CODEC_INVALID_PARAM
;
num
=
si
->
scaling_factor_num
[
layer
];
den
=
si
->
scaling_factor_den
[
layer
];
...
...
@@ -552,7 +531,6 @@ static void set_svc_parameters(SvcContext *svc_ctx,
svc_params
.
max_quantizer
=
codec_ctx
->
config
.
enc
->
rc_max_quantizer
;
}
svc_params
.
distance_from_i_frame
=
si
->
frame_within_gop
;
vpx_codec_control
(
codec_ctx
,
VP9E_SET_SVC_PARAMETERS
,
&
svc_params
);
}
...
...
@@ -573,22 +551,9 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
svc_log_reset
(
svc_ctx
);
si
->
layers
=
svc_ctx
->
spatial_layers
;
if
(
si
->
encode_frame_count
==
0
)
{
si
->
frame_within_gop
=
0
;
}
si
->
is_keyframe
=
(
si
->
frame_within_gop
==
0
);
if
(
rawimg
!=
NULL
)
{
svc_log
(
svc_ctx
,
SVC_LOG_DEBUG
,
"vpx_svc_encode layers: %d, frame_count: %d, "
"frame_within_gop: %d
\n
"
,
si
->
layers
,
si
->
encode_frame_count
,
si
->
frame_within_gop
);
}
if
(
rawimg
!=
NULL
)
{
// encode each layer
for
(
si
->
layer
=
0
;
si
->
layer
<
s
i
->
layers
;
++
si
->
layer
)
{
for
(
si
->
layer
=
0
;
si
->
layer
<
s
vc_ctx
->
spatial_
layers
;
++
si
->
layer
)
{
set_svc_parameters
(
svc_ctx
,
codec_ctx
);
}
}
...
...
@@ -635,7 +600,7 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
}
case
VPX_CODEC_SPATIAL_SVC_LAYER_SIZES
:
{
int
i
;
for
(
i
=
0
;
i
<
s
i
->
layers
;
++
i
)
for
(
i
=
0
;
i
<
s
vc_ctx
->
spatial_
layers
;
++
i
)
si
->
bytes_sum
[
i
]
+=
cx_pkt
->
data
.
layer_sizes
[
i
];
break
;
}
...
...
@@ -646,11 +611,6 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx,
}
}
if
(
rawimg
!=
NULL
)
{
++
si
->
frame_within_gop
;
++
si
->
encode_frame_count
;
}
return
VPX_CODEC_OK
;
}
...
...
@@ -660,18 +620,6 @@ const char *vpx_svc_get_message(const SvcContext *svc_ctx) {
return
si
->
message_buffer
;
}
int
vpx_svc_get_encode_frame_count
(
const
SvcContext
*
svc_ctx
)
{
const
SvcInternal
*
const
si
=
get_const_svc_internal
(
svc_ctx
);
if
(
svc_ctx
==
NULL
||
si
==
NULL
)
return
0
;
return
si
->
encode_frame_count
;
}
void
vpx_svc_set_keyframe
(
SvcContext
*
svc_ctx
)
{
SvcInternal
*
const
si
=
get_svc_internal
(
svc_ctx
);
if
(
svc_ctx
==
NULL
||
si
==
NULL
)
return
;
si
->
frame_within_gop
=
0
;
}
static
double
calc_psnr
(
double
d
)
{
if
(
d
==
0
)
return
100
;
return
-
10
.
0
*
log
(
d
)
/
log
(
10
.
0
);
...
...
@@ -696,7 +644,7 @@ const char *vpx_svc_dump_statistics(SvcContext *svc_ctx) {
if
(
number_of_frames
<=
0
)
return
vpx_svc_get_message
(
svc_ctx
);
svc_log
(
svc_ctx
,
SVC_LOG_INFO
,
"
\n
"
);
for
(
i
=
0
;
i
<
s
i
->
layers
;
++
i
)
{
for
(
i
=
0
;
i
<
s
vc_ctx
->
spatial_
layers
;
++
i
)
{
svc_log
(
svc_ctx
,
SVC_LOG_INFO
,
"Layer %d Average PSNR=[%2.3f, %2.3f, %2.3f, %2.3f], Bytes=[%u]
\n
"
,
...
...
@@ -731,7 +679,7 @@ const char *vpx_svc_dump_statistics(SvcContext *svc_ctx) {
}
// only display statistics once
si
->
encode_frame_count
=
0
;
si
->
psnr_pkt_received
=
0
;
svc_log
(
svc_ctx
,
SVC_LOG_INFO
,
"Total Bytes=[%u]
\n
"
,
bytes_total
);
return
vpx_svc_get_message
(
svc_ctx
);
...
...
This diff is collapsed.
Click to expand it.
vpx/svc_context.h
+
0
−
9
View file @
bb74a77c
...
...
@@ -102,15 +102,6 @@ vpx_codec_err_t vpx_svc_get_layer_resolution(const SvcContext *svc_ctx,
int
layer
,
unsigned
int
*
width
,
unsigned
int
*
height
);
/**
* return number of frames that have been encoded
*/
int
vpx_svc_get_encode_frame_count
(
const
SvcContext
*
svc_ctx
);
/**
* force the next frame to be a keyframe
*/
void
vpx_svc_set_keyframe
(
SvcContext
*
svc_ctx
);
#ifdef __cplusplus
}
// extern "C"
...
...
This diff is collapsed.
Click to expand it.
vpx/vp8cx.h
+
0
−
1
View file @
bb74a77c
...
...
@@ -307,7 +307,6 @@ typedef struct vpx_svc_parameters {
int
temporal_layer
;
/**< current temporal layer number - 0 = base */
int
max_quantizer
;
/**< max quantizer for current layer */
int
min_quantizer
;
/**< min quantizer for current layer */
int
distance_from_i_frame
;
/**< frame number within current gop */
int
lst_fb_idx
;
/**< last frame frame buffer index */
int
gld_fb_idx
;
/**< golden frame frame buffer index */
int
alt_fb_idx
;
/**< alt reference frame frame buffer index */
...
...
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