diff --git a/lib/common/cmp_cal_up_model.h b/lib/common/cmp_cal_up_model.h index b1124778fda5e18259fdddc19312b809090c3d09..3a4c3457590f9d06045d8fb299e425addd3ad942 100644 --- a/lib/common/cmp_cal_up_model.h +++ b/lib/common/cmp_cal_up_model.h @@ -53,7 +53,7 @@ /** - * @brief implantation of the model update equation + * @brief implementation of the model update equation * @note check before that model_value is not greater than MAX_MODEL_VALUE * * @warning: Do not use this macro with types larger than uint32_t diff --git a/lib/common/cmp_support.h b/lib/common/cmp_support.h index 3c4d37f7b203d4acb4fa5fe8006218586df30c7f..38ee7e295e0e4aa3108fb07e0c0d9878ff8c68cf 100644 --- a/lib/common/cmp_support.h +++ b/lib/common/cmp_support.h @@ -49,7 +49,7 @@ /* valid compression parameter ranges for ICU non-imagette compression */ #define MIN_NON_IMA_GOLOMB_PAR 1U -#define MAX_NON_IMA_GOLOMB_PAR UINT16_MAX /* the compression entity dos not allow larger values */ +#define MAX_NON_IMA_GOLOMB_PAR UINT16_MAX /* the compression entity does not allow larger values */ #define MIN_NON_IMA_SPILL 2U /* for maximum spill value look at cmp_icu_max_spill function */ #define MAX_ICU_ROUND 3U @@ -275,7 +275,7 @@ struct cmp_status { /** - * @brief The cmp_info structure contain the information and metadata of an + * @brief The cmp_info structure contains the information and metadata of an * executed RDCU compression. */ @@ -283,7 +283,7 @@ struct cmp_info { uint32_t cmp_mode_used; /**< Compression mode used */ uint32_t spill_used; /**< Spillover threshold used */ uint32_t golomb_par_used; /**< Golomb parameter used */ - uint32_t samples_used; /**< Number of samples (16 bit value) to be stored */ + uint32_t samples_used; /**< Number of samples (16-bit value) to be stored */ uint32_t cmp_size; /**< Compressed data size; measured in bits */ uint32_t ap1_cmp_size; /**< Adaptive compressed data size 1; measured in bits */ uint32_t ap2_cmp_size; /**< Adaptive compressed data size 2; measured in bits */ diff --git a/lib/common/list.h b/lib/common/list.h index a05803139a75738f7ddfba05048ae9c85ea91d78..1d529cc44655850b0022dbf73a87a549a820c82d 100644 --- a/lib/common/list.h +++ b/lib/common/list.h @@ -57,7 +57,7 @@ * * This does of course not apply as long as you do access your lists only * at slow rates (i.e. in the order of several tens of ms) or if performance - * is not at all critial. + * is not at all critical. * */ diff --git a/lib/decompress/decmp.c b/lib/decompress/decmp.c index 3120ec9acf1e59a5fbe324180f281f24d7f2bee1..0c0548b39bf2da48f607a3a42e4e808ae44a30cd 100644 --- a/lib/decompress/decmp.c +++ b/lib/decompress/decmp.c @@ -330,7 +330,7 @@ static int decode_value(const struct decoder_setup *setup, uint32_t *decoded_val /** - * @brief configure a decoder setup structure to have a setup to decode a vale + * @brief configure a decoder setup structure to have a setup to decode a value * * @param setup pointer to the decoder setup * @param dec pointer to a bit_decoder context diff --git a/lib/icu_compress/cmp_icu.c b/lib/icu_compress/cmp_icu.c index faa9d53d9f374aebd2647bee34519bef2cb40dbe..ef2fd3347f17f6764a19b537caa6fb8144857335 100644 --- a/lib/icu_compress/cmp_icu.c +++ b/lib/icu_compress/cmp_icu.c @@ -569,7 +569,7 @@ static uint32_t encode_normal(uint32_t value, uint32_t stream_len, /** - * @brief subtract the model from the data, encode the result and puts it into + * @brief subtracts the model from the data, encodes the result and puts it into * bitstream, for encoding outlier use the zero escape symbol mechanism * * @param data data to encode @@ -599,11 +599,11 @@ static uint32_t encode_value_zero(uint32_t data, uint32_t model, uint32_t stream * return ... */ if (data < (setup->spillover_par - 1)) { /* detect non-outlier */ - data++; /* add 1 to every value so we can use 0 as escape symbol */ + data++; /* add 1 to every value so we can use 0 as the escape symbol */ return encode_normal(data, stream_len, setup); } - data++; /* add 1 to every value so we can use 0 as escape symbol */ + data++; /* add 1 to every value so we can use 0 as the escape symbol */ /* use zero as escape symbol */ stream_len = encode_normal(0, stream_len, setup); @@ -618,7 +618,7 @@ static uint32_t encode_value_zero(uint32_t data, uint32_t model, uint32_t stream /** - * @brief subtract the model from the data, encode the result and put it into + * @brief subtract the model from the data, encode the result and puts it into * bitstream, for encoding outlier use the multi escape symbol mechanism * * @param data data to encode @@ -728,7 +728,7 @@ static uint32_t cmp_buffer_length_to_bits(uint32_t buffer_length) /** - * @brief configure an encoder setup structure to have a setup to encode a vale + * @brief configure an encoder setup structure to have a setup to encode a value * * @param setup pointer to the encoder setup * @param cmp_par compression parameter @@ -755,7 +755,7 @@ static void configure_encoder_setup(struct encoder_setup *setup, setup->encoder_par2 = ilog_2(cmp_par); setup->spillover_par = spillover; - /* for encoder_par1 which are a power of two we can use the faster rice_encoder */ + /* for encoder_par1 which is a power of two we can use the faster rice_encoder */ if (is_a_pow_of_2(setup->encoder_par1)) setup->generate_cw_f = &rice_encoder; else @@ -1706,7 +1706,7 @@ static uint32_t compress_l_fx_efx_ncob_ecob(const struct cmp_cfg *cfg, uint32_t cfg->round, cfg->max_used_bits->l_efx, cfg); configure_encoder_setup(&setup_ecob, cfg->cmp_par_ecob, cfg->spill_ecob, cfg->round, cfg->max_used_bits->l_ecob, cfg); - /* we use compression parameter for both variance data fields */ + /* we use compression parameters for both variance data fields */ configure_encoder_setup(&setup_fx_var, cfg->cmp_par_fx_cob_variance, cfg->spill_fx_cob_variance, cfg->round, cfg->max_used_bits->l_fx_variance, cfg); configure_encoder_setup(&setup_cob_var, cfg->cmp_par_fx_cob_variance, cfg->spill_fx_cob_variance, @@ -2746,7 +2746,7 @@ uint32_t compress_chunk(void *chunk, uint32_t chunk_size, /** - * @brief returns the maximum compressed size in a worst case scenario + * @brief returns the maximum compressed size in a worst-case scenario * In case the input data is not compressible * This function is primarily useful for memory allocation purposes * (destination buffer size). diff --git a/lib/rdcu_compress/cmp_rdcu.c b/lib/rdcu_compress/cmp_rdcu.c index 457d975249341f81c2c8b50436ad2620ae11b881..ec99dc7817ba63d027069e9da18ddb7a9588445f 100644 --- a/lib/rdcu_compress/cmp_rdcu.c +++ b/lib/rdcu_compress/cmp_rdcu.c @@ -50,7 +50,7 @@ static int interrupt_signal_enabled = RDCU_INTR_SIG_DEFAULT; /** * @brief save repeating 3 lines of code... * - * @note This function depends on the SpW implantation and must be adjusted to it. + * @note This function depends on the SpW implementation and must be adjusted to it. * * @note prints abort message if pending status is non-zero after 10 retries */ @@ -92,7 +92,7 @@ int rdcu_interrupt_compression(void) rdcu_syncing(); /* clear local bit immediately, this is a write-only register. - * we would not want to restart compression by accidentially calling + * we would not want to restart compression by accidentally calling * rdcu_sync_compr_ctrl() again */ rdcu_clear_data_compr_interrupt(); diff --git a/lib/rdcu_compress/cmp_rdcu_cfg.c b/lib/rdcu_compress/cmp_rdcu_cfg.c index 8f1b3f6d79ce9c0955fe5c9219f1d71894e95ad4..5093e7c1a2e8970369b36451ae42708efe53a6d4 100644 --- a/lib/rdcu_compress/cmp_rdcu_cfg.c +++ b/lib/rdcu_compress/cmp_rdcu_cfg.c @@ -60,12 +60,12 @@ struct cmp_cfg rdcu_cfg_create(enum cmp_data_type data_type, enum cmp_mode cmp_m /** - * @brief check if a buffer is in outside the RDCU SRAM + * @brief check if a buffer is outside the RDCU SRAM * * @param addr start address of the buffer * @param size length of the buffer in bytes * - * @returns 0 if buffer in inside the RDCU SRAM, 1 when the buffer is outside + * @returns 0 if the buffer is inside the RDCU SRAM, 1 when the buffer is outside */ static int outside_sram_range(uint32_t addr, uint32_t size) @@ -92,7 +92,7 @@ static int outside_sram_range(uint32_t addr, uint32_t size) * @param start_b start address of the 2nd buffer * @param end_b end address of the 2nd buffer * - * @returns 0 if buffers are not overlapping, otherwise buffer are + * @returns 0 if buffers are not overlapping, otherwise buffers are * overlapping */ diff --git a/lib/rdcu_compress/rdcu_rmap.c b/lib/rdcu_compress/rdcu_rmap.c index dc7c71a5dfd259ce0b43a9d03a79a1bf87bdab90..c0b7662c3fb610f99ebb907f2e15c001ff2f1a03 100644 --- a/lib/rdcu_compress/rdcu_rmap.c +++ b/lib/rdcu_compress/rdcu_rmap.c @@ -24,7 +24,7 @@ * and set() RMAP calls, they operate on the local copy and the user issues * sync() calls. * - * To monitor the syncronisation status, we maintaining a transaction log + * To monitor the synchronisation status, we maintaining a transaction log * tracking the submitted command set. Response packets could be processed * by interrupt (or thread), but in this variant, we process the return packets * when the user calls rdcu_ctrl_sync_status() diff --git a/lib/rdcu_compress/rmap.h b/lib/rdcu_compress/rmap.h index 9c217804b37300e8fa9414af3b6368870436236a..3bb948aca4720eb76adb485b9fb5121a445619c5 100644 --- a/lib/rdcu_compress/rmap.h +++ b/lib/rdcu_compress/rmap.h @@ -148,7 +148,7 @@ struct rmap_instruction { uint8_t cmd_resp:1; uint8_t cmd:4; uint8_t reply_addr_len:2; -#elif defined (__LITTLE_ENDIAN) +#elif defined(__LITTLE_ENDIAN) uint8_t reply_addr_len:2; uint8_t cmd:4; uint8_t cmd_resp:1; diff --git a/programs/cmp_guess.c b/programs/cmp_guess.c index bda3c3e9d3743a544db5303c4aa4d690ff7c6c11..10956e7ed09ebabb202d998a89c08c6a38296958 100644 --- a/programs/cmp_guess.c +++ b/programs/cmp_guess.c @@ -40,7 +40,7 @@ static int num_model_updates = CMP_GUESS_N_MODEL_UPDATE_DEF; * @note the default value is CMP_GUESS_N_MODEL_UPDATE_DEF * @note this is needed to guess a good model_value * - * @param n_model_updates number of model updates + * @param n_model_updates number of model updates */ void cmp_guess_set_model_updates(int n_model_updates) @@ -52,7 +52,7 @@ void cmp_guess_set_model_updates(int n_model_updates) /** * @brief guess a good model value * - * @param n_model_updates number of model updates + * @param n_model_updates number of model updates * * @returns guessed model_value */ diff --git a/programs/cmp_io.c b/programs/cmp_io.c index 7aae26ff5978403bba72c35ef6345c7583e9d842..66ea2964486a13e2ced72025abb0c7a741220ba6 100644 --- a/programs/cmp_io.c +++ b/programs/cmp_io.c @@ -162,7 +162,7 @@ static FILE *open_file(const char *dirname, const char *filename) * @param output_prefix file name without file extension * @param name_extension extension (with leading point character) * @param flags CMP_IO_VERBOSE_EXTRA print verbose output if set - * CMP_IO_BINARY write file in binary format if set + * CMP_IO_BINARY write the file in binary format if set * * @returns 0 on success, error otherwise */ @@ -210,7 +210,7 @@ int write_input_data_to_file(const void *data, uint32_t data_size, enum cmp_data * @param name_extension file extension (with leading point character) * * @param flags CMP_IO_VERBOSE_EXTRA print verbose output if set - * CMP_IO_BINARY write file in binary format if set + * CMP_IO_BINARY write the file in binary format if set * * @returns 0 on success, error otherwise */ @@ -352,7 +352,7 @@ static int sram_addr_to_int(const char *addr) } if (i > RDCU_SRAM_END) { - printf("%s: The sram address is out of the rdcu range\n", + printf("%s: The SRAM address is out of the rdcu range\n", PROGRAM_NAME); return -1; } @@ -467,7 +467,7 @@ const char *data_type2string(enum cmp_data_type data_type) /** - * @brief parse a compression mode vale string to an integer + * @brief parse a compression mode value string to an integer * @note string can be either a number or the name of the compression mode * * @param cmp_mode_str string containing the compression mode value to parse @@ -511,6 +511,7 @@ int cmp_mode_parse(const char *cmp_mode_str, enum cmp_mode *cmp_mode) return -1; } else { uint32_t read_val; + if (atoui32(cmp_mode_str, cmp_mode_str, &read_val)) return -1; *cmp_mode = read_val; @@ -1099,17 +1100,18 @@ static const char *skip_comment(const char *str) /** - * @brief Interprets an hex-encoded 8 bit integer value in a byte string pointed + * @brief Interprets a hex-encoded 8-bit integer value in a byte string pointed * to by str. * @details Discards any whitespace characters (as identified by calling isspace) - * until the first non-whitespace character is found, then takes maximum 2 - * characters (with base 16) unsigned integer number representation and - * converts them to an uint8_t value. The function set the pointer + * until the first non-whitespace character is found, then takes a maximum + * of 2 characters (with base 16) unsigned integer number representation + * and converts them to an uint8_t value. The function sets the pointer * pointed to by str_end to point to the character past the last character * interpreted. If str_end is a null pointer, it is ignored. * - * @param str pointer to the null-terminated byte string to be interpreted - * @param str_end pointer to a pointer to character (can be NULL) + * @param str pointer to the null-terminated byte string to be interpreted + * @param str_end point to the character past the last numeric character + * interpreted (can be NULL) * * @returns Integer value corresponding to the contents of str on success. If no * conversion can be performed, 0 is returned (errno is set to EINVAL)). @@ -1222,7 +1224,7 @@ static __inline ssize_t str2uint8_arr(const char *str, uint8_t *data, uint32_t b c = *eptr; if (c != '\0' && !isxdigit(c) && !isspace(c) && c != '#') { if (isprint(c)) - fprintf(stderr, "%s: %s: Error read in '%.*s'. The data are not correct formatted.\n", + fprintf(stderr, "%s: %s: Error read in '%.*s'. The data are not correctly formatted.\n", PROGRAM_NAME, file_name, (int)(eptr-nptr+1), nptr); else fprintf(stderr, "%s: %s: Error: Non printable character found. If you want to read binary files, use the --binary option.\n", @@ -1349,7 +1351,7 @@ ssize_t read_file8(const char *file_name, uint8_t *buf, uint32_t buf_size, int f printf("%s: %s: Error: unexpected end of file.\n", PROGRAM_NAME, file_name); goto fail; } - /* just to be save we have a zero terminated string */ + /* just to be safe we have a zero terminated string */ file_cpy[file_size] = '\0'; fclose(fp); diff --git a/programs/rdcu_pkt_to_file.c b/programs/rdcu_pkt_to_file.c index bc8734f6895e5680246488a2fd78ff4e2ca32c2a..2ae6a9fa50a4536cb40d2c74614afc0ae62ed038 100644 --- a/programs/rdcu_pkt_to_file.c +++ b/programs/rdcu_pkt_to_file.c @@ -37,14 +37,14 @@ #include <cmp_rdcu_testing.h> -/* Name of directory were the RMAP packages are stored */ +/* Name of the directory where the RMAP packages are stored */ static char tc_folder_dir[MAX_TC_FOLDER_DIR_LEN] = "TC_FILES"; /** - * @brief set the directory name were the RMAP packages are stored + * @brief set the directory name where the RMAP packages are stored * - * @param dir_name Name of directory were the RMAP packages are stored + * @param dir_name name of the directory where the RMAP packages are stored */ void set_tc_folder_dir(const char *dir_name) @@ -62,7 +62,7 @@ void set_tc_folder_dir(const char *dir_name) * @brief return a file to write with the name format dir_name/XXX.tc, where XXX * is n_tc in decimal representation * - * @param dir_name name of directory were the RMAP packages are stored + * @param dir_name name of the directory where the RMAP packages are stored * @param n_tc number of TC commands * * @return pointer to the new file stream @@ -103,8 +103,8 @@ static FILE *open_file_tc(const char *dir_name, int n_tc) /** - * @brief Implementation of the rmap_rx function for the rdcu_rmap lib. All - * generated packages are write to a file. + * @brief implementation of the rmap_rx function for the rdcu_rmap lib, all + * generated packages are written to a file. */ static int32_t rmap_tx_to_file(const void *hdr, uint32_t hdr_size, @@ -242,7 +242,8 @@ static int read_rdcu_pkt_mode_cfg(uint8_t *icu_addr, uint8_t *rdcu_addr, if (line[0] == ' ' || line[0] == '\t' || line[0] == '#') continue; - if (!strncmp(line, "ICU_ADDR", l = strlen("ICU_ADDR"))) { + l = strlen("ICU_ADDR"); + if (!strncmp(line, "ICU_ADDR", l)) { end = NULL; errno = 0; i = strtoul(line + l, &end, 0); @@ -255,7 +256,8 @@ static int read_rdcu_pkt_mode_cfg(uint8_t *icu_addr, uint8_t *rdcu_addr, *icu_addr = (uint8_t)i; continue; } - if (!strncmp(line, "RDCU_ADDR", l = strlen("RDCU_ADDR"))) { + l = strlen("RDCU_ADDR"); + if (!strncmp(line, "RDCU_ADDR", l)) { end = NULL; errno = 0; i = strtoul(line + l, &end, 0); @@ -268,7 +270,8 @@ static int read_rdcu_pkt_mode_cfg(uint8_t *icu_addr, uint8_t *rdcu_addr, *rdcu_addr = (uint8_t)i; continue; } - if (!strncmp(line, "MTU", l = strlen("MTU"))) { + l = strlen("MTU"); + if (!strncmp(line, "MTU", l)) { end = NULL; errno = 0; i = strtoul(line + l, &end, 0); @@ -317,7 +320,7 @@ int init_rmap_pkt_to_file(void) /** - * @brief generate the rmap packets to set up an RDCU compression + * @brief generates the RMAP packets to set up an RDCU compression * @note note that the initialization function init_rmap_pkt_to_file() must be * executed before * @note the configuration of the ICU_ADDR, RDCU_ADDR, MTU settings are in the @@ -357,7 +360,7 @@ int gen_write_rdcu_pkts(const struct cmp_cfg *cfg) /** - * @brief generate the rmap packets to read the result of an RDCU compression + * @brief generates the RMAP packets to read the result of an RDCU compression * @note note that the initialization function init_rmap_pkt_to_file() must be * executed before * @note the configuration of the ICU_ADDR, RDCU_ADDR, MTU settings are in the @@ -428,7 +431,7 @@ int gen_read_rdcu_pkts(const struct cmp_info *info) /** - * @brief generate the rmap packets to set up an RDCU compression, read the + * @brief generate the RMAP packets to set up an RDCU compression, read the * bitstream and the updated model in parallel to write the data to compressed * and the model and start the compression * @note the compressed data are read from cfg->rdcu_buffer_adr with the length diff --git a/test/cmp_tool/cmp_tool_integration_test.py b/test/cmp_tool/cmp_tool_integration_test.py index 520d2546470e94e3f0ee1e4c69a7c367ef798109..72512f25f2d9baa17c5b368ea39b77103089d299 100755 --- a/test/cmp_tool/cmp_tool_integration_test.py +++ b/test/cmp_tool/cmp_tool_integration_test.py @@ -522,7 +522,7 @@ def test_model_compression(): cfg["ap1_golomb_par"] = '20' cfg["ap1_spill"] = '70' cfg["ap2_golomb_par"] = '63' - cfg["ap1_spill"] = '6' + cfg["ap2_spill"] = '6' for key, value in cfg.items(): f.write(key + ' = ' + str(value) + '\n') @@ -980,7 +980,7 @@ def test_wrong_formart_data_fiel(): assert(stdout == CMP_START_STR_CMP + "Importing configuration file %s ... DONE\n" % (cfg_file_name) + "Importing data file %s ... FAILED\n" % (data_file_name)) - assert(stderr == "cmp_tool: wrong.data: Error read in 'W'. The data are not correct formatted.\n") + assert(stderr == "cmp_tool: wrong.data: Error read in 'W'. The data are not correctly formatted.\n") assert(returncode == EXIT_FAILURE) finally: del_file(data_file_name) @@ -1004,7 +1004,7 @@ def test_wrong_formart_cmp_fiel(): assert(stdout == CMP_START_STR_DECMP + "Importing decompression information file %s ... DONE\n" % (info_file_name) + "Importing compressed data file %s ... FAILED\n" % (cmp_file_name)) - assert(stderr == "cmp_tool: wrong.cmp: Error read in 'w'. The data are not correct formatted.\n") + assert(stderr == "cmp_tool: wrong.cmp: Error read in 'w'. The data are not correctly formatted.\n") assert(returncode == EXIT_FAILURE) finally: del_file(cmp_file_name) @@ -1163,7 +1163,7 @@ def test_header_wrong_formatted(): assert(returncode == EXIT_FAILURE) assert(stdout == CMP_START_STR_DECMP + "Importing compressed data file %s ... FAILED\n" % (cmp_file_name)) - assert(stderr == "cmp_tool: %s: Error read in '!'. The data are not correct formatted.\n" % (cmp_file_name)) + assert(stderr == "cmp_tool: %s: Error read in '!'. The data are not correctly formatted.\n" % (cmp_file_name)) finally: del_file(cmp_file_name)