diff options
author | Marco <marpan@google.com> | 2016-01-15 09:35:41 -0800 |
---|---|---|
committer | Marco <marpan@google.com> | 2016-01-20 08:53:51 -0800 |
commit | abf58ecf6a74bcabaad180e53694c5c070c72773 (patch) | |
tree | a23c1d77906d6456cbc276d3a0a68c152ce3e6cf /examples | |
parent | a7e0b1ea0169c28bea4a11727bab54ee0d6f26ce (diff) | |
download | libvpx-abf58ecf6a74bcabaad180e53694c5c070c72773.tar.gz |
Vidyo patch: Changes to the scalability code.
Changes to mode selection for 1 pass SVC mode:
use base layer motion vector, changes to intra-prediction.
Change-Id: I3e883aa04db521cfa026a0b12c9478ea35a344c9
Diffstat (limited to 'examples')
-rw-r--r-- | examples/vp9_spatial_svc_encoder.c | 5 | ||||
-rw-r--r-- | examples/vpx_temporal_svc_encoder.c | 31 |
2 files changed, 33 insertions, 3 deletions
diff --git a/examples/vp9_spatial_svc_encoder.c b/examples/vp9_spatial_svc_encoder.c index d2b368856..271ab704b 100644 --- a/examples/vp9_spatial_svc_encoder.c +++ b/examples/vp9_spatial_svc_encoder.c @@ -30,6 +30,7 @@ #include "vpx/vp8cx.h" #include "vpx/vpx_encoder.h" #include "../vpxstats.h" +#include "vp9/encoder/vp9_encoder.h" #define OUTPUT_RC_STATS 1 static const arg_def_t skip_frames_arg = @@ -749,6 +750,7 @@ int main(int argc, const char **argv) { cx_time += vpx_usec_timer_elapsed(&timer); printf("%s", vpx_svc_get_message(&svc_ctx)); + fflush(stdout); if (res != VPX_CODEC_OK) { die_codec(&codec, "Failed to encode frame"); } @@ -756,6 +758,7 @@ int main(int argc, const char **argv) { while ((cx_pkt = vpx_codec_get_cx_data(&codec, &iter)) != NULL) { switch (cx_pkt->kind) { case VPX_CODEC_CX_FRAME_PKT: { + SvcInternal_t *const si = (SvcInternal_t *)svc_ctx.internal; if (cx_pkt->data.frame.sz > 0) { #if OUTPUT_RC_STATS uint32_t sizes[8]; @@ -851,6 +854,8 @@ int main(int argc, const char **argv) { printf("SVC frame: %d, kf: %d, size: %d, pts: %d\n", frames_received, !!(cx_pkt->data.frame.flags & VPX_FRAME_IS_KEY), (int)cx_pkt->data.frame.sz, (int)cx_pkt->data.frame.pts); + if (enc_cfg.ss_number_layers == 1 && enc_cfg.ts_number_layers == 1) + si->bytes_sum[0] += (int)cx_pkt->data.frame.sz; ++frames_received; break; } diff --git a/examples/vpx_temporal_svc_encoder.c b/examples/vpx_temporal_svc_encoder.c index 5adda9eeb..16abb9deb 100644 --- a/examples/vpx_temporal_svc_encoder.c +++ b/examples/vpx_temporal_svc_encoder.c @@ -41,7 +41,7 @@ enum denoiserState { kDenoiserOnAdaptive }; -static int mode_to_num_layers[12] = {1, 2, 2, 3, 3, 3, 3, 5, 2, 3, 3, 3}; +static int mode_to_num_layers[13] = {1, 2, 2, 3, 3, 3, 3, 5, 2, 3, 3, 3, 3}; // For rate control encoding stats. struct RateControlMetrics { @@ -432,7 +432,32 @@ static void set_temporal_layer_pattern(int layering_mode, layer_flags[7] = layer_flags[3]; break; } - case 11: + case 11: { + // 3-layers structure with one reference frame. + // This works same as temporal_layering_mode 3. + // This was added to compare with vp9_spatial_svc_encoder. + + // 3-layers, 4-frame period. + int ids[4] = {0, 2, 1, 2}; + cfg->ts_periodicity = 4; + *flag_periodicity = 4; + cfg->ts_number_layers = 3; + cfg->ts_rate_decimator[0] = 4; + cfg->ts_rate_decimator[1] = 2; + cfg->ts_rate_decimator[2] = 1; + memcpy(cfg->ts_layer_id, ids, sizeof(ids)); + // 0=L, 1=GF, 2=ARF, Intra-layer prediction disabled. + layer_flags[0] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF | + VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF; + layer_flags[2] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF | + VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST; + layer_flags[1] = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF | + VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF; + layer_flags[3] = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_ARF | + VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF; + break; + } + case 12: default: { // 3-layers structure as in case 10, but no sync/refresh points for // layer 1 and 2. @@ -530,7 +555,7 @@ int main(int argc, char **argv) { } layering_mode = strtol(argv[10], NULL, 0); - if (layering_mode < 0 || layering_mode > 12) { + if (layering_mode < 0 || layering_mode > 13) { die("Invalid layering mode (0..12) %s", argv[10]); } |