diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-20 04:26:00 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-24 00:46:59 +0200 |
commit | ee0e03fe772a244e5c3633b8024ae3b3485fbb54 (patch) | |
tree | 383e994da4d805a7577e27744130b62f7425ddde | |
parent | 0d53d92e3a94a89582f4ee7aa37c3cb54b573b3a (diff) | |
download | ffmpeg-ee0e03fe772a244e5c3633b8024ae3b3485fbb54.tar.gz |
avcodec/idctdsp: Add function to apply permutation to array
It is the part of ff_init_scantable() that is used
by all users of said function.
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/idctdsp.c | 9 | ||||
-rw-r--r-- | libavcodec/idctdsp.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c index 4ee9c3aa74..50156930ed 100644 --- a/libavcodec/idctdsp.c +++ b/libavcodec/idctdsp.c @@ -27,6 +27,15 @@ #include "simple_idct.h" #include "xvididct.h" +av_cold void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], + const uint8_t permutation[64]) +{ + for (int i = 0; i < 64; i++) { + int j = src[i]; + dst[i] = permutation[j]; + } +} + av_cold void ff_init_scantable(const uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable) { diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h index 2bd9820f72..b286bc231c 100644 --- a/libavcodec/idctdsp.h +++ b/libavcodec/idctdsp.h @@ -43,6 +43,8 @@ enum idct_permutation_type { FF_IDCT_PERM_SSE2, }; +void ff_permute_scantable(uint8_t dst[64], const uint8_t src[64], + const uint8_t permutation[64]); void ff_init_scantable(const uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable); void ff_init_scantable_permutation(uint8_t *idct_permutation, |