Remove vp10's build dependency on vp9

CONFIG_VP9_HIGHBITDEPTH is currently used by both vp9 and vp10, but in
many place outside vp9/vp10, the macro was used in conjunction of
CONFIG_VP9. This created a dependency on vp9 for vp10 to build. This
commit removes the dependency by use CONFIG_VP9_HIGHBITDEPTH only in
these places.

Change-Id: I8cc007fc9cf132394c6498ce6759e606b64a6ad0
This commit is contained in:
Yaowu Xu 2015-08-14 12:16:07 -07:00
Родитель 94ba3939cd
Коммит 72889a2a60
7 изменённых файлов: 41 добавлений и 41 удалений

Просмотреть файл

@ -286,7 +286,7 @@ double sse_to_psnr(double samples, double peak, double sse) {
}
// TODO(debargha): Consolidate the functions below into a separate file.
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static void highbd_img_upshift(vpx_image_t *dst, vpx_image_t *src,
int input_shift) {
// Note the offset is 1 less than half.
@ -499,4 +499,4 @@ void vpx_img_downshift(vpx_image_t *dst, vpx_image_t *src,
lowbd_img_downshift(dst, src, down_shift);
}
}
#endif // CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#endif // CONFIG_VP9_HIGHBITDEPTH

Просмотреть файл

@ -151,7 +151,7 @@ int vpx_img_read(vpx_image_t *img, FILE *file);
double sse_to_psnr(double samples, double peak, double mse);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
void vpx_img_upshift(vpx_image_t *dst, vpx_image_t *src, int input_shift);
void vpx_img_downshift(vpx_image_t *dst, vpx_image_t *src, int down_shift);
void vpx_img_truncate_16_to_8(vpx_image_t *dst, vpx_image_t *src);

Просмотреть файл

@ -91,7 +91,7 @@ void vpx_free(void *memblk) {
}
}
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
void *vpx_memset16(void *dest, int val, size_t length) {
int i;
void *orig = dest;
@ -100,4 +100,4 @@ void *vpx_memset16(void *dest, int val, size_t length) {
*dest16++ = val;
return orig;
}
#endif // CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#endif // CONFIG_VP9_HIGHBITDEPTH

Просмотреть файл

@ -30,7 +30,7 @@ extern "C" {
void *vpx_realloc(void *memblk, size_t size);
void vpx_free(void *memblk);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
void *vpx_memset16(void *dest, int val, size_t length);
#endif

Просмотреть файл

@ -15,7 +15,7 @@
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
#include "vpx_scale/yv12config.h"
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
#include "vp9/common/vp9_common.h"
#endif
@ -60,7 +60,7 @@ static void extend_plane(uint8_t *const src, int src_stride,
}
}
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static void extend_plane_high(uint8_t *const src8, int src_stride,
int width, int height,
int extend_top, int extend_left,
@ -113,7 +113,7 @@ void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
assert(ybf->y_height - ybf->y_crop_height >= 0);
assert(ybf->y_width - ybf->y_crop_width >= 0);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (ybf->flags & YV12_FLAG_HIGHBITDEPTH) {
extend_plane_high(
ybf->y_buffer, ybf->y_stride,
@ -236,7 +236,7 @@ void vp8_yv12_copy_frame_c(const YV12_BUFFER_CONFIG *src_ybc,
assert(src_ybc->y_height == dst_ybc->y_height);
#endif
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (src_ybc->flags & YV12_FLAG_HIGHBITDEPTH) {
assert(dst_ybc->flags & YV12_FLAG_HIGHBITDEPTH);
for (row = 0; row < src_ybc->y_height; ++row) {
@ -303,7 +303,7 @@ void vpx_yv12_copy_y_c(const YV12_BUFFER_CONFIG *src_ybc,
const uint8_t *src = src_ybc->y_buffer;
uint8_t *dst = dst_ybc->y_buffer;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (src_ybc->flags & YV12_FLAG_HIGHBITDEPTH) {
const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);

Просмотреть файл

@ -89,7 +89,7 @@ static const arg_def_t fb_arg = ARG_DEF(
NULL, "frame-buffers", 1, "Number of frame buffers to use");
static const arg_def_t md5arg = ARG_DEF(
NULL, "md5", 0, "Compute the MD5 sum of the decoded frame");
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static const arg_def_t outbitdeptharg = ARG_DEF(
NULL, "output-bit-depth", 1, "Output bit-depth for decoded frames");
#endif
@ -99,7 +99,7 @@ static const arg_def_t *all_args[] = {
&progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile,
&threadsarg, &frameparallelarg, &verbosearg, &scalearg, &fb_arg,
&md5arg, &error_concealment, &continuearg,
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
&outbitdeptharg,
#endif
NULL
@ -136,7 +136,7 @@ static const arg_def_t *vp8_pp_args[] = {
#if CONFIG_LIBYUV
static INLINE int libyuv_scale(vpx_image_t *src, vpx_image_t *dst,
FilterModeEnum mode) {
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (src->fmt == VPX_IMG_FMT_I42016) {
assert(dst->fmt == VPX_IMG_FMT_I42016);
return I420Scale_16((uint16_t*)src->planes[VPX_PLANE_Y],
@ -293,7 +293,7 @@ static void update_image_md5(const vpx_image_t *img, const int planes[3],
static void write_image_file(const vpx_image_t *img, const int planes[3],
FILE *file) {
int i, y;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
const int bytes_per_sample = ((img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1);
#else
const int bytes_per_sample = 1;
@ -527,7 +527,7 @@ static FILE *open_outfile(const char *name) {
}
}
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static int img_shifted_realloc_required(const vpx_image_t *img,
const vpx_image_t *shifted,
vpx_img_fmt_t required_fmt) {
@ -561,7 +561,7 @@ static int main_loop(int argc, const char **argv_) {
int opt_yv12 = 0;
int opt_i420 = 0;
vpx_codec_dec_cfg_t cfg = {0, 0, 0};
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
int output_bit_depth = 0;
#endif
#if CONFIG_VP8_DECODER
@ -575,7 +575,7 @@ static int main_loop(int argc, const char **argv_) {
int dec_flags = 0;
int do_scale = 0;
vpx_image_t *scaled_img = NULL;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
vpx_image_t *img_shifted = NULL;
#endif
int frame_avail, got_data, flush_decoder = 0;
@ -618,7 +618,7 @@ static int main_loop(int argc, const char **argv_) {
use_y4m = 0;
flipuv = 1;
opt_yv12 = 1;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
output_bit_depth = 8; // For yv12 8-bit depth output is assumed
#endif
} else if (arg_match(&arg, &use_i420, argi)) {
@ -657,7 +657,7 @@ static int main_loop(int argc, const char **argv_) {
num_external_frame_buffers = arg_parse_uint(&arg);
else if (arg_match(&arg, &continuearg, argi))
keep_going = 1;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
else if (arg_match(&arg, &outbitdeptharg, argi)) {
output_bit_depth = arg_parse_uint(&arg);
}
@ -988,7 +988,7 @@ static int main_loop(int argc, const char **argv_) {
#endif
}
}
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
// Default to codec bit depth if output bit depth not set
if (!output_bit_depth) {
output_bit_depth = img->bit_depth;
@ -1125,7 +1125,7 @@ fail:
free(buf);
if (scaled_img) vpx_img_free(scaled_img);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (img_shifted) vpx_img_free(img_shifted);
#endif

Просмотреть файл

@ -201,7 +201,7 @@ static const arg_def_t disable_warning_prompt = ARG_DEF(
"y", "disable-warning-prompt", 0,
"Display warnings, but do not prompt user to continue.");
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static const arg_def_t test16bitinternalarg = ARG_DEF(
NULL, "test-16bit-internal", 0, "Force use of 16 bit internal buffer");
#endif
@ -251,7 +251,7 @@ static const arg_def_t *global_args[] = {
#endif
&timebase, &framerate,
&error_resilient,
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
&test16bitinternalarg,
#endif
&lag_in_frames, NULL
@ -419,7 +419,7 @@ static const arg_def_t input_color_space = ARG_DEF_ENUM(
NULL, "color-space", 1,
"The color space of input content:", color_space_enum);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static const struct arg_enum_list bitdepth_enum[] = {
{"8", VPX_BITS_8},
{"10", VPX_BITS_10},
@ -452,7 +452,7 @@ static const arg_def_t *vp9_args[] = {
&frame_parallel_decoding, &aq_mode, &frame_periodic_boost,
&noise_sens, &tune_content, &input_color_space,
&min_gf_interval, &max_gf_interval,
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
&bitdeptharg, &inbitdeptharg,
#endif
NULL
@ -527,7 +527,7 @@ void usage_exit(void) {
#define mmin(a, b) ((a) < (b) ? (a) : (b))
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static void find_mismatch_high(const vpx_image_t *const img1,
const vpx_image_t *const img2,
int yloc[4], int uloc[4], int vloc[4]) {
@ -725,7 +725,7 @@ static int compare_img(const vpx_image_t *const img1,
match &= (img1->fmt == img2->fmt);
match &= (img1->d_w == img2->d_w);
match &= (img1->d_h == img2->d_h);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (img1->fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
l_w *= 2;
c_w *= 2;
@ -780,7 +780,7 @@ struct stream_config {
int arg_ctrl_cnt;
int write_webm;
int have_kf_max_dist;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
// whether to use 16bit internal buffers
int use_16bit_internal;
#endif
@ -1066,7 +1066,7 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
static const int *ctrl_args_map = NULL;
struct stream_config *config = &stream->config;
int eos_mark_found = 0;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
int test_16bit_internal = 0;
#endif
@ -1129,7 +1129,7 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
config->cfg.g_w = arg_parse_uint(&arg);
} else if (arg_match(&arg, &height, argi)) {
config->cfg.g_h = arg_parse_uint(&arg);
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
} else if (arg_match(&arg, &bitdeptharg, argi)) {
config->cfg.g_bit_depth = arg_parse_enum_or_int(&arg);
} else if (arg_match(&arg, &inbitdeptharg, argi)) {
@ -1202,7 +1202,7 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
config->have_kf_max_dist = 1;
} else if (arg_match(&arg, &kf_disabled, argi)) {
config->cfg.kf_mode = VPX_KF_DISABLED;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
} else if (arg_match(&arg, &test16bitinternalarg, argi)) {
if (strcmp(global->codec->name, "vp9") == 0 ||
strcmp(global->codec->name, "vp10") == 0) {
@ -1238,7 +1238,7 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
argj++;
}
}
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (strcmp(global->codec->name, "vp9") == 0 ||
strcmp(global->codec->name, "vp10") == 0) {
config->use_16bit_internal = test_16bit_internal |
@ -1524,7 +1524,7 @@ static void initialize_encoder(struct stream_state *stream,
flags |= global->show_psnr ? VPX_CODEC_USE_PSNR : 0;
flags |= global->out_part ? VPX_CODEC_USE_OUTPUT_PARTITION : 0;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
flags |= stream->config.use_16bit_internal ? VPX_CODEC_USE_HIGHBITDEPTH : 0;
#endif
@ -1572,7 +1572,7 @@ static void encode_frame(struct stream_state *stream,
/ cfg->g_timebase.num / global->framerate.num;
/* Scale if necessary */
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (img) {
if ((img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) &&
(img->d_w != cfg->g_w || img->d_h != cfg->g_h)) {
@ -1823,7 +1823,7 @@ static void test_decode(struct stream_state *stream,
enc_img = ref_enc.img;
vpx_codec_control(&stream->decoder, VP9_GET_REFERENCE, &ref_dec);
dec_img = ref_dec.img;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if ((enc_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) !=
(dec_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH)) {
if (enc_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
@ -1844,7 +1844,7 @@ static void test_decode(struct stream_state *stream,
if (!compare_img(&enc_img, &dec_img)) {
int y[4], u[4], v[4];
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (enc_img.fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
find_mismatch_high(&enc_img, &dec_img, y, u, v);
} else {
@ -1894,7 +1894,7 @@ static void print_time(const char *label, int64_t etl) {
int main(int argc, const char **argv_) {
int pass;
vpx_image_t raw;
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
vpx_image_t raw_shift;
int allocated_raw_shift = 0;
int use_16bit_internal = 0;
@ -2080,7 +2080,7 @@ int main(int argc, const char **argv_) {
&input.pixel_aspect_ratio));
FOREACH_STREAM(initialize_encoder(stream, &global));
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (strcmp(global.codec->name, "vp9") == 0 ||
strcmp(global.codec->name, "vp10") == 0) {
// Check to see if at least one stream uses 16 bit internal.
@ -2137,7 +2137,7 @@ int main(int argc, const char **argv_) {
frame_avail = 0;
if (frames_in > global.skip_frames) {
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
vpx_image_t *frame_to_encode;
if (input_shift || (use_16bit_internal && input.bit_depth == 8)) {
assert(use_16bit_internal);
@ -2298,7 +2298,7 @@ int main(int argc, const char **argv_) {
});
#endif
#if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
if (allocated_raw_shift)
vpx_img_free(&raw_shift);
#endif