From: Johann Date: Thu, 1 Nov 2018 20:02:45 +0000 (-0700) Subject: vpx_codec_enc_config_default: disable 'usage' X-Git-Tag: v1.8.0~178^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e57f388bcf1a9ed00a45a08216ec2b6c0b041a96;p=libvpx vpx_codec_enc_config_default: disable 'usage' Found with clang-tidy. This value is unused in libvpx. There is an existing test which ensures this is not used: test/encode_api_test.cc: EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_enc_config_default(kCodecs[i], &cfg, 1)); Change-Id: I94bd0663c6652b4267204c02c3921972c854d0b0 --- diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index b5f96a17e..71eadeb08 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -1190,7 +1190,7 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] = { static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = { { 0, { - 0, /* g_usage */ + 0, /* g_usage (unused) */ 0, /* g_threads */ 0, /* g_profile */ diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 3b2d9a866..efe23e33d 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1690,7 +1690,7 @@ static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { { 0, { // NOLINT - 0, // g_usage + 0, // g_usage (unused) 8, // g_threads 0, // g_profile diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c index 1cf2dca69..ac1e3d061 100644 --- a/vpx/src/vpx_encoder.c +++ b/vpx/src/vpx_encoder.c @@ -154,7 +154,7 @@ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, vpx_codec_enc_cfg_map_t *map; int i; - if (!iface || !cfg || usage > INT_MAX) + if (!iface || !cfg || usage != 0) res = VPX_CODEC_INVALID_PARAM; else if (!(iface->caps & VPX_CODEC_CAP_ENCODER)) res = VPX_CODEC_INCAPABLE; @@ -163,12 +163,9 @@ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, for (i = 0; i < iface->enc.cfg_map_count; ++i) { map = iface->enc.cfg_maps + i; - if (map->usage == (int)usage) { - *cfg = map->cfg; - cfg->g_usage = usage; - res = VPX_CODEC_OK; - break; - } + *cfg = map->cfg; + res = VPX_CODEC_OK; + break; } } diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h index 7a232b0ef..1692028ea 100644 --- a/vpx/vp8cx.h +++ b/vpx/vp8cx.h @@ -227,8 +227,8 @@ enum vp8e_enc_control_id { /*!\brief Codec control function to set constrained quality level. * - * \attention For this value to be used vpx_codec_enc_cfg_t::g_usage must be - * set to #VPX_CQ. + * \attention For this value to be used vpx_codec_enc_cfg_t::rc_end_usage must + * be set to #VPX_CQ * \note Valid range: 0..63 * * Supported in codecs: VP8, VP9 diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h index bddd72191..050d69552 100644 --- a/vpx/vpx_encoder.h +++ b/vpx/vpx_encoder.h @@ -278,12 +278,9 @@ typedef struct vpx_codec_enc_cfg { * generic settings (g) */ - /*!\brief Algorithm specific "usage" value + /*!\brief Deprecated: Algorithm specific "usage" value * - * Algorithms may define multiple values for usage, which may convey the - * intent of how the application intends to use the stream. If this value - * is non-zero, consult the documentation for the codec to determine its - * meaning. + * This value must be zero. */ unsigned int g_usage; @@ -482,8 +479,7 @@ typedef struct vpx_codec_enc_cfg { * The quantizer is the most direct control over the quality of the * encoded image. The range of valid values for the quantizer is codec * specific. Consult the documentation for the codec to determine the - * values to use. To determine the range programmatically, call - * vpx_codec_enc_config_default() with a usage value of 0. + * values to use. */ unsigned int rc_min_quantizer; @@ -492,8 +488,7 @@ typedef struct vpx_codec_enc_cfg { * The quantizer is the most direct control over the quality of the * encoded image. The range of valid values for the quantizer is codec * specific. Consult the documentation for the codec to determine the - * values to use. To determine the range programmatically, call - * vpx_codec_enc_config_default() with a usage value of 0. + * values to use. */ unsigned int rc_max_quantizer; @@ -799,7 +794,7 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver( * * \param[in] iface Pointer to the algorithm interface to use. * \param[out] cfg Configuration buffer to populate. - * \param[in] reserved Must set to 0 for VP8 and VP9. + * \param[in] usage Must be set to 0. * * \retval #VPX_CODEC_OK * The configuration was populated. @@ -810,7 +805,7 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver( */ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, vpx_codec_enc_cfg_t *cfg, - unsigned int reserved); + unsigned int usage); /*!\brief Set or change configuration *