From 433241ad0e02baa5de4cf2fd267b92cdef02c333 Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Wed, 14 Aug 2024 11:35:55 +0200 Subject: [PATCH] Refactor: Move cmp_bit_to_4byte() function from cmp_support.c to cmp_icu.c --- lib/common/cmp_support.c | 15 --------------- lib/common/cmp_support.h | 2 -- lib/rdcu_compress/cmp_rdcu.c | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/common/cmp_support.c b/lib/common/cmp_support.c index 464acad..1beaec2 100644 --- a/lib/common/cmp_support.c +++ b/lib/common/cmp_support.c @@ -349,21 +349,6 @@ unsigned int cmp_bit_to_byte(unsigned int cmp_size_bit) } -/** - * @brief calculate the need bytes to hold a bitstream - * @note we round up the result to multiples of 4 bytes - * - * @param cmp_size_bit compressed data size, measured in bits - * - * @returns the size in bytes to store the hole bitstream - */ - -unsigned int cmp_bit_to_4byte(unsigned int cmp_size_bit) -{ - return (cmp_bit_to_byte(cmp_size_bit) + 3) & ~0x3UL; -} - - /** * @brief check if the compression data type, compression mode, model value and * the lossy rounding parameters are invalid for a RDCU or ICU compression diff --git a/lib/common/cmp_support.h b/lib/common/cmp_support.h index fd90ce8..11eec69 100644 --- a/lib/common/cmp_support.h +++ b/lib/common/cmp_support.h @@ -333,9 +333,7 @@ struct fx_cob_par { int is_a_pow_of_2(unsigned int v); unsigned int ilog_2(uint32_t x); - unsigned int cmp_bit_to_byte(unsigned int cmp_size_bit); -unsigned int cmp_bit_to_4byte(unsigned int cmp_size_bit); int cmp_cfg_icu_is_invalid(const struct cmp_cfg *cfg); int cmp_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg); diff --git a/lib/rdcu_compress/cmp_rdcu.c b/lib/rdcu_compress/cmp_rdcu.c index 9635570..d1e54e7 100644 --- a/lib/rdcu_compress/cmp_rdcu.c +++ b/lib/rdcu_compress/cmp_rdcu.c @@ -406,6 +406,21 @@ int rdcu_read_cmp_info(struct cmp_info *info) } +/** + * @brief calculate the need bytes to hold a bitstream + * @note we round up the result to multiples of 4 bytes + * + * @param cmp_size_bit compressed data size, measured in bits + * + * @returns the size in bytes to store the hole bitstream + */ + +static unsigned int cmp_bit_to_4byte(unsigned int cmp_size_bit) +{ + return (cmp_bit_to_byte(cmp_size_bit) + 3) & ~0x3UL; +} + + /** * @brief read the compressed bitstream from the RDCU SRAM * -- GitLab