summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2018-03-21 10:56:09 -0700
committerMarco Paniconi <marpan@google.com>2018-03-21 16:47:59 -0700
commit3cb9c5ffe93f32d3299389f3e756941524e2b223 (patch)
tree1896bbc335a58a3a4038708056bf4cb2cbcb8aab /examples
parent62c47475325915008e3f9cca6b636aeca07ab607 (diff)
downloadlibvpx-3cb9c5ffe93f32d3299389f3e756941524e2b223.tar.gz
vp9-svc: Fix to sample encoder
Get the correct computation of number of input layers to account for frame drops. Change-Id: I39637381e1981b53c930da67a5c525191de6907d
Diffstat (limited to 'examples')
-rw-r--r--examples/vp9_spatial_svc_encoder.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/vp9_spatial_svc_encoder.c b/examples/vp9_spatial_svc_encoder.c
index ccc9ebdd8..4531a9ea4 100644
--- a/examples/vp9_spatial_svc_encoder.c
+++ b/examples/vp9_spatial_svc_encoder.c
@@ -670,7 +670,10 @@ int main(int argc, const char **argv) {
die("Failed to initialize encoder\n");
#if OUTPUT_RC_STATS
+ rc.window_count = 1;
rc.window_size = 15; // Silence a static analysis warning.
+ rc.avg_st_encoding_bitrate = 0.0;
+ rc.variance_st_encoding_bitrate = 0.0;
if (svc_ctx.output_rc_stat) {
set_rate_control_stats(&rc, &enc_cfg);
framerate = enc_cfg.g_timebase.den / enc_cfg.g_timebase.num;
@@ -763,6 +766,17 @@ int main(int argc, const char **argv) {
++rc.layer_input_frames[sl * enc_cfg.ts_number_layers +
layer_id.temporal_layer_id];
}
+ } else {
+ // For the fixed pattern SVC, temporal layer is given by superframe count.
+ unsigned int tl = 0;
+ if (enc_cfg.ts_number_layers == 2)
+ tl = (frame_cnt % 2 != 0);
+ else if (enc_cfg.ts_number_layers == 3) {
+ if (frame_cnt % 2 != 0) tl = 2;
+ if ((frame_cnt > 1) && ((frame_cnt - 2) % 4 == 0)) tl = 1;
+ }
+ for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl)
+ ++rc.layer_input_frames[sl * enc_cfg.ts_number_layers + tl];
}
vpx_usec_timer_start(&timer);
@@ -805,8 +819,6 @@ int main(int argc, const char **argv) {
VP9E_TEMPORAL_LAYERING_MODE_BYPASS) {
int num_layers_encoded = 0;
for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl) {
- ++rc.layer_input_frames[sl * enc_cfg.ts_number_layers +
- layer_id.temporal_layer_id];
sizes[sl] = 0;
if (cx_pkt->data.frame.spatial_layer_encoded[sl]) {
sizes[sl] = sizes_parsed[num_layers_encoded];