Commit 01d43e1f authored by Tom Finegan's avatar Tom Finegan

Make CONFIG_COLORSPACE_HEADERS public API changes unconditional.

Avoid changing the public API based on an experiment flag:

- Remove aom_config.h include from aom_image.h.
- Unconditionally include the existing API additions.
- Add some missing doc comments (silences Doxygen warnings).
- Return an error when using ctrl flags that require
  CONFIG_COLORSPACE_HEADERS when it's not enabled.
- Move colorspace_headers to the correct section of configure.
- Move CONFIG_COLORSPACE_HEADERS to the correct section of
  aom_config_defaults.cmake.
- clang-format style check appeasement

Change-Id: I7b5d72c6f9f1a5561409d7813ba59180d98d8805
parent 67876e77
......@@ -35,8 +35,6 @@ extern "C" {
#define AOM_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel. */
#define AOM_IMG_FMT_HIGHBITDEPTH 0x800 /**< Image uses 16bit framebuffer. */
#include "./aom_config.h"
/*!\brief List of supported image formats */
typedef enum aom_img_fmt {
AOM_IMG_FMT_NONE,
......@@ -71,25 +69,19 @@ typedef enum aom_img_fmt {
/*!\brief List of supported color spaces */
typedef enum aom_color_space {
AOM_CS_UNKNOWN = 0, /**< Unknown */
AOM_CS_BT_601 = 1, /**< BT.601 */
AOM_CS_BT_709 = 2, /**< BT.709 */
AOM_CS_SMPTE_170 = 3, /**< SMPTE.170 */
AOM_CS_SMPTE_240 = 4, /**< SMPTE.240 */
#if CONFIG_COLORSPACE_HEADERS
AOM_CS_UNKNOWN = 0, /**< Unknown */
AOM_CS_BT_601 = 1, /**< BT.601 */
AOM_CS_BT_709 = 2, /**< BT.709 */
AOM_CS_SMPTE_170 = 3, /**< SMPTE.170 */
AOM_CS_SMPTE_240 = 4, /**< SMPTE.240 */
AOM_CS_BT_2020_NCL = 5, /**< BT.2020 non-constant luminance (BT.2100) */
AOM_CS_BT_2020_CL = 6, /**< BT.2020 constant luminance */
AOM_CS_SRGB = 7, /**< sRGB */
AOM_CS_ICTCP = 8, /**< ICtCp, ITU-R BT.2100 */
AOM_CS_RESERVED = 9 /**< Values 9..31 are reserved */
#else
AOM_CS_BT_2020 = 5, /**< BT.2020 */
AOM_CS_RESERVED = 6, /**< Reserved */
AOM_CS_SRGB = 7 /**< sRGB */
#endif
} aom_color_space_t; /**< alias for enum aom_color_space */
} aom_color_space_t; /**< alias for enum aom_color_space */
#if CONFIG_COLORSPACE_HEADERS
/*!\brief List of supported transfer functions */
typedef enum aom_transfer_function {
AOM_TF_UNKNOWN = 0, /**< Unknown */
AOM_TF_BT_709 = 1, /**< BT.709 */
......@@ -97,7 +89,6 @@ typedef enum aom_transfer_function {
AOM_TF_HLG = 3, /**< Hybrid Log-Gamma */
AOM_TF_RESERVED = 4 /**< Values 4..31 are reserved */
} aom_transfer_function_t; /**< alias for enum aom_transfer_function */
#endif
/*!\brief List of supported color range */
typedef enum aom_color_range {
......@@ -105,7 +96,7 @@ typedef enum aom_color_range {
AOM_CR_FULL_RANGE = 1 /**< YUV/RGB [0..255] */
} aom_color_range_t; /**< alias for enum aom_color_range */
#if CONFIG_COLORSPACE_HEADERS
/*!\brief List of chroma sample positions */
typedef enum aom_chroma_sample_position {
AOM_CSP_UNKNOWN = 0, /**< Unknown */
AOM_CSP_VERTICAL = 1, /**< Horizontally co-located with luma(0, 0)*/
......@@ -113,17 +104,14 @@ typedef enum aom_chroma_sample_position {
AOM_CSP_COLOCATED = 2, /**< Co-located with luma(0, 0) sample */
AOM_CSP_RESERVED = 3 /**< Reserved value */
} aom_chroma_sample_position_t; /**< alias for enum aom_transfer_function */
#endif
/**\brief Image Descriptor */
typedef struct aom_image {
aom_img_fmt_t fmt; /**< Image Format */
aom_color_space_t cs; /**< Color Space */
#if CONFIG_COLORSPACE_HEADERS
aom_img_fmt_t fmt; /**< Image Format */
aom_color_space_t cs; /**< Color Space */
aom_transfer_function_t tf; /**< transfer function */
aom_chroma_sample_position_t csp; /**< chroma sample position */
#endif
aom_color_range_t range; /**< Color Range */
aom_color_range_t range; /**< Color Range */
/* Image storage dimensions */
unsigned int w; /**< Stored image width */
......
......@@ -341,7 +341,6 @@ enum aome_enc_control_id {
*/
AV1E_SET_COLOR_SPACE,
#if CONFIG_COLORSPACE_HEADERS
/*!\brief Codec control function to set transfer function info.
* \note Valid ranges: 0..4, default is "UNKNOWN".
* 0 = UNKNOWN,
......@@ -360,7 +359,6 @@ enum aome_enc_control_id {
* 3 = RESERVED
*/
AV1E_SET_CHROMA_SAMPLE_POSITION,
#endif
/*!\brief Codec control function to set minimum interval between GF/ARF frames
*
......@@ -753,13 +751,11 @@ AOM_CTRL_USE_TYPE(AV1E_SET_TUNE_CONTENT, int) /* aom_tune_content */
AOM_CTRL_USE_TYPE(AV1E_SET_COLOR_SPACE, int)
#define AOM_CTRL_AV1E_SET_COLOR_SPACE
#if CONFIG_COLORSPACE_HEADERS
AOM_CTRL_USE_TYPE(AV1E_SET_TRANSFER_FUNCTION, int)
#define AOM_CTRL_AV1E_SET_TRANSFER_FUNCTION
AOM_CTRL_USE_TYPE(AV1E_SET_CHROMA_SAMPLE_POSITION, int)
#define AOM_CTRL_AV1E_SET_CHROMA_SAMPLE_POSITION
#endif
AOM_CTRL_USE_TYPE(AV1E_SET_MIN_GF_INTERVAL, unsigned int)
#define AOM_CTRL_AV1E_SET_MIN_GF_INTERVAL
......
......@@ -70,10 +70,8 @@ typedef struct yv12_buffer_config {
int subsampling_y;
unsigned int bit_depth;
aom_color_space_t color_space;
#if CONFIG_COLORSPACE_HEADERS
aom_transfer_function_t transfer_function;
aom_chroma_sample_position_t chroma_sample_position;
#endif
aom_color_range_t color_range;
int render_width;
int render_height;
......
......@@ -474,29 +474,17 @@ static const arg_def_t max_gf_interval = ARG_DEF(
"max gf/arf frame interval (default 0, indicating in-built behavior)");
static const struct arg_enum_list color_space_enum[] = {
{ "unknown", AOM_CS_UNKNOWN },
{ "bt601", AOM_CS_BT_601 },
{ "bt709", AOM_CS_BT_709 },
{ "smpte170", AOM_CS_SMPTE_170 },
{ "smpte240", AOM_CS_SMPTE_240 },
#if CONFIG_COLORSPACE_HEADERS
{ "bt2020ncl", AOM_CS_BT_2020_NCL },
{ "bt2020cl", AOM_CS_BT_2020_CL },
{ "sRGB", AOM_CS_SRGB },
{ "ICtCp", AOM_CS_ICTCP },
#else
{ "bt2020", AOM_CS_BT_2020 },
{ "reserved", AOM_CS_RESERVED },
{ "sRGB", AOM_CS_SRGB },
#endif
{ NULL, 0 }
{ "unknown", AOM_CS_UNKNOWN }, { "bt601", AOM_CS_BT_601 },
{ "bt709", AOM_CS_BT_709 }, { "smpte170", AOM_CS_SMPTE_170 },
{ "smpte240", AOM_CS_SMPTE_240 }, { "bt2020ncl", AOM_CS_BT_2020_NCL },
{ "bt2020cl", AOM_CS_BT_2020_CL }, { "sRGB", AOM_CS_SRGB },
{ "ICtCp", AOM_CS_ICTCP }, { NULL, 0 }
};
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_COLORSPACE_HEADERS
static const struct arg_enum_list transfer_function_enum[] = {
{ "unknown", AOM_TF_UNKNOWN },
{ "bt709", AOM_TF_BT_709 },
......@@ -520,7 +508,6 @@ static const arg_def_t input_chroma_sample_position =
ARG_DEF_ENUM(NULL, "chroma-sample-position", 1,
"The chroma sample position when chroma 4:2:0 is signaled:",
chroma_sample_position_enum);
#endif
static const struct arg_enum_list tune_content_enum[] = {
{ "default", AOM_CONTENT_DEFAULT },
......@@ -584,10 +571,8 @@ static const arg_def_t *av1_args[] = { &cpu_used_av1,
&noise_sens,
&tune_content,
&input_color_space,
#if CONFIG_COLORSPACE_HEADERS
&input_transfer_function,
&input_chroma_sample_position,
#endif
&min_gf_interval,
&max_gf_interval,
#if CONFIG_EXT_PARTITION
......@@ -643,10 +628,8 @@ static const int av1_arg_ctrl_map[] = { AOME_SET_CPUUSED,
AV1E_SET_NOISE_SENSITIVITY,
AV1E_SET_TUNE_CONTENT,
AV1E_SET_COLOR_SPACE,
#if CONFIG_COLORSPACE_HEADERS
AV1E_SET_TRANSFER_FUNCTION,
AV1E_SET_CHROMA_SAMPLE_POSITION,
#endif
AV1E_SET_MIN_GF_INTERVAL,
AV1E_SET_MAX_GF_INTERVAL,
#if CONFIG_EXT_PARTITION
......
......@@ -75,10 +75,8 @@ struct av1_extracfg {
aom_bit_depth_t bit_depth;
aom_tune_content content;
aom_color_space_t color_space;
#if CONFIG_COLORSPACE_HEADERS
aom_transfer_function_t transfer_function;
aom_chroma_sample_position_t chroma_sample_position;
#endif
int color_range;
int render_width;
int render_height;
......@@ -138,14 +136,12 @@ static struct av1_extracfg default_extra_cfg = {
#if CONFIG_EXT_DELTA_Q
NO_DELTA_Q, // deltaq_mode
#endif
CONFIG_XIPHRC, // frame_periodic_delta_q
AOM_BITS_8, // Bit depth
AOM_CONTENT_DEFAULT, // content
AOM_CS_UNKNOWN, // color space
#if CONFIG_COLORSPACE_HEADERS
AOM_TF_UNKNOWN, // transfer function
AOM_CSP_UNKNOWN, // chroma sample position
#endif
CONFIG_XIPHRC, // frame_periodic_delta_q
AOM_BITS_8, // Bit depth
AOM_CONTENT_DEFAULT, // content
AOM_CS_UNKNOWN, // color space
AOM_TF_UNKNOWN, // transfer function
AOM_CSP_UNKNOWN, // chroma sample position
0, // color range
0, // render width
0, // render height
......@@ -561,10 +557,17 @@ static aom_codec_err_t set_encoder_config(
#endif
oxcf->color_space = extra_cfg->color_space;
#if CONFIG_COLORSPACE_HEADERS
oxcf->transfer_function = extra_cfg->transfer_function;
oxcf->chroma_sample_position = extra_cfg->chroma_sample_position;
#else
if (extra_cfg->transfer_function != AOM_TF_UNKNOWN)
return AOM_CODEC_UNSUP_FEATURE;
if (extra_cfg->chroma_sample_position != AOM_CSP_UNKNOWN)
return AOM_CODEC_UNSUP_FEATURE;
#endif
oxcf->color_range = extra_cfg->color_range;
oxcf->render_width = extra_cfg->render_width;
oxcf->render_height = extra_cfg->render_height;
......@@ -630,39 +633,7 @@ static aom_codec_err_t set_encoder_config(
#endif
oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost;
oxcf->motion_vector_unit_test = extra_cfg->motion_vector_unit_test;
/*
printf("Current AV1 Settings: \n");
printf("target_bandwidth: %d\n", oxcf->target_bandwidth);
printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity);
printf("sharpness: %d\n", oxcf->sharpness);
printf("cpu_used: %d\n", oxcf->cpu_used);
printf("Mode: %d\n", oxcf->mode);
printf("auto_key: %d\n", oxcf->auto_key);
printf("key_freq: %d\n", oxcf->key_freq);
printf("end_usage: %d\n", oxcf->end_usage);
printf("under_shoot_pct: %d\n", oxcf->under_shoot_pct);
printf("over_shoot_pct: %d\n", oxcf->over_shoot_pct);
printf("starting_buffer_level: %d\n", oxcf->starting_buffer_level);
printf("optimal_buffer_level: %d\n", oxcf->optimal_buffer_level);
printf("maximum_buffer_size: %d\n", oxcf->maximum_buffer_size);
printf("fixed_q: %d\n", oxcf->fixed_q);
printf("worst_allowed_q: %d\n", oxcf->worst_allowed_q);
printf("best_allowed_q: %d\n", oxcf->best_allowed_q);
printf("allow_spatial_resampling: %d\n", oxcf->allow_spatial_resampling);
printf("scaled_frame_width: %d\n", oxcf->scaled_frame_width);
printf("scaled_frame_height: %d\n", oxcf->scaled_frame_height);
printf("two_pass_vbrbias: %d\n", oxcf->two_pass_vbrbias);
printf("two_pass_vbrmin_section: %d\n", oxcf->two_pass_vbrmin_section);
printf("two_pass_vbrmax_section: %d\n", oxcf->two_pass_vbrmax_section);
printf("lag_in_frames: %d\n", oxcf->lag_in_frames);
printf("enable_auto_arf: %d\n", oxcf->enable_auto_arf);
printf("Version: %d\n", oxcf->Version);
printf("error resilient: %d\n", oxcf->error_resilient_mode);
printf("frame parallel detokenization: %d\n",
oxcf->frame_parallel_decoding_mode);
*/
return AOM_CODEC_OK;
}
......@@ -1486,22 +1457,32 @@ static aom_codec_err_t ctrl_set_color_space(aom_codec_alg_priv_t *ctx,
return update_extra_cfg(ctx, &extra_cfg);
}
#if CONFIG_COLORSPACE_HEADERS
static aom_codec_err_t ctrl_set_transfer_function(aom_codec_alg_priv_t *ctx,
va_list args) {
#if CONFIG_COLORSPACE_HEADERS
struct av1_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.transfer_function = CAST(AV1E_SET_TRANSFER_FUNCTION, args);
return update_extra_cfg(ctx, &extra_cfg);
#else
(void)ctx;
(void)args;
return AOM_CODEC_UNSUP_FEATURE;
#endif
}
static aom_codec_err_t ctrl_set_chroma_sample_position(
aom_codec_alg_priv_t *ctx, va_list args) {
#if CONFIG_COLORSPACE_HEADERS
struct av1_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.chroma_sample_position =
CAST(AV1E_SET_CHROMA_SAMPLE_POSITION, args);
return update_extra_cfg(ctx, &extra_cfg);
}
#else
(void)ctx;
(void)args;
return AOM_CODEC_UNSUP_FEATURE;
#endif
}
static aom_codec_err_t ctrl_set_color_range(aom_codec_alg_priv_t *ctx,
va_list args) {
......@@ -1589,10 +1570,8 @@ static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ AV1E_SET_FRAME_PERIODIC_BOOST, ctrl_set_frame_periodic_boost },
{ AV1E_SET_TUNE_CONTENT, ctrl_set_tune_content },
{ AV1E_SET_COLOR_SPACE, ctrl_set_color_space },
#if CONFIG_COLORSPACE_HEADERS
{ AV1E_SET_TRANSFER_FUNCTION, ctrl_set_transfer_function },
{ AV1E_SET_CHROMA_SAMPLE_POSITION, ctrl_set_chroma_sample_position },
#endif
{ AV1E_SET_COLOR_RANGE, ctrl_set_color_range },
{ AV1E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity },
{ AV1E_SET_MIN_GF_INTERVAL, ctrl_set_min_gf_interval },
......
......@@ -173,10 +173,8 @@ typedef struct BufferPool {
typedef struct AV1Common {
struct aom_internal_error_info error;
aom_color_space_t color_space;
#if CONFIG_COLORSPACE_HEADERS
aom_transfer_function_t transfer_function;
aom_chroma_sample_position_t chroma_sample_position;
#endif
int color_range;
int width;
int height;
......
......@@ -285,10 +285,8 @@ typedef struct AV1EncoderConfig {
int use_highbitdepth;
#endif
aom_color_space_t color_space;
#if CONFIG_COLORSPACE_HEADERS
aom_transfer_function_t transfer_function;
aom_chroma_sample_position_t chroma_sample_position;
#endif
int color_range;
int render_width;
int render_height;
......
......@@ -96,7 +96,6 @@ set(CONFIG_UNIT_TESTS 1 CACHE NUMBER "Enables unit tests.")
set(CONFIG_ACCOUNTING 0 CACHE NUMBER "Enables bit accounting.")
set(CONFIG_ANALYZER 0 CACHE NUMBER "Enables bit stream analyzer.")
set(CONFIG_COEFFICIENT_RANGE_CHECKING 0 CACHE NUMBER "Coefficient range check.")
set(CONFIG_COLORSPACE_HEADERS 0 CACHE NUMBER "Colorspace header support.")
set(CONFIG_HIGHBITDEPTH 1 CACHE NUMBER "Enables high bit depth support.")
set(CONFIG_INSPECTION 0 CACHE NUMBER "Enables bitstream inspection.")
set(CONFIG_INTERNAL_STATS 0 CACHE NUMBER "Codec stats.")
......@@ -119,6 +118,7 @@ set(CONFIG_CHROMA_2X2 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_CHROMA_SUB8X8 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_CDEF_DIST 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_COEF_INTERLEAVE 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_COLORSPACE_HEADERS 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_COMPOUND_ROUND 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_COMPOUND_SEGMENT 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_COMPOUND_SINGLEREF 0 CACHE NUMBER "AV1 experiment flag.")
......
......@@ -342,6 +342,7 @@ EXPERIMENT_LIST="
no_frame_context_signaling
txmg
hash_me
colorspace_headers
"
CONFIG_LIST="
dependency_tracking
......@@ -388,7 +389,6 @@ CONFIG_LIST="
highbitdepth
experimental
size_limit
colorspace_headers
${EXPERIMENT_LIST}
analyzer
"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment