• R/O
  • SSH
  • HTTPS

openica: コミット


コミットメタ情報

リビジョン13 (tree)
日時2008-11-04 20:40:14
作者yuu-t

ログメッセージ

permutation solving method is changed in bt_ica and rt_ica

変更サマリ

差分

--- openica/bt_ica/fdica_batch.cc (revision 12)
+++ openica/bt_ica/fdica_batch.cc (revision 13)
@@ -28,6 +28,7 @@
2828
2929 void ProjectionBack_eachSource( C3_VECTOR &in_W, C3_VECTOR &out_WPB, int in_out_idx );
3030 void SolvePerm_by_DOA( C3_VECTOR &W, D_VECTOR &micpos, int Fs );
31+void SolvePerm_by_Phase( C3_VECTOR &W );
3132
3233 void load_init_matrix( char *in_fname, C3_VECTOR &out_W );
3334 void load_init_matrix_identity( C3_VECTOR &out_W );
@@ -103,7 +104,7 @@
103104 **/
104105 if( param->solve_perm_type == SOLVE_PERM_DOA) {
105106 fprintf( stderr, "DOA-based permutation solving\n");
106- SolvePerm_by_DOA( W_ICA, param->micpos, param->Fs );
107+ SolvePerm_by_Phase( W_ICA );
107108 }
108109
109110 /**
@@ -202,72 +203,23 @@
202203 }
203204 }
204205
205-/** Estimating DOA based on phase information
206- *
207- * @param in_W unmixing matrix
208- * @param DOA_deg estimated DOAs in degree
209- * @param DOA_isv validate flag of estimated DOA
210- * @param Fs sampling frequnecy
211- * @param micpos microphone positions
206+
207+/** Sovling Permutation based on phase difference (2x2 only)
212208 *
209+ * @param W target umixing matrices W[FFTsize][output channels][input channels]
210+ *
213211 */
214-void DOA_estimation( C3_VECTOR &W, D2_VECTOR &DOA_deg, I2_VECTOR &DOA_isv, int Fs, D_VECTOR &micpos )
212+void SolvePerm_by_Phase( C3_VECTOR &W )
215213 {
216- int bins, ins, outs;
217- int bin, j;
214+ int bins = W.size();
215+ int nOUTs = W[0].size();
218216
219- C3_VECTOR W_INV;
220-
221- bins = W.size();
222- outs = W[0].size();
223- ins = W[0][0].size();
224-
225- init_3d( W_INV, bins/2+1, outs, ins );
226-
227- /** Make inversion **/
228- for( bin = 0; bin < bins/2+1 ; bin++ )
229- pinv( W[bin], W_INV[bin], 1.0e-12 );
230-
231- /** **/
232- for( bin = 1 ; bin < bins/2+1; bin++ ) {
233- for( j = 0 ; j < ins ; j++ ){
234- DOA_deg[j][bin] = c_angle( c_div(W_INV[bin][0][j], W_INV[bin][1][j]) ) * SOUND_VELOCITY / ( 2.0 * PI * (FLOAT)bin * (FLOAT) Fs / (FLOAT)bins * (micpos[0] - micpos[1] ) );
235- if( fabs( DOA_deg[j][bin] ) > 1 || isnan(DOA_deg[j][bin]) ) {
236- DOA_deg[j][bin] = DOA_deg[j][bin]/fabs(DOA_deg[j][bin]) * 90.0;
237- DOA_isv[j][bin] = 0;
238- } else {
239- DOA_deg[j][bin] = asin( DOA_deg[j][bin] ) / PI * 180;
240- DOA_isv[j][bin] = 1;
241- }
242- }
243- }
244-
245-}
246-
247-/** Solving Permutation based on estimated DOA (Now, 2 input 2 output only )
248- *
249- * @param W target unmixing matrices W[FFTsize][output channels][input channels]
250- * @param micpos microphone positions
251- * @param in_out_idx source number of desired source
252- * @param Sampling Frequnecy
253- */
254-void SolvePerm_by_DOA( C3_VECTOR &W, D_VECTOR &micpos, int Fs )
255-{
256- int nOUTs = W[0].size();
257- int bins = W.size();
258- int bin;
217+ D_VECTOR phase_diff( nOUTs );
259218 COMPLEX c_tmp;
260-
261- D2_VECTOR DOA_deg( nOUTs, D_VECTOR(bins/2+1) );
262- I2_VECTOR DOA_isv( nOUTs, I_VECTOR(bins/2+1) );
263-
264- DOA_estimation( W, DOA_deg, DOA_isv, Fs, micpos );
265-
266- /** sorting **/
267- /** DC component is not contribute to separate, then
268- we do not use DC component **/
269- for( bin = 1; bin < bins/2+1 ; bin++ ){
270- if( DOA_isv[0][bin] && DOA_isv[1][bin] && DOA_deg[0][bin] < DOA_deg[1][bin] ){
219+ for ( int bin = 1 ; bin < bins/2+1 ; bin++ ){
220+ for( int j = 0; j < nOUTs ; j++ )
221+ phase_diff[j] = c_angle( c_div( W[bin][j][0], W[bin][j][1] ) );
222+ if( phase_diff[ 0 ] > phase_diff[ 1 ] ){
271223 c_tmp = W[bin][0][0];
272224 W[bin][0][0] = W[bin][1][0];
273225 W[bin][1][0] = c_tmp;
@@ -279,7 +231,6 @@
279231 }
280232 }
281233
282-
283234 /** Load initial unmixing matrix.
284235 *
285236 * @param in_fname filename of initial unmixing matrix
--- openica/rt_ica/fdica_blkwise.cc (revision 12)
+++ openica/rt_ica/fdica_blkwise.cc (revision 13)
@@ -420,72 +420,22 @@
420420 return 0;
421421 }
422422
423-
424-/** Estimating DOA based on phase information
425- *
426- * @param in_W unmixing matrix
427- * @param DOA_deg estimated DOAs in degree
428- * @param DOA_isv validate flag of estimated DOA
429- * @param Fs sampling frequnecy
430- * @param micpos microphone positions
423+/** Sovling Permutation based on phase difference (2x2 only)
431424 *
425+ * @param W target umixing matrices W[FFTsize][output channels][input channels]
426+ *
432427 */
433-void DOA_estimation( C3_VECTOR &W, D2_VECTOR &DOA_deg, I2_VECTOR &DOA_isv, int Fs, D_VECTOR &micpos )
428+void SolvePerm_by_Phase( C3_VECTOR &W )
434429 {
435- int bins, ins, outs;
436- int bin, j;
430+ int bins = W.size();
431+ int nOUTs = W[0].size();
437432
438- C3_VECTOR W_INV;
439-
440- bins = W.size();
441- outs = W[0].size();
442- ins = W[0][0].size();
443-
444- init_3d( W_INV, bins/2+1, outs, ins );
445-
446- /** Make inversion **/
447- for( bin = 0; bin < bins/2+1 ; bin++ )
448- pinv( W[bin], W_INV[bin], 1.0e-12 );
449-
450- /** **/
451- for( bin = 1 ; bin < bins/2+1; bin++ ) {
452- for( j = 0 ; j < ins ; j++ ){
453- DOA_deg[j][bin] = c_angle( c_div(W_INV[bin][0][j], W_INV[bin][1][j]) ) * SOUND_VELOCITY / ( 2.0 * PI * (FLOAT)bin * (FLOAT) Fs / (FLOAT)bins * (micpos[0] - micpos[1] ) );
454- if( fabs( DOA_deg[j][bin] ) > (1-EPS) || isnan(DOA_deg[j][bin]) ) {
455- DOA_deg[j][bin] = DOA_deg[j][bin]/fabs(DOA_deg[j][bin]) * 90.0;
456- DOA_isv[j][bin] = 0;
457- } else {
458- DOA_deg[j][bin] = asin( DOA_deg[j][bin] ) / PI * 180;
459- DOA_isv[j][bin] = 1;
460- }
461- }
462- }
463-
464-}
465-
466-/** Solving Permutation based on estimated DOA (Now, 2 input 2 output only )
467- *
468- * @param W target unmixing matrices W[FFTsize][output channels][input channels]
469- * @param micpos microphone positions
470- * @param Fs Sampling Frequnecy
471- */
472-void SolvePerm_by_DOA( C3_VECTOR &W, D_VECTOR &micpos, int Fs )
473-{
474- int nOUTs = W[0].size();
475- int bins = W.size();
476- int bin;
433+ D_VECTOR phase_diff( nOUTs );
477434 COMPLEX c_tmp;
478-
479- D2_VECTOR DOA_deg( nOUTs, D_VECTOR(bins/2+1) );
480- I2_VECTOR DOA_isv( nOUTs, I_VECTOR(bins/2+1) );
481-
482- DOA_estimation( W, DOA_deg, DOA_isv, Fs, micpos );
483-
484- /** sorting **/
485- /** DC component is not contribute to separate, then
486- we do not use DC component **/
487- for( bin = 1; bin < bins/2+1 ; bin++ ){
488- if( DOA_isv[0][bin] && DOA_isv[1][bin] && DOA_deg[0][bin] > DOA_deg[1][bin] ){
435+ for ( int bin = 1 ; bin < bins/2+1 ; bin++ ){
436+ for( int j = 0; j < nOUTs ; j++ )
437+ phase_diff[j] = c_angle( c_div( W[bin][j][0], W[bin][j][1] ) );
438+ if( phase_diff[ 0 ] > phase_diff[ 1 ] ){
489439 c_tmp = W[bin][0][0];
490440 W[bin][0][0] = W[bin][1][0];
491441 W[bin][1][0] = c_tmp;
@@ -594,7 +544,7 @@
594544
595545 /** Solving Permuatation **/
596546 if( param->solve_perm_type == SOLVE_PERM_DOA )
597- SolvePerm_by_DOA( W, param->micpos, param->Fs );
547+ SolvePerm_by_Phase( W );
598548 else if( param->solve_perm_type == SOLVE_PERM_POWER )
599549 SolvePerm_by_Power( W, Yst, param, bp );
600550
@@ -827,7 +777,7 @@
827777
828778 /** Solving Permuatation **/
829779 if( param->solve_perm_type == SOLVE_PERM_DOA )
830- SolvePerm_by_DOA( W, param->micpos, param->Fs );
780+ SolvePerm_by_Phase( W );
831781 else if( param->solve_perm_type == SOLVE_PERM_POWER )
832782 SolvePerm_by_Power( W, Yst, param, bp );
833783
--- openica/ChangeLog (revision 12)
+++ openica/ChangeLog (revision 13)
@@ -1,3 +1,8 @@
1+2008-11-04 Takahashi Yuu <yuu-t@spacy6.naist.jp>
2+
3+ * Permutation solving methods is changed.
4+ New method utilize only unmixing matrix.
5+
16 2008-09-01 Takahashi Yuu <yuu-t@spacy6.naist.jp>
27
38 * Release 0.0.4
旧リポジトリブラウザで表示