int main(){ // Using C API to decompose 1D signal. // Results equivalent to pywt.dwt([1,2,3,4,5,6,7,8], 'db2', 'zpd'). // Compile: gcc -I../src dwt_decompose.c ../src/wt.c ../src/wavelets.c ../src/common.c ../src/convolution.c Wavelet *w = wavelet('d', 2); MODE mode = MODE_ZEROPAD; int i; float input[] = {1,2,3,4,5,6,7,8,9}; float *cA, *cD; index_t input_len, output_len; input_len = sizeof input / sizeof input[0]; output_len = dwt_buffer_length(input_len, w->dec_len, mode); cA = wtcalloc(output_len, sizeof(float)); cD = wtcalloc(output_len, sizeof(float)); printf("Wavelet: %s %d\n\n", w->family_name, w->vanishing_moments_psi); float_dec_a(input, input_len, w, cA, output_len, mode); float_dec_d(input, input_len, w, cD, output_len, mode); for(i=0; i<output_len; i++){ printf("%f ", cA[i]); } printf("\n\n"); for(i=0; i<output_len; i++){ printf("%f ", cD[i]); } printf("\n"); free_wavelet(w); wtfree(cA); wtfree(cD); return 0; }
void MainWindow::open_file() { std::cout << "MainWindow::open_file()\n"; std::string filename = run_open_file_dialog("Select stegocontener to read", Gtk::FILE_CHOOSER_ACTION_OPEN); if(filename != "") { m_png = Cairo::ImageSurface::create_from_png(filename); if(!m_png) { Gtk::MessageDialog err(*this, "Open file failed", false, Gtk::MESSAGE_ERROR); err.set_secondary_text("Open file failed"); err.run(); } else { Image image(m_png); Wavelet wavelet(image); std::string test_text = wavelet.read_text(); // std::cout<<" READED TEXT : '"<<test_text<<"'\n"; std::ostringstream msg; msg << "Size: " << m_png->get_width() << "x" << m_png->get_height() << ", readed " << test_text.size() << " characters"; m_statusbar.push(msg.str()); m_text.get_buffer()->set_text(test_text); m_first.set_size_request(m_png->get_width(), m_png->get_height()); m_first.show(); m_text_window.set_size_request(m_png->get_width(), m_png->get_height()); m_text_window.show(); m_save.set_sensitive(true); } } }
int Wave::unreadBlipCount() const { return wavelet()->unreadBlipCount(); }
int Wave::blipCount() const { return wavelet()->blipCount(); }
void SPHSystem::comp_energy() { Particle *p; Particle *np; int3 cell_pos; int3 near_pos; uint hash; float3 rel_pos; float r2; for(uint i=0; i<num_particle; i++) { p=&(mem[i]); cell_pos=calc_cell_pos(p->pos); float3 transform=make_float3(0.0f); float3 tot_trans=make_float3(0.0f); float3 vel_trans=make_float3(0.0f); for(int x=-1; x<=1; x++) { for(int y=-1; y<=1; y++) { for(int z=-1; z<=1; z++) { near_pos.x=cell_pos.x+x; near_pos.y=cell_pos.y+y; near_pos.z=cell_pos.z+z; hash=calc_cell_hash(near_pos); if(hash == 0xffffffff) { continue; } np=cell[hash].start; while(np != NULL) { rel_pos=np->pos-p->pos; r2=rel_pos.x*rel_pos.x+rel_pos.y*rel_pos.y+rel_pos.z*rel_pos.z; if(r2<INF || r2>=kernel_2[p->level]) { np=np->next; continue; } transform.x=wavelet(rel_pos.x/kernel[p->level]); transform.y=wavelet(rel_pos.y/kernel[p->level]); transform.z=wavelet(rel_pos.z/kernel[p->level]); tot_trans=tot_trans+transform; vel_trans.x=vel_trans.x+(np->vel.x*transform.x/sqrt(kernel[p->level])); vel_trans.y=vel_trans.y+(np->vel.y*transform.y/sqrt(kernel[p->level])); vel_trans.z=vel_trans.z+(np->vel.z*transform.z/sqrt(kernel[p->level])); np=np->next; } } } } vel_trans=vel_trans/tot_trans; p->energy=0.5f*(vel_trans.x*vel_trans.x+vel_trans.y*vel_trans.y+vel_trans.z*vel_trans.z); } }
void SPHSystem::comp_dens_pres() { Particle *p; Particle *np; int3 cell_pos; int3 near_pos; uint hash; float3 rel_pos; float r2; for(uint i=0; i<num_particle; i++) { p=&(mem[i]); cell_pos=calc_cell_pos(p->pos); float3 transform=make_float3(0.0f); float3 tot_trans=make_float3(0.0f); float3 vel_trans=make_float3(0.0f); p->dens=0.0f; p->pres=0.0f; for(int x=-1; x<=1; x++) { for(int y=-1; y<=1; y++) { for(int z=-1; z<=1; z++) { near_pos.x=cell_pos.x+x; near_pos.y=cell_pos.y+y; near_pos.z=cell_pos.z+z; hash=calc_cell_hash(near_pos); if(hash == 0xffffffff) { continue; } np=cell[hash].start; while(np != NULL) { rel_pos=np->pos-p->pos; r2=rel_pos.x*rel_pos.x+rel_pos.y*rel_pos.y+rel_pos.z*rel_pos.z; if(r2<INF || r2>=kernel_2[p->level]) { np=np->next; continue; } p->dens=p->dens + mass[np->level] * poly6_value[p->level] * pow(kernel_2[p->level]-r2, 3); if(enable_split == 1 && tick == 0 || enable_merge == 1 && tick == 1) { transform.x=wavelet(rel_pos.x/kernel[p->level]); transform.y=wavelet(rel_pos.y/kernel[p->level]); transform.z=wavelet(rel_pos.z/kernel[p->level]); tot_trans=tot_trans+transform; vel_trans.x=vel_trans.x+(np->vel.x*transform.x/sqrt(kernel[p->level])); vel_trans.y=vel_trans.y+(np->vel.y*transform.y/sqrt(kernel[p->level])); vel_trans.z=vel_trans.z+(np->vel.z*transform.z/sqrt(kernel[p->level])); } np=np->next; } } } } if(enable_split == 1 && tick == 0 || enable_merge == 1 && tick == 1) { vel_trans=vel_trans/tot_trans; p->energy=0.5f*(vel_trans.x*vel_trans.x+vel_trans.y*vel_trans.y+vel_trans.z*vel_trans.z); } p->dens=p->dens+self_dens[p->level]; p->pres=(pow(p->dens / rest_density, 7) - 1) *gas_constant; } }
Wavelet* wavelet(char name, int order) { Wavelet *w, *wtmp; index_t i; // Haar wavelet if(name == 'h' || name == 'H'){ // the same as db1 w = wavelet('d', 1); w->family_name = "Haar"; w->short_name = "haar"; return w; // Reverse biorthogonal wavelets family } else if (name == 'r' || name == 'R') { // rbio is like bior, only with switched filters wtmp = wavelet('b', order); w = copy_wavelet(wtmp); if(w == NULL) return NULL; w->dec_len = wtmp->rec_len; w->rec_len = wtmp->dec_len; /* w->dec_hi_offset = wtmp->rec_hi_offset; w->rec_hi_offset = wtmp->dec_hi_offset; w->dec_lo_offset = wtmp->rec_lo_offset; w->rec_lo_offset = wtmp->dec_lo_offset; */ for(i = 0; i < w->rec_len; ++i){ w->rec_lo_double[i] = wtmp->dec_lo_double[wtmp->dec_len-1-i]; w->rec_hi_double[i] = wtmp->dec_hi_double[wtmp->dec_len-1-i]; w->rec_lo_float[i] = wtmp->dec_lo_float[wtmp->dec_len-1-i]; w->rec_hi_float[i] = wtmp->dec_hi_float[wtmp->dec_len-1-i]; } for(i = 0; i < w->dec_len; ++i){ w->dec_hi_double[i] = wtmp->rec_hi_double[wtmp->rec_len-1-i]; w->dec_lo_double[i] = wtmp->rec_lo_double[wtmp->rec_len-1-i]; w->dec_hi_float[i] = wtmp->rec_hi_float[wtmp->rec_len-1-i]; w->dec_lo_float[i] = wtmp->rec_lo_float[wtmp->rec_len-1-i]; } w->vanishing_moments_psi = order / 10; // 1st digit w->vanishing_moments_phi = -1; w->family_name = "Reverse biorthogonal"; w->short_name = "rbio"; free_wavelet(wtmp); return w; } w = wtmalloc(sizeof(Wavelet)); if(w == NULL) return NULL; //w->dec_lo_offset = w->rec_lo_offset = 0; //w->dec_hi_offset = w->rec_hi_offset = 0; w->_builtin = 1; switch(name){ // Daubechies wavelets family case 'd': case 'D': w->dec_len = w->rec_len = 2*order; w->vanishing_moments_psi = order; w->vanishing_moments_phi = 0; w->support_width = 2*order - 1; w->orthogonal = 1; w->biorthogonal = 1; w->symmetry = ASYMMETRIC; w->compact_support = 1; w->family_name = "Daubechies"; w->short_name = "db"; switch (order) { case 1: w->dec_lo_double = db1_double[0]; w->dec_hi_double = db1_double[1]; w->rec_lo_double = db1_double[2]; w->rec_hi_double = db1_double[3]; w->dec_lo_float = db1_float[0]; w->dec_hi_float = db1_float[1]; w->rec_lo_float = db1_float[2]; w->rec_hi_float = db1_float[3]; break; case 2: w->dec_lo_double = db2_double[0]; w->dec_hi_double = db2_double[1]; w->rec_lo_double = db2_double[2]; w->rec_hi_double = db2_double[3]; w->dec_lo_float = db2_float[0]; w->dec_hi_float = db2_float[1]; w->rec_lo_float = db2_float[2]; w->rec_hi_float = db2_float[3]; break; case 3: w->dec_lo_double = db3_double[0]; w->dec_hi_double = db3_double[1]; w->rec_lo_double = db3_double[2]; w->rec_hi_double = db3_double[3]; w->dec_lo_float = db3_float[0]; w->dec_hi_float = db3_float[1]; w->rec_lo_float = db3_float[2]; w->rec_hi_float = db3_float[3]; break; case 4: w->dec_lo_double = db4_double[0]; w->dec_hi_double = db4_double[1]; w->rec_lo_double = db4_double[2]; w->rec_hi_double = db4_double[3]; w->dec_lo_float = db4_float[0]; w->dec_hi_float = db4_float[1]; w->rec_lo_float = db4_float[2]; w->rec_hi_float = db4_float[3]; break; case 5: w->dec_lo_double = db5_double[0]; w->dec_hi_double = db5_double[1]; w->rec_lo_double = db5_double[2]; w->rec_hi_double = db5_double[3]; w->dec_lo_float = db5_float[0]; w->dec_hi_float = db5_float[1]; w->rec_lo_float = db5_float[2]; w->rec_hi_float = db5_float[3]; break; case 6: w->dec_lo_double = db6_double[0]; w->dec_hi_double = db6_double[1]; w->rec_lo_double = db6_double[2]; w->rec_hi_double = db6_double[3]; w->dec_lo_float = db6_float[0]; w->dec_hi_float = db6_float[1]; w->rec_lo_float = db6_float[2]; w->rec_hi_float = db6_float[3]; break; case 7: w->dec_lo_double = db7_double[0]; w->dec_hi_double = db7_double[1]; w->rec_lo_double = db7_double[2]; w->rec_hi_double = db7_double[3]; w->dec_lo_float = db7_float[0]; w->dec_hi_float = db7_float[1]; w->rec_lo_float = db7_float[2]; w->rec_hi_float = db7_float[3]; break; case 8: w->dec_lo_double = db8_double[0]; w->dec_hi_double = db8_double[1]; w->rec_lo_double = db8_double[2]; w->rec_hi_double = db8_double[3]; w->dec_lo_float = db8_float[0]; w->dec_hi_float = db8_float[1]; w->rec_lo_float = db8_float[2]; w->rec_hi_float = db8_float[3]; break; case 9: w->dec_lo_double = db9_double[0]; w->dec_hi_double = db9_double[1]; w->rec_lo_double = db9_double[2]; w->rec_hi_double = db9_double[3]; w->dec_lo_float = db9_float[0]; w->dec_hi_float = db9_float[1]; w->rec_lo_float = db9_float[2]; w->rec_hi_float = db9_float[3]; break; case 10: w->dec_lo_double = db10_double[0]; w->dec_hi_double = db10_double[1]; w->rec_lo_double = db10_double[2]; w->rec_hi_double = db10_double[3]; w->dec_lo_float = db10_float[0]; w->dec_hi_float = db10_float[1]; w->rec_lo_float = db10_float[2]; w->rec_hi_float = db10_float[3]; break; case 11: w->dec_lo_double = db11_double[0]; w->dec_hi_double = db11_double[1]; w->rec_lo_double = db11_double[2]; w->rec_hi_double = db11_double[3]; w->dec_lo_float = db11_float[0]; w->dec_hi_float = db11_float[1]; w->rec_lo_float = db11_float[2]; w->rec_hi_float = db11_float[3]; break; case 12: w->dec_lo_double = db12_double[0]; w->dec_hi_double = db12_double[1]; w->rec_lo_double = db12_double[2]; w->rec_hi_double = db12_double[3]; w->dec_lo_float = db12_float[0]; w->dec_hi_float = db12_float[1]; w->rec_lo_float = db12_float[2]; w->rec_hi_float = db12_float[3]; break; case 13: w->dec_lo_double = db13_double[0]; w->dec_hi_double = db13_double[1]; w->rec_lo_double = db13_double[2]; w->rec_hi_double = db13_double[3]; w->dec_lo_float = db13_float[0]; w->dec_hi_float = db13_float[1]; w->rec_lo_float = db13_float[2]; w->rec_hi_float = db13_float[3]; break; case 14: w->dec_lo_double = db14_double[0]; w->dec_hi_double = db14_double[1]; w->rec_lo_double = db14_double[2]; w->rec_hi_double = db14_double[3]; w->dec_lo_float = db14_float[0]; w->dec_hi_float = db14_float[1]; w->rec_lo_float = db14_float[2]; w->rec_hi_float = db14_float[3]; break; case 15: w->dec_lo_double = db15_double[0]; w->dec_hi_double = db15_double[1]; w->rec_lo_double = db15_double[2]; w->rec_hi_double = db15_double[3]; w->dec_lo_float = db15_float[0]; w->dec_hi_float = db15_float[1]; w->rec_lo_float = db15_float[2]; w->rec_hi_float = db15_float[3]; break; case 16: w->dec_lo_double = db16_double[0]; w->dec_hi_double = db16_double[1]; w->rec_lo_double = db16_double[2]; w->rec_hi_double = db16_double[3]; w->dec_lo_float = db16_float[0]; w->dec_hi_float = db16_float[1]; w->rec_lo_float = db16_float[2]; w->rec_hi_float = db16_float[3]; break; case 17: w->dec_lo_double = db17_double[0]; w->dec_hi_double = db17_double[1]; w->rec_lo_double = db17_double[2]; w->rec_hi_double = db17_double[3]; w->dec_lo_float = db17_float[0]; w->dec_hi_float = db17_float[1]; w->rec_lo_float = db17_float[2]; w->rec_hi_float = db17_float[3]; break; case 18: w->dec_lo_double = db18_double[0]; w->dec_hi_double = db18_double[1]; w->rec_lo_double = db18_double[2]; w->rec_hi_double = db18_double[3]; w->dec_lo_float = db18_float[0]; w->dec_hi_float = db18_float[1]; w->rec_lo_float = db18_float[2]; w->rec_hi_float = db18_float[3]; break; case 19: w->dec_lo_double = db19_double[0]; w->dec_hi_double = db19_double[1]; w->rec_lo_double = db19_double[2]; w->rec_hi_double = db19_double[3]; w->dec_lo_float = db19_float[0]; w->dec_hi_float = db19_float[1]; w->rec_lo_float = db19_float[2]; w->rec_hi_float = db19_float[3]; break; case 20: w->dec_lo_double = db20_double[0]; w->dec_hi_double = db20_double[1]; w->rec_lo_double = db20_double[2]; w->rec_hi_double = db20_double[3]; w->dec_lo_float = db20_float[0]; w->dec_hi_float = db20_float[1]; w->rec_lo_float = db20_float[2]; w->rec_hi_float = db20_float[3]; break; default: wtfree(w); return NULL; } break; // Symlets wavelets family case 's': case 'S': w->dec_len = w->rec_len = order << 1; w->vanishing_moments_psi = order; w->vanishing_moments_phi = 0; w->support_width = 2*order - 1; w->orthogonal = 1; w->biorthogonal = 1; w->symmetry = NEAR_SYMMETRIC; w->compact_support = 1; w->family_name = "Symlets"; w->short_name = "sym"; switch (order) { case 2: w->dec_lo_double = sym2_double[0]; w->dec_hi_double = sym2_double[1]; w->rec_lo_double = sym2_double[2]; w->rec_hi_double = sym2_double[3]; w->dec_lo_float = sym2_float[0]; w->dec_hi_float = sym2_float[1]; w->rec_lo_float = sym2_float[2]; w->rec_hi_float = sym2_float[3]; break; case 3: w->dec_lo_double = sym3_double[0]; w->dec_hi_double = sym3_double[1]; w->rec_lo_double = sym3_double[2]; w->rec_hi_double = sym3_double[3]; w->dec_lo_float = sym3_float[0]; w->dec_hi_float = sym3_float[1]; w->rec_lo_float = sym3_float[2]; w->rec_hi_float = sym3_float[3]; break; case 4: w->dec_lo_double = sym4_double[0]; w->dec_hi_double = sym4_double[1]; w->rec_lo_double = sym4_double[2]; w->rec_hi_double = sym4_double[3]; w->dec_lo_float = sym4_float[0]; w->dec_hi_float = sym4_float[1]; w->rec_lo_float = sym4_float[2]; w->rec_hi_float = sym4_float[3]; break; case 5: w->dec_lo_double = sym5_double[0]; w->dec_hi_double = sym5_double[1]; w->rec_lo_double = sym5_double[2]; w->rec_hi_double = sym5_double[3]; w->dec_lo_float = sym5_float[0]; w->dec_hi_float = sym5_float[1]; w->rec_lo_float = sym5_float[2]; w->rec_hi_float = sym5_float[3]; break; case 6: w->dec_lo_double = sym6_double[0]; w->dec_hi_double = sym6_double[1]; w->rec_lo_double = sym6_double[2]; w->rec_hi_double = sym6_double[3]; w->dec_lo_float = sym6_float[0]; w->dec_hi_float = sym6_float[1]; w->rec_lo_float = sym6_float[2]; w->rec_hi_float = sym6_float[3]; break; case 7: w->dec_lo_double = sym7_double[0]; w->dec_hi_double = sym7_double[1]; w->rec_lo_double = sym7_double[2]; w->rec_hi_double = sym7_double[3]; w->dec_lo_float = sym7_float[0]; w->dec_hi_float = sym7_float[1]; w->rec_lo_float = sym7_float[2]; w->rec_hi_float = sym7_float[3]; break; case 8: w->dec_lo_double = sym8_double[0]; w->dec_hi_double = sym8_double[1]; w->rec_lo_double = sym8_double[2]; w->rec_hi_double = sym8_double[3]; w->dec_lo_float = sym8_float[0]; w->dec_hi_float = sym8_float[1]; w->rec_lo_float = sym8_float[2]; w->rec_hi_float = sym8_float[3]; break; case 9: w->dec_lo_double = sym9_double[0]; w->dec_hi_double = sym9_double[1]; w->rec_lo_double = sym9_double[2]; w->rec_hi_double = sym9_double[3]; w->dec_lo_float = sym9_float[0]; w->dec_hi_float = sym9_float[1]; w->rec_lo_float = sym9_float[2]; w->rec_hi_float = sym9_float[3]; break; case 10: w->dec_lo_double = sym10_double[0]; w->dec_hi_double = sym10_double[1]; w->rec_lo_double = sym10_double[2]; w->rec_hi_double = sym10_double[3]; w->dec_lo_float = sym10_float[0]; w->dec_hi_float = sym10_float[1]; w->rec_lo_float = sym10_float[2]; w->rec_hi_float = sym10_float[3]; break; case 11: w->dec_lo_double = sym11_double[0]; w->dec_hi_double = sym11_double[1]; w->rec_lo_double = sym11_double[2]; w->rec_hi_double = sym11_double[3]; w->dec_lo_float = sym11_float[0]; w->dec_hi_float = sym11_float[1]; w->rec_lo_float = sym11_float[2]; w->rec_hi_float = sym11_float[3]; break; case 12: w->dec_lo_double = sym12_double[0]; w->dec_hi_double = sym12_double[1]; w->rec_lo_double = sym12_double[2]; w->rec_hi_double = sym12_double[3]; w->dec_lo_float = sym12_float[0]; w->dec_hi_float = sym12_float[1]; w->rec_lo_float = sym12_float[2]; w->rec_hi_float = sym12_float[3]; break; case 13: w->dec_lo_double = sym13_double[0]; w->dec_hi_double = sym13_double[1]; w->rec_lo_double = sym13_double[2]; w->rec_hi_double = sym13_double[3]; w->dec_lo_float = sym13_float[0]; w->dec_hi_float = sym13_float[1]; w->rec_lo_float = sym13_float[2]; w->rec_hi_float = sym13_float[3]; break; case 14: w->dec_lo_double = sym14_double[0]; w->dec_hi_double = sym14_double[1]; w->rec_lo_double = sym14_double[2]; w->rec_hi_double = sym14_double[3]; w->dec_lo_float = sym14_float[0]; w->dec_hi_float = sym14_float[1]; w->rec_lo_float = sym14_float[2]; w->rec_hi_float = sym14_float[3]; break; case 15: w->dec_lo_double = sym15_double[0]; w->dec_hi_double = sym15_double[1]; w->rec_lo_double = sym15_double[2]; w->rec_hi_double = sym15_double[3]; w->dec_lo_float = sym15_float[0]; w->dec_hi_float = sym15_float[1]; w->rec_lo_float = sym15_float[2]; w->rec_hi_float = sym15_float[3]; break; case 16: w->dec_lo_double = sym16_double[0]; w->dec_hi_double = sym16_double[1]; w->rec_lo_double = sym16_double[2]; w->rec_hi_double = sym16_double[3]; w->dec_lo_float = sym16_float[0]; w->dec_hi_float = sym16_float[1]; w->rec_lo_float = sym16_float[2]; w->rec_hi_float = sym16_float[3]; break; case 17: w->dec_lo_double = sym17_double[0]; w->dec_hi_double = sym17_double[1]; w->rec_lo_double = sym17_double[2]; w->rec_hi_double = sym17_double[3]; w->dec_lo_float = sym17_float[0]; w->dec_hi_float = sym17_float[1]; w->rec_lo_float = sym17_float[2]; w->rec_hi_float = sym17_float[3]; break; case 18: w->dec_lo_double = sym18_double[0]; w->dec_hi_double = sym18_double[1]; w->rec_lo_double = sym18_double[2]; w->rec_hi_double = sym18_double[3]; w->dec_lo_float = sym18_float[0]; w->dec_hi_float = sym18_float[1]; w->rec_lo_float = sym18_float[2]; w->rec_hi_float = sym18_float[3]; break; case 19: w->dec_lo_double = sym19_double[0]; w->dec_hi_double = sym19_double[1]; w->rec_lo_double = sym19_double[2]; w->rec_hi_double = sym19_double[3]; w->dec_lo_float = sym19_float[0]; w->dec_hi_float = sym19_float[1]; w->rec_lo_float = sym19_float[2]; w->rec_hi_float = sym19_float[3]; break; case 20: w->dec_lo_double = sym20_double[0]; w->dec_hi_double = sym20_double[1]; w->rec_lo_double = sym20_double[2]; w->rec_hi_double = sym20_double[3]; w->dec_lo_float = sym20_float[0]; w->dec_hi_float = sym20_float[1]; w->rec_lo_float = sym20_float[2]; w->rec_hi_float = sym20_float[3]; break; default: wtfree(w); return NULL; } break; // Coiflets wavelets family case 'c': case 'C': w->dec_len = w->rec_len = order * 6; w->vanishing_moments_psi = 2*order; w->vanishing_moments_phi = 2*order -1; w->support_width = 6*order - 1; w->orthogonal = 1; w->biorthogonal = 1; w->symmetry = NEAR_SYMMETRIC; w->compact_support = 1; w->family_name = "Coiflets"; w->short_name = "coif"; switch (order) { case 1: w->dec_lo_double = coif1_double[0]; w->dec_hi_double = coif1_double[1]; w->rec_lo_double = coif1_double[2]; w->rec_hi_double = coif1_double[3]; w->dec_lo_float = coif1_float[0]; w->dec_hi_float = coif1_float[1]; w->rec_lo_float = coif1_float[2]; w->rec_hi_float = coif1_float[3]; break; case 2: w->dec_lo_double = coif2_double[0]; w->dec_hi_double = coif2_double[1]; w->rec_lo_double = coif2_double[2]; w->rec_hi_double = coif2_double[3]; w->dec_lo_float = coif2_float[0]; w->dec_hi_float = coif2_float[1]; w->rec_lo_float = coif2_float[2]; w->rec_hi_float = coif2_float[3]; break; case 3: w->dec_lo_double = coif3_double[0]; w->dec_hi_double = coif3_double[1]; w->rec_lo_double = coif3_double[2]; w->rec_hi_double = coif3_double[3]; w->dec_lo_float = coif3_float[0]; w->dec_hi_float = coif3_float[1]; w->rec_lo_float = coif3_float[2]; w->rec_hi_float = coif3_float[3]; break; case 4: w->dec_lo_double = coif4_double[0]; w->dec_hi_double = coif4_double[1]; w->rec_lo_double = coif4_double[2]; w->rec_hi_double = coif4_double[3]; w->dec_lo_float = coif4_float[0]; w->dec_hi_float = coif4_float[1]; w->rec_lo_float = coif4_float[2]; w->rec_hi_float = coif4_float[3]; break; case 5: w->dec_lo_double = coif5_double[0]; w->dec_hi_double = coif5_double[1]; w->rec_lo_double = coif5_double[2]; w->rec_hi_double = coif5_double[3]; w->dec_lo_float = coif5_float[0]; w->dec_hi_float = coif5_float[1]; w->rec_lo_float = coif5_float[2]; w->rec_hi_float = coif5_float[3]; break; default: wtfree(w); return NULL; } break; // Biorthogonal wavelets family case 'b': case 'B': w->vanishing_moments_psi = order/10; w->vanishing_moments_phi = -1; w->support_width = -1; w->orthogonal = 0; w->biorthogonal = 1; w->symmetry = SYMMETRIC; w->compact_support = 1; w->family_name = "Biorthogonal"; w->short_name = "bior"; switch (order) { case 11: w->dec_lo_double = bior1_1_double[0]; w->dec_hi_double = bior1_1_double[1]; w->rec_lo_double = bior1_1_double[2]; w->rec_hi_double = bior1_1_double[3]; w->dec_lo_float = bior1_1_float[0]; w->dec_hi_float = bior1_1_float[1]; w->rec_lo_float = bior1_1_float[2]; w->rec_hi_float = bior1_1_float[3]; w->dec_len = w->rec_len = 2 * 1; break; case 13: w->dec_lo_double = bior1_3_double[0]; w->dec_hi_double = bior1_3_double[1]; w->rec_lo_double = bior1_3_double[2]; w->rec_hi_double = bior1_3_double[3]; w->dec_lo_float = bior1_3_float[0]; w->dec_hi_float = bior1_3_float[1]; w->rec_lo_float = bior1_3_float[2]; w->rec_hi_float = bior1_3_float[3]; w->dec_len = w->rec_len = 2 * 3; break; case 15: w->dec_lo_double = bior1_5_double[0]; w->dec_hi_double = bior1_5_double[1]; w->rec_lo_double = bior1_5_double[2]; w->rec_hi_double = bior1_5_double[3]; w->dec_lo_float = bior1_5_float[0]; w->dec_hi_float = bior1_5_float[1]; w->rec_lo_float = bior1_5_float[2]; w->rec_hi_float = bior1_5_float[3]; w->dec_len = w->rec_len = 2 * 5; break; case 22: w->dec_lo_double = bior2_2_double[0]; w->dec_hi_double = bior2_2_double[1]; w->rec_lo_double = bior2_2_double[2]; w->rec_hi_double = bior2_2_double[3]; w->dec_lo_float = bior2_2_float[0]; w->dec_hi_float = bior2_2_float[1]; w->rec_lo_float = bior2_2_float[2]; w->rec_hi_float = bior2_2_float[3]; w->dec_len = w->rec_len = 2 * 2 + 2; break; case 24: w->dec_lo_double = bior2_4_double[0]; w->dec_hi_double = bior2_4_double[1]; w->rec_lo_double = bior2_4_double[2]; w->rec_hi_double = bior2_4_double[3]; w->dec_lo_float = bior2_4_float[0]; w->dec_hi_float = bior2_4_float[1]; w->rec_lo_float = bior2_4_float[2]; w->rec_hi_float = bior2_4_float[3]; w->dec_len = w->rec_len = 2 * 4 + 2; break; case 26: w->dec_lo_double = bior2_6_double[0]; w->dec_hi_double = bior2_6_double[1]; w->rec_lo_double = bior2_6_double[2]; w->rec_hi_double = bior2_6_double[3]; w->dec_lo_float = bior2_6_float[0]; w->dec_hi_float = bior2_6_float[1]; w->rec_lo_float = bior2_6_float[2]; w->rec_hi_float = bior2_6_float[3]; w->dec_len = w->rec_len = 2 * 6 + 2; break; case 28: w->dec_lo_double = bior2_8_double[0]; w->dec_hi_double = bior2_8_double[1]; w->rec_lo_double = bior2_8_double[2]; w->rec_hi_double = bior2_8_double[3]; w->dec_lo_float = bior2_8_float[0]; w->dec_hi_float = bior2_8_float[1]; w->rec_lo_float = bior2_8_float[2]; w->rec_hi_float = bior2_8_float[3]; w->dec_len = w->rec_len = 2 * 8 + 2; break; case 31: w->dec_lo_double = bior3_1_double[0]; w->dec_hi_double = bior3_1_double[1]; w->rec_lo_double = bior3_1_double[2]; w->rec_hi_double = bior3_1_double[3]; w->dec_lo_float = bior3_1_float[0]; w->dec_hi_float = bior3_1_float[1]; w->rec_lo_float = bior3_1_float[2]; w->rec_hi_float = bior3_1_float[3]; w->dec_len = w->rec_len = 2 * 1 + 2; break; case 33: w->dec_lo_double = bior3_3_double[0]; w->dec_hi_double = bior3_3_double[1]; w->rec_lo_double = bior3_3_double[2]; w->rec_hi_double = bior3_3_double[3]; w->dec_lo_float = bior3_3_float[0]; w->dec_hi_float = bior3_3_float[1]; w->rec_lo_float = bior3_3_float[2]; w->rec_hi_float = bior3_3_float[3]; w->dec_len = w->rec_len = 2 * 3 + 2; break; case 35: w->dec_lo_double = bior3_5_double[0]; w->dec_hi_double = bior3_5_double[1]; w->rec_lo_double = bior3_5_double[2]; w->rec_hi_double = bior3_5_double[3]; w->dec_lo_float = bior3_5_float[0]; w->dec_hi_float = bior3_5_float[1]; w->rec_lo_float = bior3_5_float[2]; w->rec_hi_float = bior3_5_float[3]; w->dec_len = w->rec_len = 2 * 5 + 2; break; case 37: w->dec_lo_double = bior3_7_double[0]; w->dec_hi_double = bior3_7_double[1]; w->rec_lo_double = bior3_7_double[2]; w->rec_hi_double = bior3_7_double[3]; w->dec_lo_float = bior3_7_float[0]; w->dec_hi_float = bior3_7_float[1]; w->rec_lo_float = bior3_7_float[2]; w->rec_hi_float = bior3_7_float[3]; w->dec_len = w->rec_len = 2 * 7 + 2; break; case 39: w->dec_lo_double = bior3_9_double[0]; w->dec_hi_double = bior3_9_double[1]; w->rec_lo_double = bior3_9_double[2]; w->rec_hi_double = bior3_9_double[3]; w->dec_lo_float = bior3_9_float[0]; w->dec_hi_float = bior3_9_float[1]; w->rec_lo_float = bior3_9_float[2]; w->rec_hi_float = bior3_9_float[3]; w->dec_len = w->rec_len = 2 * 9 + 2; break; case 44: w->dec_lo_double = bior4_4_double[0]; w->dec_hi_double = bior4_4_double[1]; w->rec_lo_double = bior4_4_double[2]; w->rec_hi_double = bior4_4_double[3]; w->dec_lo_float = bior4_4_float[0]; w->dec_hi_float = bior4_4_float[1]; w->rec_lo_float = bior4_4_float[2]; w->rec_hi_float = bior4_4_float[3]; w->dec_len = w->rec_len = 2 * 4 + 2; break; case 55: w->dec_lo_double = bior5_5_double[0]; w->dec_hi_double = bior5_5_double[1]; w->rec_lo_double = bior5_5_double[2]; w->rec_hi_double = bior5_5_double[3]; w->dec_lo_float = bior5_5_float[0]; w->dec_hi_float = bior5_5_float[1]; w->rec_lo_float = bior5_5_float[2]; w->rec_hi_float = bior5_5_float[3]; w->dec_len = w->rec_len = 2 * 5 + 2; break; case 68: w->dec_lo_double = bior6_8_double[0]; w->dec_hi_double = bior6_8_double[1]; w->rec_lo_double = bior6_8_double[2]; w->rec_hi_double = bior6_8_double[3]; w->dec_lo_float = bior6_8_float[0]; w->dec_hi_float = bior6_8_float[1]; w->rec_lo_float = bior6_8_float[2]; w->rec_hi_float = bior6_8_float[3]; w->dec_len = w->rec_len = 2 * 8 + 2; break; default: wtfree(w); return NULL; } //## ENDFOR $DTYPE$ break; // Discrete FIR filter approximation of Meyer wavelet case 'm': case 'M': w->vanishing_moments_psi = -1; w->vanishing_moments_phi = -1; w->support_width = -1; w->orthogonal = 1; w->biorthogonal = 1; w->symmetry = SYMMETRIC; w->compact_support = 1; w->family_name = "Discrete Meyer (FIR Approximation)"; w->short_name = "dmey"; w->dec_lo_double = dmey_double[0]; w->dec_hi_double = dmey_double[1]; w->rec_lo_double = dmey_double[2]; w->rec_hi_double = dmey_double[3]; w->dec_lo_float = dmey_float[0]; w->dec_hi_float = dmey_float[1]; w->rec_lo_float = dmey_float[2]; w->rec_hi_float = dmey_float[3]; w->dec_len = w->rec_len = 62; return w; break; default: wtfree(w); return NULL; } return w; }