diff --git a/framework/modules/saf_vbap/saf_vbap.c b/framework/modules/saf_vbap/saf_vbap.c index d4eac4f8a..eb4dc7d58 100644 --- a/framework/modules/saf_vbap/saf_vbap.c +++ b/framework/modules/saf_vbap/saf_vbap.c @@ -681,15 +681,10 @@ void invertLsMtx3D ) { int i, j, n; - float* tempGroup; - float tempInv[9], eye3[9]; + float tempGroup[9]; + float tempInv[9]; void* hSinv; - for(i=0; i<3; i++) - for(j=0; j<3; j++) - eye3[i*3+j] = i==j ? 1.0f : 0.0f; - tempGroup = malloc1d(9* sizeof(float)); - /* pre-calculate inversions of the loudspeaker groups and store into matrix */ (*layoutInvMtx) = malloc1d(N_group * 9 * sizeof(float)); utility_sinv_create(&hSinv, 3); @@ -700,18 +695,13 @@ void invertLsMtx3D tempGroup[j*3+i] = U_spkr[ls_groups[n*3+i]*3 + j]; /* get inverse of current group */ - utility_sinv(hSinv, tempGroup,tempGroup,3); - cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, 3, 3, 3, 1.0f, - (float*)eye3, 3, - tempGroup, 3, 0.0f, - (float*)tempInv, 3); + utility_sinv(hSinv, tempGroup, tempInv, 3); /* store the vectorized inverse as a row the output */ for(i=0; i<3; i++) for(j=0; j<3; j++) (*layoutInvMtx)[n*9+(i*3+j)] = tempInv[j*3+i]; } - free(tempGroup); utility_sinv_destroy(&hSinv); } @@ -947,15 +937,10 @@ void invertLsMtx2D ) { int i, j, n; - float* tempGroup; - float tempInv[4], eye2[4]; + float tempGroup[4]; + float tempInv[4]; void* hSinv; - for(i=0; i<2; i++) - for(j=0; j<2; j++) - eye2[i*2+j] = i==j ? 1.0f : 0.0f; - tempGroup = malloc1d(4* sizeof(float)); - /* pre-calculate inversions of the loudspeaker groups and store into matrix */ (*layoutInvMtx) = malloc1d(N_pairs * 4 * sizeof(float)); utility_sinv_create(&hSinv, 2); @@ -966,11 +951,7 @@ void invertLsMtx2D tempGroup[j*2+i] = U_spkr[ls_pairs[n*2+i]*2 + j]; /* get inverse of current group */ - utility_sinv(hSinv, tempGroup,tempGroup,2); - cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, 2, 2, 2, 1.0, - eye2, 2, - tempGroup, 2, 0.0, - tempInv, 2); + utility_sinv(hSinv, tempGroup, tempInv, 2); /* store the vectorized inverse as a row the output */ for(i=0; i<2; i++) @@ -978,7 +959,6 @@ void invertLsMtx2D (*layoutInvMtx)[n*4+(i*2+j)] = tempInv[j*2+i]; } - free(tempGroup); utility_sinv_destroy(&hSinv); }