return vector
-def failllll_transform2(block):
- N = len(block)
- cos = [0.0] * (N>>1)
-
- front = deepcopy(block)
- back = deepcopy(block)
-
- step = 1
- j = N *2
- half_N = N
- prev_half_N = N
-
- while j > 1: #// Cycle of iterations Input Butterfly
- half_N = half_N >> 1
- current_PI_half_By_N = (math.pi / 2) / prev_half_N
- current_PI_By_N = 0.0
- step_Phase = current_PI_half_By_N * 2.0
- print ("n", N, "cos", end=" ")
- for i in range(half_N):
- #Precompute Cosine's coefficients
- a = current_PI_By_N + current_PI_half_By_N
- print (i, a / (math.pi), math.cos(a) * 2, end=" ")
- cos[i] = 0.5 / math.cos(a)
- current_PI_By_N += step_Phase
- print()
- k = 0
- for x in range(step):
- for i in range(half_N):
- shift = k + prev_half_N - i - 1
- back[k + i] = front[k + i] + front[shift]
- back[k + half_N + i] = (front[k + i] - front[shift]) * cos[i]
- print ("xf coeff", N, j, i, x, "k/kh", k+i, k+half_N+i)
- k += prev_half_N
- temp = front
- front = back
- back = temp
- j = j >> 1
- step = step << 1
- prev_half_N = half_N
-
- half_N = 2
- prev_half_N = 2
- j = 2
-
- print("xform intermediate", front)
-
- while j < N: # Cycle of Out ButterFly
- k = 0
- print ("out", j, N, step, half_N)
- for x in range(step):
- for i in range(half_N - 1):
- back[k + (i << 1)] = front[k + i]
- back[k + (i << 1) + 1] = (front[k + half_N + i] +
- front[k + half_N + i + 1])
- print (" out", j, x, i, "k", k,
- "k+i<<1", k+(i<<1), "hh1", k+half_N+i)
- back[k + ((half_N - 1) << 1)] = front[k + half_N - 1]
- back[k + (half_N << 1) - 1] = front[k + (half_N << 1) - 1]
- k += prev_half_N
-
- temp = front
- front = back
- back = temp
- j = j << 1
- step = step >> 1
- half_N = prev_half_N
- prev_half_N = prev_half_N << 1
-
- for i in range(N):
- block[i] = front[i] #// Unload DCT coefficients
- dN = 2.0
- #block[0] = block[0] / dN #// Compute DC.
-
- print("transform2 result", block)
- return block
-
-
def itersum_explore(vector, indent=0):
idt = " " * indent
n = len(vector)