ffmpeg-devel
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
November 2025
- 64 participants
- 306 discussions
PR #21065 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21065
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21065.patch
From 8782e4f08669ab2038158cf9b7e03fb782ba263b Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/4.4
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..9efee16c65
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/4.4
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..b0812dd647
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/4.4
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21064 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21064
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21064.patch
From 43c5a46fec9a3935fc42a2cc1259b9f3b0a40be4 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/5.0
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..554527bcab
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/5.0
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..7a3821d6d2
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/5.0
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21063 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21063
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21063.patch
From 37f559d7844914b30d683f4016c7a001dd2ef305 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/5.1
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..453d2c300e
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/5.1
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..ad0d902a9b
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/5.1
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21062 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21062
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21062.patch
From 02f3d02734f4f1aa942eac47c4015a303edad8bf Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/6.0
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..ba51b93080
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/6.0
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..4b3be3ea35
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/6.0
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21061 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21061
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21061.patch
From 28fb3be2b62d60337b6da33b085762c4570c9121 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/6.1
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..26a685430d
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/6.1
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..316fed60db
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/6.1
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21060 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21060
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21060.patch
From b5f3c9ef34e3a29712e5605fa46548cf07ac3c6c Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/7.0
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..09cb749558
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/7.0
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..c952f77694
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/7.0
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21059 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21059
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21059.patch
From 9205963cb3ddc6c020c0ca34c2d5b8dadc7f9a15 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo(a)rothenpieler.org>
Date: Sun, 30 Nov 2025 16:25:19 +0100
Subject: [PATCH] forgejo: backport CI to release/7.1
---
.forgejo/pre-commit/config.yaml | 36 ++++
.forgejo/pre-commit/ignored-words.txt | 119 +++++++++++++
.forgejo/workflows/lint.yml | 26 +++
.forgejo/workflows/test.yml | 76 ++++++++
tools/check_arm_indent.sh | 55 ++++++
tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++
6 files changed, 555 insertions(+)
create mode 100644 .forgejo/pre-commit/config.yaml
create mode 100644 .forgejo/pre-commit/ignored-words.txt
create mode 100644 .forgejo/workflows/lint.yml
create mode 100644 .forgejo/workflows/test.yml
create mode 100755 tools/check_arm_indent.sh
create mode 100755 tools/indent_arm_assembly.pl
diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml
new file mode 100644
index 0000000000..f1ab7765ef
--- /dev/null
+++ b/.forgejo/pre-commit/config.yaml
@@ -0,0 +1,36 @@
+exclude: ^tests/ref/
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-executables-have-shebangs
+ - id: check-illegal-windows-names
+ - id: check-shebang-scripts-are-executable
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: file-contents-sorter
+ files:
+ .forgejo/pre-commit/ignored-words.txt
+ args:
+ - --ignore-case
+ - id: fix-byte-order-marker
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+- repo: local
+ hooks:
+ - id: aarch64-asm-indent
+ name: fix aarch64 assembly indentation
+ files: ^.*/aarch64/.*\.S$
+ language: script
+ entry: ./tools/check_arm_indent.sh --apply
+ pass_filenames: false
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.4.1
+ hooks:
+ - id: codespell
+ args:
+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
+ exclude: ^tools/(patcheck|clean-diff)$
diff --git a/.forgejo/pre-commit/ignored-words.txt b/.forgejo/pre-commit/ignored-words.txt
new file mode 100644
index 0000000000..870fd96be3
--- /dev/null
+++ b/.forgejo/pre-commit/ignored-words.txt
@@ -0,0 +1,119 @@
+abl
+ACN
+acount
+addin
+alis
+alls
+ALOG
+ALS
+als
+ANC
+anc
+ANS
+ans
+anull
+basf
+bloc
+brane
+BREIF
+BU
+bu
+bufer
+CAF
+caf
+clen
+clens
+Collet
+compre
+dum
+endin
+erro
+FIEL
+fiel
+filp
+fils
+FILTERD
+filterd
+fle
+fo
+FPR
+fro
+Hald
+indx
+ine
+inh
+inout
+inouts
+inport
+ist
+LAF
+laf
+lastr
+LinS
+mapp
+mis
+mot
+nd
+nIn
+offsetp
+orderd
+ot
+outout
+padd
+PAETH
+paeth
+PARM
+parm
+parms
+pEvents
+PixelX
+Psot
+quater
+readd
+recuse
+redY
+Reencode
+reencode
+remaind
+renderD
+rin
+SAV
+SEH
+SER
+ser
+setts
+shft
+SIZ
+siz
+skipd
+sme
+som
+sover
+STAP
+startd
+statics
+struc
+suble
+TE
+tE
+te
+tha
+tne
+tolen
+tpye
+tre
+TRUN
+trun
+truns
+Tung
+TYE
+ue
+UES
+ues
+vai
+vas
+vie
+VILL
+vor
+wel
+wih
diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml
new file mode 100644
index 0000000000..4cdbc08057
--- /dev/null
+++ b/.forgejo/workflows/lint.yml
@@ -0,0 +1,26 @@
+on:
+ push:
+ branches:
+ - release/7.1
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: utilities
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install pre-commit CI
+ id: install
+ run: |
+ python3 -m venv ~/pre-commit
+ ~/pre-commit/bin/pip install --upgrade pip setuptools
+ ~/pre-commit/bin/pip install pre-commit
+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
+ - name: Cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit-${{ steps.install.outputs.envhash }}
+ - name: Run pre-commit CI
+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml
new file mode 100644
index 0000000000..2b41d486ba
--- /dev/null
+++ b/.forgejo/workflows/test.yml
@@ -0,0 +1,76 @@
+on:
+ push:
+ branches:
+ - release/7.1
+ pull_request:
+
+jobs:
+ run_fate:
+ strategy:
+ fail-fast: false
+ matrix:
+ runner: [linux-aarch64]
+ shared: ['static']
+ bits: ['64']
+ include:
+ - runner: linux-amd64
+ shared: 'static'
+ bits: '32'
+ - runner: linux-amd64
+ shared: 'shared'
+ bits: '64'
+ runs-on: ${{ matrix.runner }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
+ $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
+ $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
+ || CFGRES=$? && CFGRES=$?
+ cat ffbuild/config.log
+ exit $CFGRES
+ - name: Build
+ run: make -j$(nproc)
+ - name: Restore Cached Fate-Suite
+ id: cache
+ uses: actions/cache/restore@v4
+ with:
+ path: fate-suite
+ key: fate-suite
+ restore-keys: |
+ fate-suite-
+ - name: Sync Fate-Suite
+ id: fate
+ run: |
+ make fate-rsync SAMPLES=$PWD/fate-suite
+ echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | 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 }}
+ with:
+ path: fate-suite
+ key: fate-suite-${{ steps.fate.outputs.hash }}
+ - name: Run Fate
+ run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc)
+ compile_only:
+ strategy:
+ fail-fast: false
+ matrix:
+ image: ["ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest"]
+ runs-on: linux-amd64
+ container: ${{ matrix.image }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Configure
+ run: |
+ ./configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
+ --cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
+ --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
+ --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS"
+ - name: Build
+ run: make -j$(nproc)
+ - name: Run Fate
+ run: make -j$(nproc) fate-build
diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh
new file mode 100755
index 0000000000..5becfe0aec
--- /dev/null
+++ b/tools/check_arm_indent.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+cd $(dirname $0)/..
+
+if [ "$1" = "--apply" ]; then
+ apply=1
+fi
+
+ret=0
+
+for i in */aarch64/*.S */aarch64/*/*.S; do
+ case $i in
+ libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S)
+ # Skip files with known (and tolerated) deviations from the tool.
+ continue
+ esac
+ ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$?
+ if ! git diff --quiet --no-index "$i" tmp.S; then
+ if [ -n "$apply" ]; then
+ mv tmp.S "$i"
+ else
+ git --no-pager diff --no-index "$i" tmp.S
+ fi
+ ret=1
+ fi
+done
+
+rm -f tmp.S
+
+exit $ret
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
new file mode 100755
index 0000000000..359c2bcf4f
--- /dev/null
+++ b/tools/indent_arm_assembly.pl
@@ -0,0 +1,243 @@
+#!/usr/bin/env perl
+#
+# Copyright (c) 2025 Martin Storsjo
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# A script for reformatting ARM/AArch64 assembly according to the following
+# style:
+# - Instructions start after 8 columns, operands start after 24 columns
+# - Vector register layouts and modifiers like "uxtw" are written in lowercase
+# - Optionally align operand columns vertically according to their
+# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b).
+#
+# The script can be executed as "indent_arm_assembly.pl file [outfile]".
+# If no outfile is specified, the given file is overwritten in place.
+#
+# Alternatively, the if no file parameters are given, the script reads input
+# code on stdin, and outputs the reformatted code on stdout.
+
+use strict;
+
+my $indent_operands = 0;
+my $instr_indent = 8;
+my $operand_indent = 24;
+my $match_indent = 0;
+my $file;
+my $outfile;
+
+while (@ARGV) {
+ my $opt = shift;
+
+ if ($opt eq "-operands") {
+ $indent_operands = 1;
+ } elsif ($opt eq "-indent") {
+ $instr_indent = shift;
+ } elsif ($opt eq "-operand-indent") {
+ $operand_indent = shift;
+ } elsif ($opt eq "-match-indent") {
+ $match_indent = 1;
+ } else {
+ if (!$file) {
+ $file = $opt;
+ } elsif (!$outfile) {
+ $outfile = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
+ }
+}
+
+if ($operand_indent < $instr_indent) {
+ die "Can't indent operands to $operand_indent while indenting " .
+ "instructions to $instr_indent\n";
+}
+
+# Return a string consisting of n spaces
+sub spaces {
+ my $n = $_[0];
+ return " " x $n;
+}
+
+sub indentcolumns {
+ my $input = $_[0];
+ my $chars = $_[1];
+ my @operands = split(/,/, $input);
+ my $num = @operands;
+ my $ret = "";
+ for (my $i = 0; $i < $num; $i++) {
+ my $cur = $operands[$i];
+ # Trim out leading/trailing whitespace
+ $cur =~ s/^\s+|\s+$//g;
+ $ret .= $cur;
+ if ($i + 1 < $num) {
+ # If we have a following operand, add a comma and whitespace to
+ # align the next operand.
+ my $next = $operands[$i+1];
+ my $len = length($cur);
+ if ($len > $chars) {
+ # If this operand was too wide for the intended column width,
+ # don't try to realign the line at all, just return the input
+ # untouched.
+ return $input;
+ }
+ my $pad = $chars - $len;
+ if ($next =~ /[su]xt[bhw]|[la]s[lr]/) {
+ # If the next item isn't a regular operand, but a modifier,
+ # don't try to align that. E.g. "add x0, x0, w1, uxtw #1".
+ $pad = 0;
+ }
+ $ret .= "," . spaces(1 + $pad);
+ }
+ }
+ return $ret;
+}
+
+# Realign the operands part of an instruction line, making each operand
+# take up the maximum width for that kind of operand.
+sub columns {
+ my $rest = $_[0];
+ if ($rest !~ /,/) {
+ # No commas, no operands to split and align
+ return $rest;
+ }
+ if ($rest =~ /{|[^\w]\[/) {
+ # Check for instructions that use register ranges, like {v0.8b,v1.8b}
+ # or mem address operands, like "ldr x0, [sp]" - we skip trying to
+ # realign these.
+ return $rest;
+ }
+ if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) {
+ # If we have references to aarch64 style vector registers, like
+ # v0.8b, then align all operands to the maximum width of such
+ # operands - v16.16b.
+ #
+ # TODO: Ideally, we'd handle mixed operand types individually.
+ return indentcolumns($rest, 7);
+ }
+ # Indent operands according to the maximum width of regular registers,
+ # like x10.
+ return indentcolumns($rest, 3);
+}
+
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ if ($outfile) {
+ open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!";
+ } else {
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ }
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
+ # Trim off trailing whitespace.
+ chomp;
+ if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
+ my $label = $1;
+ my $indent = $2;
+ my $instr = $3;
+ my $origspace = $4;
+ my $rest = $5;
+
+ my $orig_operand_indent = length($label) + length($indent) +
+ length($instr) + length($origspace);
+
+ if ($indent_operands) {
+ $rest = columns($rest);
+ }
+
+ my $size = $instr_indent;
+ if ($match_indent) {
+ # Try to check the current attempted indent size and normalize
+ # to it; match existing ident sizes of 4, 8, 10 and 12 columns.
+ my $cur_indent = length($label) + length($indent);
+ if ($cur_indent >= 3 && $cur_indent <= 5) {
+ $size = 4;
+ } elsif ($cur_indent >= 7 && $cur_indent <= 9) {
+ $size = 8;
+ } elsif ($cur_indent == 10 || $cur_indent == 12) {
+ $size = $cur_indent;
+ }
+ }
+ if (length($label) >= $size) {
+ # Not enough space for the label; just add a space between the label
+ # and the instruction.
+ $indent = " ";
+ } else {
+ $indent = spaces($size - length($label));
+ }
+
+ my $instr_end = length($label) + length($indent) + length($instr);
+ $size = $operand_indent - $instr_end;
+ if ($match_indent) {
+ # Check how the operands currently seem to be indented.
+ my $cur_indent = $orig_operand_indent;
+ if ($cur_indent >= 11 && $cur_indent <= 13) {
+ $size = 12;
+ } elsif ($cur_indent >= 14 && $cur_indent <= 17) {
+ $size = 16;
+ } elsif ($cur_indent >= 18 && $cur_indent <= 22) {
+ $size = 20;
+ } elsif ($cur_indent >= 23 && $cur_indent <= 27) {
+ $size = 24;
+ }
+ $size -= $instr_end;
+ }
+ my $operand_space = " ";
+ if ($size > 0) {
+ $operand_space = spaces($size);
+ }
+
+ # Lowercase the aarch64 vector layout description, .8B -> .8b
+ $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge;
+ # Lowercase modifiers like "uxtw" or "lsl"
+ $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge;
+
+ # Reassemble the line
+ if ($rest eq "") {
+ $_ = $label . $indent . $instr;
+ } else {
+ $_ = $label . $indent . $instr . $operand_space . $rest;
+ }
+ }
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(INPUT);
+ close(OUTPUT);
+}
+if ($tempfile) {
+ rename($tempfile, $file);
+}
--
2.49.1
1
0
PR #21058 opened by Rémi Denis-Courmont (Courmisch)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21058
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21058.patch
From b4e5ae52354bfdb5f09e61a35c41beee0eb16314 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
Date: Fri, 14 Nov 2025 11:24:45 +0100
Subject: [PATCH 1/2] avcodec/mpegvideo_unquantize: Constify MPVContext pointee
Also use MPVContext instead of MpegEncContext.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
---
libavcodec/arm/mpegvideo_arm.c | 4 ++--
libavcodec/arm/mpegvideo_armv5te.c | 8 ++++----
libavcodec/mips/h263dsp_mips.h | 6 +++---
libavcodec/mips/mpegvideo_mips.h | 20 ++++++++++----------
libavcodec/mips/mpegvideo_mmi.c | 20 ++++++++++----------
libavcodec/mips/mpegvideo_msa.c | 6 +++---
libavcodec/mpeg4videodec.h | 6 +++---
libavcodec/mpegvideo.h | 12 ++++++------
libavcodec/mpegvideo_unquantize.c | 28 ++++++++++++++--------------
libavcodec/mpegvideo_unquantize.h | 26 +++++++++++++-------------
libavcodec/neon/mpegvideo.c | 4 ++--
libavcodec/ppc/mpegvideo_altivec.c | 4 ++--
libavcodec/x86/mpegvideo.c | 24 ++++++++++++------------
13 files changed, 84 insertions(+), 84 deletions(-)
diff --git a/libavcodec/arm/mpegvideo_arm.c b/libavcodec/arm/mpegvideo_arm.c
index 5c96c9df2c..cb109cd832 100644
--- a/libavcodec/arm/mpegvideo_arm.c
+++ b/libavcodec/arm/mpegvideo_arm.c
@@ -41,9 +41,9 @@ CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end,
CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC);
#endif
-void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,
+void ff_dct_unquantize_h263_inter_neon(const MPVContext *s, int16_t *block,
int n, int qscale);
-void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, int16_t *block,
+void ff_dct_unquantize_h263_intra_neon(const MPVContext *s, int16_t *block,
int n, int qscale);
av_cold void ff_mpv_unquantize_init_arm(MPVUnquantDSPContext *s, int bitexact)
diff --git a/libavcodec/arm/mpegvideo_armv5te.c b/libavcodec/arm/mpegvideo_armv5te.c
index 2737f68643..3a6d015767 100644
--- a/libavcodec/arm/mpegvideo_armv5te.c
+++ b/libavcodec/arm/mpegvideo_armv5te.c
@@ -50,8 +50,8 @@ static inline void dct_unquantize_h263_helper_c(int16_t *block, int qmul, int qa
}
#endif
-static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_intra_armv5te(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int level, qmul, qadd;
int nCoeffs;
@@ -79,8 +79,8 @@ static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
block[0] = level;
}
-static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_inter_armv5te(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int qmul, qadd;
int nCoeffs;
diff --git a/libavcodec/mips/h263dsp_mips.h b/libavcodec/mips/h263dsp_mips.h
index d4de2233a7..5ea9fcbb88 100644
--- a/libavcodec/mips/h263dsp_mips.h
+++ b/libavcodec/mips/h263dsp_mips.h
@@ -25,11 +25,11 @@
void ff_h263_h_loop_filter_msa(uint8_t *src, int stride, int q_scale);
void ff_h263_v_loop_filter_msa(uint8_t *src, int stride, int q_scale);
-void ff_dct_unquantize_mpeg2_inter_msa(MpegEncContext *s, int16_t *block,
+void ff_dct_unquantize_mpeg2_inter_msa(const MPVContext *s, int16_t *block,
int32_t index, int32_t q_scale);
-void ff_dct_unquantize_h263_inter_msa(MpegEncContext *s, int16_t *block,
+void ff_dct_unquantize_h263_inter_msa(const MPVContext *s, int16_t *block,
int32_t index, int32_t q_scale);
-void ff_dct_unquantize_h263_intra_msa(MpegEncContext *s, int16_t *block,
+void ff_dct_unquantize_h263_intra_msa(const MPVContext *s, int16_t *block,
int32_t index, int32_t q_scale);
int ff_pix_sum_msa(const uint8_t *pix, ptrdiff_t line_size);
diff --git a/libavcodec/mips/mpegvideo_mips.h b/libavcodec/mips/mpegvideo_mips.h
index 2a9ea4006e..2544279ac5 100644
--- a/libavcodec/mips/mpegvideo_mips.h
+++ b/libavcodec/mips/mpegvideo_mips.h
@@ -23,16 +23,16 @@
#include "libavcodec/mpegvideo.h"
-void ff_dct_unquantize_h263_intra_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale);
-void ff_dct_unquantize_h263_inter_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale);
-void ff_dct_unquantize_mpeg1_intra_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale);
-void ff_dct_unquantize_mpeg1_inter_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale);
-void ff_dct_unquantize_mpeg2_intra_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale);
+void ff_dct_unquantize_h263_intra_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale);
+void ff_dct_unquantize_h263_inter_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale);
+void ff_dct_unquantize_mpeg1_intra_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale);
+void ff_dct_unquantize_mpeg1_inter_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale);
+void ff_dct_unquantize_mpeg2_intra_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale);
void ff_denoise_dct_mmi(int16_t block[64], int sum[64], const uint16_t offset[64]);
#endif /* AVCODEC_MIPS_MPEGVIDEO_MIPS_H */
diff --git a/libavcodec/mips/mpegvideo_mmi.c b/libavcodec/mips/mpegvideo_mmi.c
index 87d4aafd8c..90bd90c147 100644
--- a/libavcodec/mips/mpegvideo_mmi.c
+++ b/libavcodec/mips/mpegvideo_mmi.c
@@ -25,8 +25,8 @@
#include "mpegvideo_mips.h"
#include "libavutil/mips/mmiutils.h"
-void ff_dct_unquantize_h263_intra_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale)
+void ff_dct_unquantize_h263_intra_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale)
{
int64_t level, nCoeffs;
double ftmp[6];
@@ -101,8 +101,8 @@ void ff_dct_unquantize_h263_intra_mmi(MpegEncContext *s, int16_t *block,
block[0] = level;
}
-void ff_dct_unquantize_h263_inter_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale)
+void ff_dct_unquantize_h263_inter_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale)
{
int64_t nCoeffs;
double ftmp[6];
@@ -160,8 +160,8 @@ void ff_dct_unquantize_h263_inter_mmi(MpegEncContext *s, int16_t *block,
);
}
-void ff_dct_unquantize_mpeg1_intra_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale)
+void ff_dct_unquantize_mpeg1_intra_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale)
{
int64_t nCoeffs;
const uint16_t *quant_matrix;
@@ -254,8 +254,8 @@ void ff_dct_unquantize_mpeg1_intra_mmi(MpegEncContext *s, int16_t *block,
block[0] = block0;
}
-void ff_dct_unquantize_mpeg1_inter_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale)
+void ff_dct_unquantize_mpeg1_inter_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale)
{
int64_t nCoeffs;
const uint16_t *quant_matrix;
@@ -342,8 +342,8 @@ void ff_dct_unquantize_mpeg1_inter_mmi(MpegEncContext *s, int16_t *block,
);
}
-void ff_dct_unquantize_mpeg2_intra_mmi(MpegEncContext *s, int16_t *block,
- int n, int qscale)
+void ff_dct_unquantize_mpeg2_intra_mmi(const MPVContext *s, int16_t *block,
+ int n, int qscale)
{
uint64_t nCoeffs;
const uint16_t *quant_matrix;
diff --git a/libavcodec/mips/mpegvideo_msa.c b/libavcodec/mips/mpegvideo_msa.c
index cd4adc0f77..a870a2cd79 100644
--- a/libavcodec/mips/mpegvideo_msa.c
+++ b/libavcodec/mips/mpegvideo_msa.c
@@ -194,7 +194,7 @@ static int32_t mpeg2_dct_unquantize_inter_msa(int16_t *block,
return sum_res;
}
-void ff_dct_unquantize_h263_intra_msa(MpegEncContext *s,
+void ff_dct_unquantize_h263_intra_msa(const MPVContext *s,
int16_t *block, int32_t index,
int32_t qscale)
{
@@ -219,7 +219,7 @@ void ff_dct_unquantize_h263_intra_msa(MpegEncContext *s,
h263_dct_unquantize_msa(block, qmul, qadd, nCoeffs, 1);
}
-void ff_dct_unquantize_h263_inter_msa(MpegEncContext *s,
+void ff_dct_unquantize_h263_inter_msa(const MPVContext *s,
int16_t *block, int32_t index,
int32_t qscale)
{
@@ -236,7 +236,7 @@ void ff_dct_unquantize_h263_inter_msa(MpegEncContext *s,
h263_dct_unquantize_msa(block, qmul, qadd, nCoeffs, 0);
}
-void ff_dct_unquantize_mpeg2_inter_msa(MpegEncContext *s,
+void ff_dct_unquantize_mpeg2_inter_msa(const MPVContext *s,
int16_t *block, int32_t index,
int32_t qscale)
{
diff --git a/libavcodec/mpeg4videodec.h b/libavcodec/mpeg4videodec.h
index aafde454ea..2eafa1ef8b 100644
--- a/libavcodec/mpeg4videodec.h
+++ b/libavcodec/mpeg4videodec.h
@@ -93,11 +93,11 @@ typedef struct Mpeg4DecContext {
Mpeg4VideoDSPContext mdsp;
- void (*dct_unquantize_mpeg2_inter)(MpegEncContext *s,
+ void (*dct_unquantize_mpeg2_inter)(const MPVContext *s,
int16_t *block, int n, int qscale);
- void (*dct_unquantize_mpeg2_intra)(MpegEncContext *s,
+ void (*dct_unquantize_mpeg2_intra)(const MPVContext *s,
int16_t *block, int n, int qscale);
- void (*dct_unquantize_h263_intra)(MpegEncContext *s,
+ void (*dct_unquantize_h263_intra)(const MPVContext *s,
int16_t *block, int n, int qscale);
union {
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index cb4b99acd3..e21ce5164d 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -57,6 +57,8 @@ enum OutputFormat {
FMT_SPEEDHQ,
};
+typedef struct MpegEncContext MPVContext;
+
/**
* MpegEncContext.
*/
@@ -271,10 +273,10 @@ typedef struct MpegEncContext {
int interlaced_dct;
int first_field; ///< is 1 for the first field of a field picture 0 otherwise
- void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (MPEG-4 can use both)
- int16_t *block/*align 16*/, int n, int qscale);
- void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (MPEG-4 can use both)
- int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_intra)(const MPVContext *s, // unquantizer to use (MPEG-4 can use both)
+ int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_inter)(const MPVContext *s, // unquantizer to use (MPEG-4 can use both)
+ int16_t *block/*align 16*/, int n, int qscale);
/* flag to indicate a reinitialization is required, e.g. after
* a frame size change */
@@ -286,8 +288,6 @@ typedef struct MpegEncContext {
ERContext er;
} MpegEncContext;
-typedef MpegEncContext MPVContext;
-
/**
* Set the given MpegEncContext to common defaults (same for encoding
* and decoding). The changed fields will not depend upon the prior
diff --git a/libavcodec/mpegvideo_unquantize.c b/libavcodec/mpegvideo_unquantize.c
index 213e37a514..06c29d0753 100644
--- a/libavcodec/mpegvideo_unquantize.c
+++ b/libavcodec/mpegvideo_unquantize.c
@@ -33,8 +33,8 @@
#include "mpegvideodata.h"
#include "mpegvideo_unquantize.h"
-static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg1_intra_c(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
@@ -62,8 +62,8 @@ static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
}
}
-static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg1_inter_c(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
@@ -91,8 +91,8 @@ static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
}
}
-static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg2_intra_c(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
@@ -120,8 +120,8 @@ static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
}
}
-static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg2_intra_bitexact(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
@@ -153,8 +153,8 @@ static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
block[63]^=sum&1;
}
-static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg2_inter_c(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
@@ -186,8 +186,8 @@ static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
block[63]^=sum&1;
}
-static void dct_unquantize_h263_intra_c(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_intra_c(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, qmul, qadd;
int nCoeffs;
@@ -220,8 +220,8 @@ static void dct_unquantize_h263_intra_c(MpegEncContext *s,
}
}
-static void dct_unquantize_h263_inter_c(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_inter_c(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, level, qmul, qadd;
int nCoeffs;
diff --git a/libavcodec/mpegvideo_unquantize.h b/libavcodec/mpegvideo_unquantize.h
index 3e6d8aedf7..1a43f467c6 100644
--- a/libavcodec/mpegvideo_unquantize.h
+++ b/libavcodec/mpegvideo_unquantize.h
@@ -29,21 +29,21 @@
#include "config.h"
-typedef struct MpegEncContext MpegEncContext;
+typedef struct MpegEncContext MPVContext;
typedef struct MPVUnquantDSPContext {
- void (*dct_unquantize_mpeg1_intra)(struct MpegEncContext *s,
- int16_t *block/*align 16*/, int n, int qscale);
- void (*dct_unquantize_mpeg1_inter)(struct MpegEncContext *s,
- int16_t *block/*align 16*/, int n, int qscale);
- void (*dct_unquantize_mpeg2_intra)(struct MpegEncContext *s,
- int16_t *block/*align 16*/, int n, int qscale);
- void (*dct_unquantize_mpeg2_inter)(struct MpegEncContext *s,
- int16_t *block/*align 16*/, int n, int qscale);
- void (*dct_unquantize_h263_intra)(struct MpegEncContext *s,
- int16_t *block/*align 16*/, int n, int qscale);
- void (*dct_unquantize_h263_inter)(struct MpegEncContext *s,
- int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_mpeg1_intra)(const MPVContext *s,
+ int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_mpeg1_inter)(const MPVContext *s,
+ int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_mpeg2_intra)(const MPVContext *s,
+ int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_mpeg2_inter)(const MPVContext *s,
+ int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_h263_intra)(const MPVContext *s,
+ int16_t *block/*align 16*/, int n, int qscale);
+ void (*dct_unquantize_h263_inter)(const MPVContext *s,
+ int16_t *block/*align 16*/, int n, int qscale);
} MPVUnquantDSPContext;
#if !ARCH_MIPS
diff --git a/libavcodec/neon/mpegvideo.c b/libavcodec/neon/mpegvideo.c
index a0276ad808..fdc57d3876 100644
--- a/libavcodec/neon/mpegvideo.c
+++ b/libavcodec/neon/mpegvideo.c
@@ -84,7 +84,7 @@ static void inline ff_dct_unquantize_h263_neon(int qscale, int qadd, int nCoeffs
vst1_s16(block, d0s16);
}
-static void dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,
+static void dct_unquantize_h263_inter_neon(const MPVContext *s, int16_t *block,
int n, int qscale)
{
int nCoeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
@@ -93,7 +93,7 @@ static void dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,
ff_dct_unquantize_h263_neon(qscale, qadd, nCoeffs + 1, block);
}
-static void dct_unquantize_h263_intra_neon(MpegEncContext *s, int16_t *block,
+static void dct_unquantize_h263_intra_neon(const MPVContext *s, int16_t *block,
int n, int qscale)
{
int qadd;
diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c
index 26e98acfb8..ad3a783a87 100644
--- a/libavcodec/ppc/mpegvideo_altivec.c
+++ b/libavcodec/ppc/mpegvideo_altivec.c
@@ -40,8 +40,8 @@
/* AltiVec version of dct_unquantize_h263
this code assumes `block' is 16 bytes-aligned */
-static void dct_unquantize_h263_altivec(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_altivec(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
int i, qmul, qadd;
int nCoeffs;
diff --git a/libavcodec/x86/mpegvideo.c b/libavcodec/x86/mpegvideo.c
index 8632acd412..4c3299362e 100644
--- a/libavcodec/x86/mpegvideo.c
+++ b/libavcodec/x86/mpegvideo.c
@@ -30,8 +30,8 @@
#if HAVE_MMX_INLINE
-static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_intra_mmx(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
x86_reg level, qmul, qadd, nCoeffs;
@@ -105,8 +105,8 @@ __asm__ volatile(
}
-static void dct_unquantize_h263_inter_mmx(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_h263_inter_mmx(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
x86_reg qmul, qadd, nCoeffs;
@@ -166,8 +166,8 @@ __asm__ volatile(
);
}
-static void dct_unquantize_mpeg1_intra_mmx(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg1_intra_mmx(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
x86_reg nCoeffs;
const uint16_t *quant_matrix;
@@ -235,8 +235,8 @@ __asm__ volatile(
block[0]= block0;
}
-static void dct_unquantize_mpeg1_inter_mmx(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg1_inter_mmx(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
x86_reg nCoeffs;
const uint16_t *quant_matrix;
@@ -301,8 +301,8 @@ __asm__ volatile(
);
}
-static void dct_unquantize_mpeg2_intra_mmx(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg2_intra_mmx(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
x86_reg nCoeffs;
const uint16_t *quant_matrix;
@@ -369,8 +369,8 @@ __asm__ volatile(
//Note, we do not do mismatch control for intra as errors cannot accumulate
}
-static void dct_unquantize_mpeg2_inter_mmx(MpegEncContext *s,
- int16_t *block, int n, int qscale)
+static void dct_unquantize_mpeg2_inter_mmx(const MPVContext *s,
+ int16_t *block, int n, int qscale)
{
x86_reg nCoeffs;
const uint16_t *quant_matrix;
--
2.49.1
From 428baa1fbe1c5541ccb25a9b4897703b1830191c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi(a)remlab.net>
Date: Sat, 8 Jun 2024 23:08:21 +0300
Subject: [PATCH 2/2] lavc/mpv_unquantize: R-V V H.263 DCT unquantize
SpacemiT X60:
dct_unquantize_h263_inter_c: 417.8 ( 1.00x)
dct_unquantize_h263_inter_rvv_i32: 66.0 ( 6.33x)
dct_unquantize_h263_intra_c: 140.2 ( 1.00x)
dct_unquantize_h263_intra_rvv_i32: 67.7 ( 2.07x)
Note that the C benchmarks are not stable, depending heavily on the
number of coefficients picked by the RNG. The R-V V benchmarks are
however very stable and generally better than C's.
---
libavcodec/mpegvideo_unquantize.c | 2 +
libavcodec/mpegvideo_unquantize.h | 1 +
libavcodec/riscv/Makefile | 2 +
libavcodec/riscv/mpegvideo_init.c | 62 +++++++++++++++++++++++++++++++
libavcodec/riscv/mpegvideo_rvv.S | 51 +++++++++++++++++++++++++
5 files changed, 118 insertions(+)
create mode 100644 libavcodec/riscv/mpegvideo_init.c
create mode 100644 libavcodec/riscv/mpegvideo_rvv.S
diff --git a/libavcodec/mpegvideo_unquantize.c b/libavcodec/mpegvideo_unquantize.c
index 06c29d0753..58b530c22d 100644
--- a/libavcodec/mpegvideo_unquantize.c
+++ b/libavcodec/mpegvideo_unquantize.c
@@ -266,6 +266,8 @@ av_cold void ff_mpv_unquantize_init(MPVUnquantDSPContext *s,
ff_mpv_unquantize_init_arm(s, bitexact);
#elif ARCH_PPC
ff_mpv_unquantize_init_ppc(s, bitexact);
+#elif ARCH_RISCV
+ ff_mpv_unquantize_init_riscv(s, bitexact);
#elif ARCH_X86
ff_mpv_unquantize_init_x86(s, bitexact);
#elif ARCH_MIPS
diff --git a/libavcodec/mpegvideo_unquantize.h b/libavcodec/mpegvideo_unquantize.h
index 1a43f467c6..50319d7ad3 100644
--- a/libavcodec/mpegvideo_unquantize.h
+++ b/libavcodec/mpegvideo_unquantize.h
@@ -55,6 +55,7 @@ void ff_mpv_unquantize_init(MPVUnquantDSPContext *s,
void ff_mpv_unquantize_init_arm (MPVUnquantDSPContext *s, int bitexact);
void ff_mpv_unquantize_init_neon(MPVUnquantDSPContext *s, int bitexact);
void ff_mpv_unquantize_init_ppc (MPVUnquantDSPContext *s, int bitexact);
+void ff_mpv_unquantize_init_riscv(MPVUnquantDSPContext *s, int bitexact);
void ff_mpv_unquantize_init_x86 (MPVUnquantDSPContext *s, int bitexact);
void ff_mpv_unquantize_init_mips(MPVUnquantDSPContext *s, int bitexact,
int q_scale_type);
diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
index 736f873fe8..8c1f2f5f6e 100644
--- a/libavcodec/riscv/Makefile
+++ b/libavcodec/riscv/Makefile
@@ -51,6 +51,8 @@ OBJS-$(CONFIG_LPC) += riscv/lpc_init.o
RVV-OBJS-$(CONFIG_LPC) += riscv/lpc_rvv.o
OBJS-$(CONFIG_ME_CMP) += riscv/me_cmp_init.o
RVV-OBJS-$(CONFIG_ME_CMP) += riscv/me_cmp_rvv.o
+OBJS-$(CONFIG_MPEGVIDEO) += riscv/mpegvideo_init.o
+RVV-OBJS-$(CONFIG_MPEGVIDEO) += riscv/mpegvideo_rvv.o
OBJS-$(CONFIG_MPEGVIDEOENCDSP) += riscv/mpegvideoencdsp_init.o
RVV-OBJS-$(CONFIG_MPEGVIDEOENCDSP) += riscv/mpegvideoencdsp_rvv.o
OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
diff --git a/libavcodec/riscv/mpegvideo_init.c b/libavcodec/riscv/mpegvideo_init.c
new file mode 100644
index 0000000000..418b91f437
--- /dev/null
+++ b/libavcodec/riscv/mpegvideo_init.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2022 Rémi Denis-Courmont.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavcodec/mpegvideo.h"
+#include "libavcodec/mpegvideo_unquantize.h"
+
+void ff_h263_dct_unquantize_intra_rvv(const MPVContext *s, int16_t *block,
+ ptrdiff_t len, int qscale, int aic);
+void ff_h263_dct_unquantize_inter_rvv(const MPVContext *s, int16_t *block,
+ ptrdiff_t len, int qscale);
+
+static void dct_unquantize_h263_intra_rvv(const MPVContext *s,
+ int16_t *block, int n, int qscale)
+{
+ if (!s->h263_aic)
+ block[0] *= (n < 4) ? s->y_dc_scale : s->c_dc_scale;
+
+ n = s->ac_pred ? 63
+ : s->intra_scantable.raster_end[s->block_last_index[n]];
+ ff_h263_dct_unquantize_intra_rvv(s, block, n, qscale, s->h263_aic);
+}
+
+static void dct_unquantize_h263_inter_rvv(const MPVContext *s,
+ int16_t *block, int n, int qscale)
+{
+ n = s->inter_scantable.raster_end[s->block_last_index[n]];
+ ff_h263_dct_unquantize_inter_rvv(s, block, n, qscale);
+}
+
+av_cold
+void ff_mpv_unquantize_init_riscv(MPVUnquantDSPContext *c, int bitexact)
+{
+#if HAVE_RVV
+ int flags = av_get_cpu_flags();
+
+ if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
+ c->dct_unquantize_h263_intra = dct_unquantize_h263_intra_rvv;
+ c->dct_unquantize_h263_inter = dct_unquantize_h263_inter_rvv;
+ }
+#endif
+}
diff --git a/libavcodec/riscv/mpegvideo_rvv.S b/libavcodec/riscv/mpegvideo_rvv.S
new file mode 100644
index 0000000000..1a148f75da
--- /dev/null
+++ b/libavcodec/riscv/mpegvideo_rvv.S
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2024 Rémi Denis-Courmont.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/riscv/asm.S"
+
+func ff_h263_dct_unquantize_intra_rvv
+ addi a1, a1, 2
+ beqz a4, 1f
+ slli a3, a3, 1
+ mv a4, zero
+ j 2f
+endfunc
+
+func ff_h263_dct_unquantize_inter_rvv, zve32x, zba
+ addi a2, a2, 1
+1:
+ addi a4, a3, -1
+ slli a3, a3, 1
+ ori a4, a4, 1
+2:
+ vsetvli t0, a2, e16, m8, ta, mu
+ vle16.v v8, (a1)
+ sub a2, a2, t0
+ vmv.v.x v16, a4
+ vmslt.vi v0, v8, 0
+ vneg.v v16, v16, v0.t
+ vmsne.vi v0, v8, 0
+ vmadd.vx v8, a3, v16, v0.t
+ vse16.v v8, (a1)
+ sh1add a1, t0, a1
+ bnez a2, 2b
+
+ ret
+endfunc
--
2.49.1
1
0
PR #21057 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21057
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21057.patch
Most EXIF metadata is in IFD0 and most EXIF payloads only contain
one IFD, but it is possible for there to be more IFDs after the
existing trailing one. exiftool and similar software report these IFDs
as IFD1, IFD2, etc. This commit reads those additional IFDs and attaches
them as dummy entries in the top-level IFD ranging from 0xFFFC down to
0xFFED, which are unused by the EXIF spec. The EXIF API is only able to
return and work with a single IFD, so by attaching it as a subdirectory
this metadata can be preserved.
This is done transparently through the read/write process. Upon parsing
an additional IFD1, it will be attached, but it will be written with
av_exif_write after IFD0 rather than as a subdirectory, as intended.
Existing files without more than one IFD, i.e. most files, will be unaffected
by this change, as well as API clients looking to parse specific fields, but
now more metadata is parsed and written, rather than simply being discarded
as trailing data.
Signed-off-by: Leo Izen <leo.izen(a)gmail.com>
From 3570ab1658f9ce87be88e71a82f666340885ca90 Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen(a)gmail.com>
Date: Sun, 30 Nov 2025 06:55:16 -0500
Subject: [PATCH] avcodec/exif: parse additional EXIF IFDs
Most EXIF metadata is in IFD0 and most EXIF payloads only contain
one IFD, but it is possible for there to be more IFDs after the
existing trailing one. exiftool and similar software report these IFDs
as IFD1, IFD2, etc. This commit reads those additional IFDs and attaches
them as dummy entries in the top-level IFD ranging from 0xFFFC down to
0xFFED, which are unused by the EXIF spec. The EXIF API is only able to
return and work with a single IFD, so by attaching it as a subdirectory
this metadata can be preserved.
This is done transparently through the read/write process. Upon parsing
an additional IFD1, it will be attached, but it will be written with
av_exif_write after IFD0 rather than as a subdirectory, as intended.
Existing files without more than one IFD, i.e. most files, will be unaffected
by this change, as well as API clients looking to parse specific fields, but
now more metadata is parsed and written, rather than simply being discarded
as trailing data.
Signed-off-by: Leo Izen <leo.izen(a)gmail.com>
---
libavcodec/exif.c | 106 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 97 insertions(+), 9 deletions(-)
diff --git a/libavcodec/exif.c b/libavcodec/exif.c
index 93e1050d1f..50f56dd0c0 100644
--- a/libavcodec/exif.c
+++ b/libavcodec/exif.c
@@ -192,6 +192,24 @@ static const struct exif_tag tag_list[] = { // JEITA CP-3451 EXIF specification:
{"InteropIFD", 0xA005}, // <- Table 13 Interoperability IFD Attribute Information
{"GlobalParametersIFD", 0x0190},
{"ProfileIFD", 0xc6f5},
+
+ /* Extra FFmpeg tags */
+ { "IFD1", 0xFFFC},
+ { "IFD2", 0xFFFB},
+ { "IFD3", 0xFFFA},
+ { "IFD4", 0xFFF9},
+ { "IFD5", 0xFFF8},
+ { "IFD6", 0xFFF7},
+ { "IFD7", 0xFFF6},
+ { "IFD8", 0xFFF5},
+ { "IFD9", 0xFFF4},
+ { "IFD10", 0xFFF3},
+ { "IFD11", 0xFFF2},
+ { "IFD12", 0xFFF1},
+ { "IFD13", 0xFFF0},
+ { "IFD14", 0xFFEF},
+ { "IFD15", 0xFFEE},
+ { "IFD16", 0xFFED},
};
/* same as type_sizes but with string == 1 */
@@ -635,7 +653,9 @@ static size_t exif_get_ifd_size(const AVExifMetadata *ifd)
for (size_t i = 0; i < ifd->count; i++) {
const AVExifEntry *entry = &ifd->entries[i];
if (entry->type == AV_TIFF_IFD) {
- total_size += BASE_TAG_SIZE + exif_get_ifd_size(&entry->value.ifd) + entry->ifd_offset;
+ /* this is an extra IFD, not an entry, so we don't need to add base tag size */
+ size_t base_size = entry->id > 0xFFECu && entry->id <= 0xFFFCu ? 0 : BASE_TAG_SIZE;
+ total_size += base_size + exif_get_ifd_size(&entry->value.ifd) + entry->ifd_offset;
} else {
size_t payload_size = entry->count * exif_sizes[entry->type];
total_size += BASE_TAG_SIZE + (payload_size > 4 ? payload_size : 0);
@@ -708,12 +728,16 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, AVBufferRef **buffer,
AVBufferRef *buf = NULL;
size_t size, headsize = 8;
PutByteContext pb;
- int ret, off = 0;
+ int ret = 0, off = 0;
+ AVExifMetadata *ifd_new = NULL;
+ AVExifMetadata extra_ifds[16] = { 0 };
int le = 1;
- if (*buffer)
- return AVERROR(EINVAL);
+ if (*buffer) {
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
size = exif_get_ifd_size(ifd);
switch (header_mode) {
@@ -733,8 +757,10 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, AVBufferRef **buffer,
break;
}
buf = av_buffer_alloc(size + off + headsize);
- if (!buf)
- return AVERROR(ENOMEM);
+ if (!buf) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
if (header_mode == AV_EXIF_EXIF00) {
AV_WL32(buf->data, MKTAG('E','x','i','f'));
@@ -752,6 +778,30 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, AVBufferRef **buffer,
tput32(&pb, le, 8);
}
+ int extras;
+ for (extras = 0; extras < FF_ARRAY_ELEMS(extra_ifds); extras++) {
+ AVExifEntry *extra_entry = NULL;
+ ret = av_exif_get_entry(logctx, (AVExifMetadata *) ifd, 0xFFFCu - extras, 0, &extra_entry);
+ if (ret <= 0)
+ break;
+ if (!ifd_new) {
+ ifd_new = av_exif_clone_ifd(ifd);
+ if (!ifd_new)
+ break;
+ ifd = ifd_new;
+ }
+ /* calling remove_entry will call av_exif_free on the original */
+ AVExifMetadata *cloned = av_exif_clone_ifd(&extra_entry->value.ifd);
+ if (!cloned)
+ break;
+ extra_ifds[extras] = *cloned;
+ /* don't use av_exif_free here, we want to preserve internals */
+ av_free(cloned);
+ ret = av_exif_remove_entry(logctx, ifd_new, 0xFFFCu - extras, 0);
+ if (!cloned)
+ break;
+ }
+
ret = exif_write_ifd(logctx, &pb, le, 0, ifd);
if (ret < 0) {
av_buffer_unref(&buf);
@@ -759,9 +809,26 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, AVBufferRef **buffer,
return ret;
}
- *buffer = buf;
+ for (int i = 0; i < extras; i++) {
+ int tell = bytestream2_tell_p(&pb);
+ /* exif_write_ifd always writes 0 i.e. last ifd so we overwrite that here */
+ bytestream2_seek_p(&pb, -4, SEEK_CUR);
+ tput32(&pb, le, tell);
+ ret = exif_write_ifd(logctx, &pb, le, 0, &extra_ifds[i]);
+ if (ret < 0)
+ break;
+ }
- return 0;
+ *buffer = buf;
+ ret = 0;
+
+end:
+ av_exif_free(ifd_new);
+ av_freep(&ifd_new);
+ for (int i = 0; i < FF_ARRAY_ELEMS(extra_ifds); i++)
+ av_exif_free(&extra_ifds[i]);
+
+ return ret;
}
int av_exif_parse_buffer(void *logctx, const uint8_t *buf, size_t size,
@@ -820,8 +887,29 @@ int av_exif_parse_buffer(void *logctx, const uint8_t *buf, size_t size,
av_log(logctx, AV_LOG_ERROR, "error decoding EXIF data: %s\n", av_err2str(ret));
return ret;
}
+ if (!ret)
+ goto finish;
+ int next = ret;
+ bytestream2_seek(&gbytes, next, SEEK_SET);
- return bytestream2_tell(&gbytes);
+ /* cap at 16 extra IFDs for sanity/parse security */
+ for (uint16_t extra_tag = 0xFFFCu; extra_tag > 0xFFECu; extra_tag--) {
+ AVExifMetadata extra_ifd = { 0 };
+ ret = exif_parse_ifd_list(logctx, &gbytes, le, 0, &extra_ifd, 1);
+ if (ret < 0) {
+ av_exif_free(&extra_ifd);
+ break;
+ }
+ next = ret;
+ bytestream2_seek(&gbytes, next, SEEK_SET);
+ ret = av_exif_set_entry(logctx, ifd, extra_tag, AV_TIFF_IFD, 1, NULL, 0, &extra_ifd);
+ av_exif_free(&extra_ifd);
+ if (ret < 0 || !next || bytestream2_get_bytes_left(&gbytes) <= 0)
+ break;
+ }
+
+finish:
+ return ret;
}
#define COLUMN_SEP(i, c) ((i) ? ((i) % (c) ? ", " : "\n") : "")
--
2.49.1
1
0
PR #21055 opened by Sebastian Ramacher (sebastinas)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21055
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21055.patch
Same as #20902 but for release/7.1
From 1291bd52318ad29235d792530340b08bfab1fc5b Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg(a)gyani.pro>
Date: Sun, 28 Sep 2025 13:20:23 +0530
Subject: [PATCH] configure: unbreak glslang build
Don't unconditionally link to libSPVRemapper which was removed in 16.0 in 3a7f787
---
configure | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index 98b582a5d5..32b920240f 100755
--- a/configure
+++ b/configure
@@ -6917,12 +6917,16 @@ enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontco
enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
enabled libharfbuzz && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
-enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
+if enabled libglslang; then
+ spvremap="-lSPVRemapper"
+ require_headers "glslang/build_info.h" && { test_cpp_condition glslang/build_info.h "GLSLANG_VERSION_MAJOR >= 16" && spvremap="" ; }
+ check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lGenericCodeGen \
- -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
+ ${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
- -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ; }
+ ${spvremap} -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ;
+fi
enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
--
2.49.1
1
0