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
This commit is contained in:
Johann
2018-11-01 13:02:45 -07:00
parent 811759d868
commit e57f388bcf
5 changed files with 14 additions and 22 deletions
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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
+4 -7
View File
@@ -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;
}
}
+2 -2
View File
@@ -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
+6 -11
View File
@@ -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
*