/github/workspace/src/TransformFunctions/plp_dwt_common.c
Functions
Name | |
---|---|
uint32_t | plp_dwt_max_level(uint32_t sig_len, uint32_t wavelet_len) Computes maximum available decomposition level for a signal length and wavelet length. |
uint32_t | plp_dwt_dec_len(uint32_t sig_len, uint32_t wavelet_len, uint32_t level) Calculates decomposition output length given a level. |
Functions Documentation
function plp_dwt_max_level
uint32_t plp_dwt_max_level(
uint32_t sig_len,
uint32_t wavelet_len
)
Computes maximum available decomposition level for a signal length and wavelet length.
Parameters:
- sig_len length of input signal
- wavelet_len wavelet length
Return: Maximal decomposition level
function plp_dwt_dec_len
uint32_t plp_dwt_dec_len(
uint32_t sig_len,
uint32_t wavelet_len,
uint32_t level
)
Calculates decomposition output length given a level.
Parameters:
- sig_len length of input signal
- wavelet_len wavelet length
- level decomposition level (0 for maximal decomposition)
Return: Length of decomposition output buffer
Source code
/* ----------------------------------------------------------------------
* Project: PULP DSP Library
* Title: plp_dwt_common.c
* Description: Common Discret Wavelet Transform utilitiy functions
*
* $Date: 10. Juli 2021
* $Revision: V1
*
* Target Processor: PULP cores with "F" support (wolfe)
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2021 ETH Zurich and University of Bologna. All rights reserved.
*
* Author: Jakub Mandula, ETH Zurich
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "plp_math.h"
uint32_t plp_dwt_max_level(uint32_t sig_len, uint32_t wavelet_len){
uint32_t quotient = sig_len/(wavelet_len - 1);
uint32_t level = 0;
while(quotient >>= 1) ++level;
return level;
}
uint32_t plp_dwt_dec_len(uint32_t sig_len, uint32_t wavelet_len, uint32_t level){
uint32_t total = 0;
uint32_t quotient = sig_len/(wavelet_len - 1) >> 1;
do {
sig_len = PLP_DWT_OUTPUT_LENGTH(sig_len, wavelet_len);
total += sig_len;
level--; // In the case that level was 0, it will underflow. The while loop will then run until the first stop condition
} while(quotient >>= 1 && level > 0);
total += sig_len;
return total;
}
Updated on 2023-03-01 at 16:16:33 +0000