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

📄 ofilter2.c

📁 LastWave
💻 C
📖 第 1 页 / 共 2 页
字号:
/*..........................................................................*//*                                                                          *//*      L a s t W a v e    P a c k a g e 'owtrans2d' 2.1                    *//*                                                                          *//*      Copyright (C) 1998-2002 Geoff Davis, Emmanuel Bacry, Jerome Fraleu. *//*                                                                          *//*      The original program was written in C++ by Geoff Davis.             *//*      Then it has been translated in C and adapted to LastWave by         *//*      J. Fraleu and E. Bacry.                                             *//*                                                                          *//*      If you are interested in the C++ code please go to                  *//*          http://www.cs.dartmouth.edu/~gdavis                             *//*                                                                          *//*      emails : geoffd@microsoft.com                                       *//*               fraleu@cmap.polytechnique.fr                               *//*               lastwave@cmap.polytechnique.fr                             *//*                                                                          *//*..........................................................................*//*                                                                          *//*      This program is a free software, you can redistribute it and/or     *//*      modify it under the terms of the GNU General Public License as      *//*      published by the Free Software Foundation; either version 2 of the  *//*      License, or (at your option) any later version                      *//*                                                                          *//*      This program is distributed in the hope that it will be useful,     *//*      but WITHOUT ANY WARRANTY; without even the implied warranty of      *//*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *//*      GNU General Public License for more details.                        *//*                                                                          *//*      You should have received a copy of the GNU General Public License   *//*      along with this program (in a file named COPYRIGHT);                *//*      if not, write to the Free Software Foundation, Inc.,                *//*      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA             *//*                                                                          *//*..........................................................................*/#include "lastwave.h"#include "owtrans2d.h"/************************************************* * * The coefficients of the different filters * *************************************************/ /* Haar */ #define Sqrt2 1.414213562static LWFLOAT HaarCoeffs [] = { 1.0/Sqrt2, 1.0/Sqrt2 };/* A few Daubechies filters */static LWFLOAT Daub4Coeffs [] = { 0.4829629131445341,  0.8365163037378077,		          0.2241438680420134, -0.1294095225512603 };static LWFLOAT Daub6Coeffs [] = { 0.3326705529500825,  0.8068915093110924,		          0.4598775021184914, -0.1350110200102546,		         -0.0854412738820267,  0.0352262918857095 };static LWFLOAT Daub8Coeffs [] = { 0.2303778133088964,  0.7148465705529154,			  0.6308807679398587, -0.0279837694168599,			 -0.1870348117190931,  0.0308413818355607,			  0.0328830116668852, -0.0105974017850690 };/* Filter from Eero Simoncelli's PhD thesis -- used in Edward Adelson's EPIC wavelet coder   These are probably the filter coefficients used in Shapiro's EZW paper */static LWFLOAT AdelsonCoeffs[] = { 0.028220367, -0.060394127, -0.07388188, 			 0.41394752,   0.7984298,   0.41394752, 			 -0.07388188, -0.060394127, 0.028220367 };/* 7/9 Filter from M. Antonini, M. Barlaud, P. Mathieu, and I. Daubechies, "Image coding using wavelet transform", IEEE Transactions on Image Processing", Vol. pp. 205-220, 1992. */static LWFLOAT AntoniniSynthesis [] = { -6.453888262893856e-02,			      -4.068941760955867e-02,			       4.180922732222124e-01,			       7.884856164056651e-01,			       4.180922732222124e-01,			      -4.068941760955867e-02,			      -6.453888262893856e-02 };static LWFLOAT AntoniniAnalysis[] =  {  3.782845550699535e-02,			     -2.384946501937986e-02,			     -1.106244044184226e-01,			      3.774028556126536e-01,			      8.526986790094022e-01,			      3.774028556126537e-01,			     -1.106244044184226e-01,			     -2.384946501937986e-02,			      3.782845550699535e-02 };/* Unpublished 18/10 filter from Villasenor's group */static LWFLOAT Villa1810Synthesis [] = { 9.544158682436510e-04,			  -2.727196296995984e-06,			  -9.452462998353147e-03,			  -2.528037293949898e-03,			   3.083373438534281e-02,			  -1.376513483818621e-02,			  -8.566118833165798e-02,			   1.633685405569902e-01,			   6.233596410344172e-01,			   6.233596410344158e-01,			   1.633685405569888e-01,			  -8.566118833165885e-02,			  -1.376513483818652e-02,			   3.083373438534267e-02,			  -2.528037293949898e-03,			  -9.452462998353147e-03,			  -2.727196296995984e-06,			   9.544158682436510e-04};static LWFLOAT Villa1810Analysis [] = {  2.885256501123136e-02,			   8.244478227504624e-05,			  -1.575264469076351e-01,			   7.679048884691438e-02,			   7.589077294537618e-01,			   7.589077294537619e-01,			   7.679048884691436e-02,			  -1.575264469076351e-01,			   8.244478227504624e-05,			   2.885256501123136e-02};/* Filters from Chris Brislawn's tutorial code */static LWFLOAT BrislawnAnalysis [] = {  0.037828455506995,  -0.023849465019380, 			       -0.110624404418423,   0.377402855612654,				0.852698679009403, 				0.377402855612654,  -0.110624404418423,			       -0.023849465019380,   0.037828455506995 };static LWFLOAT BrislawnSynthesis [] = { -0.064538882628938, -0.040689417609558,				 0.418092273222212, 				 0.788485616405664,				 0.418092273222212, 				-0.040689417609558, -0.064538882628938};static LWFLOAT Brislawn2Analysis [] = {  0.026913419, -0.032303352,			        -0.241109818,  0.054100420,			         0.899506092,  0.899506092, 			         0.054100420, -0.241109818, 			        -0.032303352,  0.026913419};static LWFLOAT Brislawn2Synthesis [] = { 0.019843545,  0.023817599, 				-0.023257840,  0.145570740,  				 0.541132748,  0.541132748, 				 0.145570740, -0.023257840, 				 0.023817599, 0.019843545 };/* Filters from J. Villasenor, B. Belzer, J. Liao, "Wavelet Filter Evaluation for Image Compression." IEEE Transactions on Image Processing, Vol. 2, pp. 1053-1060, August 1995. */static LWFLOAT Villa1Analysis [] = {  3.782845550699535e-02,  -2.384946501937986e-02,  -1.106244044184226e-01,  3.774028556126536e-01,  8.526986790094022e-01,  3.774028556126537e-01,  -1.106244044184226e-01,  -2.384946501937986e-02,  3.782845550699535e-02};static LWFLOAT Villa1Synthesis [] = {  -6.453888262893856e-02,  -4.068941760955867e-02,  4.180922732222124e-01,  7.884856164056651e-01,  4.180922732222124e-01,  -4.068941760955867e-02,  -6.453888262893856e-02};static LWFLOAT Villa2Analysis [] = {  -8.472827741318157e-03,  3.759210316686883e-03,  4.728175282882753e-02,  -3.347508104780150e-02,  -6.887811419061032e-02,  3.832692613243884e-01,  7.672451593927493e-01,  3.832692613243889e-01,  -6.887811419061045e-02,  -3.347508104780156e-02,  4.728175282882753e-02,  3.759210316686883e-03,  -8.472827741318157e-03};static LWFLOAT Villa2Synthesis [] = {  1.418215589126359e-02,  6.292315666859828e-03,  -1.087373652243805e-01,  -6.916271012030040e-02,  4.481085999263908e-01,  8.328475700934288e-01,  4.481085999263908e-01,  -6.916271012030040e-02,  -1.087373652243805e-01,  6.292315666859828e-03,  1.418215589126359e-02};static LWFLOAT Villa3Analysis [] = {  -1.290777652578771e-01,  4.769893003875977e-02,  7.884856164056651e-01,  7.884856164056651e-01,  4.769893003875977e-02,  -1.290777652578771e-01};static LWFLOAT Villa3Synthesis [] = {  1.891422775349768e-02,  6.989495243807747e-03,  -6.723693471890128e-02,  1.333892255971154e-01,  6.150507673110278e-01,  6.150507673110278e-01,  1.333892255971154e-01,  -6.723693471890128e-02,  6.989495243807747e-03,  1.891422775349768e-02};static LWFLOAT Villa4Analysis [] = {  -1.767766952966369e-01,  3.535533905932738e-01,  1.060660171779821e+00,  3.535533905932738e-01,  -1.767766952966369e-01};static LWFLOAT Villa4Synthesis [] = {  3.535533905932738e-01,  7.071067811865476e-01,  3.535533905932738e-01};static LWFLOAT Villa5Analysis [] = {  7.071067811865476e-01,  7.071067811865476e-01};static LWFLOAT Villa5Synthesis [] = {  -8.838834764831845e-02,  8.838834764831845e-02,  7.071067811865476e-01,  7.071067811865476e-01,  8.838834764831845e-02,  -8.838834764831845e-02};static LWFLOAT Villa6Analysis [] = {  3.314563036811943e-02,  -6.629126073623885e-02,  -1.767766952966369e-01,  4.198446513295127e-01,  9.943689110435828e-01,  4.198446513295127e-01,  -1.767766952966369e-01,  -6.629126073623885e-02,  3.314563036811943e-02};static LWFLOAT Villa6Synthesis [] = {  3.535533905932738e-01,  7.071067811865476e-01,  3.535533905932738e-01};/* Other Filter */static LWFLOAT OdegardAnalysis[] = {   5.2865768532960523e-02,  -3.3418473279346828e-02,  -9.3069263703582719e-02,   3.8697186387262039e-01,   7.8751377152779212e-01,   3.8697186387262039e-01,  -9.3069263703582719e-02,  -3.3418473279346828e-02,   5.2865768532960523e-02};static LWFLOAT OdegardSynthesis[] = {  -8.6748316131711606e-02,  -5.4836926902779436e-02,   4.4030170672498536e-01,   8.1678063499210640e-01,   4.4030170672498536e-01,  -5.4836926902779436e-02,  -8.6748316131711606e-02};/************************************************* * * Functions that deals with OFilter2 structure * *************************************************/ static OFILTER2 NewOFilter2(void){  OFILTER2 filter;    filter = (OFILTER2) Malloc(sizeof(struct ofilter2));    filter->coeff = NULL;  filter->size = 0;  filter->firstIndex = 0;    return(filter);}

⌨️ 快捷键说明

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