diff --git a/cmp_tool.c b/cmp_tool.c index 19213b8c4ad394671a07eba4ddbeea18532432b2..e9cd735ab2a4ad7b0cd580d120e133a977b258af 100644 --- a/cmp_tool.c +++ b/cmp_tool.c @@ -367,26 +367,22 @@ int main(int argc, char **argv) printf("DONE\n"); printf("Importing compressed data file %s ... ", data_file_name); - cmp_size_byte = cmp_bit_to_4byte(info.cmp_size); ent_size = cmp_ent_create(NULL, DATA_TYPE_IMAGETTE, info.cmp_mode_used == CMP_MODE_RAW, - cmp_size_byte); + cmp_bit_to_4byte(info.cmp_size)); if (!ent_size) goto fail; - decomp_entity = malloc(ent_size); + decomp_entity = calloc(1, ent_size); if (!decomp_entity) { fprintf(stderr, "%s: Error allocating memory for decompression input buffer.\n", PROGRAM_NAME); goto fail; } ent_size = cmp_ent_create(decomp_entity, DATA_TYPE_IMAGETTE, info.cmp_mode_used == CMP_MODE_RAW, - cmp_size_byte); + cmp_bit_to_4byte(info.cmp_size)); if (!ent_size) goto fail; - if (info.cmp_mode_used == CMP_MODE_RAW) - /* the raw data does not have to be a multiple of 4 bytes */ - cmp_size_byte = (info.cmp_size+7)/CHAR_BIT; - + cmp_size_byte = (info.cmp_size+7)/CHAR_BIT; f_size = read_file8(data_file_name, cmp_ent_get_data_buf(decomp_entity), cmp_size_byte, verbose_en); if (f_size < 0) @@ -407,17 +403,26 @@ int main(int argc, char **argv) /* to be save allocate at least the size of the cmp_entity struct */ if (buf_size < sizeof(struct cmp_entity)) buf_size = sizeof(struct cmp_entity); + /* The compressed data is read in 4-byte words, so our + * data buffer must be a multiple of 4 bytes. + */ + buf_size = (buf_size + 3) & ~((size_t)0x3); - decomp_entity = malloc(buf_size); + decomp_entity = calloc(1, buf_size); if (!decomp_entity) { fprintf(stderr, "%s: Error allocating memory for the compression entity buffer.\n", PROGRAM_NAME); goto fail; } size = read_file_cmp_entity(data_file_name, decomp_entity, - size, verbose_en); + (uint32_t)size, verbose_en); if (size < 0) goto fail; + if (cmp_ent_get_size(decomp_entity) & 0x3) { + printf("\nThe size of the compression entity is not a multiple of 4 bytes. Padding the compression entity to a multiple of 4 bytes.\n"); + cmp_ent_set_size(decomp_entity, (uint32_t)buf_size); + } + if (verbose_en) { cmp_ent_print(decomp_entity); printf("\n"); diff --git a/include/cmp_entity.h b/include/cmp_entity.h index dd1fa94d908c42365fd495cc478199c3a4487e27..35bb79d3abadb1f306849b80ada554ad366d3ef4 100644 --- a/include/cmp_entity.h +++ b/include/cmp_entity.h @@ -192,7 +192,7 @@ int cmp_ent_set_coarse_end_time(struct cmp_entity *ent, uint32_t coarse_time); int cmp_ent_set_fine_end_time(struct cmp_entity *ent, uint16_t fine_time); int cmp_ent_set_data_type(struct cmp_entity *ent, enum cmp_data_type data_type, - int raw_mode); + int raw_mode_flag); int cmp_ent_set_cmp_mode(struct cmp_entity *ent, enum cmp_mode cmp_mode_used); int cmp_ent_set_model_value(struct cmp_entity *ent, uint32_t model_value_used); int cmp_ent_set_model_id(struct cmp_entity *ent, uint32_t model_id); @@ -221,23 +221,23 @@ int cmp_ent_set_ima_ap2_golomb_par(struct cmp_entity *ent, uint32_t ap2_golomb_p /* set functions for specific entity header for non-imagette data product types */ -int cmp_ent_set_non_ima_spill1(struct cmp_entity *ent, uint32_t spill1_used); -int cmp_ent_set_non_ima_cmp_par1(struct cmp_entity *ent, uint32_t cmp_par1_used); +int cmp_ent_set_non_ima_spill1(struct cmp_entity *ent, uint32_t spill_1_used); +int cmp_ent_set_non_ima_cmp_par1(struct cmp_entity *ent, uint32_t cmp_par_1_used); -int cmp_ent_set_non_ima_spill2(struct cmp_entity *ent, uint32_t spill2_used); -int cmp_ent_set_non_ima_cmp_par2(struct cmp_entity *ent, uint32_t cmp_par2_used); +int cmp_ent_set_non_ima_spill2(struct cmp_entity *ent, uint32_t spill_2_used); +int cmp_ent_set_non_ima_cmp_par2(struct cmp_entity *ent, uint32_t cmp_par_2_used); -int cmp_ent_set_non_ima_spill3(struct cmp_entity *ent, uint32_t spill3_used); -int cmp_ent_set_non_ima_cmp_par3(struct cmp_entity *ent, uint32_t cmp_par3_used); +int cmp_ent_set_non_ima_spill3(struct cmp_entity *ent, uint32_t spill_3_used); +int cmp_ent_set_non_ima_cmp_par3(struct cmp_entity *ent, uint32_t cmp_par_3_used); -int cmp_ent_set_non_ima_spill4(struct cmp_entity *ent, uint32_t spill4_used); -int cmp_ent_set_non_ima_cmp_par4(struct cmp_entity *ent, uint32_t cmp_par4_used); +int cmp_ent_set_non_ima_spill4(struct cmp_entity *ent, uint32_t spill_4_used); +int cmp_ent_set_non_ima_cmp_par4(struct cmp_entity *ent, uint32_t cmp_par_4_used); -int cmp_ent_set_non_ima_spill5(struct cmp_entity *ent, uint32_t spill5_used); -int cmp_ent_set_non_ima_cmp_par5(struct cmp_entity *ent, uint32_t cmp_par5_used); +int cmp_ent_set_non_ima_spill5(struct cmp_entity *ent, uint32_t spill_5_used); +int cmp_ent_set_non_ima_cmp_par5(struct cmp_entity *ent, uint32_t cmp_par_5_used); -int cmp_ent_set_non_ima_spill6(struct cmp_entity *ent, uint32_t spill6_used); -int cmp_ent_set_non_ima_cmp_par6(struct cmp_entity *ent, uint32_t cmp_par6_used); +int cmp_ent_set_non_ima_spill6(struct cmp_entity *ent, uint32_t spill_6_used); +int cmp_ent_set_non_ima_cmp_par6(struct cmp_entity *ent, uint32_t cmp_par_6_used); @@ -311,7 +311,7 @@ int32_t cmp_ent_get_cmp_data(struct cmp_entity *ent, uint32_t *data_buf, uint32_t data_buf_size); /* calculate the size of the compression entity header */ -uint32_t cmp_ent_cal_hdr_size(enum cmp_data_type data_type, int raw_mode); +uint32_t cmp_ent_cal_hdr_size(enum cmp_data_type data_type, int raw_mode_flag); #if defined __has_include diff --git a/include/cmp_support.h b/include/cmp_support.h index c5247e9a1bf20d2def653e127a691c1c495327c7..d696bf433b9b5c89ebb55e9c2b243dc5c6c901ba 100644 --- a/include/cmp_support.h +++ b/include/cmp_support.h @@ -317,8 +317,6 @@ int rdcu_supported_cmp_mode_is_used(enum cmp_mode cmp_mode); int zero_escape_mech_is_used(enum cmp_mode cmp_mode); int multi_escape_mech_is_used(enum cmp_mode cmp_mode); -/* unsigned int round_fwd(unsigned int value, unsigned int round); */ -/* unsigned int round_inv(unsigned int value, unsigned int round); */ unsigned int cmp_up_model(unsigned int data, unsigned int model, unsigned int model_value, unsigned int round); diff --git a/lib/cmp_entity.c b/lib/cmp_entity.c index 64052c14b554bdbe0119a5eada0ad56b1976290d..3336e674f0445011e5866950ba39ac76c134d703 100644 --- a/lib/cmp_entity.c +++ b/lib/cmp_entity.c @@ -2413,7 +2413,7 @@ static void cmp_ent_parse_generic_header(struct cmp_entity *ent) debug_print("Compressed with cmp_tool version: %u.%02u\n", major, minor); } else - debug_print("ICU ASW Version ID: %" PRIu32 "\n", version_id); + debug_print("ICU ASW Version ID: %08" PRIx32 "\n", version_id); cmp_ent_size = cmp_ent_get_size(ent); debug_print("Compression Entity Size: %" PRIu32 " byte\n", cmp_ent_size); diff --git a/lib/cmp_io.c b/lib/cmp_io.c index 4f3ba6ac2fa824f3f70a422f2c6e80f244aa46ad..9cf36eac9f5c1224aedd275cd3548e5b575feacc 100644 --- a/lib/cmp_io.c +++ b/lib/cmp_io.c @@ -1230,8 +1230,8 @@ static ssize_t str2uint8_arr(const char *str, uint8_t *data, uint32_t buf_size, if (!data) /* finished counting the sample */ break; - fprintf(stderr, "%s: %s: Error: The files do not contain enough data as requested.\n", - PROGRAM_NAME, file_name); + fprintf(stderr, "%s: %s: Error: The files do not contain enough data. Expected: 0x%x, has 0x%zx.\n", + PROGRAM_NAME, file_name, buf_size, i); return -1; } @@ -1275,12 +1275,12 @@ static ssize_t str2uint8_arr(const char *str, uint8_t *data, uint32_t buf_size, nptr = eptr; } - /* did we read all data in the string? */ - while (isspace(*nptr) || *nptr == '#') { + /* did we read all data in the string? 0 at the end are ignored */ + while (isspace(*nptr) || *nptr == '0' || *nptr == '#') { if (*nptr == '#') nptr = skip_comment(nptr); else - nptr = skip_space(nptr); + nptr++; } if (*nptr != '\0') { fprintf(stderr, "%s: %s: Warning: The file may contain more data than specified by the samples or cmp_size parameter.\n", @@ -1339,7 +1339,7 @@ ssize_t read_file8(const char *file_name, uint8_t *buf, uint32_t buf_size, int v return 0; } if ((unsigned long)file_size < buf_size) { - fprintf(stderr, "%s: %s: Error: The files do not contain enough data as requested.\n", PROGRAM_NAME, file_name); + fprintf(stderr, "%s: %s: Error: The files do not contain enough data.\n", PROGRAM_NAME, file_name); goto fail; } /* reset the file position indicator to the beginning of the file */ @@ -1451,13 +1451,13 @@ ssize_t read_file_cmp_entity(const char *file_name, struct cmp_entity *ent, enum cmp_data_type data_type = cmp_ent_get_data_type(ent); if (data_type == DATA_TYPE_UNKNOWN) { - fprintf(stderr, "%s: %s: Error: Compression data type is not supported.\n", + fprintf(stderr, "%s: %s: Error: Compression data type is not supported. The header of the compression entity may be corrupted.\n", PROGRAM_NAME, file_name); return -1; } if (size != (ssize_t)cmp_ent_get_size(ent)) { - fprintf(stderr, "%s: %s: The size of the compression entity set in the header of the compression entity is not the same size as the read-in file has.\n", - PROGRAM_NAME, file_name); + fprintf(stderr, "%s: %s: The size of the compression entity set in the header of the compression entity is not the same size as the read-in file has. Expected: 0x%x, has 0x%zx.\n", + PROGRAM_NAME, file_name, cmp_ent_get_size(ent), size); return -1; } diff --git a/test/cmp_icu/test_cmp_icu.c b/test/cmp_icu/test_cmp_icu.c index a78041f6085e8546fa899f37514fa7610cf33184..26a7f38a03cce685d6a1653ddd66230fe1ac7e2b 100644 --- a/test/cmp_icu/test_cmp_icu.c +++ b/test/cmp_icu/test_cmp_icu.c @@ -31,7 +31,6 @@ #include "cmp_icu.h" #include "../lib/cmp_icu.c" /* this is a hack to test static functions */ -/* TODO: test compression with samples = 0 and buffer_length = 0; */ /** * @brief Seeds the pseudo-random number generator used by rand() @@ -2569,7 +2568,7 @@ void test_compress_imagette_error_cases(void) uint32_t output_buf[2] = {0xFFFF, 0xFFFF}; struct cmp_cfg cfg = {0}; int cmp_size; - struct cmp_max_used_bits max_used_bits; + struct cmp_max_used_bits my_max_used_bits; cfg.data_type = DATA_TYPE_IMAGETTE; cfg.cmp_mode = CMP_MODE_DIFF_ZERO; @@ -2627,9 +2626,9 @@ void test_compress_imagette_error_cases(void) TEST_ASSERT_EQUAL_INT(-1, cmp_size); /* error in setup */ - max_used_bits = cmp_get_max_used_bits(); - max_used_bits.nc_imagette = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits = cmp_get_max_used_bits(); + my_max_used_bits.nc_imagette = 33; + cmp_set_max_used_bits(&my_max_used_bits); cfg.data_type = DATA_TYPE_IMAGETTE; cfg.cmp_mode = CMP_MODE_DIFF_ZERO; cfg.input_buf = data; @@ -2843,7 +2842,7 @@ void test_compress_s_fx_model_multi(void) int cmp_size; struct multi_entry_hdr *hdr; uint32_t *cmp_data; - struct cmp_max_used_bits max_used_bits; + struct cmp_max_used_bits my_max_used_bits; /* setup configuration */ cfg.data_type = DATA_TYPE_S_FX; @@ -2901,10 +2900,10 @@ void test_compress_s_fx_model_multi(void) model[5].fx = 0x001FFFFF; memcpy(hdr->entry, model, sizeof(model)); - max_used_bits = cmp_get_max_used_bits(); - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 21; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits = cmp_get_max_used_bits(); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 21; + cmp_set_max_used_bits(&my_max_used_bits); cmp_size = icu_compress_data(&cfg); @@ -2938,122 +2937,6 @@ void test_compress_s_fx_model_multi(void) } -#if 0 -void todo_est_compress_s_fx_efx_model_multi(void) -{ - uint32_t i; - struct s_fx_efx data[6], model[6]; - struct s_fx_efx *up_model_buf; - struct cmp_cfg cfg = {0}; - int cmp_size; - struct multi_entry_hdr *hdr; - uint32_t *cmp_data; - struct cmp_max_used_bits max_used_bits = cmp_get_max_used_bits(); - - /* define max_used_bits */ - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 21; - max_used_bits.s_efx = 21; - cmp_set_max_used_bits(&max_used_bits); - - /* setup configuration */ - cfg.data_type = DATA_TYPE_S_FX_EFX; - cfg.cmp_mode = CMP_MODE_MODEL_MULTI; - cfg.model_value = 16; - cfg.samples = 6; - cfg.input_buf = malloc(cmp_cal_size_of_data(cfg.samples, cfg.data_type)); - TEST_ASSERT_NOT_NULL(cfg.input_buf); - cfg.model_buf = malloc(cmp_cal_size_of_data(cfg.samples, cfg.data_type)); - TEST_ASSERT_NOT_NULL(cfg.model_buf); - cfg.icu_new_model_buf = malloc(cmp_cal_size_of_data(cfg.samples, cfg.data_type)); - TEST_ASSERT_NOT_NULL(cfg.icu_new_model_buf); - cfg.buffer_length = 6; - cfg.icu_output_buf = malloc(cmp_cal_size_of_data(cfg.buffer_length, cfg.data_type)); - TEST_ASSERT_NOT_NULL(cfg.icu_output_buf); - cfg.cmp_par_exp_flags = 1; - cfg.spill_exp_flags = 8; - cfg.cmp_par_fx = 3; - cfg.spill_fx = 35; - cfg.cmp_par_efx = 4; - cfg.spill_efx = 35; - - - /* generate input data */ - hdr = cfg.input_buf; - /* use dummy data for the header */ - memset(hdr, 0x42, sizeof(struct multi_entry_hdr)); - data[0].exp_flags = 0x0; - data[0].fx = 0x0; - data[0].efx = 0x0; - data[1].exp_flags = 0x1; - data[1].fx = 0x1; - data[1].efx = 0; - data[2].exp_flags = 0x2; - data[2].fx = 0x23; - data[2].efx = 0; - data[3].exp_flags = 0x3; - data[3].fx = 0x42; - data[3].efx = 0; - data[4].exp_flags = 0x0; - data[4].fx = 0x001FFFFF; - data[4].efx = 0; - data[5].exp_flags = 0x0; - data[5].fx = 0x0; - data[5].efx = 0; - memcpy(hdr->entry, data, sizeof(data)); - - /* generate model data */ - hdr = cfg.model_buf; - /* use dummy data for the header */ - memset(hdr, 0x41, sizeof(struct multi_entry_hdr)); - model[0].exp_flags = 0x0; - model[0].fx = 0x0; - model[0].efx = 0x1FFFFF; - model[1].exp_flags = 0x3; - model[1].fx = 0x1; - model[1].efx = 0x1FFFFF; - model[2].exp_flags = 0x0; - model[2].fx = 0x42; - model[2].efx = 0x1FFFFF; - model[3].exp_flags = 0x0; - model[3].fx = 0x23; - model[3].efx = 0x1FFFFF; - model[4].exp_flags = 0x3; - model[4].fx = 0x0; - model[4].efx = 0x1FFFFF; - model[5].exp_flags = 0x2; - model[5].fx = 0x001FFFFF; - model[5].efx = 0x1FFFFF; - memcpy(hdr->entry, model, sizeof(model)); - - cmp_size = icu_compress_data(&cfg); -#if 0 - TEST_ASSERT_EQUAL_INT(166, cmp_size); - TEST_ASSERT_FALSE(memcmp(cfg.input_buf, cfg.icu_output_buf, MULTI_ENTRY_HDR_SIZE)); - cmp_data = &cfg.icu_output_buf[MULTI_ENTRY_HDR_SIZE/sizeof(uint32_t)]; - TEST_ASSERT_EQUAL_HEX(0x1C77FFA6, be32_to_cpu(cmp_data[0])); - TEST_ASSERT_EQUAL_HEX(0xAFFF4DE5, be32_to_cpu(cmp_data[1])); - TEST_ASSERT_EQUAL_HEX(0xCC000000, be32_to_cpu(cmp_data[2])); - -#endif - hdr = cfg.icu_new_model_buf; - up_model_buf = (struct s_fx *)hdr->entry; - TEST_ASSERT_FALSE(memcmp(hdr, cfg.icu_output_buf, MULTI_ENTRY_HDR_SIZE)); - for (i = 0; i < cfg.samples; i++) { - TEST_ASSERT_EQUAL(model[i].exp_flags, up_model_buf[i].exp_flags); - TEST_ASSERT_EQUAL(model[i].fx, up_model_buf[i].fx); - TEST_ASSERT_EQUAL(model[i].efx, up_model_buf[i].efx); - } - - - free(cfg.input_buf); - free(cfg.model_buf); - free(cfg.icu_new_model_buf); - free(cfg.icu_output_buf); -} -#endif - - /** * @test compress_s_fx */ @@ -3068,12 +2951,12 @@ void test_compress_s_fx_error_cases(void) uint32_t spillover_fx = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct s_fx)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct s_fx)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct s_fx *data_p = (struct s_fx *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 21; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 21; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_S_FX, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3090,26 +2973,26 @@ void test_compress_s_fx_error_cases(void) TEST_ASSERT_EQUAL_INT(sizeof(compressed_data), compressed_data_size); /* test if data are higher than max used bits value */ - data_p[0].fx = 0x200000; /* has more than 21 bits (max_used_bits.s_fx) */ + data_p[0].fx = 0x200000; /* has more than 21 bits (my_max_used_bits.s_fx) */ cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); /* compressed data are to small for the compressed_data buffer */ - max_used_bits.s_exp_flags = 8; - max_used_bits.s_fx = 32; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 8; + my_max_used_bits.s_fx = 32; + cmp_set_max_used_bits(&my_max_used_bits); memset(data_to_compress, 0xff, sizeof(data_to_compress)); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_SMALL_BUF, cmp_bits); - max_used_bits.s_exp_flags = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.s_exp_flags = 32; - max_used_bits.s_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 32; + my_max_used_bits.s_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3131,13 +3014,13 @@ void test_compress_s_fx_efx_error_cases(void) uint32_t spillover_efx = cmp_icu_max_spill(MAX_NON_IMA_GOLOMB_PAR); uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+2*sizeof(struct s_fx_efx)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct s_fx_efx)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct s_fx_efx *data_p = (struct s_fx_efx *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 21; - max_used_bits.s_efx = 16; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 21; + my_max_used_bits.s_efx = 16; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_S_FX_EFX, CMP_MODE_DIFF_MULTI, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3154,37 +3037,37 @@ void test_compress_s_fx_efx_error_cases(void) TEST_ASSERT_EQUAL_INT(sizeof(compressed_data), compressed_data_size); /* test if data are higher than max used bits value */ - data_p[0].exp_flags = 0x4; /* has more than 2 bits (max_used_bits.s_exp_flags) */ + data_p[0].exp_flags = 0x4; /* has more than 2 bits (my_max_used_bits.s_exp_flags) */ cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); data_p[0].exp_flags = 0x3; - data_p[1].fx = 0x200000; /* has more than 21 bits (max_used_bits.fx) */ + data_p[1].fx = 0x200000; /* has more than 21 bits (my_max_used_bits.fx) */ cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); data_p[1].fx = 0x1FFFFF; - data_p[1].efx = 0x100000; /* has more than 16 bits (max_used_bits.efx) */ + data_p[1].efx = 0x100000; /* has more than 16 bits (my_max_used_bits.efx) */ cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); /* error case exp_flag setup */ - max_used_bits.s_exp_flags = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); /* error case fx setup */ - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); /* error case efx setup */ - max_used_bits.s_fx = 21; - max_used_bits.s_efx = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_fx = 21; + my_max_used_bits.s_efx = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3207,14 +3090,14 @@ void test_compress_s_fx_ncob_error_cases(void) uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct s_fx_ncob)] = {0}; uint8_t model_data[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct s_fx_ncob)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct s_fx_ncob)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct s_fx_ncob *data_p = (struct s_fx_ncob *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 21; - max_used_bits.s_ncob = 31; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 21; + my_max_used_bits.s_ncob = 31; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_S_FX_NCOB, CMP_MODE_MODEL_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3234,7 +3117,7 @@ void test_compress_s_fx_ncob_error_cases(void) TEST_ASSERT_EQUAL_INT(CMP_ERROR_SMALL_BUF, cmp_bits); /* test if data are higher than max used bits value */ - data_p[2].exp_flags = 0x4; /* has more than 2 bits (max_used_bits.s_exp_flags) */ + data_p[2].exp_flags = 0x4; /* has more than 2 bits (my_max_used_bits.s_exp_flags) */ cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); @@ -3250,22 +3133,22 @@ void test_compress_s_fx_ncob_error_cases(void) data_p[0].ncob_y = 0x7FFFFFFF; /* value to high */ /* error case exp_flag setup */ - max_used_bits.s_exp_flags = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); /* error case fx setup */ - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); /* error case efx setup */ - max_used_bits.s_fx = 21; - max_used_bits.s_ncob = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_fx = 21; + my_max_used_bits.s_ncob = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3292,16 +3175,16 @@ void test_compress_s_fx_efx_ncob_ecob_error_cases(void) uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct s_fx_efx_ncob_ecob)] = {0}; uint8_t model_data[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct s_fx_efx_ncob_ecob)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct s_fx_efx_ncob_ecob)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct s_fx_efx_ncob_ecob *data_p = (struct s_fx_efx_ncob_ecob *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.s_exp_flags = 2; - max_used_bits.s_fx = 21; - max_used_bits.s_ncob = 31; - max_used_bits.s_efx = 23; - max_used_bits.s_ecob = 7; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 2; + my_max_used_bits.s_fx = 21; + my_max_used_bits.s_ncob = 31; + my_max_used_bits.s_efx = 23; + my_max_used_bits.s_ecob = 7; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_S_FX_EFX_NCOB_ECOB, CMP_MODE_MODEL_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3353,37 +3236,37 @@ void test_compress_s_fx_efx_ncob_ecob_error_cases(void) data_p[1].ecob_y = 0x7F; /* error case exp_flag setup */ - max_used_bits.s_exp_flags = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); /* error case fx setup */ - max_used_bits.s_exp_flags = 32; - max_used_bits.s_fx = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_exp_flags = 32; + my_max_used_bits.s_fx = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); /* error case efx setup */ - max_used_bits.s_fx = 32; - max_used_bits.s_ncob = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_fx = 32; + my_max_used_bits.s_ncob = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.s_ncob = 32; - max_used_bits.s_efx = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_ncob = 32; + my_max_used_bits.s_efx = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.s_efx = 32; - max_used_bits.s_ecob = 33; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.s_efx = 32; + my_max_used_bits.s_ecob = 33; + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.s_ecob = 32; + my_max_used_bits.s_ecob = 32; } @@ -3399,10 +3282,10 @@ void test_compress_f_fx_error_cases(void) uint32_t spillover_fx = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct f_fx)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct f_fx)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; - max_used_bits.f_fx = 23; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 23; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_F_FX, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3421,8 +3304,8 @@ void test_compress_f_fx_error_cases(void) cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_SMALL_BUF, cmp_bits); - max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3442,12 +3325,12 @@ void test_compress_f_fx_efx_error_cases(void) uint32_t spillover_efx = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+2*sizeof(struct f_fx_efx)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct f_fx_efx)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct f_fx_efx *data_p = (struct f_fx_efx *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.f_fx = 23; - max_used_bits.f_efx = 31; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 23; + my_max_used_bits.f_efx = 31; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_F_FX_EFX, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3471,19 +3354,19 @@ void test_compress_f_fx_efx_error_cases(void) /* efx value is to big for the max used bits values */ data_p[0].efx = 0x80000000; - cmp_set_max_used_bits(&max_used_bits); + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); data_p[0].efx = 0x7FFFFFFF; - max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.f_fx = 32; - max_used_bits.f_efx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 32; + my_max_used_bits.f_efx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3503,12 +3386,12 @@ void test_compress_f_fx_ncob_error_cases(void) uint32_t spillover_ncob = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+2*sizeof(struct f_fx_ncob)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct f_fx_ncob)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct f_fx_ncob *data_p = (struct f_fx_ncob *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.f_fx = 31; - max_used_bits.f_ncob = 23; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 31; + my_max_used_bits.f_ncob = 23; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_F_FX_NCOB, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3530,24 +3413,24 @@ void test_compress_f_fx_ncob_error_cases(void) /* value is to big for the max used bits values */ data_p[0].ncob_x = 0x800000; - cmp_set_max_used_bits(&max_used_bits); + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); data_p[0].ncob_x = 0x7FFFFF; data_p[0].ncob_y = 0x800000; - cmp_set_max_used_bits(&max_used_bits); + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); data_p[0].ncob_y = 0x7FFFFF; - max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.f_fx = 32; - max_used_bits.f_ncob = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 32; + my_max_used_bits.f_ncob = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3571,14 +3454,14 @@ void test_compress_f_fx_efx_ncob_ecob(void) uint32_t spillover_ecob = 55; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+4*sizeof(struct f_fx_efx_ncob_ecob)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct f_fx_efx_ncob_ecob)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct f_fx_efx_ncob_ecob *data_p = (struct f_fx_efx_ncob_ecob *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.f_fx = 31; - max_used_bits.f_ncob = 3; - max_used_bits.f_efx = 16; - max_used_bits.f_ecob = 8; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 31; + my_max_used_bits.f_ncob = 3; + my_max_used_bits.f_efx = 16; + my_max_used_bits.f_ecob = 8; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_F_FX_EFX_NCOB_ECOB, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3624,26 +3507,26 @@ void test_compress_f_fx_efx_ncob_ecob(void) TEST_ASSERT_EQUAL_INT(CMP_ERROR_HIGH_VALUE, cmp_bits); data_p[3].ecob_y = 0x100-1; - max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.f_fx = 32; - max_used_bits.f_ncob = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_fx = 32; + my_max_used_bits.f_ncob = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.f_ncob = 32; - max_used_bits.f_efx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_ncob = 32; + my_max_used_bits.f_efx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.f_efx = 32; - max_used_bits.f_ecob = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.f_efx = 32; + my_max_used_bits.f_ecob = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3665,14 +3548,14 @@ void test_compress_l_fx_error_cases(void) uint32_t spillover_fx_cob_variance = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct l_fx)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct l_fx)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct l_fx *data_p = (struct l_fx *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.l_exp_flags = 23; - max_used_bits.l_fx = 31; - max_used_bits.l_efx = 1; - max_used_bits.l_fx_variance = 23; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 23; + my_max_used_bits.l_fx = 31; + my_max_used_bits.l_efx = 1; + my_max_used_bits.l_fx_variance = 23; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_L_FX, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3704,20 +3587,20 @@ void test_compress_l_fx_error_cases(void) data_p[0].fx_variance = 0x800000-1; - max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_exp_flags = 32; - max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 32; + my_max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_fx = 32; - max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_fx = 32; + my_max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3741,14 +3624,14 @@ void test_compress_l_fx_efx_error_cases(void) uint32_t spillover_fx_cob_variance = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct l_fx_efx)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct l_fx_efx)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct l_fx_efx *data_p = (struct l_fx_efx *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.l_exp_flags = 23; - max_used_bits.l_fx = 31; - max_used_bits.l_efx = 1; - max_used_bits.l_fx_variance = 23; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 23; + my_max_used_bits.l_fx = 31; + my_max_used_bits.l_efx = 1; + my_max_used_bits.l_fx_variance = 23; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_L_FX_EFX, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3785,26 +3668,26 @@ void test_compress_l_fx_efx_error_cases(void) data_p[0].fx_variance = 0x800000-1; - max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_exp_flags = 32; - max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 32; + my_max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_fx = 32; - max_used_bits.l_efx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_fx = 32; + my_max_used_bits.l_efx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_efx = 32; - max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_efx = 32; + my_max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3828,15 +3711,15 @@ void test_compress_l_fx_ncob_error_cases(void) uint32_t spillover_fx_cob_variance = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct l_fx_ncob)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct l_fx_ncob)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct l_fx_ncob *data_p = (struct l_fx_ncob *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.l_exp_flags = 23; - max_used_bits.l_fx = 31; - max_used_bits.l_ncob = 2; - max_used_bits.l_fx_variance = 23; - max_used_bits.l_cob_variance = 11; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 23; + my_max_used_bits.l_fx = 31; + my_max_used_bits.l_ncob = 2; + my_max_used_bits.l_fx_variance = 23; + my_max_used_bits.l_cob_variance = 11; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_L_FX_NCOB, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -3888,32 +3771,32 @@ void test_compress_l_fx_ncob_error_cases(void) data_p[2].cob_y_variance = 0x800-1; - max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_exp_flags = 32; - max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 32; + my_max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_fx = 32; - max_used_bits.l_ncob = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_fx = 32; + my_max_used_bits.l_ncob = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_ncob = 32; - max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_ncob = 32; + my_max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_fx_variance = 32; - max_used_bits.l_cob_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_fx_variance = 32; + my_max_used_bits.l_cob_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -3941,17 +3824,17 @@ void test_compress_l_fx_efx_ncob_ecob_error_cases(void) uint32_t spillover_fx_cob_variance = 8; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct l_fx_efx_ncob_ecob)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct l_fx_efx_ncob_ecob)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct l_fx_efx_ncob_ecob *data_p = (struct l_fx_efx_ncob_ecob *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.l_exp_flags = 23; - max_used_bits.l_fx = 31; - max_used_bits.l_ncob = 2; - max_used_bits.l_efx = 1; - max_used_bits.l_ecob = 3; - max_used_bits.l_fx_variance = 23; - max_used_bits.l_cob_variance = 11; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 23; + my_max_used_bits.l_fx = 31; + my_max_used_bits.l_ncob = 2; + my_max_used_bits.l_efx = 1; + my_max_used_bits.l_ecob = 3; + my_max_used_bits.l_fx_variance = 23; + my_max_used_bits.l_cob_variance = 11; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_L_FX_EFX_NCOB_ECOB, CMP_MODE_DIFF_ZERO, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -4018,44 +3901,44 @@ void test_compress_l_fx_efx_ncob_ecob_error_cases(void) data_p[2].cob_y_variance = 0x800-1; - max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_exp_flags = 32; - max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_exp_flags = 32; + my_max_used_bits.l_fx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_fx = 32; - max_used_bits.l_ncob = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_fx = 32; + my_max_used_bits.l_ncob = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_ncob = 32; - max_used_bits.l_efx = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_ncob = 32; + my_max_used_bits.l_efx = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_efx = 32; - max_used_bits.l_ecob = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_efx = 32; + my_max_used_bits.l_ecob = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_ecob = 32; - max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_ecob = 32; + my_max_used_bits.l_fx_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.l_fx_variance = 32; - max_used_bits.l_cob_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.l_fx_variance = 32; + my_max_used_bits.l_cob_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -4075,12 +3958,12 @@ void test_compress_nc_offset_error_cases(void) uint32_t spillover_variance = cmp_icu_max_spill(MAX_NON_IMA_GOLOMB_PAR); uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct nc_offset)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct nc_offset)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct nc_offset *data_p = (struct nc_offset *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.nc_offset_mean = 1; - max_used_bits.nc_offset_variance = 31; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_offset_mean = 1; + my_max_used_bits.nc_offset_variance = 31; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_OFFSET, CMP_MODE_DIFF_MULTI, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -4106,14 +3989,14 @@ void test_compress_nc_offset_error_cases(void) data_p[1].variance = 0x80000000-1; - max_used_bits.nc_offset_mean = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_offset_mean = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.nc_offset_mean = 32; - max_used_bits.nc_offset_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_offset_mean = 32; + my_max_used_bits.nc_offset_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -4135,13 +4018,13 @@ void test_compress_nc_background_error_cases(void) uint32_t spillover_pixels_error = 42; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct nc_background)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct nc_background)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct nc_background *data_p = (struct nc_background *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.nc_background_mean = 1; - max_used_bits.nc_background_variance = 31; - max_used_bits.nc_background_outlier_pixels = 2; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_background_mean = 1; + my_max_used_bits.nc_background_variance = 31; + my_max_used_bits.nc_background_outlier_pixels = 2; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_BACKGROUND, CMP_MODE_DIFF_MULTI, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -4172,20 +4055,20 @@ void test_compress_nc_background_error_cases(void) data_p[1].outlier_pixels = 0x3; - max_used_bits.nc_background_mean = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_background_mean = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.nc_background_mean = 32; - max_used_bits.nc_background_variance = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_background_mean = 32; + my_max_used_bits.nc_background_variance = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.nc_background_variance = 32; - max_used_bits.nc_background_outlier_pixels = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.nc_background_variance = 32; + my_max_used_bits.nc_background_outlier_pixels = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } @@ -4207,13 +4090,13 @@ void test_compress_smearing_error_cases(void) uint32_t spillover_pixels_error = 42; uint8_t data_to_compress[MULTI_ENTRY_HDR_SIZE+3*sizeof(struct smearing)] = {0}; uint8_t compressed_data[MULTI_ENTRY_HDR_SIZE+1*sizeof(struct smearing)] = {0}; - struct cmp_max_used_bits max_used_bits = {0}; + struct cmp_max_used_bits my_max_used_bits = {0}; struct smearing *data_p = (struct smearing *)&data_to_compress[MULTI_ENTRY_HDR_SIZE]; - max_used_bits.smearing_mean = 1; - max_used_bits.smearing_variance_mean = 15; - max_used_bits.smearing_outlier_pixels = 2; - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.smearing_mean = 1; + my_max_used_bits.smearing_variance_mean = 15; + my_max_used_bits.smearing_outlier_pixels = 2; + cmp_set_max_used_bits(&my_max_used_bits); cfg = cmp_cfg_icu_create(DATA_TYPE_SMEARING, CMP_MODE_DIFF_MULTI, 0, CMP_LOSSLESS); TEST_ASSERT(cfg.data_type != DATA_TYPE_UNKNOWN); @@ -4244,20 +4127,20 @@ void test_compress_smearing_error_cases(void) data_p[1].outlier_pixels = 0x3; - max_used_bits.smearing_mean = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.smearing_mean = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.smearing_mean = 32; - max_used_bits.smearing_variance_mean = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.smearing_mean = 32; + my_max_used_bits.smearing_variance_mean = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); - max_used_bits.smearing_variance_mean = 32; - max_used_bits.smearing_outlier_pixels = 33; /* more than 32 bits are not allowed */ - cmp_set_max_used_bits(&max_used_bits); + my_max_used_bits.smearing_variance_mean = 32; + my_max_used_bits.smearing_outlier_pixels = 33; /* more than 32 bits are not allowed */ + cmp_set_max_used_bits(&my_max_used_bits); cmp_bits = icu_compress_data(&cfg); TEST_ASSERT_EQUAL_INT(-1, cmp_bits); } diff --git a/test/cmp_tool/cmp_tool_integration_test.py b/test/cmp_tool/cmp_tool_integration_test.py index 7d58943afab15702f38a6142e43de20de4118b6c..c5e489861be23a0dc8b4a26087f06383b1256418 100755 --- a/test/cmp_tool/cmp_tool_integration_test.py +++ b/test/cmp_tool/cmp_tool_integration_test.py @@ -21,6 +21,7 @@ IMAGETTE_HEADER_SIZE = GENERIC_HEADER_SIZE+4 IMAGETTE_ADAPTIVE_HEADER_SIZE = GENERIC_HEADER_SIZE+12 NON_IMAGETTE_HEADER_SIZE = GENERIC_HEADER_SIZE+32 + def call_cmp_tool(args): args = shlex.split(PATH_CMP_TOOL + " " + args) @@ -1016,6 +1017,81 @@ def test_sample_used_is_to_big(): del_file(info_file_name) +def test_cmp_entity_not_4_byte_aligned(): + cmp_data = '444444' # cmp data are not a multiple of 4 + + version_id = 0x8001_0042 + cmp_ent_size = IMAGETTE_HEADER_SIZE + len(cmp_data)//2 + original_size = 0xA + + start_time = cuc_timestamp(datetime.utcnow()) + end_time = cuc_timestamp(datetime.utcnow()) + + data_type = 1 + cmp_mode_used = 2 + model_value_used = 8 + model_id = 0xBEEF + model_counter = 0 + lossy_cmp_par_used = 0 + + generic_header = build_generic_header(version_id, cmp_ent_size, + original_size, start_time, end_time, data_type, + cmp_mode_used, model_value_used, model_id, + model_counter, lossy_cmp_par_used) + spill_used = 60 + golomb_par_used = 7 + + ima_header = build_imagette_header(spill_used, golomb_par_used) + cmp_data_header = generic_header + ima_header + cmp_data + + data_exp = '00 01 00 02 00 03 00 04 00 05 \n' + info = ("cmp_size = 20\n" + "golomb_par_used = 7\n" + "spill_used = 60\n" + + "cmp_mode_used = 2\n" +"samples_used=5\n") + + cmp_file_name = 'unaligned_cmp_size.cmp' + info_file_name = 'unaligned_cmp_size.info' + output_prefix = '4_byte_aligned' + pars = ['-i %s -d %s --no_header -o %s' % (info_file_name, cmp_file_name, output_prefix), + '-d %s -o %s' % (cmp_file_name, output_prefix)] + + try: + with open(info_file_name, 'w') as f: + f.write(info) + + for par in pars: + with open(cmp_file_name, 'w') as f: + if '--no_header' in par: + f.write(cmp_data) + else: + f.write(cmp_data_header) + + returncode, stdout, stderr = call_cmp_tool(par) + + assert(stderr == "") + + if '--no_header' in par: + assert(stdout == CMP_START_STR_DECMP + + "Importing decompression information file %s ... DONE\n" % (info_file_name) + + "Importing compressed data file %s ... DONE\n" % (cmp_file_name) + + "Decompress data ... DONE\n" + + "Write decompressed data to file %s.dat ... DONE\n" % (output_prefix)) + else: + assert(stdout == CMP_START_STR_DECMP + + "Importing compressed data file %s ... \n" % (cmp_file_name) + + "The size of the compression entity is not a multiple of 4 bytes. Padding the compression entity to a multiple of 4 bytes.\n" + + "DONE\n" + + "Decompress data ... DONE\n"+ + "Write decompressed data to file %s.dat ... DONE\n" % (output_prefix)) + + assert(returncode == EXIT_SUCCESS) + with open(output_prefix+".dat", encoding='utf-8') as f: + assert(f.read() == data_exp) # decompressed data == input data + + finally: + del_file(cmp_file_name) + del_file(info_file_name) + del_file(output_prefix+".dat") + def test_header_wrong_formatted(): cmp_file_name = 'read_wrong_format_header.cmp' @@ -1072,7 +1148,9 @@ def test_header_read_in(): 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: The size of the compression entity set in the header of the compression entity is not the same size as the read-in file has.\n" %(cmp_file_name)) + assert(stderr == "cmp_tool: %s: The size of the compression entity set in the " + "header of the compression entity is not the same size as the read-in " + "file has. Expected: 0x28, has 0x26.\n" %(cmp_file_name)) # false data type data_type = 0x7FFE @@ -1090,7 +1168,8 @@ def test_header_read_in(): 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: Compression data type is not supported.\n" % (cmp_file_name)) + assert(stderr == "cmp_tool: %s: Error: Compression data type is not supported. The " + "header of the compression entity may be corrupted.\n" % (cmp_file_name)) # false cmp_mode_used cmp_mode_used = 0xFF @@ -1153,7 +1232,7 @@ def test_model_fiel_erros(): "Importing configuration file %s ... DONE\n" % (cfg_file_name) + "Importing data file %s ... DONE\n" % (data_file_name) + "Importing model file %s ... FAILED\n" % (model_file_name) ) - assert(stderr == "cmp_tool: %s: Error: The files do not contain enough data as requested.\n" % (model_file_name)) + assert(stderr == "cmp_tool: %s: Error: The files do not contain enough data. Expected: 0xa, has 0x8.\n" % (model_file_name)) # updated model can not write with open(model_file_name, 'w', encoding='utf-8') as f: diff --git a/test/meson.build b/test/meson.build index b6139e5bb3e34a72038783bab4a6c1073cbee79c..877bbd7d05bbafafb9101d5eea8514581b037b65 100644 --- a/test/meson.build +++ b/test/meson.build @@ -15,17 +15,14 @@ endif cppcheck = find_program('cppcheck', required : false) if cppcheck.found() cppcheck_args = [ - main, cmplib_sources, - '--clang', + '--project=' + join_paths(meson.build_root(), 'compile_commands.json'), + # '--clang', '--cppcheck-build-dir='+meson.current_build_dir(), - '-I', 'include', '--std=c89', - # '--addon=misra.py', - '--bug-hunting', '--enable=all', '--inconclusive' ] - run_target('inspector', + run_target('cppcheck', command : [cppcheck, cppcheck_args] ) endif