[x265] [PATCH v2 1/9] Move C DCT implementations into X265_NS

Hari Limaye hari.limaye at arm.com
Tue Aug 27 15:10:26 UTC 2024


Move C implementations of DCT functions into the X265_NS namespace, and
remove the static modifier from their declarations, so that they can be
referenced from external code when linking to libx265.
---
 source/common/dct.cpp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/source/common/dct.cpp b/source/common/dct.cpp
index b102b6e31..a0b977f4a 100644
--- a/source/common/dct.cpp
+++ b/source/common/dct.cpp
@@ -439,7 +439,8 @@ static void partialButterfly4(const int16_t* src, int16_t* dst, int shift, int l
     }
 }
 
-static void dst4_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
+namespace X265_NS {
+void dst4_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
 {
     const int shift_1st = 1 + X265_DEPTH - 8;
     const int shift_2nd = 8;
@@ -456,7 +457,7 @@ static void dst4_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
     fastForwardDst(coef, dst, shift_2nd);
 }
 
-static void dct4_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
+void dct4_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
 {
     const int shift_1st = 1 + X265_DEPTH - 8;
     const int shift_2nd = 8;
@@ -473,7 +474,7 @@ static void dct4_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
     partialButterfly4(coef, dst, shift_2nd, 4);
 }
 
-static void dct8_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
+void dct8_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
 {
     const int shift_1st = 2 + X265_DEPTH - 8;
     const int shift_2nd = 9;
@@ -490,7 +491,7 @@ static void dct8_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
     partialButterfly8(coef, dst, shift_2nd, 8);
 }
 
-static void dct16_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
+void dct16_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
 {
     const int shift_1st = 3 + X265_DEPTH - 8;
     const int shift_2nd = 10;
@@ -507,7 +508,7 @@ static void dct16_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
     partialButterfly16(coef, dst, shift_2nd, 16);
 }
 
-static void dct32_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
+void dct32_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
 {
     const int shift_1st = 4 + X265_DEPTH - 8;
     const int shift_2nd = 11;
@@ -524,7 +525,7 @@ static void dct32_c(const int16_t* src, int16_t* dst, intptr_t srcStride)
     partialButterfly32(coef, dst, shift_2nd, 32);
 }
 
-static void idst4_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
+void idst4_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
 {
     const int shift_1st = 7;
     const int shift_2nd = 12 - (X265_DEPTH - 8);
@@ -541,7 +542,7 @@ static void idst4_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
     }
 }
 
-static void idct4_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
+void idct4_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
 {
     const int shift_1st = 7;
     const int shift_2nd = 12 - (X265_DEPTH - 8);
@@ -558,7 +559,7 @@ static void idct4_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
     }
 }
 
-static void idct8_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
+void idct8_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
 {
     const int shift_1st = 7;
     const int shift_2nd = 12 - (X265_DEPTH - 8);
@@ -575,7 +576,7 @@ static void idct8_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
     }
 }
 
-static void idct16_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
+void idct16_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
 {
     const int shift_1st = 7;
     const int shift_2nd = 12 - (X265_DEPTH - 8);
@@ -592,7 +593,7 @@ static void idct16_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
     }
 }
 
-static void idct32_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
+void idct32_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
 {
     const int shift_1st = 7;
     const int shift_2nd = 12 - (X265_DEPTH - 8);
@@ -608,6 +609,7 @@ static void idct32_c(const int16_t* src, int16_t* dst, intptr_t dstStride)
         memcpy(&dst[i * dstStride], &block[i * 32], 32 * sizeof(int16_t));
     }
 }
+} // namespace X265_NS
 
 static void dequant_normal_c(const int16_t* quantCoef, int16_t* coef, int num, int scale, int shift)
 {
-- 
2.42.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0001-Move-C-DCT-implementations-into-X265_NS.patch
Type: text/x-patch
Size: 4734 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240827/0e59fef0/attachment.bin>


More information about the x265-devel mailing list