⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wavelet.c

📁 QccPack implementation in C
💻 C
📖 第 1 页 / 共 2 页
字号:
int QccWAVWaveletAnalysis2D(const QccMatrix input_matrix,                            QccMatrix output_matrix,                            int num_rows,                            int num_cols,                            int phase_row,                            int phase_col,                            const QccWAVWavelet *wavelet){  int return_value;  int row, col;  QccVector input_column = NULL;  QccVector output_column = NULL;  if (input_matrix == NULL)    return(0);  if (output_matrix == NULL)    return(0);  if (wavelet == NULL)    return(0);  if ((input_column = QccVectorAlloc(num_rows)) == NULL)    {        QccErrorAddMessage("(QccWAVWaveletAnalysis2D): Error calling QccVectorAlloc()");        goto QccError;    }  if ((output_column = QccVectorAlloc(num_rows)) == NULL)    {        QccErrorAddMessage("(QccWAVWaveletAnalysis2D): Error calling QccVectorAlloc()");        goto QccError;    }  for (row = 0; row < num_rows; row++)    if (QccWAVWaveletAnalysis1D(input_matrix[row],                                output_matrix[row],                                num_cols,                                phase_row,                                wavelet))      {        QccErrorAddMessage("(QccWAVWaveletAnalysis2D): Error calling QccWAVWaveletAnalysis1D()");        goto QccError;      }  for (col = 0; col < num_cols; col++)    {      for (row = 0; row < num_rows; row++)        input_column[row] = output_matrix[row][col];      if (QccWAVWaveletAnalysis1D(input_column,                                  output_column,                                  num_rows,                                  phase_col,                                  wavelet))        {          QccErrorAddMessage("(QccWAVWaveletAnalysis2D): Error calling QccWAVWaveletAnalysis1D()");          goto QccError;        }            for (row = 0; row < num_rows; row++)        output_matrix[row][col] = output_column[row];    }  return_value = 0;  goto QccReturn; QccError:  return_value = 1; QccReturn:  QccVectorFree(input_column);  QccVectorFree(output_column);  return(return_value);}int QccWAVWaveletSynthesis2D(const QccMatrix input_matrix,                             QccMatrix output_matrix,                             int num_rows,                             int num_cols,                             int phase_row,                             int phase_col,                             const QccWAVWavelet *wavelet){  int return_value;  int row, col;  QccVector input_column = NULL;  QccVector output_column = NULL;  QccVector input_row = NULL;  if (input_matrix == NULL)    return(0);  if (output_matrix == NULL)    return(0);  if (wavelet == NULL)    return(0);  if ((input_column = QccVectorAlloc(num_rows)) == NULL)    {        QccErrorAddMessage("(QccWAVWaveletSynthesis2D): Error calling QccVectorAlloc()");        goto QccError;    }  if ((output_column = QccVectorAlloc(num_rows)) == NULL)    {        QccErrorAddMessage("(QccWAVWaveletSynthesis2D): Error calling QccVectorAlloc()");        goto QccError;    }  if ((input_row = QccVectorAlloc(num_cols)) == NULL)    {        QccErrorAddMessage("(QccWAVWaveletSynthesis2D): Error calling QccVectorAlloc()");        goto QccError;    }  for (col = 0; col < num_cols; col++)    {      for (row = 0; row < num_rows; row++)        input_column[row] = input_matrix[row][col];      if (QccWAVWaveletSynthesis1D(input_column,                                   output_column,                                   num_rows,                                   phase_col,                                   wavelet))        {          QccErrorAddMessage("(QccWAVWaveletSynthesis2D): Error calling QccWAVWaveletSynthesis1D()");          goto QccError;        }            for (row = 0; row < num_rows; row++)        output_matrix[row][col] = output_column[row];    }  for (row = 0; row < num_rows; row++)    {      for (col = 0; col < num_cols; col++)        input_row[col] = output_matrix[row][col];      if (QccWAVWaveletSynthesis1D(input_row,                                   output_matrix[row],                                   num_cols,                                   phase_row,                                   wavelet))        {          QccErrorAddMessage("(QccWAVWaveletSynthesis2D): Error calling QccWAVWaveletSynthesis1D()");          goto QccError;        }    }  return_value = 0;  goto QccReturn; QccError:  return_value = 1; QccReturn:  QccVectorFree(input_column);  QccVectorFree(output_column);  QccVectorFree(input_row);  return(return_value);}int QccWAVWaveletAnalysis3D(const QccVolume input_volume,                            QccVolume output_volume,                            int num_frames,                            int num_rows,                            int num_cols,                            int phase_frame,                            int phase_row,                            int phase_col,                            const QccWAVWavelet *wavelet){  int return_value;  int frame, row, col;  QccVector input_z = NULL;  QccVector output_z = NULL;    if (input_volume == NULL)    return(0);  if (output_volume == NULL)    return(0);  if (wavelet == NULL)    return(0);    if ((input_z = QccVectorAlloc(num_frames)) == NULL)    {      QccErrorAddMessage("(QccWAVWaveletAnalysis3D): Error calling QccVectorAlloc()");      goto QccError;    }  if ((output_z = QccVectorAlloc(num_frames)) == NULL)    {      QccErrorAddMessage("(QccWAVWaveletAnalysis3D): Error calling QccVectorAlloc()");      goto QccError;    }    for (frame = 0; frame < num_frames; frame++)    if (QccWAVWaveletAnalysis2D(input_volume[frame],                                output_volume[frame],                                num_rows,                                num_cols,                                phase_row,                                phase_col,                                wavelet))      {        QccErrorAddMessage("(QccWAVWaveletAnalysis3D): Error calling QccWAVWaveletAnalysis2D()");        goto QccError;      }    for (row = 0; row < num_rows; row++)    for (col = 0; col < num_cols; col++)      {        for (frame = 0; frame < num_frames; frame++)          input_z[frame] = output_volume[frame][row][col];                if (QccWAVWaveletAnalysis1D(input_z,                                    output_z,                                    num_frames,                                    phase_frame,                                    wavelet))          {            QccErrorAddMessage("(QccWAVWaveletAnalysis3D): Error calling QccWAVWaveletAnalysis1D()");            goto QccError;          }                for (frame = 0; frame < num_frames; frame++)          output_volume[frame][row][col] = output_z[frame];      }    return_value = 0;  goto QccReturn; QccError:  return_value = 1; QccReturn:  QccVectorFree(input_z);  QccVectorFree(output_z);  return(return_value);}int QccWAVWaveletSynthesis3D(const QccVolume input_volume,                             QccVolume output_volume,                             int num_frames,                             int num_rows,                             int num_cols,                             int phase_frame,                             int phase_row,                             int phase_col,                             const QccWAVWavelet *wavelet){  int return_value;  int frame, row, col;  QccVector input_z = NULL;  QccVector output_z = NULL;  QccMatrix input_frame = NULL;    if (input_volume == NULL)    return(0);  if (output_volume == NULL)    return(0);  if (wavelet == NULL)    return(0);    if ((input_z = QccVectorAlloc(num_frames)) == NULL)    {      QccErrorAddMessage("(QccWAVWaveletSynthesis3D): Error calling QccVectorAlloc()");      goto QccError;    }  if ((output_z = QccVectorAlloc(num_frames)) == NULL)    {      QccErrorAddMessage("(QccWAVWaveletSynthesis3D): Error calling QccVectorAlloc()");      goto QccError;    }    if ((input_frame = QccMatrixAlloc(num_rows, num_cols)) == NULL)    {      QccErrorAddMessage("(QccWAVWaveletSynthesis3D): Error calling QccMatrixAlloc()");      goto QccError;    }    for (row = 0; row < num_rows; row++)    for (col = 0; col < num_cols; col++)      {        for (frame = 0; frame < num_frames; frame++)          input_z[frame] = input_volume[frame][row][col];                if (QccWAVWaveletSynthesis1D(input_z,                                     output_z,                                     num_frames,                                     phase_frame,                                     wavelet))          {            QccErrorAddMessage("(QccWAVWaveletSynthesis3D): Error calling QccWAVWaveletSynthesis1D()");            goto QccError;          }                for (frame = 0; frame < num_frames; frame++)          output_volume[frame][row][col] = output_z[frame];      }    for (frame = 0; frame < num_frames; frame++)    {      if (QccMatrixCopy(input_frame, output_volume[frame], num_rows, num_cols))	{	  QccErrorAddMessage("(QccWAVWaveletSynthesis3D): Error calling QccMatrixCopy()");	  goto QccError;	}            if (QccWAVWaveletSynthesis2D(input_frame,                                   output_volume[frame],                                   num_rows,                                   num_cols,                                   phase_row,                                   phase_col,                                   wavelet))        {          QccErrorAddMessage("(QccWAVWaveletSynthesis3D): Error calling QccWAVWaveletSynthesis2D()");          goto QccError;        }    }    return_value = 0;  goto QccReturn; QccError:  return_value = 1; QccReturn:  QccVectorFree(input_z);  QccVectorFree(output_z);  QccMatrixFree(input_frame, num_rows);  return(return_value);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -