shithub: libvpx

Download patch

ref: 223645aa83091fd88473ad2ddf20f80682b60a47
parent: e3979bd385d4d7517897b92502c727ab5e4831bc
author: James Zern <jzern@google.com>
date: Fri Mar 13 16:29:09 EDT 2020

vpx_codec_enc_config_default: rm unnecessary loop

quiets -Wunreachable-code-loop-increment, present since:
e57f388bc vpx_codec_enc_config_default: disable 'usage'

as g_usage was never supported for vp8/9 this was always a single
iteration. if additional usages are added in the future similar to av1
this can be restored.

Bug: b/150166387
Change-Id: Ic6f0985829e87694de8b5e0340cffa6c451ed1c2

--- a/configure
+++ b/configure
@@ -627,6 +627,7 @@
         check_add_cflags -Wmissing-declarations
         check_add_cflags -Wmissing-prototypes
         check_add_cflags -Wuninitialized
+        check_add_cflags -Wunreachable-code-loop-increment
         check_add_cflags -Wunused
         check_add_cflags -Wextra
         # check_add_cflags also adds to cxxflags. gtest does not do well with
--- a/vpx/src/vpx_encoder.c
+++ b/vpx/src/vpx_encoder.c
@@ -152,8 +152,6 @@
                                              vpx_codec_enc_cfg_t *cfg,
                                              unsigned int usage) {
   vpx_codec_err_t res;
-  vpx_codec_enc_cfg_map_t *map;
-  int i;
 
   if (!iface || !cfg || usage != 0)
     res = VPX_CODEC_INVALID_PARAM;
@@ -160,14 +158,9 @@
   else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
     res = VPX_CODEC_INCAPABLE;
   else {
-    res = VPX_CODEC_INVALID_PARAM;
-
-    for (i = 0; i < iface->enc.cfg_map_count; ++i) {
-      map = iface->enc.cfg_maps + i;
-      *cfg = map->cfg;
-      res = VPX_CODEC_OK;
-      break;
-    }
+    assert(iface->enc.cfg_map_count == 1);
+    *cfg = iface->enc.cfg_maps->cfg;
+    res = VPX_CODEC_OK;
   }
 
   return res;