From 5044779e77517851d91b65d1eec4199919901ecf Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 30 Nov 2017 10:52:25 -0800 Subject: [PATCH] decouple spatial-svc from encoder abi this is only meant for testing. along with --enable-experimental --enable-spatial-svc require VPX_TEST_SPATIAL_SVC to be defined rather than bumping the encoder ABI. Change-Id: I7f34d9f60300fa31ccf22e1a4aa619392c391b2e --- examples/vpx_temporal_svc_encoder.c | 6 ------ vp9/vp9_cx_iface.c | 4 +--- vpx/src/svc_encodeframe.c | 6 ++---- vpx/vpx_encoder.h | 10 ++++------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/examples/vpx_temporal_svc_encoder.c b/examples/vpx_temporal_svc_encoder.c index bff6e1722..e7b31f5eb 100644 --- a/examples/vpx_temporal_svc_encoder.c +++ b/examples/vpx_temporal_svc_encoder.c @@ -558,11 +558,7 @@ int main(int argc, char **argv) { #if VP8_ROI_MAP vpx_roi_map_t roi; #endif -#if VPX_ENCODER_ABI_VERSION > (4 + VPX_CODEC_ABI_VERSION) vpx_svc_layer_id_t layer_id = { 0, 0 }; -#else - vpx_svc_layer_id_t layer_id = { 0 }; -#endif const VpxInterface *encoder = NULL; FILE *infile = NULL; struct RateControlMetrics rc; @@ -814,10 +810,8 @@ int main(int argc, char **argv) { struct vpx_usec_timer timer; vpx_codec_iter_t iter = NULL; const vpx_codec_cx_pkt_t *pkt; -#if VPX_ENCODER_ABI_VERSION > (4 + VPX_CODEC_ABI_VERSION) // Update the temporal layer_id. No spatial layers in this test. layer_id.spatial_layer_id = 0; -#endif layer_id.temporal_layer_id = cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity]; if (strncmp(encoder->name, "vp9", 3) == 0) { diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 00e69c04d..881caae78 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1288,8 +1288,7 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, cx_data += size; cx_data_sz -= size; -#if VPX_ENCODER_ABI_VERSION > (6 + VPX_CODEC_ABI_VERSION) -#if CONFIG_SPATIAL_SVC +#if CONFIG_SPATIAL_SVC && defined(VPX_TEST_SPATIAL_SVC) if (cpi->use_svc && !ctx->output_cx_pkt_cb.output_cx_pkt) { vpx_codec_cx_pkt_t pkt_sizes, pkt_psnr; int sl; @@ -1309,7 +1308,6 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt_psnr); } -#endif #endif if (is_one_pass_cbr_svc(cpi) && (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1)) { diff --git a/vpx/src/svc_encodeframe.c b/vpx/src/svc_encodeframe.c index 8d9a5c3f5..f633600c7 100644 --- a/vpx/src/svc_encodeframe.c +++ b/vpx/src/svc_encodeframe.c @@ -559,8 +559,7 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx, iter = NULL; while ((cx_pkt = vpx_codec_get_cx_data(codec_ctx, &iter))) { switch (cx_pkt->kind) { -#if VPX_ENCODER_ABI_VERSION > (6 + VPX_CODEC_ABI_VERSION) -#if CONFIG_SPATIAL_SVC +#if CONFIG_SPATIAL_SVC && defined(VPX_TEST_SPATIAL_SVC) case VPX_CODEC_SPATIAL_SVC_LAYER_PSNR: { int i; for (i = 0; i < svc_ctx->spatial_layers; ++i) { @@ -594,10 +593,9 @@ vpx_codec_err_t vpx_svc_encode(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx, si->bytes_sum[i] += cx_pkt->data.layer_sizes[i]; break; } -#endif #endif case VPX_CODEC_PSNR_PKT: { -#if VPX_ENCODER_ABI_VERSION > (6 + VPX_CODEC_ABI_VERSION) +#if CONFIG_SPATIAL_SVC && defined(VPX_TEST_SPATIAL_SVC) int j; svc_log(svc_ctx, SVC_LOG_DEBUG, "frame: %d, layer: %d, PSNR(Total/Y/U/V): " diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h index 063d02e67..464bc408c 100644 --- a/vpx/vpx_encoder.h +++ b/vpx/vpx_encoder.h @@ -154,9 +154,8 @@ enum vpx_codec_cx_pkt_kind { VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */ VPX_CODEC_FPMB_STATS_PKT, /**< first pass mb statistics for this frame */ VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */ -// Spatial SVC is still experimental and may be removed before the next ABI -// bump. -#if VPX_ENCODER_ABI_VERSION > (6 + VPX_CODEC_ABI_VERSION) +// Spatial SVC is still experimental and may be removed. +#if defined(VPX_TEST_SPATIAL_SVC) VPX_CODEC_SPATIAL_SVC_LAYER_SIZES, /**< Sizes for each layer in this frame*/ VPX_CODEC_SPATIAL_SVC_LAYER_PSNR, /**< PSNR for each layer in this frame*/ #endif @@ -192,9 +191,8 @@ typedef struct vpx_codec_cx_pkt { double psnr[4]; /**< PSNR, total/y/u/v */ } psnr; /**< data for PSNR packet */ vpx_fixed_buf_t raw; /**< data for arbitrary packets */ -// Spatial SVC is still experimental and may be removed before the next -// ABI bump. -#if VPX_ENCODER_ABI_VERSION > (6 + VPX_CODEC_ABI_VERSION) +// Spatial SVC is still experimental and may be removed. +#if defined(VPX_TEST_SPATIAL_SVC) size_t layer_sizes[VPX_SS_MAX_LAYERS]; struct vpx_psnr_pkt layer_psnr[VPX_SS_MAX_LAYERS]; #endif -- 2.40.0