「DCexchange」の編集履歴(バックアップ)一覧はこちら

DCexchange」(2009/01/21 (水) 20:48:47) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

//cpp /** * @brief origin shift (top-left <-> center) * @author maeda * @date 2008/09/10 */ #include "DCexchange.h" /** * in-place DC exchange for 2dimensional data (top-left <-> center) * this function works both odd/even size data * @param data fft data * @param cols column size of the data ( sometimes the size of x ) * @param rows row size of the data ( sometimes the size of y ) * @return true if succeed */ int maDCexchange2D( fftw_complex *data, int cols, int rows ) { int i,j; int p1,p2; // point position int c2,r2; // temporary for cols/2,rows/2 double re,im; // temporary if( data==NULL ) return false; if( rows<0 || cols<0 ) return false; c2 = cols/2; r2 = rows/2; for( j=0; j<r2; j++ ){ for( i=0; i<cols; i++ ){ // exchange p1( i, j ) <-> p2( (cols/2+i)%cols, rows/2+j ) p1 = j*cols + i; p2 = (r2+j)*cols + (r2+i)%cols; re = data[p1][0]; im = data[p1][1]; data[p1][0] = data[p2][0]; data[p1][1] = data[p2][1]; data[p2][0] = re; data[p2][1] = im; } } return true; }
//cpp /** * @brief origin shift (top-left <-> center) * @author maeda * @date 2008/09/10 */ #include "DCexchange.h" /** * in-place DC exchange for 2dimensional data (top-left <-> center) * this function works both odd/even size data * @param data fft data * @param cols column size of the data ( sometimes the size of x ) * @param rows row size of the data ( sometimes the size of y ) * @return true if succeed */ int maDCexchange2D( fftw_complex *data, int cols, int rows ) { int i,j; int p1,p2; // point position int c2,r2; // temporary for cols/2,rows/2 double re,im; // temporary if( data==NULL ) return false; if( rows<0 || cols<0 ) return false; c2 = cols/2; r2 = rows/2; for( j=0; j<r2; j++ ){ for( i=0; i<cols; i++ ){ // exchange p1( i, j ) <-> p2( (cols/2+i)%cols, rows/2+j ) p1 = j*cols + i; p2 = (r2+j)*cols + (c2+i)%cols; re = data[p1][0]; im = data[p1][1]; data[p1][0] = data[p2][0]; data[p1][1] = data[p2][1]; data[p2][0] = re; data[p2][1] = im; } } return true; }

表示オプション

横に並べて表示:
変化行の前後のみ表示: