1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00
Go to file
Andreas Rheinhardt 1cb7fd317c avcodec/svq1enc: Use unsigned for parameter >= 0 to workaround GCC bug
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: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-23 22:53:29 +02:00
compat avfilter: add chromakey_cuda filter 2022-07-10 17:20:15 +02:00
doc fftools/ffmpeg: move each muxer to a separate thread 2022-07-23 11:53:19 +02:00
ffbuild ffbuild/common: Fix CPPFLAGS applied for compiling C++ files 2022-05-24 21:30:52 +02:00
fftools fftools/ffmpeg: Zero subtitle packet padding 2022-07-23 19:01:44 +02:00
libavcodec avcodec/svq1enc: Use unsigned for parameter >= 0 to workaround GCC bug 2022-07-23 22:53:29 +02:00
libavdevice lavd: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:17 +02:00
libavfilter lavf/sr: fix the segmentation fault caused by incorrect input frame free. 2022-07-22 08:15:04 +08:00
libavformat avformat/asfcrypt: Fix wrong array length in function declaration 2022-07-23 22:53:29 +02:00
libavutil lavu/frame: add a duration field to AVFrame 2022-07-19 12:27:17 +02:00
libpostproc Bump versions after 5.1 branch 2022-07-13 00:29:05 +02:00
libswresample Bump versions after 5.1 branch 2022-07-13 00:29:05 +02:00
libswscale swscale: add NV16 input/output 2022-07-19 12:20:16 +02:00
presets
tests fftools/ffmpeg: use the sync queues to handle -frames 2022-07-23 11:53:19 +02:00
tools tools/target_dec_fuzzer: Adjust threshold for MWSC 2022-07-21 19:27:38 +02:00
.gitattributes fate: add SCC test 2017-01-27 17:06:42 +01:00
.gitignore gitignore: add config_components.h 2022-03-17 18:35:41 -03:00
.mailmap mailmap: add entry for myself 2021-03-09 02:09:55 +00:00
.travis.yml Merge commit '899ee03088d55152a48830df0899887f055da1de' 2019-03-14 15:53:16 -03:00
Changelog fftools/ffmpeg: move each muxer to a separate thread 2022-07-23 11:53:19 +02:00
configure fftools/ffmpeg: depend on threads 2022-07-23 11:53:19 +02:00
CONTRIBUTING.md Add CONTRIBUTING.md 2016-09-18 10:02:13 +01:00
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
INSTALL.md INSTALL.md: Fix Markdown formatting 2019-01-31 10:29:16 -09:00
LICENSE.md avfilter/vf_geq: Relicense to LGPL 2019-12-28 11:20:48 +01:00
MAINTAINERS MAINTAINERS: add myself as maintainer for LoongArch. 2022-06-08 18:29:30 +02:00
Makefile Makefile: Prompt for reconfigure on lavc/hwaccels.h modification 2022-07-01 00:34:38 +02:00
README.md README: fix typo and description of libavfilter 2021-10-08 09:44:34 +05:30
RELEASE RELEASE: update after 5.1 branch 2022-07-13 00:31:42 +02:00

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides means to alter decoded audio and video through a directed graph of connected filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.