move half-reverse to before outer butterfly in I-DCT
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 29 Jul 2021 20:28:01 +0000 (21:28 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 29 Jul 2021 20:28:01 +0000 (21:28 +0100)
src/openpower/decoder/isa/fastdct-test.py
src/openpower/decoder/isa/fastdctlee.py

index 72414d5cc59bf93fb5cfcfe5d91fbc7fc5b59965..c3aacd6bc39e104f57f4df9374d051be153c22aa 100644 (file)
@@ -28,7 +28,7 @@ import fastdctlee, naivedct, remap_dct_yield
 class FastDctTest(unittest.TestCase):
 
     def test_fast_dct_lee_vs_naive(self):
-        for i in range(3, 4):
+        for i in range(3, 10):
             n = 2**i
             vector = FastDctTest.nonrandom_vector(n)
             expect = naivedct.transform(vector)
index 5d89a3d972963d03fc5de17ddcfeb1f97b8f82f2..2ab421fbcb2fe054e381f117a692ed681519e6d3 100644 (file)
@@ -360,6 +360,7 @@ def inverse_transform_iter(vec):
 
     print("transform2-inv pre-itersum", vec)
     #vec = halfrev2(vec, True)
+    vec = [vec[ri[i]] for i in range(n)]
     #print("transform2-inv post-itersum-reorder", vec)
 
     # first the outer butterfly (iterative sum thing)
@@ -374,12 +375,9 @@ def inverse_transform_iter(vec):
             jr.reverse()
             print ("itersum    jr", i+halfsize, i+size, jr)
             for jh in jr:
-                #x = vec[ji[jh]]
-                #y = vec[ji[jh+size]]
-                #vec[ji[jh+size]] = x + y
-                x = vec[jh]
-                y = vec[jh+size]
-                vec[jh+size] = x + y
+                x = vec[ri[jh]]
+                y = vec[ri[jh+size]]
+                vec[ri[jh+size]] = x + y
                 print ("    itersum", size, i, jh, jh+size,
                         x, y, "jh+sz", vec[ji[jh+size]])
         size *= 2
@@ -388,7 +386,6 @@ def inverse_transform_iter(vec):
 
     # and pretend we LDed data in half-swapped *and* bit-reversed order as well
     # TODO: merge these two
-    vec = [vec[ri[i]] for i in range(n)]
     vec = halfrev2(vec, True)
     ri = list(range(n))