[spatial svc]Use #if instead of #ifdef on macro CONFIG_SPATIAL_SVC
authorMinghai Shang <minghai@google.com>
Tue, 22 Jul 2014 17:05:40 +0000 (10:05 -0700)
committerMinghai Shang <minghai@google.com>
Tue, 22 Jul 2014 18:11:55 +0000 (11:11 -0700)
Change-Id: Ifc94377a0d05d66e3d21b007893a985b66db6082

vp8/vp8_cx_iface.c
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_lookahead.h
vp9/encoder/vp9_svc_layercontext.c
vp9/vp9_cx_iface.c
vpx/vpx_encoder.h

index cbff86c..a10c401 100644 (file)
@@ -1316,7 +1316,7 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
         "vp8.fpf"           /* first pass filename */
 #endif
         VPX_SS_DEFAULT_LAYERS, /* ss_number_layers */
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
         {0},
 #endif
         {0},                /* ss_target_bitrate */
index 80b9c93..1815d5d 100644 (file)
@@ -2422,15 +2422,13 @@ int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags,
   int res = 0;
   const int subsampling_x = sd->uv_width  < sd->y_width;
   const int subsampling_y = sd->uv_height < sd->y_height;
-  const int is_spatial_svc = cpi->use_svc &&
-                             (cpi->svc.number_temporal_layers == 1);
 
   check_initial_width(cpi, subsampling_x, subsampling_y);
 
   vpx_usec_timer_start(&timer);
 
-#ifdef CONFIG_SPATIAL_SVC
-  if (is_spatial_svc)
+#if CONFIG_SPATIAL_SVC
+  if (cpi->use_svc && cpi->svc.number_temporal_layers == 1)
     res = vp9_svc_lookahead_push(cpi, cpi->lookahead, sd, time_stamp, end_time,
                                  frame_flags);
   else
@@ -2561,7 +2559,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
     return -1;
 
   if (is_spatial_svc && cpi->pass == 2) {
+#if CONFIG_SPATIAL_SVC
     vp9_svc_lookahead_peek(cpi, cpi->lookahead, 0, 1);
+#endif
     vp9_restore_layer_context(cpi);
   }
 
@@ -2584,7 +2584,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
   if (arf_src_index) {
     assert(arf_src_index <= rc->frames_to_key);
 
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
     if (is_spatial_svc)
       cpi->source = vp9_svc_lookahead_peek(cpi, cpi->lookahead,
                                            arf_src_index, 0);
@@ -2594,7 +2594,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
     if (cpi->source != NULL) {
       cpi->alt_ref_source = cpi->source;
 
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
       if (is_spatial_svc && cpi->svc.spatial_layer_id > 0) {
         int i;
         // Reference a hidden frame from a lower layer
@@ -2629,7 +2629,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
   if (!cpi->source) {
     // Get last frame source.
     if (cm->current_video_frame > 0) {
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
       if (is_spatial_svc)
         cpi->last_source = vp9_svc_lookahead_peek(cpi, cpi->lookahead, -1, 0);
       else
@@ -2640,7 +2640,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
     }
 
     // Read in the source frame.
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
     if (is_spatial_svc)
       cpi->source = vp9_svc_lookahead_pop(cpi, cpi->lookahead, flush);
     else
index f9cc3c8..678c51a 100644 (file)
@@ -14,7 +14,7 @@
 #include "vpx_scale/yv12config.h"
 #include "vpx/vpx_integer.h"
 
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
 #include "vpx/vp8cx.h"
 #include "vpx/vpx_encoder.h"
 #endif
@@ -31,7 +31,7 @@ struct lookahead_entry {
   int64_t             ts_end;
   unsigned int        flags;
 
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
   vpx_svc_parameters_t svc_params[VPX_SS_MAX_LAYERS];
 #endif
 };
index 1eb4509..f8d1a83 100644 (file)
@@ -223,6 +223,7 @@ int vp9_is_upper_layer_key_frame(const VP9_COMP *const cpi) {
          cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame;
 }
 
+#if CONFIG_SPATIAL_SVC
 int vp9_svc_lookahead_push(const VP9_COMP *const cpi, struct lookahead_ctx *ctx,
                            YV12_BUFFER_CONFIG *src, int64_t ts_start,
                            int64_t ts_end, unsigned int flags) {
@@ -352,3 +353,4 @@ struct lookahead_entry *vp9_svc_lookahead_pop(VP9_COMP *const cpi,
 
   return buf;
 }
+#endif
index 2522fd0..b3dc0b1 100644 (file)
@@ -176,7 +176,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
 
   RANGE_CHECK(cfg, ss_number_layers, 1, VPX_SS_MAX_LAYERS);
 
-#ifdef CONFIG_SPATIAL_SVC
+#if 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) {
@@ -403,7 +403,7 @@ static vpx_codec_err_t set_encoder_config(
     int 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
+#if CONFIG_SPATIAL_SVC
       oxcf->ss_play_alternate[i] =  cfg->ss_enable_auto_alt_ref[i];
 #endif
     }
@@ -888,14 +888,14 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t  *ctx,
         vpx_codec_cx_pkt_t pkt;
         VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi;
 
-#ifdef CONFIG_SPATIAL_SVC
+#if 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
+#if CONFIG_SPATIAL_SVC
             || (cpi->use_svc && cpi->svc.number_temporal_layers == 1 &&
                 cpi->svc.spatial_layer_id < cpi->svc.number_spatial_layers - 1)
 #endif
@@ -923,7 +923,7 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t  *ctx,
         pkt.data.frame.flags = lib_flags << 16;
 
         if (lib_flags & FRAMEFLAGS_KEY
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
             || (cpi->use_svc && cpi->svc.number_temporal_layers == 1 &&
                 cpi->svc.layer_context[0].is_key_frame)
 #endif
@@ -965,7 +965,7 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t  *ctx,
         vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
         cx_data += size;
         cx_data_sz -= size;
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
         if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
           vpx_codec_cx_pkt_t pkt = {0};
           int i;
@@ -1287,7 +1287,7 @@ static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = {
       9999,               // kf_max_dist
 
       VPX_SS_DEFAULT_LAYERS,  // ss_number_layers
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
       {0},
 #endif
       {0},                    // ss_target_bitrate
index 345c73b..9d2f18c 100644 (file)
@@ -157,7 +157,7 @@ extern "C" {
     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 */
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
     VPX_CODEC_SPATIAL_SVC_LAYER_SIZES, /**< Sizes for each layer in this frame*/
 #endif
     VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions  */
@@ -196,7 +196,7 @@ extern "C" {
         double       psnr[4];     /**< PSNR, total/y/u/v */
       } psnr;                       /**< data for PSNR packet */
       struct vpx_fixed_buf raw;     /**< data for arbitrary packets */
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
       size_t layer_sizes[VPX_SS_MAX_LAYERS];
 #endif
 
@@ -637,7 +637,7 @@ extern "C" {
      */
     unsigned int           ss_number_layers;
 
-#ifdef CONFIG_SPATIAL_SVC
+#if CONFIG_SPATIAL_SVC
     /*!\brief Enable auto alt reference flags for each spatial layer.
      *
      * These values specify if auto alt reference frame is enabled for each