Index: source/libvpx/vp9/vp9_cx_iface.c |
diff --git a/source/libvpx/vp9/vp9_cx_iface.c b/source/libvpx/vp9/vp9_cx_iface.c |
index 7b4b17809ba9439b8e2175432fc22aad23e7726a..46e6e919c205d042fd5d19b16e5ea76445ee8ec3 100644 |
--- a/source/libvpx/vp9/vp9_cx_iface.c |
+++ b/source/libvpx/vp9/vp9_cx_iface.c |
@@ -42,6 +42,7 @@ struct vp9_extracfg { |
unsigned int frame_periodic_boost; |
vpx_bit_depth_t bit_depth; |
vp9e_tune_content content; |
+ vpx_color_space_t color_space; |
}; |
static struct vp9_extracfg default_extra_cfg = { |
@@ -64,7 +65,8 @@ static struct vp9_extracfg default_extra_cfg = { |
NO_AQ, // aq_mode |
0, // frame_periodic_delta_q |
VPX_BITS_8, // Bit depth |
- VP9E_CONTENT_DEFAULT // content |
+ VP9E_CONTENT_DEFAULT, // content |
+ VPX_CS_UNKNOWN, // color space |
}; |
struct vpx_codec_alg_priv { |
@@ -294,7 +296,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, VPX_CS_UNKNOWN, VPX_CS_SRGB); |
return VPX_CODEC_OK; |
} |
@@ -351,9 +353,9 @@ static int get_image_bps(const vpx_image_t *img) { |
} |
static vpx_codec_err_t set_encoder_config( |
- VP9EncoderConfig *oxcf, |
- const vpx_codec_enc_cfg_t *cfg, |
- const struct vp9_extracfg *extra_cfg) { |
+ VP9EncoderConfig *oxcf, |
+ const vpx_codec_enc_cfg_t *cfg, |
+ const struct vp9_extracfg *extra_cfg) { |
const int is_vbr = cfg->rc_end_usage == VPX_VBR; |
oxcf->profile = cfg->g_profile; |
oxcf->max_threads = (int)cfg->g_threads; |
@@ -437,6 +439,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; |
@@ -1322,6 +1325,13 @@ static vpx_codec_err_t ctrl_set_tune_content(vpx_codec_alg_priv_t *ctx, |
return update_extra_cfg(ctx, &extra_cfg); |
} |
+static vpx_codec_err_t ctrl_set_color_space(vpx_codec_alg_priv_t *ctx, |
+ va_list args) { |
+ struct vp9_extracfg extra_cfg = ctx->extra_cfg; |
+ extra_cfg.color_space = CAST(VP9E_SET_COLOR_SPACE, args); |
+ return update_extra_cfg(ctx, &extra_cfg); |
+} |
+ |
static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { |
{VP8_COPY_REFERENCE, ctrl_copy_reference}, |
{VP8E_UPD_ENTROPY, ctrl_update_entropy}, |
@@ -1357,6 +1367,7 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { |
{VP9E_REGISTER_CX_CALLBACK, ctrl_register_cx_callback}, |
{VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id}, |
{VP9E_SET_TUNE_CONTENT, ctrl_set_tune_content}, |
+ {VP9E_SET_COLOR_SPACE, ctrl_set_color_space}, |
{VP9E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity}, |
// Getters |