Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: test
run-name: ${{ github.workflow }} - ${{ github.sha }}
on:
push:
branches: [ main, up ]
pull_request:
branches: [ main, up ]
workflow_dispatch:


jobs:
ffvvc-test:
name: ffvvc-test / ${{ matrix.os.name }}/${{ matrix.compiler.name }}/${{ matrix.assembler.name }}
env:
configure_flags: --enable-ffmpeg --disable-everything --enable-decoder=vvc --enable-parser=vvc --enable-demuxer=vvc --enable-protocol=file,pipe --enable-encoder=rawvideo,wrapped_avframe --enable-muxer=rawvideo,md5,null
strategy:
fail-fast: false
matrix:
os:
- { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4 }
- { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 }
compiler:
- { name: gcc, flags: --cc=gcc }
- { name: clang, flags: --cc=clang }
- { name: msvc, flags: --toolchain=msvc }
- { name: clang-usan, flags: '--toolchain=clang-usan --disable-optimizations' }
- { name: clang-asan, flags: '--toolchain=clang-asan --disable-optimizations' }
assembler:
- { name: no asm, flags: --disable-asm }
- { name: yasm, flags: --as=yasm }
- { name: nasm, flags: --as=nasm }
exclude:
# GitHub's Actions runners do not support AVX2.
- os: { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4}
compiler: { name: msvc, flags: --toolchain=msvc }
- os: { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4 }
assembler: { name: yasm, flags: --as=yasm }
- os: { name: linux, runner: ubuntu-latest, shell: bash, runner_threads: 4 }
assembler: { name: nasm, flags: --as=nasm }
# Address sanitizer cannot be run with handwritten assembly.
- compiler: { name: clang-asan, flags: '--toolchain=clang-asan --disable-optimizations' }
assembler: { name: nasm, flags: --as=nasm }
- compiler: { name: clang-asan, flags: '--toolchain=clang-asan --disable-optimizations' }
assembler: { name: yasm, flags: --as=yasm }
# Windows only supports MSVC.
- os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 }
compiler: { name: gcc, flags: --cc=gcc }
- os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 }
compiler: { name: clang, flags: --cc=clang }
- os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 }
compiler: { name: clang-usan, flags: '--toolchain=clang-usan --disable-optimizations' }
- os: { name: windows, runner: windows-latest, shell: 'msys2 {0}', runner_threads: 1 }
compiler: { name: clang-asan, flags: '--toolchain=clang-asan --disable-optimizations' }

runs-on: ${{ matrix.os.runner }}
defaults:
run:
shell: ${{ matrix.os.shell }}

steps:
- name: Get MSVC
if: ${{ matrix.compiler.name == 'msvc' && matrix.os.name == 'windows' }}
uses: ilammy/msvc-dev-cmd@v1

- name: Set up MSYS2
if: ${{ matrix.os.shell == 'msys2 {0}' }}
uses: msys2/setup-msys2@v2
with:
release: false
msystem: UCRT64
path-type: inherit
install: >-
make
diffutils

- name: Setup python package
run: python3 -m pip install tqdm pyyaml

- name: Get assembler
if: ${{ matrix.os.shell == 'msys2 {0}' && matrix.assembler.name != 'no asm' }}
run: pacman --noconfirm -S ${{ matrix.assembler.name }}

- name: Get source
uses: actions/checkout@v3
with:
path: FFmpeg

- name: Configure
run: cd FFmpeg && ./configure ${{ matrix.compiler.flags }} ${{ matrix.assembler.flags }} ${{ env.configure_flags }} || (tail ffbuild/config.log; false)

- name: Build
run: cd FFmpeg && make -j8

- name: Get tests
uses: actions/checkout@v3
with:
repository: ffvvc/tests
path: tests

- name: Unit test
run: python3 tests/tools/ffmpeg.py --threads ${{ matrix.os.runner_threads }} --ffmpeg-path=./FFmpeg/ffmpeg tests/conformance/passed

- name: Check ASM
run: cd FFmpeg && make checkasm -j && ./tests/checkasm/checkasm

- name: Negative test
run: python3 tests/tools/ffmpeg.py --threads ${{ matrix.os.runner_threads }} --ffmpeg-path=./FFmpeg/ffmpeg tests/conformance/failed || true
37 changes: 24 additions & 13 deletions libavcodec/cbs_h266_syntax_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,9 +2118,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
} else {
if (current->pps_no_pic_partition_flag)
infer(pps_num_slices_in_pic_minus1, 0);
else if (current->pps_single_slice_per_subpic_flag)
else if (current->pps_single_slice_per_subpic_flag) {
for (i = 0; i <= sps->sps_num_subpics_minus1; i++)
current->num_slices_in_subpic[i] = 1;
infer(pps_num_slices_in_pic_minus1,
sps->sps_num_subpics_minus1);
}
// else?
}
if (!current->pps_rect_slice_flag ||
Expand Down Expand Up @@ -3219,19 +3222,27 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
flag(sh_cabac_init_flag);
else
infer(sh_cabac_init_flag, 0);
if (ph->ph_temporal_mvp_enabled_flag && !pps->pps_rpl_info_in_ph_flag) {
if (current->sh_slice_type == VVC_SLICE_TYPE_B)
flag(sh_collocated_from_l0_flag);
else
infer(sh_collocated_from_l0_flag, 1);
if ((current->sh_collocated_from_l0_flag &&
current->num_ref_idx_active[0] > 1) ||
(!current->sh_collocated_from_l0_flag &&
current->num_ref_idx_active[1] > 1)) {
unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1;
ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1);
if (ph->ph_temporal_mvp_enabled_flag) {
if (!pps->pps_rpl_info_in_ph_flag) {
if (current->sh_slice_type == VVC_SLICE_TYPE_B)
flag(sh_collocated_from_l0_flag);
else
infer(sh_collocated_from_l0_flag, 1);
if ((current->sh_collocated_from_l0_flag &&
current->num_ref_idx_active[0] > 1) ||
(!current->sh_collocated_from_l0_flag &&
current->num_ref_idx_active[1] > 1)) {
unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1;
ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1);
} else {
infer(sh_collocated_ref_idx, 0);
}
} else {
infer(sh_collocated_ref_idx, 0);
if (current->sh_slice_type == VVC_SLICE_TYPE_B)
infer(sh_collocated_from_l0_flag, ph->ph_collocated_from_l0_flag);
else
infer(sh_collocated_from_l0_flag, 1);
infer(sh_collocated_ref_idx, ph->ph_collocated_ref_idx);
}
}
if (!pps->pps_wp_info_in_ph_flag &&
Expand Down
12 changes: 8 additions & 4 deletions libavcodec/vvc/vvc_ctu.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ static int get_qp_y_pred(const VVCLocalContext *lc)
const int min_cb_width = fc->ps.pps->min_cb_width;
const int x_cb = cu->x0 >> sps->min_cb_log2_size_y;
const int y_cb = cu->y0 >> sps->min_cb_log2_size_y;
const int x_ctb = cu->x0 >> ctb_log2_size;
const int y_ctb = cu->y0 >> ctb_log2_size;
const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == x_ctb && (yQg >> ctb_log2_size) == y_ctb;
const int in_same_ctb_b = (xQg >> ctb_log2_size) == x_ctb && ((yQg - 1) >> ctb_log2_size) == y_ctb;
const int rx = cu->x0 >> ctb_log2_size;
const int ry = cu->y0 >> ctb_log2_size;
const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == rx && (yQg >> ctb_log2_size) == ry;
const int in_same_ctb_b = (xQg >> ctb_log2_size) == rx && ((yQg - 1) >> ctb_log2_size) == ry;
int qPy_pred, qPy_a, qPy_b;

if (lc->na.cand_up) {
Expand Down Expand Up @@ -2493,6 +2493,10 @@ void ff_vvc_decode_neighbour(VVCLocalContext *lc, const int x_ctb, const int y_c
lc->boundary_flags |= BOUNDARY_UPPER_TILE;
if (ry > 0 && fc->tab.slice_idx[rs] != fc->tab.slice_idx[rs - fc->ps.pps->ctb_width])
lc->boundary_flags |= BOUNDARY_UPPER_SLICE;
if (fc->ps.sps->r->sps_subpic_ctu_top_left_x[lc->sc->sh.r->curr_subpic_idx] == rx)
lc->boundary_flags |= BOUNDARY_LEFT_SUBPIC;
if (fc->ps.sps->r->sps_subpic_ctu_top_left_y[lc->sc->sh.r->curr_subpic_idx] == ry)
lc->boundary_flags |= BOUNDARY_UPPER_SUBPIC;
lc->ctb_left_flag = rx > 0 && !(lc->boundary_flags & BOUNDARY_LEFT_TILE);
lc->ctb_up_flag = ry > 0 && !(lc->boundary_flags & BOUNDARY_UPPER_TILE) && !(lc->boundary_flags & BOUNDARY_UPPER_SLICE);
lc->ctb_up_right_flag = lc->ctb_up_flag && (fc->ps.pps->ctb_to_col_bd[rx] == fc->ps.pps->ctb_to_col_bd[rx + 1]) &&
Expand Down
6 changes: 4 additions & 2 deletions libavcodec/vvc/vvc_ctu.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,10 @@ typedef struct VVCLocalContext {

#define BOUNDARY_LEFT_SLICE (1 << 0)
#define BOUNDARY_LEFT_TILE (1 << 1)
#define BOUNDARY_UPPER_SLICE (1 << 2)
#define BOUNDARY_UPPER_TILE (1 << 3)
#define BOUNDARY_LEFT_SUBPIC (1 << 2)
#define BOUNDARY_UPPER_SLICE (1 << 3)
#define BOUNDARY_UPPER_TILE (1 << 4)
#define BOUNDARY_UPPER_SUBPIC (1 << 5)
/* properties of the boundary of the current CTB for the purposes
* of the deblocking filter */
int boundary_flags;
Expand Down
Loading