]> granicus.if.org Git - libvpx/commitdiff
vpx_codec_enc_config_default: disable 'usage'
authorJohann <johann.koenig@duck.com>
Thu, 1 Nov 2018 20:02:45 +0000 (13:02 -0700)
committerJohann <johann.koenig@duck.com>
Mon, 5 Nov 2018 23:14:46 +0000 (15:14 -0800)
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

vp8/vp8_cx_iface.c
vp9/vp9_cx_iface.c
vpx/src/vpx_encoder.c
vpx/vp8cx.h
vpx/vpx_encoder.h

index b5f96a17e417cb1e8b4bffc3bb2ad40e07ed71df..71eadeb08a974196882779a001b03f57c5632348 100644 (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 */
 
index 3b2d9a8661728cfb6e935733d32c35a2b85b2f07..efe23e33d35bab0623ce9ab5ddff1347a002ffdd 100644 (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
 
index 1cf2dca695a929023af4b98fc3c14832ec6e3140..ac1e3d061fb3d24d85a00b24a793f1892a1ecf8b 100644 (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;
     }
   }
 
index 7a232b0ef90bed72e72cb97885140bb962f3ecc3..1692028eaeb650694bc04daf40f9c45d06845894 100644 (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
index bddd72191bef75a7afa9a9202f83862b3d70e397..050d695520917384a4eaf9bff65c83d1e46b20cf 100644 (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
  *