summaryrefslogtreecommitdiff
path: root/vp9/vp9_cx_iface.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2015-09-15 21:56:51 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2015-09-16 06:41:46 -0400
commiteeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7 (patch)
treed5c3713996f6630ffe9cfd0bf3c69ecb636d6a59 /vp9/vp9_cx_iface.c
parente562c71783d303bab7f9d6a9852db3debec3f865 (diff)
downloadlibvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.tar
libvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.tar.gz
libvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.tar.bz2
libvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.zip
Add support for color-range.
In decoder, export (eventually) into vpx_image_t.range field. In encoder, use oxcf->color_range to set it (same way as for color_space). See issue 1059. Change-Id: Ieabbb2a785fa58cc4044bd54eee66f328f3906ce
Diffstat (limited to 'vp9/vp9_cx_iface.c')
-rw-r--r--vp9/vp9_cx_iface.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index f155b9aef..fd65ed966 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -45,6 +45,7 @@ struct vp9_extracfg {
vpx_bit_depth_t bit_depth;
vp9e_tune_content content;
vpx_color_space_t color_space;
+ int color_range;
};
static struct vp9_extracfg default_extra_cfg = {
@@ -71,6 +72,7 @@ static struct vp9_extracfg default_extra_cfg = {
VPX_BITS_8, // Bit depth
VP9E_CONTENT_DEFAULT, // content
VPX_CS_UNKNOWN, // color space
+ 0, // color range
};
struct vpx_codec_alg_priv {
@@ -321,6 +323,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
ERROR("Codec bit-depth 8 not supported in profile > 1");
}
RANGE_CHECK(extra_cfg, color_space, VPX_CS_UNKNOWN, VPX_CS_SRGB);
+ RANGE_CHECK(extra_cfg, color_range, 0, 2);
return VPX_CODEC_OK;
}
@@ -465,6 +468,7 @@ static vpx_codec_err_t set_encoder_config(
#endif
oxcf->color_space = extra_cfg->color_space;
+ oxcf->color_range = extra_cfg->color_range;
oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
oxcf->arnr_strength = extra_cfg->arnr_strength;
oxcf->min_gf_interval = extra_cfg->min_gf_interval;
@@ -1436,6 +1440,13 @@ static vpx_codec_err_t ctrl_set_color_space(vpx_codec_alg_priv_t *ctx,
return update_extra_cfg(ctx, &extra_cfg);
}
+static vpx_codec_err_t ctrl_set_color_range(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ struct vp9_extracfg extra_cfg = ctx->extra_cfg;
+ extra_cfg.color_range = CAST(VP9E_SET_COLOR_RANGE, 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},
@@ -1472,6 +1483,7 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{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_COLOR_RANGE, ctrl_set_color_range},
{VP9E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity},
{VP9E_SET_MIN_GF_INTERVAL, ctrl_set_min_gf_interval},
{VP9E_SET_MAX_GF_INTERVAL, ctrl_set_max_gf_interval},