1. 28 Jul, 2022 4 commits
  2. 27 Jul, 2022 4 commits
  3. 26 Jul, 2022 4 commits
  4. 25 Jul, 2022 17 commits
  5. 24 Jul, 2022 8 commits
  6. 23 Jul, 2022 3 commits
    • Andreas Rheinhardt's avatar
      avcodec/svq1enc: Use unsigned for parameter >= 0 to workaround GCC bug · 1cb7fd31
      Andreas Rheinhardt authored
      encode_block() in svq1enc.c looks like the following:
      
      static int encode_block(int block[7][256], int level)
      {
          int best_score = 0;
      
          for (unsigned x = 0; x < level; x++) {
              int v = block[1][x];
              block[level][x] = 0;
              best_score      += v * v;
          }
      
          if (level > 0 && best_score > 64) {
              int score = 0;
      
              score += encode_block(block, level - 1);
              score += encode_block(block, level - 1);
      
              if (score < best_score) {
                  best_score = score;
              }
          }
      
          return best_score;
      }
      
      When called from outside of encode_block(), it is always called with
      level == 5.
      
      This triggers a bug [1] in GCC: On -O3, it creates eight clones of
      encode_block with different values of level inlined into it. The clones
      with negative values are of course useless*, but they also lead to
      -Warray-bounds warnings, because they access block[-1].
      
      This has been mitigated in GCC 12: It no longer creates clones
      for parameters that it knows are impossible. Somehow switching levels
      to unsigned makes GCC know this. Therefore this commit does this.
      (For GCC 11, this changes the warning to "array subscript 4294967295 is
      above array bounds" from "array subscript -1 is below array bounds".)
      
      [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102513
      
      *: These clones can actually be discarded when compiling with
      -ffunction-sections.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
      1cb7fd31
    • Andreas Rheinhardt's avatar
      avcodec/h264_loopfilter: Fix incorrect function parameter array size · 890efee2
      Andreas Rheinhardt authored
      filter_mb_mbaff_edgev() and filter_mb_mbaff_edgecv()
      have a function parameter whose expected size depends upon
      another parameter: It is 2 * bsi + 1 (with bsi always being 1 or 2).
      This array is declared as const int16_t[7], yet some of the callers
      with bsi == 1 call it with only an const int16_t[4] available.
      This leads to -Wstringop-overread warnings from GCC 12.1.
      
      This commit fixes these by replacing [7] with [/* 2 * bsi + 1 */],
      so that the expected range and its dependence on bsi is immediately
      visible.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
      890efee2
    • Andreas Rheinhardt's avatar
      avcodec/snowenc: Don't pass int[2] as parameter declared as int[3] · 708890e7
      Andreas Rheinhardt authored
      check_block_inter() currently does this when calling check_block().
      This leads to a -Wstringop-overflow= warning when compiling with
      GCC 12.1.
      
      Given that the main part of the body of check_block() consists
      of an "if (intra) { ... } else { ... }" which is true iff
      check_block() is not called from check_block_inter(),
      it makes sense to fix this by just inlining check_block()
      check_block_inter() and turning check_block() into a new
      check_block_intra() (with the inter parts removed, of course).
      
      This should also not make much of a difference for the generated code
      given that both check_block() as well as check_block_inter()
      are already marked as av_always_inline, so this commit follows
      this route to fix the issue.
      Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
      708890e7