ref: f2f69dd3b3353b2d9cc24ee4fa5c0fd895f39f29
parent: aa2ba46a61cbe626f7e708dea9160b6699c881d0
parent: 24c9d6ad43e41edd7441bcf41c860d8cae9b88be
author: Minghai Shang <[email protected]>
date: Tue Jul 22 08:43:40 EDT 2014
Merge "[spatial svc]Use #if instead of #ifdef on macro CONFIG_SPATIAL_SVC"
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -1316,7 +1316,7 @@
"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 */
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2422,15 +2422,13 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
// 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
--- a/vp9/encoder/vp9_lookahead.h
+++ b/vp9/encoder/vp9_lookahead.h
@@ -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 @@
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
};
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -223,6 +223,7 @@
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 @@
return buf;
}
+#endif
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -176,7 +176,7 @@
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 @@
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,7 +888,7 @@
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
@@ -895,7 +895,7 @@
// 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 @@
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 @@
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 @@
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
--- a/vpx/vpx_encoder.h
+++ b/vpx/vpx_encoder.h
@@ -157,7 +157,7 @@
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 @@
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 @@
*/
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