-
Notifications
You must be signed in to change notification settings - Fork 12
1D inverse type-II DCT AVX2 optimisations #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
frankplow
wants to merge
6
commits into
ffvvc:20240120
Choose a base branch
from
frankplow:idct-asm
base: 20240120
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5917740
Add VVC 1D ITX checkasm
frankplow 32070fa
lavc/x86/vvc_itx_1d: Initial AVX2 optimisations for VVC IDCT2
frankplow f24c912
lavc/x86/vvc_itx_1d.asm: Add size 64 AVX2 IDCT2 optimisation
frankplow ac07a5a
lavc/x86/vvc_itx_1d: Don't use AVX2 optimisations when extended_preci…
frankplow 2036efb
lavc/x86/vvc_itx_1d: Fix assembly with YASM
frankplow 6105322
lavc/x86/vvc_itx_1d: Fix YASM build
frankplow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| * Copyright (c) 2023 Frank Plowman <post@frankplowman.com> | ||
| * | ||
| * This file is part of FFmpeg. | ||
| * | ||
| * FFmpeg is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 2 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 General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU 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/mem_internal.h" | ||
|
|
||
| #include "libavcodec/avcodec.h" | ||
|
|
||
| #include "libavcodec/vvc/vvcdsp.h" | ||
| #include "libavcodec/vvc/vvcdec.h" | ||
|
|
||
| #include "checkasm.h" | ||
|
|
||
| #define SIZEOF_PIXEL ((bit_depth + 7) / 8) | ||
| #define PIXEL_STRIDE (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) | ||
| #define BUF_SIZE (PIXEL_STRIDE * MAX_TB_SIZE) | ||
|
|
||
| #define randomize_buffers(buf0, buf1, size) \ | ||
| do { \ | ||
| int k; \ | ||
| for (k = 0; k < size; ++k) { \ | ||
| uint32_t r = rnd(); \ | ||
| int32_t a = INT16_MIN + r / (UINT32_MAX / (INT16_MAX - INT16_MIN + 1) + 1); \ | ||
| AV_WN32A(buf0 + k, a); \ | ||
| AV_WN32A(buf1 + k, a); \ | ||
| } \ | ||
| } while (0) | ||
|
|
||
| static void check_idct2(VVCDSPContext h, int bit_depth) | ||
| { | ||
| LOCAL_ALIGNED_32(int, ref_dst, [BUF_SIZE]); | ||
| LOCAL_ALIGNED_32(int, new_dst, [BUF_SIZE]); | ||
| LOCAL_ALIGNED_32(int, ref_src, [BUF_SIZE]); | ||
| LOCAL_ALIGNED_32(int, new_src, [BUF_SIZE]); | ||
|
|
||
| const ptrdiff_t stride = PIXEL_STRIDE * SIZEOF_PIXEL; | ||
|
|
||
| for (int log2_size = 1; log2_size <= 6; log2_size++) { | ||
| const int size = 1 << log2_size; | ||
| declare_func_emms(AV_CPU_FLAG_MMX, void, int *dst, ptrdiff_t dst_stride, | ||
| int *src, ptrdiff_t src_stride); | ||
|
|
||
| randomize_buffers(ref_src, new_src, BUF_SIZE); | ||
| memset(ref_dst, 0, BUF_SIZE); | ||
| memset(new_dst, 0, BUF_SIZE); | ||
|
|
||
| if (check_func(h.itx.itx[DCT2][log2_size - 1], "vvc_inv_dct2_%d", size)) { | ||
| call_ref(ref_dst, stride, ref_src, stride); | ||
| call_new(new_dst, stride, new_src, stride); | ||
| checkasm_check_int32_t("vvc_itx_1d.asm", 0, ref_dst, stride * sizeof(int), new_dst, stride * sizeof(int), 1, size, "dst"); | ||
| } | ||
| bench_new(new_dst, stride, new_src, stride); | ||
| } | ||
| } | ||
|
|
||
| void checkasm_check_vvc_itx_1d(void) | ||
| { | ||
| VVCDSPContext h; | ||
| ff_vvc_dsp_init(&h, 8, 0); | ||
| check_idct2(h, 8); | ||
| report("idct2"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it would be more elegant to pass
VVCFrameParamSets,VVCFrameContextor something else more general here (and the call site forff_vvc_dsp_initsupports it), however including vvc_ps.h in vvcdsp.h introduced a lot of compilation errors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, at this level, we'd better include a small set of headers