| Index: source/libvpx/vp9/vp9_cx_iface.c
|
| ===================================================================
|
| --- source/libvpx/vp9/vp9_cx_iface.c (revision 284462)
|
| +++ source/libvpx/vp9/vp9_cx_iface.c (working copy)
|
| @@ -11,6 +11,7 @@
|
| #include <stdlib.h>
|
| #include <string.h>
|
|
|
| +#include "./vpx_config.h"
|
| #include "vpx/vpx_codec.h"
|
| #include "vpx/internal/vpx_codec_internal.h"
|
| #include "./vpx_version.h"
|
| @@ -88,7 +89,7 @@
|
| size_t pending_frame_magnitude;
|
| vpx_image_t preview_img;
|
| vp8_postproc_cfg_t preview_ppcfg;
|
| - vpx_codec_pkt_list_decl(128) pkt_list;
|
| + vpx_codec_pkt_list_decl(256) pkt_list;
|
| unsigned int fixed_kf_cntr;
|
| };
|
|
|
| @@ -174,6 +175,19 @@
|
| }
|
|
|
| RANGE_CHECK(cfg, ss_number_layers, 1, VPX_SS_MAX_LAYERS);
|
| +
|
| +#ifdef CONFIG_SPATIAL_SVC
|
| + if (cfg->ss_number_layers > 1) {
|
| + unsigned int i, alt_ref_sum = 0;
|
| + for (i = 0; i < cfg->ss_number_layers; ++i) {
|
| + if (cfg->ss_enable_auto_alt_ref[i])
|
| + ++alt_ref_sum;
|
| + }
|
| + if (alt_ref_sum > REF_FRAMES - cfg->ss_number_layers)
|
| + ERROR("Not enough ref buffers for svc alt ref frames");
|
| + }
|
| +#endif
|
| +
|
| RANGE_CHECK(cfg, ts_number_layers, 1, VPX_TS_MAX_LAYERS);
|
| if (cfg->ts_number_layers > 1) {
|
| unsigned int i;
|
| @@ -260,6 +274,7 @@
|
| ERROR("rc_twopass_stats_in missing EOS stats packet");
|
| }
|
| }
|
| +
|
| if (cfg->g_profile <= (unsigned int)PROFILE_1 &&
|
| extra_cfg->bit_depth > BITS_8)
|
| ERROR("High bit-depth not supported in profile < 2");
|
| @@ -362,6 +377,10 @@
|
| oxcf->two_pass_stats_in = cfg->rc_twopass_stats_in;
|
| oxcf->output_pkt_list = extra_cfg->pkt_list;
|
|
|
| +#if CONFIG_FP_MB_STATS
|
| + oxcf->firstpass_mb_stats_in = cfg->rc_firstpass_mb_stats_in;
|
| +#endif
|
| +
|
| oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
|
| oxcf->arnr_strength = extra_cfg->arnr_strength;
|
| oxcf->arnr_type = extra_cfg->arnr_type;
|
| @@ -382,8 +401,12 @@
|
|
|
| if (oxcf->ss_number_layers > 1) {
|
| int i;
|
| - for (i = 0; i < VPX_SS_MAX_LAYERS; ++i)
|
| + for (i = 0; i < VPX_SS_MAX_LAYERS; ++i) {
|
| oxcf->ss_target_bitrate[i] = 1000 * cfg->ss_target_bitrate[i];
|
| +#ifdef CONFIG_SPATIAL_SVC
|
| + oxcf->ss_play_alternate[i] = cfg->ss_enable_auto_alt_ref[i];
|
| +#endif
|
| + }
|
| } else if (oxcf->ss_number_layers == 1) {
|
| oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth;
|
| }
|
| @@ -648,6 +671,7 @@
|
|
|
| priv->extra_cfg = extracfg_map[i].cfg;
|
| priv->extra_cfg.pkt_list = &priv->pkt_list.head;
|
| +
|
| // Maximum buffer size approximated based on having multiple ARF.
|
| priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 8;
|
|
|
| @@ -864,6 +888,11 @@
|
| vpx_codec_cx_pkt_t pkt;
|
| VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi;
|
|
|
| +#ifdef CONFIG_SPATIAL_SVC
|
| + if (cpi->use_svc && cpi->svc.number_temporal_layers == 1)
|
| + cpi->svc.layer_context[cpi->svc.spatial_layer_id].layer_size += size;
|
| +#endif
|
| +
|
| // Pack invisible frames with the next visible frame
|
| if (cpi->common.show_frame == 0
|
| #ifdef CONFIG_SPATIAL_SVC
|
| @@ -936,6 +965,18 @@
|
| vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
|
| cx_data += size;
|
| cx_data_sz -= size;
|
| +#ifdef CONFIG_SPATIAL_SVC
|
| + if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
|
| + vpx_codec_cx_pkt_t pkt = {0};
|
| + int i;
|
| + pkt.kind = VPX_CODEC_SPATIAL_SVC_LAYER_SIZES;
|
| + for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
|
| + pkt.data.layer_sizes[i] = cpi->svc.layer_context[i].layer_size;
|
| + cpi->svc.layer_context[i].layer_size = 0;
|
| + }
|
| + vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
|
| + }
|
| +#endif
|
| }
|
| }
|
| }
|
| @@ -1224,6 +1265,7 @@
|
| VPX_VBR, // rc_end_usage
|
| #if VPX_ENCODER_ABI_VERSION > (1 + VPX_CODEC_ABI_VERSION)
|
| {NULL, 0}, // rc_twopass_stats_in
|
| + {NULL, 0}, // rc_firstpass_mb_stats_in
|
| #endif
|
| 256, // rc_target_bandwidth
|
| 0, // rc_min_quantizer
|
| @@ -1245,6 +1287,9 @@
|
| 9999, // kf_max_dist
|
|
|
| VPX_SS_DEFAULT_LAYERS, // ss_number_layers
|
| +#ifdef CONFIG_SPATIAL_SVC
|
| + {0},
|
| +#endif
|
| {0}, // ss_target_bitrate
|
| 1, // ts_number_layers
|
| {0}, // ts_target_bitrate
|
|
|