long wavelet_coeffs(unsigned int N, unsigned int flags, const long dims[N], const long min[N], const long flen) { unsigned int levels = wavelet_num_levels(N, flags, dims, min, flen); assert(levels > 0); return wavelet_coeffs_r(levels - 1, N, flags, dims, min, flen); }
long wavelet_num_levels(unsigned int N, unsigned int flags, const long dims[N], const long min[N], const long flen) { if (0 == flags) return 1; long wdims[2 * N]; wavelet_dims(N, flags, wdims, dims, flen); return 1 + wavelet_num_levels(N, wavelet_filter_flags(N, flags, wdims, min), wdims, min, flen); }
void wavelet_coeffs2(unsigned int N, unsigned int flags, long odims[N], const long dims[N], const long min[N], const long flen) { md_select_dims(N, ~flags, odims, dims); if (0 == flags) return; unsigned int levels = wavelet_num_levels(N, flags, dims, min, flen); assert(levels > 0); long wdims[N]; md_select_dims(N, flags, wdims, dims); // remove unmodified dims unsigned int b = ffs(flags) - 1; odims[b] = wavelet_coeffs_r(levels - 1, N, flags, wdims, min, flen); }
static void wavelet3_thresh_apply(const operator_data_t* _data, float mu, complex float* out, const complex float* in) { const struct wavelet3_thresh_s* data = CAST_DOWN(wavelet3_thresh_s, _data); long shift[data->N]; for (unsigned int i = 0; i < data->N; i++) shift[i] = 0; if (data->randshift) { int levels = wavelet_num_levels(data->N, data->flags, data->dims, data->minsize, 4); for (unsigned int i = 0; i < data->N; i++) if (MD_IS_SET(data->flags, i)) shift[i] = rand_lim((unsigned int*)&data->rand_state, 1 << levels); } wavelet3_thresh(data->N, data->lambda * mu, data->flags, shift, data->dims, out, in, data->minsize, 4, wavelet3_dau2); }