From b7913deb7ea338e5a655fa3e6bd71b1367011067 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Fri, 9 Jan 2015 10:52:33 -0800 Subject: [PATCH] Added plumbing for setting color space Change-Id: If64052cc6e404abc8a64a889f42930d14fad21d3 (cherry picked from commit ce52b0f8d347224cd526dc1ba55597a2aa79c341) --- vp9/encoder/vp9_encoder.c | 2 +- vp9/encoder/vp9_encoder.h | 1 + vp9/vp9_cx_iface.c | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 7ba9690ab..a148ffe9e 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -563,7 +563,7 @@ static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) { #if CONFIG_VP9_HIGHBITDEPTH cm->use_highbitdepth = oxcf->use_highbitdepth; #endif - cm->color_space = UNKNOWN; + cm->color_space = oxcf->color_space; cm->width = oxcf->width; cm->height = oxcf->height; diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index e557a64d5..9b585ad90 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -217,6 +217,7 @@ typedef struct VP9EncoderConfig { #if CONFIG_VP9_HIGHBITDEPTH int use_highbitdepth; #endif + COLOR_SPACE color_space; } VP9EncoderConfig; static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index adae18b48..a8ae8144e 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -38,6 +38,7 @@ struct vp9_extracfg { AQ_MODE aq_mode; unsigned int frame_periodic_boost; vpx_bit_depth_t bit_depth; + COLOR_SPACE color_space; vp9e_tune_content content; }; @@ -59,6 +60,7 @@ static struct vp9_extracfg default_extra_cfg = { NO_AQ, // aq_mode 0, // frame_periodic_delta_q VPX_BITS_8, // Bit depth + UNKNOWN, // Color Space VP9E_CONTENT_DEFAULT // content }; @@ -288,7 +290,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx, cfg->g_bit_depth == VPX_BITS_8) { ERROR("Codec bit-depth 8 not supported in profile > 1"); } - + RANGE_CHECK(extra_cfg, color_space, UNKNOWN, SRGB); return VPX_CODEC_OK; } @@ -422,6 +424,7 @@ static vpx_codec_err_t set_encoder_config( oxcf->firstpass_mb_stats_in = cfg->rc_firstpass_mb_stats_in; #endif + oxcf->color_space = extra_cfg->color_space; oxcf->arnr_max_frames = extra_cfg->arnr_max_frames; oxcf->arnr_strength = extra_cfg->arnr_strength; -- 2.49.0