[FFmpeg-devel] [PATCH 07/22] avcodec/idctdsp: Add function to apply permutation to array
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Oct 20 11:45:25 EEST 2022
It is the part of ff_init_scantable() that is used
by all users of said function.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/idctdsp.c | 9 +++++++++
libavcodec/idctdsp.h | 2 ++
2 files changed, 11 insertions(+)
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,
--
2.34.1
More information about the ffmpeg-devel
mailing list