diff --git a/.forgejo/CODEOWNERS b/.forgejo/CODEOWNERS index 2ebe56551e..bbc05b8d40 100644 --- a/.forgejo/CODEOWNERS +++ b/.forgejo/CODEOWNERS @@ -12,11 +12,14 @@ libavcodec/*ac3* @lynne libavcodec/*atrac9* @lynne libavcodec/*bitpacked* @lynne libavcodec/*dirac* @lynne -libavcodec/*ffv1* @lynne +libavcodec/*ffv1* @lynne @michaelni +libavcodec/golomb* @michaelni libavcodec/*jpegxl* @lynne libavcodec/*jxl* @lynne libavcodec/*opus* @lynne libavcodec/*prores* @lynne +libavcodec/rangecoder* @michaelni +libavcodec/ratecontrol* @michaelni libavcodec/*siren* @lynne libavcodec/*vc2* @lynne @@ -27,6 +30,8 @@ libavcodec/x86/* @lynne # avfilter # ======= libavfilter/aarch64/* @mstorsjo +libavfilter/vf_yadif* @michaelni +libavfilter/vsrc_mandelbrot* @michaelni # avformat # ======= @@ -34,8 +39,12 @@ libavformat/iamf* @jamrial # avutil # ====== -libavutil/*crc* @lynne +libavutil/*crc* @lynne @michaelni +libavutil/eval* @michaelni libavutil/iamf* @jamrial +libavutil/mathematics* @michaelni +libavutil/mem* @michaelni +libavutil/rational* @michaelni libavutil/tx* @lynne libavutil/aarch64/* @lynne @mstorsjo @@ -46,12 +55,17 @@ libavutil/x86/* @lynne # ======= libswresample/aarch64/* @mstorsjo libswresample/arm/* @mstorsjo +libswresample/* @michaelni # swscale # ======= libswscale/aarch64/* @mstorsjo libswscale/arm/* @mstorsjo +# doc +# === +doc/* @GyanD + # Frameworks # ========== *vulkan* @lynne diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index dcec4bd415..56e844ff4b 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -30,7 +30,7 @@ jobs: id: fate run: | make fate-rsync SAMPLES=$PWD/fate-suite - echo "hash=$(find fate-suite -type f | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT + echo "hash=$(find fate-suite -type f | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT - name: Cache Fate-Suite uses: actions/cache/save@v4 if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }} diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml new file mode 100644 index 0000000000..0bb7e33251 --- /dev/null +++ b/.github/workflows/makefile.yml @@ -0,0 +1,111 @@ +name: test +run-name: ${{ github.workflow }} - ${{ github.sha }} +on: + push: + branches: [ main, up ] + pull_request: + branches: [ main, up ] + workflow_dispatch: + + +jobs: + ffvvc-test: + name: ffvvc-test / ${{ matrix.os.name }}/${{ matrix.compiler.name }}/${{ matrix.assembler.name }} + env: + configure_flags: --enable-ffmpeg --disable-everything --enable-decoder=vvc --enable-parser=vvc --enable-demuxer=vvc,mpegts --enable-protocol=file,pipe --enable-encoder=rawvideo,wrapped_avframe --enable-muxer=rawvideo,md5,null + strategy: + fail-fast: false + matrix: + os: + - { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4 } + - { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 } + compiler: + - { name: gcc, flags: --cc=gcc } + - { name: clang, flags: --cc=clang } + - { name: msvc, flags: --toolchain=msvc } + - { name: clang-usan, flags: '--toolchain=clang-usan' } + - { name: clang-asan, flags: '--toolchain=clang-asan' } + assembler: + - { name: no asm, flags: --disable-asm } + - { name: nasm, flags: --as=nasm } + exclude: + # GitHub's Actions runners do not support AVX2. + - os: { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4} + compiler: { name: msvc, flags: --toolchain=msvc } + - os: { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4 } + assembler: { name: nasm, flags: --as=nasm } + # Address sanitizer cannot be run with handwritten assembly. + - compiler: { name: clang-asan, flags: '--toolchain=clang-asan' } + assembler: { name: nasm, flags: --as=nasm } + # Windows only supports MSVC. + - os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 } + compiler: { name: gcc, flags: --cc=gcc } + - os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 } + compiler: { name: clang, flags: --cc=clang } + - os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 } + compiler: { name: clang-usan, flags: '--toolchain=clang-usan' } + - os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 } + compiler: { name: clang-asan, flags: '--toolchain=clang-asan' } + + runs-on: ${{ matrix.os.runner }} + defaults: + run: + shell: ${{ matrix.os.shell }} + + steps: + - name: Get MSVC + if: ${{ matrix.compiler.name == 'msvc' && matrix.os.name == 'windows' }} + uses: ilammy/msvc-dev-cmd@v1 + + - name: Set up MSYS2 + if: ${{ matrix.os.shell == 'msys2 {0}' }} + uses: msys2/setup-msys2@v2 + with: + release: false + msystem: UCRT64 + path-type: inherit + install: >- + make + diffutils + + - name: Setup python package + run: python3 -m pip install tqdm pyyaml + + - name: Get assembler + if: ${{ matrix.os.shell == 'msys2 {0}' && matrix.assembler.name != 'no asm' }} + run: pacman --noconfirm -S ${{ matrix.assembler.name }} + + - name: Get source + uses: actions/checkout@v3 + with: + path: FFmpeg + + - name: Configure + run: cd FFmpeg && ./configure ${{ matrix.compiler.flags }} ${{ matrix.assembler.flags }} ${{ env.configure_flags }} || (tail ffbuild/config.log; false) + + - name: Build + run: cd FFmpeg && make -j8 + + - name: Get tests + uses: actions/checkout@v3 + with: + repository: ffvvc/tests + path: tests + + - name: Unit test + run: python3 tests/tools/ffmpeg.py --threads ${{ matrix.os.runner_threads }} --ffmpeg-path=./FFmpeg/ffmpeg tests/conformance/passed + + - name: DVB 40 frames test + run: python3 tests/tools/ffmpeg.py --threads 1 --ffmpeg-path=./FFmpeg/ffmpeg tests/conformance/dvb/40frames + + - name: Check ASM + run: cd FFmpeg && make checkasm -j && ./tests/checkasm/checkasm + + - name: Negative test + run: python3 tests/tools/ffmpeg.py --threads ${{ matrix.os.runner_threads }} --ffmpeg-path=./FFmpeg/ffmpeg tests/conformance/failed || true + + - name: Check for fuzz regressions + run: python3 tests/tools/ffmpeg.py --threads ${{ matrix.os.runner_threads }} --ffmpeg-path=./FFmpeg/ffmpeg --fuzz tests/fuzz/passed + + - name: Fuzz negative test + run: python3 tests/tools/ffmpeg.py --threads ${{ matrix.os.runner_threads }} --ffmpeg-path=./FFmpeg/ffmpeg --fuzz tests/fuzz/failed || tree diff --git a/Changelog b/Changelog index 04db8e15b2..b7704604f4 100644 --- a/Changelog +++ b/Changelog @@ -26,6 +26,7 @@ version : - OpenHarmony hardware decoder/encoder - Colordetect filter - Add vf_scale_d3d11 filter +- No longer disabling GCC autovectorization, on X86, ARM and AArch64 version 7.1: diff --git a/configure b/configure index c0a4c3c87c..d5e0bb6936 100755 --- a/configure +++ b/configure @@ -4925,7 +4925,7 @@ msvc_common_flags(){ -lstdc++) ;; -l*) echo ${flag#-l}.lib ;; -LARGEADDRESSAWARE) echo $flag ;; - -L*) echo -libpath:${flag#-L} ;; + -L*) [ "$_flags_type" = "link" ] && echo -libpath:${flag#-L} ;; -Wl,*) ;; *) echo $flag ;; esac @@ -4947,6 +4947,12 @@ msvc_flags(){ done } +msvc_flags_link(){ + _flags_type=link + msvc_flags "$@" + unset _flags_type +} + icl_flags(){ msvc_common_flags "$@" for flag; do @@ -5173,12 +5179,13 @@ probe_cc(){ _cflags_noopt="-O1" if $_cc -nologo- 2>&1 | grep -q Linker; then _ld_o='-out:$@' + _flags_filter=msvc_flags_link else _ld_o='-Fe$@' + _flags_filter=msvc_flags fi _cc_o='-Fo$@' _cc_e='-P -Fi$@' - _flags_filter=msvc_flags _ld_lib='lib%.a' _ld_path='-libpath:' _flags='-nologo' @@ -5277,6 +5284,12 @@ else ar_o='$@' fi +# Treat unrecognized flags as errors on MSVC +test_cpp_condition windows.h "_MSC_FULL_VER >= 193030705" && + check_cflags -options:strict +test_host_cpp_condition windows.h "_MSC_FULL_VER >= 193030705" && + check_host_cflags -options:strict + add_cflags $extra_cflags add_cxxflags $extra_cxxflags add_objcflags $extra_objcflags @@ -5298,6 +5311,7 @@ if test "$cpu" = host; then case "$cc_type" in gcc|llvm_gcc) check_native(){ + : > $TMPC $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return sed -n "/cc1.*$1=/{ s/.*$1=\\([^ ]*\\).*/\\1/ @@ -5309,6 +5323,7 @@ if test "$cpu" = host; then ;; clang) check_native(){ + : > $TMPC $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return sed -n "/cc1.*-target-cpu /{ s/.*-target-cpu \\([^ ]*\\).*/\\1/ @@ -7714,7 +7729,25 @@ if enabled icc; then disable aligned_stack fi elif enabled gcc; then - check_optflags -fno-tree-vectorize + gcc_version=$($cc -dumpversion) + major_version=${gcc_version%%.*} + if [ $major_version -lt 13 ]; then + # Disable tree-vectorize for GCC <13 - it has historically been buggy. + check_optflags -fno-tree-vectorize + else + case $arch in + x86|arm|aarch64) + # Allow the default of having tree-vectorize enabled on well tested + # architectures. + ;; + *) + # Disable tree-vectorize on potentially less tested + # architectures. Known issues: + # - https://gcc.gnu.org/PR121064 on Loongarch + check_optflags -fno-tree-vectorize + ;; + esac + fi check_cflags -Werror=format-security check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes diff --git a/doc/filters.texi b/doc/filters.texi index bc6dafd22d..61ece1d000 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16348,6 +16348,36 @@ Render frames with rounded corners. The value, given as a float ranging from square to fully circular. In other words, it gives the radius divided by half the smaller side length. Defaults to @code{0.0}. +@item lut +Specifies a custom LUT (in Adobe .cube format) to apply to the colors +as part of color conversion. The exact interpretation depends on the value +of @option{lut_type}. + +@item lut_type +Controls the interpretation of color values fed to and from the LUT +specified as @option{lut}. Valid values are: + +@table @samp +@item auto +Chooses the interpretation of the LUT automatically from tagged +metadata, and otherwise falls back to @samp{native}. (Default) + +@item native +Applied to raw image contents in its native RGB colorspace (non-linear +light), before conversion to the output color space. + +@item normalized +Applied to the normalized RGB image contents, in linear light, before +conversion to the output color space. + +@item conversion +Fully replaces the conversion from the image color space to the output +color space. If such a LUT is present, it has the highest priority, and +overrides any ICC profiles, as well as options related to tone mapping +and output colorimetry (@option{color_primaries}, @option{color_trc}). + +@end table + @item extra_opts Pass extra libplacebo internal configuration options. These can be specified as a list of @var{key}=@var{value} pairs separated by ':'. The following example diff --git a/libavcodec/dsicinaudio.c b/libavcodec/dsicinaudio.c index aa14966c7b..abe7ba991e 100644 --- a/libavcodec/dsicinaudio.c +++ b/libavcodec/dsicinaudio.c @@ -81,6 +81,8 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx) cin->initial_decode_frame = 1; cin->delta = 0; avctx->sample_fmt = AV_SAMPLE_FMT_S16; + if (!avctx->sample_rate) + avctx->sample_rate = 8000; av_channel_layout_uninit(&avctx->ch_layout); avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; diff --git a/libavcodec/evrcdec.c b/libavcodec/evrcdec.c index 9059f67815..974c967b48 100644 --- a/libavcodec/evrcdec.c +++ b/libavcodec/evrcdec.c @@ -239,6 +239,8 @@ static av_cold int evrc_decode_init(AVCodecContext *avctx) av_channel_layout_uninit(&avctx->ch_layout); avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + if (!avctx->sample_rate) + avctx->sample_rate = 8000; for (i = 0; i < FILTER_ORDER; i++) { e->prev_lspf[i] = (i + 1) * 0.048; diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c index 231f1d32eb..cc89737b31 100644 --- a/libavcodec/g722dec.c +++ b/libavcodec/g722dec.c @@ -63,6 +63,8 @@ static av_cold int g722_decode_init(AVCodecContext * avctx) av_channel_layout_uninit(&avctx->ch_layout); avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; avctx->sample_fmt = AV_SAMPLE_FMT_S16; + if (!avctx->sample_rate) + avctx->sample_rate = 16000; c->band[0].scale_factor = 8; c->band[1].scale_factor = 2; diff --git a/libavcodec/h274.c b/libavcodec/h274.c index 248af8119b..332d0c2c52 100644 --- a/libavcodec/h274.c +++ b/libavcodec/h274.c @@ -27,6 +27,7 @@ #include "libavutil/avassert.h" #include "libavutil/bswap.h" +#include "libavcodec/bswapdsp.h" #include "libavutil/crc.h" #include "libavutil/imgutils.h" #include "libavutil/md5.h" @@ -795,15 +796,41 @@ static const int8_t R64T[64][64] = { } }; -static int verify_plane_md5(struct AVMD5 *ctx, - const uint8_t *src, const int w, const int h, const int stride, - const uint8_t *expected) +struct H274HashContext { + int type; + struct AVMD5 *ctx; + +#if HAVE_BIGENDIAN + BswapDSPContext bdsp; + uint8_t *buf; + int buf_size; +#endif +}; + +static av_always_inline void bswap16_buf_if_be(H274HashContext *s, const int ps, const uint8_t **src, const int w) +{ +#if HAVE_BIGENDIAN + if (ps) { + s->bdsp.bswap16_buf((uint16_t *)s->buf, + (const uint16_t *)*src, w); + *src = s->buf; + } +#endif +} + +static int verify_plane_md5(H274HashContext *s, + const uint8_t *_src, const int w, const int h, const int stride, + const int ps, const uint8_t *expected) { #define MD5_SIZE 16 + struct AVMD5 *ctx = s->ctx; uint8_t md5[MD5_SIZE]; + av_md5_init(ctx); for (int j = 0; j < h; j++) { - av_md5_update(ctx, src, w); + const uint8_t *src = &_src[j * stride]; + bswap16_buf_if_be(s, ps, &src, w); + av_md5_update(ctx, src, w << ps); src += stride; } av_md5_final(ctx, md5); @@ -814,15 +841,16 @@ static int verify_plane_md5(struct AVMD5 *ctx, return 0; } -static int verify_plane_crc(const uint8_t *src, const int w, const int h, const int stride, - uint16_t expected) +static int verify_plane_crc(H274HashContext *s, const uint8_t *_src, const int w, const int h, const int stride, + const int ps, uint16_t expected) { uint32_t crc = 0x0F1D; // CRC-16-CCITT-AUG const AVCRC *ctx = av_crc_get_table(AV_CRC_16_CCITT); - expected = av_le2ne32(expected); for (int j = 0; j < h; j++) { - crc = av_crc(ctx, crc, src, w); + const uint8_t *src = &_src[j * stride]; + bswap16_buf_if_be(s, ps, &src, w); + crc = av_crc(ctx, crc, src, w << ps); src += stride; } crc = av_bswap16(crc); @@ -863,11 +891,6 @@ enum { HASH_LAST = HASH_CHECKSUM, }; -struct H274HashContext { - int type; - struct AVMD5 *ctx; -}; - void ff_h274_hash_freep(H274HashContext **ctx) { if (*ctx) { @@ -875,6 +898,9 @@ void ff_h274_hash_freep(H274HashContext **ctx) if (c->ctx) av_free(c->ctx); av_freep(ctx); +#if HAVE_BIGENDIAN + av_freep(&c->buf); +#endif } } @@ -906,6 +932,10 @@ int ff_h274_hash_init(H274HashContext **ctx, const int type) return AVERROR(ENOMEM); } +#if HAVE_BIGENDIAN + ff_bswapdsp_init(&c->bdsp); +#endif + return 0; } @@ -932,10 +962,22 @@ int ff_h274_hash_verify(H274HashContext *c, const H274SEIPictureHash *hash, const uint8_t *src = frame->data[i]; const int stride = frame->linesize[i]; +#if HAVE_BIGENDIAN + if (c->type != HASH_CHECKSUM) { + if (ps) { + av_fast_malloc(&c->buf, &c->buf_size, + FFMAX3(frame->linesize[0], frame->linesize[1], + frame->linesize[2])); + if (!c->buf) + return AVERROR(ENOMEM); + } + } +#endif + if (c->type == HASH_MD5SUM) - err = verify_plane_md5(c->ctx, src, w << ps, h, stride, hash->md5[i]); + err = verify_plane_md5(c, src, w, h, stride, ps, hash->md5[i]); else if (c->type == HASH_CRC) - err = verify_plane_crc(src, w << ps, h, stride, hash->crc[i]); + err = verify_plane_crc(c, src, w, h, stride, ps, hash->crc[i]); else if (c->type == HASH_CHECKSUM) err = verify_plane_checksum(src, w, h, stride, ps, hash->checksum[i]); if (err < 0) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 3273451f9a..33166f2a90 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -91,12 +91,12 @@ static inline void init_ref(MotionEstContext *c, uint8_t *const src[3], }; int i; for(i=0; i<3; i++){ - c->src[0][i]= src[i] ? FF_PTR_ADD(src[i], offset[i]) : NULL; - c->ref[0][i]= ref[i] ? FF_PTR_ADD(ref[i], offset[i]) : NULL; + c->src[0][i]= src[i] ? src[i] + offset[i] : NULL; + c->ref[0][i]= ref[i] ? ref[i] + offset[i] : NULL; } if(ref_index){ for(i=0; i<3; i++){ - c->ref[ref_index][i]= ref2[i] ? FF_PTR_ADD(ref2[i], offset[i]) : NULL; + c->ref[ref_index][i]= ref2[i] ? ref2[i] + offset[i] : NULL; } } } diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c index 7d23a11102..4ec25a8f0f 100644 --- a/libavcodec/qcelpdec.c +++ b/libavcodec/qcelpdec.c @@ -89,6 +89,8 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx) av_channel_layout_uninit(&avctx->ch_layout); avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + if (!avctx->sample_rate) + avctx->sample_rate = 8000; for (i = 0; i < 10; i++) q->prev_lspf[i] = (i + 1) / 11.0; diff --git a/libavcodec/vulkan/common.comp b/libavcodec/vulkan/common.comp index 10af9c0623..6825693fa3 100644 --- a/libavcodec/vulkan/common.comp +++ b/libavcodec/vulkan/common.comp @@ -193,8 +193,8 @@ struct GetBitContext { uint64_t buf_end; uint64_t bits; - uint bits_valid; - uint size_in_bits; + int bits_valid; + int size_in_bits; }; #define LOAD64() \ @@ -216,11 +216,11 @@ struct GetBitContext { gb.bits_valid += 32; \ } -void init_get_bits(inout GetBitContext gb, u8buf data, uint64_t len) +void init_get_bits(inout GetBitContext gb, u8buf data, int len) { gb.buf = gb.buf_start = uint64_t(data); gb.buf_end = uint64_t(data) + len; - gb.size_in_bits = uint(len) * 8; + gb.size_in_bits = len * 8; /* Preload */ LOAD64() @@ -237,7 +237,7 @@ bool get_bit(inout GetBitContext gb) return val; } -uint get_bits(inout GetBitContext gb, uint n) +uint get_bits(inout GetBitContext gb, int n) { if (n == 0) return 0; @@ -251,7 +251,7 @@ uint get_bits(inout GetBitContext gb, uint n) return val; } -uint show_bits(inout GetBitContext gb, uint n) +uint show_bits(inout GetBitContext gb, int n) { if (n > gb.bits_valid) RELOAD32() @@ -259,7 +259,7 @@ uint show_bits(inout GetBitContext gb, uint n) return uint(gb.bits >> (64 - n)); } -void skip_bits(inout GetBitContext gb, uint n) +void skip_bits(inout GetBitContext gb, int n) { if (n > gb.bits_valid) RELOAD32() @@ -268,12 +268,12 @@ void skip_bits(inout GetBitContext gb, uint n) gb.bits_valid -= n; } -uint tell_bits(in GetBitContext gb) +int tell_bits(in GetBitContext gb) { - return uint(gb.buf - gb.buf_start) * 8 - gb.bits_valid; + return int(gb.buf - gb.buf_start) * 8 - gb.bits_valid; } -uint left_bits(in GetBitContext gb) +int left_bits(in GetBitContext gb) { - return gb.size_in_bits - uint(gb.buf - gb.buf_start) * 8 + gb.bits_valid; + return gb.size_in_bits - int(gb.buf - gb.buf_start) * 8 + gb.bits_valid; } diff --git a/libavcodec/vulkan/ffv1_dec_setup.comp b/libavcodec/vulkan/ffv1_dec_setup.comp index 671f28e7e7..5da09df21c 100644 --- a/libavcodec/vulkan/ffv1_dec_setup.comp +++ b/libavcodec/vulkan/ffv1_dec_setup.comp @@ -107,7 +107,7 @@ void golomb_init(inout SliceContext sc) uint64_t ac_byte_count = sc.c.bytestream - sc.c.bytestream_start - 1; init_get_bits(sc.gb, u8buf(sc.c.bytestream_start + ac_byte_count), - sc.c.bytestream_end - sc.c.bytestream_start - ac_byte_count); + int(sc.c.bytestream_end - sc.c.bytestream_start - ac_byte_count)); } void main(void) diff --git a/libavcodec/vulkan/ffv1_vlc.comp b/libavcodec/vulkan/ffv1_vlc.comp index d374e5a069..32a6ca9f37 100644 --- a/libavcodec/vulkan/ffv1_vlc.comp +++ b/libavcodec/vulkan/ffv1_vlc.comp @@ -121,7 +121,7 @@ Symbol get_vlc_symbol(inout VlcState state, int v, int bits) return set_sr_golomb(code, k, 12, bits); } -uint get_ur_golomb(inout GetBitContext gb, uint k, int limit, int esc_len) +uint get_ur_golomb(inout GetBitContext gb, int k, int limit, int esc_len) { for (uint i = 0; i < 12; i++) if (get_bit(gb)) @@ -130,7 +130,7 @@ uint get_ur_golomb(inout GetBitContext gb, uint k, int limit, int esc_len) return get_bits(gb, esc_len) + 11; } -int get_sr_golomb(inout GetBitContext gb, uint k, int limit, int esc_len) +int get_sr_golomb(inout GetBitContext gb, int k, int limit, int esc_len) { int v = int(get_ur_golomb(gb, k, limit, esc_len)); return (v >> 1) ^ -(v & 1); diff --git a/libavcodec/vulkan_encode_h264.c b/libavcodec/vulkan_encode_h264.c index f31b6d4069..8bbb4639e6 100644 --- a/libavcodec/vulkan_encode_h264.c +++ b/libavcodec/vulkan_encode_h264.c @@ -1313,6 +1313,7 @@ static int write_extra_headers(AVCodecContext *avctx, if (err < 0) goto fail; } else { + err = 0; *data_len = 0; } diff --git a/libavcodec/vulkan_encode_h265.c b/libavcodec/vulkan_encode_h265.c index c363778920..f0ec852557 100644 --- a/libavcodec/vulkan_encode_h265.c +++ b/libavcodec/vulkan_encode_h265.c @@ -1473,6 +1473,7 @@ static int write_extra_headers(AVCodecContext *avctx, if (err < 0) goto fail; } else { + err = 0; *data_len = 0; } diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c index d54e6a322b..e6c2f44e7b 100644 --- a/libavcodec/vvc/ctu.c +++ b/libavcodec/vvc/ctu.c @@ -1966,7 +1966,7 @@ static void palette_qp(VVCLocalContext *lc, VVCTreeType tree_type, const bool es u16[off] = pix; \ } while (0) -#define PALETTE_INDEX(x, y) index[(y) * cu->cb_width + (x)] +#define PALETTE_INDEX(x, y) index[(y) * width + (x)] // 6.5.3 Horizontal and vertical traverse scan order array initialization process // The hTravScan and vTravScan tables require approximately 576 KB of memory. @@ -1984,12 +1984,15 @@ static int palette_subblock_data(VVCLocalContext *lc, const CodingUnit *cu = lc->cu; TransformUnit *tu = cu->tus.head; const VVCSPS *sps = lc->fc->ps.sps; + const int width = tu->tbs[0].tb_width; + const int height = tu->tbs[0].tb_height; const int min_pos = subset_id << 4; - const int max_pos = FFMIN(min_pos + 16, cu->cb_width * cu->cb_height); - const int wmask = cu->cb_width - 1; - const int hmask = cu->cb_height - 1; - const int wlog2 = av_log2(cu->cb_width); - const int hlog2 = av_log2(cu->cb_height); + const int max_pos = FFMIN(min_pos + 16, width * height); + const int wmask = width - 1; + const int hmask = height - 1; + const int wlog2 = av_log2(width); + const int hlog2 = av_log2(height); + const int start_idx = tu->tbs[0].c_idx; const uint8_t esc = cu->plt[tu->tbs[0].c_idx].size; uint8_t run_copy[16] = { 0 }; @@ -2040,10 +2043,11 @@ static int palette_subblock_data(VVCLocalContext *lc, for (int c = 0; c < tu->nb_tbs; c++) { TransformBlock *tb = &tu->tbs[c]; - const Palette *plt = cu->plt + tb->c_idx; + const int c_idx = tb->c_idx; + const Palette *plt = &cu->plt[c_idx]; const int scale = ff_vvc_palette_derive_scale(lc, tu, tb); - const int hs = sps->hshift[c]; - const int vs = sps->vshift[c]; + const int hs = sps->hshift[c_idx] - sps->hshift[start_idx]; + const int vs = sps->vshift[c_idx] - sps->vshift[start_idx]; uint8_t *u8 = (uint8_t *)tb->coeffs; uint16_t *u16 = (uint16_t *)tb->coeffs; @@ -2089,9 +2093,12 @@ static int hls_palette_coding(VVCLocalContext *lc, const VVCTreeType tree_type) uint8_t run_type[MAX_PALETTE_CU_SIZE * MAX_PALETTE_CU_SIZE]; uint8_t index[MAX_PALETTE_CU_SIZE * MAX_PALETTE_CU_SIZE]; + TransformUnit *tu; + ff_vvc_channel_range(&start, &end, tree_type, sps->r->sps_chroma_format_idc); - if (!palette_add_tu(lc, start, end, tree_type)) + tu = palette_add_tu(lc, start, end, tree_type); + if (!tu) return AVERROR(ENOMEM); predictor_size = pp[start].size; @@ -2119,7 +2126,7 @@ static int hls_palette_coding(VVCLocalContext *lc, const VVCTreeType tree_type) palette_qp(lc, tree_type, escape_present); index[0] = 0; - for (int i = 0; i <= (cu->cb_width * cu->cb_height - 1) >> 4; i++) { + for (int i = 0; i <= (tu->tbs[0].tb_width * tu->tbs[0].tb_height - 1) >> 4; i++) { ret = palette_subblock_data(lc, max_index, i, transpose, run_type, index, &prev_run_pos, &adjust); if (ret < 0) diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c index 90fff3a03f..6f52306080 100644 --- a/libavcodec/vvc/dec.c +++ b/libavcodec/vvc/dec.c @@ -1112,13 +1112,11 @@ static int frame_end(VVCContext *s, VVCFrameContext *fc) return ret; ret = ff_h274_hash_verify(s->hash_ctx, &sei->picture_hash, fc->ref->frame, fc->ps.pps->width, fc->ps.pps->height); - if (ret < 0) { - av_log(s->avctx, AV_LOG_ERROR, - "Verifying checksum for frame with decoder_order %d: failed\n", - (int)fc->decode_order); - if (s->avctx->err_recognition & AV_EF_EXPLODE) - return ret; - } + av_log(s->avctx, ret < 0 ? AV_LOG_ERROR : AV_LOG_DEBUG, + "Verifying checksum for frame with decode_order %d: %s\n", + (int)fc->decode_order, ret < 0 ? "incorrect": "correct"); + if (ret < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) + return ret; } } diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 67f5360cf4..aecf28c40c 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -159,6 +159,7 @@ typedef struct LibplaceboContext { pl_vulkan vulkan; pl_gpu gpu; pl_tex tex[4]; + struct pl_custom_lut *lut; /* dedicated renderer for linear output composition */ pl_renderer linear_rr; @@ -188,6 +189,8 @@ typedef struct LibplaceboContext { AVExpr *pos_x_pexpr, *pos_y_pexpr, *pos_w_pexpr, *pos_h_pexpr; float pad_crop_ratio; float corner_rounding; + char *lut_filename; + enum pl_lut_type lut_type; int force_original_aspect_ratio; int force_divisible_by; int reset_sar; @@ -375,6 +378,26 @@ static int find_scaler(AVFilterContext *avctx, return AVERROR(EINVAL); } +static int parse_custom_lut(LibplaceboContext *s) +{ + int ret; + uint8_t *lutbuf; + size_t lutbuf_size; + + if ((ret = av_file_map(s->lut_filename, &lutbuf, &lutbuf_size, 0, s)) < 0) { + av_log(s, AV_LOG_ERROR, + "The LUT file '%s' could not be read: %s\n", + s->lut_filename, av_err2str(ret)); + return ret; + } + + s->lut = pl_lut_parse_cube(s->log, lutbuf, lutbuf_size); + av_file_unmap(lutbuf, lutbuf_size); + if (!s->lut) + return AVERROR(EINVAL); + return 0; +} + static int update_settings(AVFilterContext *ctx) { int err = 0; @@ -733,6 +756,9 @@ static int init_vulkan(AVFilterContext *avctx, const AVVulkanDeviceContext *hwct RET(parse_shader(avctx, buf, buf_len)); } + if (s->lut_filename) + RET(parse_custom_lut(s)); + /* Initialize inputs */ s->inputs = av_calloc(s->nb_inputs, sizeof(*s->inputs)); if (!s->inputs) @@ -762,6 +788,7 @@ static void libplacebo_uninit(AVFilterContext *avctx) av_freep(&s->inputs); } + pl_lut_free(&s->lut); #if PL_API_VER >= 351 pl_cache_destroy(&s->cache); #endif @@ -1033,6 +1060,8 @@ static bool map_frame(pl_gpu gpu, pl_tex *tex, .tex = tex, .map_dovi = s->apply_dovi, )); + out->lut = s->lut; + out->lut_type = s->lut_type; if (!s->apply_filmgrain) out->film_grain.type = PL_FILM_GRAIN_NONE; @@ -1457,6 +1486,13 @@ static const AVOption libplacebo_options[] = { { "pad_crop_ratio", "ratio between padding and cropping when normalizing SAR (0=pad, 1=crop)", OFFSET(pad_crop_ratio), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, 1.0, DYNAMIC }, { "fillcolor", "Background fill color", OFFSET(fillcolor), AV_OPT_TYPE_COLOR, {.str = "black@0"}, .flags = DYNAMIC }, { "corner_rounding", "Corner rounding radius", OFFSET(corner_rounding), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, .flags = DYNAMIC }, + { "lut", "Path to custom LUT file to apply", OFFSET(lut_filename), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = STATIC }, + { "lut_type", "Application mode of the custom LUT", OFFSET(lut_type), AV_OPT_TYPE_INT, { .i64 = PL_LUT_UNKNOWN }, 0, PL_LUT_CONVERSION, STATIC, .unit = "lut_type" }, + { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = PL_LUT_UNKNOWN }, 0, 0, STATIC, .unit = "lut_type" }, + { "native", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = PL_LUT_NATIVE }, 0, 0, STATIC, .unit = "lut_type" }, + { "normalized", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = PL_LUT_NORMALIZED }, 0, 0, STATIC, .unit = "lut_type" }, + { "conversion", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = PL_LUT_CONVERSION }, 0, 0, STATIC, .unit = "lut_type" }, + { "extra_opts", "Pass extra libplacebo-specific options using a :-separated list of key=value pairs", OFFSET(extra_opts), AV_OPT_TYPE_DICT, .flags = DYNAMIC }, #if PL_API_VER >= 351 { "shader_cache", "Set shader cache path", OFFSET(shader_cache), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = STATIC }, diff --git a/libavformat/Makefile b/libavformat/Makefile index c39c015e7d..2dc69315ab 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -717,6 +717,7 @@ TLS-OBJS-$(CONFIG_OPENSSL) += tls_openssl.o TLS-OBJS-$(CONFIG_SECURETRANSPORT) += tls_securetransport.o TLS-OBJS-$(CONFIG_SCHANNEL) += tls_schannel.o OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o $(TLS-OBJS-yes) +OBJS-$(CONFIG_DTLS_PROTOCOL) += tls.o $(TLS-OBJS-yes) OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o ip.o OBJS-$(CONFIG_UDPLITE_PROTOCOL) += udp.o ip.o OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index bfda7d0bd8..69c93e6b3b 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -182,7 +182,7 @@ static int read_header(AVFormatContext *s) while(!avio_feof(s->pb)) { get_bprint_line(s->pb, &bp); - if (!memcmp(bp.str, ID_STREAM, strlen(ID_STREAM))) { + if (bp.len == strlen(ID_STREAM) && !memcmp(bp.str, ID_STREAM, strlen(ID_STREAM))) { AVStream *st = avformat_new_stream(s, NULL); if (!st) @@ -192,7 +192,7 @@ static int read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_FFMETADATA; m = &st->metadata; - } else if (!memcmp(bp.str, ID_CHAPTER, strlen(ID_CHAPTER))) { + } else if (bp.len == strlen(ID_CHAPTER) && !memcmp(bp.str, ID_CHAPTER, strlen(ID_CHAPTER))) { AVChapter *ch = read_chapter(s); if (!ch) diff --git a/libavformat/iff.c b/libavformat/iff.c index 4ff10beb38..44ba5a9023 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -969,9 +969,6 @@ static int iff_read_packet(AVFormatContext *s, uint32_t chunk_id, chunk_id2; while (!avio_feof(pb)) { - if (avio_feof(pb)) - return AVERROR_EOF; - orig_pos = avio_tell(pb); chunk_id = avio_rl32(pb); data_size = avio_rb32(pb); @@ -988,6 +985,9 @@ static int iff_read_packet(AVFormatContext *s, avio_skip(pb, data_size); } } + if (pb->eof_reached) + return AVERROR_EOF; + ret = av_get_packet(pb, pkt, data_size); pkt->stream_index = iff->video_stream_index; pkt->pos = orig_pos; diff --git a/libavformat/mov.c b/libavformat/mov.c index be52f53c0c..7015329520 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -10684,9 +10684,9 @@ static int mov_read_header(AVFormatContext *s) uint32_t dvdsub_clut[FF_DVDCLUT_CLUT_LEN] = {0}; fix_timescale(mov, sc); - /* Set the primary extradata based on the first Sample. */ + /* Set the primary extradata based on the first Sample if it doesn't reference the first stsd entry. */ if (sc->stsc_count && sc->extradata_size && !sc->iamf && - sc->stsc_data[0].id > 0 && sc->stsc_data[0].id <= sc->stsd_count) { + sc->stsc_data[0].id > 1 && sc->stsc_data[0].id <= sc->stsd_count) { sc->last_stsd_index = sc->stsc_data[0].id - 1; av_freep(&st->codecpar->extradata); st->codecpar->extradata_size = sc->extradata_size[sc->last_stsd_index]; diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 96f5075d64..40e27d56ad 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -172,6 +172,9 @@ typedef struct VulkanFramesPriv { /* Modifier info list to free at uninit */ VkImageDrmFormatModifierListCreateInfoEXT *modifier_info; + + /* Properties for DRM modifier for each plane in the image */ + VkDrmFormatModifierPropertiesEXT drm_format_modifier_properties[5]; } VulkanFramesPriv; typedef struct AVVkFrameInternal { @@ -280,6 +283,7 @@ static void device_features_copy_needed(VulkanDeviceFeatures *dst, VulkanDeviceF COPY_VAL(vulkan_1_2.shaderSharedInt64Atomics); COPY_VAL(vulkan_1_2.vulkanMemoryModel); COPY_VAL(vulkan_1_2.vulkanMemoryModelDeviceScope); + COPY_VAL(vulkan_1_2.uniformBufferStandardLayout); COPY_VAL(vulkan_1_3.dynamicRendering); COPY_VAL(vulkan_1_3.maintenance4); @@ -613,7 +617,6 @@ static const VulkanOptExtension optional_device_exts[] = { { VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME, FF_VK_EXT_COOP_MATRIX }, { VK_EXT_SHADER_OBJECT_EXTENSION_NAME, FF_VK_EXT_SHADER_OBJECT }, { VK_KHR_SHADER_SUBGROUP_ROTATE_EXTENSION_NAME, FF_VK_EXT_SUBGROUP_ROTATE }, - { VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME, FF_VK_EXT_HOST_IMAGE_COPY }, #ifdef VK_KHR_shader_expect_assume { VK_KHR_SHADER_EXPECT_ASSUME_EXTENSION_NAME, FF_VK_EXT_EXPECT_ASSUME }, #endif @@ -2803,7 +2806,9 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) VulkanFramesPriv *fp = hwfc->hwctx; AVVulkanFramesContext *hwctx = &fp->p; VulkanDevicePriv *p = hwfc->device_ctx->hwctx; + AVVulkanDeviceContext *dev_hwctx = &p->p; VkImageUsageFlagBits supported_usage; + FFVulkanFunctions *vk = &p->vkctx.vkfn; const struct FFVkFormatEntry *fmt; int disable_multiplane = p->disable_multiplane || (hwctx->flags & AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE); @@ -2949,6 +2954,63 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc) if (err) return err; + /* Collect `VkDrmFormatModifierPropertiesEXT` for each plane. Required for DRM export. */ + if (p->vkctx.extensions & FF_VK_EXT_DRM_MODIFIER_FLAGS && hwctx->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { + VkImageDrmFormatModifierPropertiesEXT drm_mod = { + .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT, + }; + err = vk->GetImageDrmFormatModifierPropertiesEXT(dev_hwctx->act_dev, f->img[0], + &drm_mod); + if (err != VK_SUCCESS) { + av_log(hwfc, AV_LOG_ERROR, "Failed to get image DRM format modifier properties"); + vulkan_frame_free(hwfc, f); + return AVERROR_EXTERNAL; + } + for (int i = 0; i < fmt->vk_planes; ++i) { + VkDrmFormatModifierPropertiesListEXT modp; + VkFormatProperties2 fmtp; + VkDrmFormatModifierPropertiesEXT *mod_props = NULL; + + modp = (VkDrmFormatModifierPropertiesListEXT) { + .sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT, + }; + fmtp = (VkFormatProperties2) { + .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2, + .pNext = &modp, + }; + + /* query drmFormatModifierCount by keeping pDrmFormatModifierProperties NULL */ + vk->GetPhysicalDeviceFormatProperties2(dev_hwctx->phys_dev, fmt->fallback[i], &fmtp); + + modp.pDrmFormatModifierProperties = + av_calloc(modp.drmFormatModifierCount, sizeof(*modp.pDrmFormatModifierProperties)); + if (!modp.pDrmFormatModifierProperties) { + vulkan_frame_free(hwfc, f); + return AVERROR(ENOMEM); + } + vk->GetPhysicalDeviceFormatProperties2(dev_hwctx->phys_dev, fmt->fallback[i], &fmtp); + + for (uint32_t i = 0; i < modp.drmFormatModifierCount; ++i) { + VkDrmFormatModifierPropertiesEXT *m = &modp.pDrmFormatModifierProperties[i]; + if (m->drmFormatModifier == drm_mod.drmFormatModifier) { + mod_props = m; + break; + } + } + + if (mod_props == NULL) { + av_log(hwfc, AV_LOG_ERROR, "No DRM format modifier properties found for modifier 0x%016lx\n", + drm_mod.drmFormatModifier); + av_free(modp.pDrmFormatModifierProperties); + vulkan_frame_free(hwfc, f); + return AVERROR_EXTERNAL; + } + + fp->drm_format_modifier_properties[i] = *mod_props; + av_free(modp.pDrmFormatModifierProperties); + } + } + vulkan_frame_free(hwfc, f); /* If user did not specify a pool, hwfc->pool will be set to the internal one @@ -3879,6 +3941,17 @@ static inline uint32_t vulkan_fmt_to_drm(VkFormat vkfmt) return DRM_FORMAT_INVALID; } +#define MAX_MEMORY_PLANES 4 +static VkImageAspectFlags plane_index_to_aspect(int plane) { + if (plane == 0) return VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT; + if (plane == 1) return VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT; + if (plane == 2) return VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT; + if (plane == 3) return VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT; + + av_assert2 (false && "Invalid plane index"); + return VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT; +} + static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) { @@ -3947,14 +4020,29 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, drm_desc->nb_layers = planes; for (int i = 0; i < drm_desc->nb_layers; i++) { - VkSubresourceLayout layout; - VkImageSubresource sub = { - .aspectMask = VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT, - }; VkFormat plane_vkfmt = av_vkfmt_from_pixfmt(hwfc->sw_format)[i]; - drm_desc->layers[i].format = vulkan_fmt_to_drm(plane_vkfmt); - drm_desc->layers[i].nb_planes = 1; + drm_desc->layers[i].format = vulkan_fmt_to_drm(plane_vkfmt); + drm_desc->layers[i].nb_planes = fp->drm_format_modifier_properties[i].drmFormatModifierPlaneCount; + + if (drm_desc->layers[i].nb_planes > MAX_MEMORY_PLANES) { + av_log(hwfc, AV_LOG_ERROR, "Too many memory planes for DRM format!\n"); + err = AVERROR_EXTERNAL; + goto end; + } + + for (int j = 0; j < drm_desc->layers[i].nb_planes; j++) { + VkSubresourceLayout layout; + VkImageSubresource sub = { + .aspectMask = plane_index_to_aspect(j), + }; + + drm_desc->layers[i].planes[j].object_index = FFMIN(i, drm_desc->nb_objects - 1); + + vk->GetImageSubresourceLayout(hwctx->act_dev, f->img[i], &sub, &layout); + drm_desc->layers[i].planes[j].offset = layout.offset; + drm_desc->layers[i].planes[j].pitch = layout.rowPitch; + } if (drm_desc->layers[i].format == DRM_FORMAT_INVALID) { av_log(hwfc, AV_LOG_ERROR, "Cannot map to DRM layer, unsupported!\n"); @@ -3962,14 +4050,10 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, goto end; } - drm_desc->layers[i].planes[0].object_index = FFMIN(i, drm_desc->nb_objects - 1); if (f->tiling == VK_IMAGE_TILING_OPTIMAL) continue; - vk->GetImageSubresourceLayout(hwctx->act_dev, f->img[i], &sub, &layout); - drm_desc->layers[i].planes[0].offset = layout.offset; - drm_desc->layers[i].planes[0].pitch = layout.rowPitch; } dst->width = src->width; diff --git a/tests/fate/hlsenc.mak b/tests/fate/hlsenc.mak index b7455b7a33..2c4097d0d9 100644 --- a/tests/fate/hlsenc.mak +++ b/tests/fate/hlsenc.mak @@ -111,6 +111,21 @@ FATE_HLSENC_PROBE-$(call DEMMUX, HLS AC3, HLS MP4, AC3_DECODER) += fate-hls-fmp4 fate-hls-fmp4_ac3: tests/data/hls_fmp4_ac3.m3u8 fate-hls-fmp4_ac3: CMD = probeaudiostream $(TARGET_PATH)/tests/data/now_ac3.mp4 + +tests/data/hls_cmfa.m3u8: TAG = GEN +tests/data/hls_cmfa.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin \ + -i $(TARGET_SAMPLES)/aac/al06_44.mp4 -c copy -map 0 \ + -hls_segment_type fmp4 -hls_fmp4_init_filename now.cmfa -hls_list_size 0 \ + -hls_time 1 -hls_segment_filename "$(TARGET_PATH)/tests/data/hls_fmp4_%d.cmfa" \ + -t 1 $(TARGET_PATH)/tests/data/hls_cmfa.m3u8 2>/dev/null + +FATE_HLSENC-yes := $(if $(call FRAMECRC), $(FATE_HLSENC-yes)) + +FATE_HLSENC_PROBE-$(call FRAMECRC, HLS) += fate-hls-cmfa +fate-hls-cmfa: tests/data/hls_cmfa.m3u8 +fate-hls-cmfa: CMD = framecrc -i $(TARGET_PATH)/tests/data/hls_cmfa.m3u8 -c copy + FATE_SAMPLES_FFMPEG += $(FATE_HLSENC-yes) FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_HLSENC_PROBE-yes) fate-hlsenc: $(FATE_HLSENC-yes) $(FATE_HLSENC_PROBE-yes) diff --git a/tests/fate/vvc.mak b/tests/fate/vvc.mak index c882010713..6d7873f6e4 100644 --- a/tests/fate/vvc.mak +++ b/tests/fate/vvc.mak @@ -26,20 +26,26 @@ VVC_SAMPLES_10BIT = \ WP_A_3 \ WPP_A_3 \ WRAP_A_4 \ + FIELD_A_4 \ + +VVC_SAMPLES_422_10BIT = \ + 10b422_L_5 \ VVC_SAMPLES_444_10BIT = \ CROP_B_4 \ + ACT_A_3 \ # not tested: # BOUNDARY_A_3 (too big) # OPI_B_3 (Inter layer ref support needed) # VPS_A_3 (Inter layer ref support needed) -FATE_VVC_VARS := 8BIT 10BIT 444_10BIT +FATE_VVC_VARS := 8BIT 10BIT 422_10BIT 444_10BIT $(foreach VAR,$(FATE_VVC_VARS), $(eval VVC_TESTS_$(VAR) := $(addprefix fate-vvc-conformance-, $(VVC_SAMPLES_$(VAR))))) $(VVC_TESTS_8BIT): SCALE_OPTS := -pix_fmt yuv420p $(VVC_TESTS_10BIT): SCALE_OPTS := -pix_fmt yuv420p10le -vf scale +$(VVC_TESTS_422_10BIT): SCALE_OPTS := -pix_fmt yuv422p10le -vf scale $(VVC_TESTS_444_10BIT): SCALE_OPTS := -pix_fmt yuv444p10le -vf scale fate-vvc-conformance-%: CMD = framecrc -c:v vvc -i $(TARGET_SAMPLES)/vvc-conformance/$(subst fate-vvc-conformance-,,$(@)).bit $(SCALE_OPTS) fate-vvc-output-ref: CMD = framecrc -c:v vvc -i $(TARGET_SAMPLES)/vvc/Hierarchical.bit $(SCALE_OPTS) @@ -49,6 +55,7 @@ fate-vvc-wpp-single-slice-pic: CMD = framecrc -c:v vvc -i $(TARGET_SAMPLES)/vvc/ FATE_VVC-$(call FRAMECRC, VVC, VVC, VVC_PARSER) += $(VVC_TESTS_8BIT) fate-vvc-output-ref FATE_VVC-$(call FRAMECRC, VVC, VVC, VVC_PARSER SCALE_FILTER) += \ $(VVC_TESTS_10BIT) \ + $(VVC_TESTS_422_10BIT) \ $(VVC_TESTS_444_10BIT) \ fate-vvc-frames-with-ltr \ fate-vvc-wpp-single-slice-pic \ diff --git a/tests/ref/fate/hls-cmfa b/tests/ref/fate/hls-cmfa new file mode 100644 index 0000000000..85d803ece9 --- /dev/null +++ b/tests/ref/fate/hls-cmfa @@ -0,0 +1,50 @@ +#extradata 0: 9, 0x0196004f +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 44100 +#channel_layout_name 0: 3.0 +0, 0, 0, 1024, 561, 0x38071617 +0, 1024, 1024, 1024, 521, 0x74daf7e7 +0, 2048, 2048, 1024, 600, 0xe5141eb0 +0, 3072, 3072, 1024, 604, 0xbd3828c4 +0, 4096, 4096, 1024, 601, 0x15e52194 +0, 5120, 5120, 1024, 599, 0x768d1ea3 +0, 6144, 6144, 1024, 615, 0x9bfc30cc +0, 7168, 7168, 1024, 604, 0x645e2b63 +0, 8192, 8192, 1024, 604, 0x98f72233 +0, 9216, 9216, 1024, 583, 0xcd812a5c +0, 10240, 10240, 1024, 613, 0x41f92b61 +0, 11264, 11264, 1024, 672, 0x70bc47e2 +0, 12288, 12288, 1024, 693, 0x79a859da +0, 13312, 13312, 1024, 720, 0x45ac6f85 +0, 14336, 14336, 1024, 610, 0x1c422466 +0, 15360, 15360, 1024, 591, 0x69422883 +0, 16384, 16384, 1024, 604, 0x79091a89 +0, 17408, 17408, 1024, 612, 0xf12b2df0 +0, 18432, 18432, 1024, 588, 0xe2f72a1f +0, 19456, 19456, 1024, 599, 0x79132242 +0, 20480, 20480, 1024, 618, 0xd71a2cc1 +0, 21504, 21504, 1024, 597, 0xefa42726 +0, 22528, 22528, 1024, 613, 0x2c922b2e +0, 23552, 23552, 1024, 606, 0xc88b25ac +0, 24576, 24576, 1024, 684, 0x8786516f +0, 25600, 25600, 1024, 604, 0x7e6a26ff +0, 26624, 26624, 1024, 612, 0x19a72d6c +0, 27648, 27648, 1024, 611, 0x4eaf318c +0, 28672, 28672, 1024, 563, 0x01322454 +0, 29696, 29696, 1024, 581, 0x46181649 +0, 30720, 30720, 1024, 566, 0x29642165 +0, 31744, 31744, 1024, 586, 0x7b1c23ab +0, 32768, 32768, 1024, 533, 0xd84e166b +0, 33792, 33792, 1024, 597, 0xa0801fd0 +0, 34816, 34816, 1024, 527, 0x77fd11b4 +0, 35840, 35840, 1024, 543, 0xc8520797 +0, 36864, 36864, 1024, 599, 0xde86134b +0, 37888, 37888, 1024, 540, 0xe5321acd +0, 38912, 38912, 1024, 531, 0x73690921 +0, 39936, 39936, 1024, 590, 0x5af82fbf +0, 40960, 40960, 1024, 543, 0xec29061b +0, 41984, 41984, 1024, 537, 0x23d618eb +0, 43008, 43008, 1024, 579, 0xe55a1967 +0, 44032, 44032, 1024, 535, 0x588a180b diff --git a/tests/ref/fate/vvc-conformance-10b422_L_5 b/tests/ref/fate/vvc-conformance-10b422_L_5 new file mode 100644 index 0000000000..373c550b1f --- /dev/null +++ b/tests/ref/fate/vvc-conformance-10b422_L_5 @@ -0,0 +1,22 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 1920x1080 +#sar 0: 0/1 +0, 0, 0, 1, 8294400, 0x4c24b4d8 +0, 1, 1, 1, 8294400, 0xfcaa4734 +0, 2, 2, 1, 8294400, 0xc9a32414 +0, 3, 3, 1, 8294400, 0x7a42ba51 +0, 4, 4, 1, 8294400, 0xcf8b2dd5 +0, 5, 5, 1, 8294400, 0x2f0701ec +0, 6, 6, 1, 8294400, 0x863f665f +0, 7, 7, 1, 8294400, 0xef2e70bd +0, 8, 8, 1, 8294400, 0xeb221c2b +0, 9, 9, 1, 8294400, 0x3c074b8f +0, 10, 10, 1, 8294400, 0xb246c65a +0, 11, 11, 1, 8294400, 0x94ede8e8 +0, 12, 12, 1, 8294400, 0x2143a40b +0, 13, 13, 1, 8294400, 0xc04eb9e3 +0, 14, 14, 1, 8294400, 0x00f3a419 +0, 15, 15, 1, 8294400, 0x6ae90b65 +0, 16, 16, 1, 8294400, 0x36375084 diff --git a/tests/ref/fate/vvc-conformance-ACT_A_3 b/tests/ref/fate/vvc-conformance-ACT_A_3 new file mode 100644 index 0000000000..e145aeb67f --- /dev/null +++ b/tests/ref/fate/vvc-conformance-ACT_A_3 @@ -0,0 +1,70 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 1280x720 +#sar 0: 0/1 +0, 0, 0, 1, 5529600, 0xdb9b6d0d +0, 1, 1, 1, 5529600, 0x960e474e +0, 2, 2, 1, 5529600, 0xf1cb1670 +0, 3, 3, 1, 5529600, 0xc4fa3d5e +0, 4, 4, 1, 5529600, 0x2912fa02 +0, 5, 5, 1, 5529600, 0xb9acfc3e +0, 6, 6, 1, 5529600, 0xea39f561 +0, 7, 7, 1, 5529600, 0xeff704c9 +0, 8, 8, 1, 5529600, 0xb972e1d6 +0, 9, 9, 1, 5529600, 0x0cf45b11 +0, 10, 10, 1, 5529600, 0xee7b876f +0, 11, 11, 1, 5529600, 0xbe7d6952 +0, 12, 12, 1, 5529600, 0x809d6cd4 +0, 13, 13, 1, 5529600, 0x5b4502e1 +0, 14, 14, 1, 5529600, 0xf23878bd +0, 15, 15, 1, 5529600, 0x25eb4d6d +0, 16, 16, 1, 5529600, 0x7fcfaeed +0, 17, 17, 1, 5529600, 0x4e2c9003 +0, 18, 18, 1, 5529600, 0x69e6385b +0, 19, 19, 1, 5529600, 0xb8681116 +0, 20, 20, 1, 5529600, 0x90b890ca +0, 21, 21, 1, 5529600, 0x94ec15bb +0, 22, 22, 1, 5529600, 0x0dcaf2e5 +0, 23, 23, 1, 5529600, 0x52897d14 +0, 24, 24, 1, 5529600, 0x578f7356 +0, 25, 25, 1, 5529600, 0x90113d89 +0, 26, 26, 1, 5529600, 0x2b09a1de +0, 27, 27, 1, 5529600, 0xc3036365 +0, 28, 28, 1, 5529600, 0xb13cb584 +0, 29, 29, 1, 5529600, 0x1ea6ae1a +0, 30, 30, 1, 5529600, 0xfd408ed8 +0, 31, 31, 1, 5529600, 0x36d1bdae +0, 32, 32, 1, 5529600, 0xe7dc95a4 +0, 33, 33, 1, 5529600, 0x8f9ac8b9 +0, 34, 34, 1, 5529600, 0x6af3a821 +0, 35, 35, 1, 5529600, 0xc72ac000 +0, 36, 36, 1, 5529600, 0x0fab2899 +0, 37, 37, 1, 5529600, 0x3ea41597 +0, 38, 38, 1, 5529600, 0x5535be74 +0, 39, 39, 1, 5529600, 0x02ba563e +0, 40, 40, 1, 5529600, 0xdfbfa9a5 +0, 41, 41, 1, 5529600, 0x9bed96fa +0, 42, 42, 1, 5529600, 0x3a9df1e9 +0, 43, 43, 1, 5529600, 0x3c84b16d +0, 44, 44, 1, 5529600, 0xb10a26c8 +0, 45, 45, 1, 5529600, 0x5a30baee +0, 46, 46, 1, 5529600, 0xaa55eba4 +0, 47, 47, 1, 5529600, 0x1873de87 +0, 48, 48, 1, 5529600, 0x3ad98e8e +0, 49, 49, 1, 5529600, 0xf1a58485 +0, 50, 50, 1, 5529600, 0x43e678df +0, 51, 51, 1, 5529600, 0xf6f10a9e +0, 52, 52, 1, 5529600, 0xe89bd6c0 +0, 53, 53, 1, 5529600, 0x0b793b1b +0, 54, 54, 1, 5529600, 0xef4898d3 +0, 55, 55, 1, 5529600, 0x5b0f10d0 +0, 56, 56, 1, 5529600, 0xec2cc417 +0, 57, 57, 1, 5529600, 0x887759fe +0, 58, 58, 1, 5529600, 0x47a45789 +0, 59, 59, 1, 5529600, 0xa0f6933b +0, 60, 60, 1, 5529600, 0x77290b7a +0, 61, 61, 1, 5529600, 0xbfa5a26d +0, 62, 62, 1, 5529600, 0xee99b0d5 +0, 63, 63, 1, 5529600, 0x0fdd7e97 +0, 64, 64, 1, 5529600, 0x3173af66 diff --git a/tests/ref/fate/vvc-conformance-FIELD_A_4 b/tests/ref/fate/vvc-conformance-FIELD_A_4 new file mode 100644 index 0000000000..bd36624eb4 --- /dev/null +++ b/tests/ref/fate/vvc-conformance-FIELD_A_4 @@ -0,0 +1,25 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 720x240 +#sar 0: 1/1 +0, 0, 0, 1, 518400, 0xc9a6c44a +0, 1, 1, 1, 518400, 0x69aebed0 +0, 2, 2, 1, 518400, 0x579c56eb +0, 3, 3, 1, 518400, 0xa362c795 +0, 4, 4, 1, 518400, 0xaa91f040 +0, 5, 5, 1, 518400, 0x23fbd4bf +0, 6, 6, 1, 518400, 0x1964b60f +0, 7, 7, 1, 518400, 0xfe1c25d5 +0, 8, 8, 1, 518400, 0x959474f6 +0, 9, 9, 1, 518400, 0xa39557ac +0, 10, 10, 1, 518400, 0x04ad1eaa +0, 11, 11, 1, 518400, 0x8b290745 +0, 12, 12, 1, 518400, 0x2de33aab +0, 13, 13, 1, 518400, 0xaada1b0a +0, 14, 14, 1, 518400, 0xf7d23ea4 +0, 15, 15, 1, 518400, 0xdbd0d590 +0, 16, 16, 1, 518400, 0x457c8b65 +0, 17, 17, 1, 518400, 0x1963514d +0, 18, 18, 1, 518400, 0x2774fa12 +0, 19, 19, 1, 518400, 0xd56b3113 diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index dcfc64b18a..e2fc2bff44 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -622,7 +622,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { break; } while (got_frame == 1 && it++ < maxiteration); - fprintf(stderr, "pixels decoded: %"PRId64", samples decoded: %"PRId64", iterations: %d\n", ec_pixels, nb_samples, it); + // fprintf(stderr, "pixels decoded: %"PRId64", samples decoded: %"PRId64", iterations: %d\n", ec_pixels, nb_samples, it); av_frame_free(&frame); avcodec_free_context(&ctx); diff --git a/tools/target_swr_fuzzer.c b/tools/target_swr_fuzzer.c index 59fa24af64..8100e99524 100644 --- a/tools/target_swr_fuzzer.c +++ b/tools/target_swr_fuzzer.c @@ -110,9 +110,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { av_channel_layout_describe(& in_ch_layout, in_layout_string, sizeof( in_layout_string)); av_channel_layout_describe(&out_ch_layout, out_layout_string, sizeof(out_layout_string)); - fprintf(stderr, "%s %d %s -> %s %d %s\n", - av_get_sample_fmt_name( in_sample_fmt), in_sample_rate, in_layout_string, - av_get_sample_fmt_name(out_sample_fmt), out_sample_rate, out_layout_string); + // fprintf(stderr, "%s %d %s -> %s %d %s\n", + // av_get_sample_fmt_name( in_sample_fmt), in_sample_rate, in_layout_string, + // av_get_sample_fmt_name(out_sample_fmt), out_sample_rate, out_layout_string); if (swr_alloc_set_opts2(&swr, &out_ch_layout, out_sample_fmt, out_sample_rate, &in_ch_layout, in_sample_fmt, in_sample_rate, diff --git a/tools/target_sws_fuzzer.c b/tools/target_sws_fuzzer.c index fd8314cae1..0e14adb1be 100644 --- a/tools/target_sws_fuzzer.c +++ b/tools/target_sws_fuzzer.c @@ -151,7 +151,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { desc_src = av_pix_fmt_desc_get(srcFormat); desc_dst = av_pix_fmt_desc_get(dstFormat); - fprintf(stderr, "%d x %d %s -> %d x %d %s\n", srcW, srcH, desc_src->name, dstW, dstH, desc_dst->name); + // fprintf(stderr, "%d x %d %s -> %d x %d %s\n", srcW, srcH, desc_src->name, dstW, dstH, desc_dst->name); ret = alloc_plane(src, srcStride, srcW, srcH, srcFormat, &srcHShift, &srcVShift); if (ret < 0)