diff mbox series

[FFmpeg-devel,v2,07/24] avcodec/idctdsp: Add function to apply permutation to array

Message ID AS8P250MB07447FC402540C86998898898F2D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Headers show
Series [FFmpeg-devel,v2,01/24] configure: Add idctdsp dependency to codecs that need it | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 21, 2022, 8:12 p.m. UTC
It is the part of ff_init_scantable() that is used
by all users of said function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/idctdsp.c | 9 +++++++++
 libavcodec/idctdsp.h | 2 ++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

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,