sbc: removed mapping from V to U

This commit is contained in:
Milanka Ringwald 2016-05-20 17:13:25 +02:00
parent fdfc9b7d95
commit fc754a2b78
2 changed files with 22 additions and 9 deletions

View File

@ -156,7 +156,6 @@ def sbc_frame_synthesis_v1(frame, ch, blk, proto_table):
L2 = 2*L
S = np.zeros(M)
U = np.zeros(L)
W = np.zeros(L)
frame.X = np.zeros(M)
@ -171,16 +170,10 @@ def sbc_frame_synthesis_v1(frame, ch, blk, proto_table):
V[ch][k] = 0
for i in range(M):
V[ch][k] += N[k][i] * S[i]
for i in range(5):
for j in range(M):
U[i*M2+j] = V[ch][i*2*M2+j]
U[(i*2+1)*M+j] = V[ch][(i*4+3)*M+j]
for i in range(L):
D = proto_table[i] * (-M)
W[i] = U[i]*D
W[i] = D * VSGN(i,M2) * V[ch][remap_V(i)]
offset = blk*M
for j in range(M):

View File

@ -9,6 +9,8 @@ from sbc import *
matrix_R = np.zeros(shape = (16,8))
matrix_C2 = np.zeros(shape = (8,8))
matrix_N = np.zeros(shape = (16,16))
V_SGN = [1,1,1,1, 0, -1,-1,-1,-1, 1,1,1,1,1,1,1]
V_remap = np.zeros(80)
def sbc_init_synthesis_v1(M):
global matrix_R, matrix_C2, matrix_N
@ -16,10 +18,13 @@ def sbc_init_synthesis_v1(M):
print("SBC V1 init failed, 4-subband version not implemented yet")
M2 = M << 1
Mh = M >> 1
L = 10 * M
L2 = L << 1
matrix_R = np.zeros(shape = (M2,M))
matrix_C2 = np.zeros(shape = (M,M))
matrix_N = np.zeros(shape = (M2,M2))
V_remap = np.zeros(L)
R_c1 = 12
@ -35,6 +40,21 @@ def sbc_init_synthesis_v1(M):
matrix_N = np.dot(matrix_R, matrix_C2)
for i in range(L):
offset = i%M2
if offset >= M:
offset += M2
V_remap[i] = L2/5 * (i/M2) + offset
def VSGN(i,M2):
return V_SGN[i%M2]
def remap_V(i):
global V_remap
return V_remap[i]
def sbc_frame_synthesis_v1_4subbands(frame, ch, blk):
print "sbc_frame_synthesis_v1_4subbands(frame, ch, blk) not implemented yet"
exit(1)