[FFmpeg-cvslog] avcodec/idctdsp: Add function to apply permutation to array

Andreas Rheinhardt git at videolan.org
Mon Oct 24 02:41:16 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Oct 20 04:26:00 2022 +0200| [ee0e03fe772a244e5c3633b8024ae3b3485fbb54] | committer: Andreas Rheinhardt

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 at xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee0e03fe772a244e5c3633b8024ae3b3485fbb54
---

 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,



More information about the ffmpeg-cvslog mailing list