diff --git a/lib/common/cmp_entity.c b/lib/common/cmp_entity.c index 79641e78a680b1f7825d6aa02da759bddc4f0977..4a710d63457a4b716e659478c3a8df0b35bbdf33 100644 --- a/lib/common/cmp_entity.c +++ b/lib/common/cmp_entity.c @@ -1677,6 +1677,8 @@ void *cmp_ent_get_data_buf(struct cmp_entity *ent) break; case DATA_TYPE_UNKNOWN: default: + /* default branch never reached; cmp_ent_get_data_type returns + * DATA_TYPE_UNKNOWN if data type is unknown */ debug_print("Error: Compression data type not supported."); return NULL; } diff --git a/lib/common/cmp_support.c b/lib/common/cmp_support.c index b3abb675264d042696fd043d028e5c898f91fbef..464acad84d1b45aa14494ceaa6023db9922ee178 100644 --- a/lib/common/cmp_support.c +++ b/lib/common/cmp_support.c @@ -111,29 +111,6 @@ int raw_mode_is_used(enum cmp_mode cmp_mode) } -/** - * @brief check if the compression mode is supported by the RDCU compressor - * - * @param cmp_mode compression mode - * - * @returns 1 when the compression mode is supported by the RDCU, otherwise 0 - */ - -int rdcu_supported_cmp_mode_is_used(enum cmp_mode cmp_mode) -{ - switch (cmp_mode) { - case CMP_MODE_RAW: - case CMP_MODE_MODEL_ZERO: - case CMP_MODE_DIFF_ZERO: - case CMP_MODE_MODEL_MULTI: - case CMP_MODE_DIFF_MULTI: - return 1; - default: - return 0; - } -} - - /** * @brief check if the data product data type is supported by the RDCU compressor * @@ -168,7 +145,16 @@ int rdcu_supported_data_type_is_used(enum cmp_data_type data_type) int cmp_mode_is_supported(enum cmp_mode cmp_mode) { - return rdcu_supported_cmp_mode_is_used(cmp_mode); + switch (cmp_mode) { + case CMP_MODE_RAW: + case CMP_MODE_MODEL_ZERO: + case CMP_MODE_DIFF_ZERO: + case CMP_MODE_MODEL_MULTI: + case CMP_MODE_DIFF_MULTI: + return 1; + default: + return 0; + } } @@ -384,58 +370,30 @@ unsigned int cmp_bit_to_4byte(unsigned int cmp_size_bit) * * @param cfg pointer to a compression configuration containing the compression * data product type, compression mode, model value and the rounding parameters - * @param opt check options: - * RDCU_CHECK for RDCU compression check - * ICU_CHECK for ICU compression check * * @returns 0 if the compression data type, compression mode, model value and * the lossy rounding parameters are valid for an RDCU or ICU compression, * non-zero if parameters are invalid */ -int cmp_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt) +int cmp_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg) { int cfg_invalid = 0; - int invalid_data_type; - int unsupported_cmp_mode; - int check_model_value; - uint32_t max_round_value = 0; - MAYBE_UNUSED const char *str = ""; if (!cfg) return 1; - switch (opt) { - case RDCU_CHECK: - /* the RDCU can only compress imagette data */ - invalid_data_type = !cmp_imagette_data_type_is_used(cfg->data_type); - unsupported_cmp_mode = !rdcu_supported_cmp_mode_is_used(cfg->cmp_mode); - max_round_value = MAX_RDCU_ROUND; - /* for the RDCU the model vale has to be always in the allowed range */ - check_model_value = 1; - str = " for a RDCU compression"; - break; - case ICU_CHECK: - invalid_data_type = cmp_data_type_is_invalid(cfg->data_type); - unsupported_cmp_mode = !cmp_mode_is_supported(cfg->cmp_mode); - max_round_value = MAX_ICU_ROUND; - check_model_value = model_mode_is_used(cfg->cmp_mode); - break; - default: - return 1; - } - - if (invalid_data_type) { - debug_print("Error: selected compression data type is not supported%s.", str); + if (cmp_data_type_is_invalid(cfg->data_type)) { + debug_print("Error: selected compression data type is not supported."); cfg_invalid++; } - if (unsupported_cmp_mode) { - debug_print("Error: selected cmp_mode: %i is not supported%s.", cfg->cmp_mode, str); + if (!cmp_mode_is_supported(cfg->cmp_mode)) { + debug_print("Error: selected cmp_mode: %i is not supported.", cfg->cmp_mode); cfg_invalid++; } - if (check_model_value) { + if (model_mode_is_used(cfg->cmp_mode)) { if (cfg->model_value > MAX_MODEL_VALUE) { debug_print("Error: selected model_value: %" PRIu32 " is invalid. The largest supported value is: %u.", cfg->model_value, MAX_MODEL_VALUE); @@ -443,9 +401,9 @@ int cmp_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt) } } - if (cfg->round > max_round_value) { - debug_print("Error: selected lossy parameter: %" PRIu32 " is not supported%s. The largest supported value is: %" PRIu32 ".", - cfg->round, str, max_round_value); + if (cfg->round > MAX_ICU_ROUND) { + debug_print("Error: selected lossy parameter: %" PRIu32 " is not supported. The largest supported value is: %" PRIu32 ".", + cfg->round, MAX_ICU_ROUND); cfg_invalid++; } @@ -600,7 +558,6 @@ int cmp_cfg_icu_max_used_bits_out_of_limit(const struct cmp_max_used_bits *max_u * @param cmp_par compression parameter * @param spill spillover threshold parameter * @param cmp_mode compression mode - * @param data_type compression data type * @param par_name string describing the use of the compression par. for * debug messages (can be NULL) * @@ -608,28 +565,9 @@ int cmp_cfg_icu_max_used_bits_out_of_limit(const struct cmp_max_used_bits *max_u */ static int cmp_pars_are_invalid(uint32_t cmp_par, uint32_t spill, enum cmp_mode cmp_mode, - enum cmp_data_type data_type, const char *par_name MAYBE_UNUSED) + const char *par_name MAYBE_UNUSED) { int cfg_invalid = 0; - uint32_t min_golomb_par; - uint32_t max_golomb_par; - uint32_t min_spill; - uint32_t max_spill; - - /* The maximum compression parameter for imagette data are smaller to - * fit into the imagette compression entity header */ - if (cmp_imagette_data_type_is_used(data_type)) { - min_golomb_par = MIN_IMA_GOLOMB_PAR; - max_golomb_par = MAX_IMA_GOLOMB_PAR; - min_spill = MIN_IMA_SPILL; - max_spill = cmp_ima_max_spill(cmp_par); - } else { - min_golomb_par = MIN_NON_IMA_GOLOMB_PAR; - max_golomb_par = MAX_NON_IMA_GOLOMB_PAR; - min_spill = MIN_NON_IMA_SPILL; - max_spill = cmp_icu_max_spill(cmp_par); - } - switch (cmp_mode) { case CMP_MODE_RAW: @@ -639,19 +577,19 @@ static int cmp_pars_are_invalid(uint32_t cmp_par, uint32_t spill, enum cmp_mode case CMP_MODE_DIFF_MULTI: case CMP_MODE_MODEL_ZERO: case CMP_MODE_MODEL_MULTI: - if (cmp_par < min_golomb_par || cmp_par > max_golomb_par) { + if (cmp_par < MIN_NON_IMA_GOLOMB_PAR || cmp_par > MAX_NON_IMA_GOLOMB_PAR) { debug_print("Error: The selected %s compression parameter: %" PRIu32 " is not supported in the selected compression mode. The compression parameter has to be between [%" PRIu32 ", %" PRIu32 "] in this mode.", - par_name, cmp_par, min_golomb_par, max_golomb_par); + par_name, cmp_par, MIN_NON_IMA_GOLOMB_PAR, MAX_NON_IMA_GOLOMB_PAR); cfg_invalid++; } - if (spill < min_spill) { + if (spill < MIN_NON_IMA_SPILL) { debug_print("Error: The selected %s spillover threshold value: %" PRIu32 " is too small. The smallest possible spillover value is: %" PRIu32 ".", - par_name, spill, min_spill); + par_name, spill, MIN_NON_IMA_SPILL); cfg_invalid++; } - if (spill > max_spill) { + if (spill > cmp_icu_max_spill(cmp_par)) { debug_print("Error: The selected %s spillover threshold value: %" PRIu32 " is too large for the selected %s compression parameter: %" PRIu32 ". The largest possible spillover value in the selected compression mode is: %" PRIu32 ".", - par_name, spill, par_name, cmp_par, max_spill); + par_name, spill, par_name, cmp_par, cmp_icu_max_spill(cmp_par)); cfg_invalid++; } @@ -673,18 +611,13 @@ static int cmp_pars_are_invalid(uint32_t cmp_par, uint32_t spill, enum cmp_mode * @brief check if the imagette specific compression parameters are invalid * * @param cfg pointer to a compressor configuration - * @param opt check options: - * RDCU_CHECK for a imagette RDCU compression check - * ICU_CHECK for a imagette ICU compression check * * @returns 0 if the imagette specific parameters are valid, otherwise invalid */ -int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt) +int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg) { int cfg_invalid = 0; - enum cmp_mode cmp_mode; - enum cmp_data_type data_type; if (!cfg) return 1; @@ -694,29 +627,8 @@ int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt) cfg_invalid++; } - /* The RDCU needs valid compression parameters also in RAW_MODE */ - if (opt == RDCU_CHECK && cfg->cmp_mode == CMP_MODE_RAW) - cmp_mode = CMP_MODE_MODEL_ZERO; - else - cmp_mode = cfg->cmp_mode; - - if (opt == ICU_CHECK) - data_type = DATA_TYPE_CHUNK; - else - data_type = cfg->data_type; - - - cfg_invalid += cmp_pars_are_invalid(cfg->golomb_par, cfg->spill, cmp_mode, - data_type, "imagette"); - - /* for the RDCU the adaptive parameters have to be always valid */ - if (opt == RDCU_CHECK || cmp_ap_imagette_data_type_is_used(cfg->data_type)) { - cfg_invalid += cmp_pars_are_invalid(cfg->ap1_golomb_par, cfg->ap1_spill, - cmp_mode, cfg->data_type, "adaptive 1 imagette"); - cfg_invalid += cmp_pars_are_invalid(cfg->ap2_golomb_par, cfg->ap2_spill, - cmp_mode, cfg->data_type, "adaptive 2 imagette"); - } - + cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_imagette, cfg->spill_imagette, + cfg->cmp_mode, "imagette"); return cfg_invalid; } @@ -833,22 +745,22 @@ int cmp_cfg_fx_cob_is_invalid(const struct cmp_cfg *cfg) if (needed_pars.fx) /* this is always true because every flux/center of brightness data type contains a flux parameter */ cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_fx, cfg->spill_fx, - cfg->cmp_mode, cfg->data_type, "flux"); + cfg->cmp_mode, "flux"); if (needed_pars.exp_flags) cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_exp_flags, cfg->spill_exp_flags, - cfg->cmp_mode, cfg->data_type, "exposure flags"); + cfg->cmp_mode, "exposure flags"); if (needed_pars.ncob) cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_ncob, cfg->spill_ncob, - cfg->cmp_mode, cfg->data_type, "center of brightness"); + cfg->cmp_mode, "center of brightness"); if (needed_pars.efx) cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_efx, cfg->spill_efx, - cfg->cmp_mode, cfg->data_type, "extended flux"); + cfg->cmp_mode, "extended flux"); if (needed_pars.ecob) cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_ecob, cfg->spill_ecob, - cfg->cmp_mode, cfg->data_type, "extended center of brightness"); + cfg->cmp_mode, "extended center of brightness"); if (needed_pars.fx_cob_variance) cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_fx_cob_variance, - cfg->spill_fx_cob_variance, cfg->cmp_mode, cfg->data_type, "flux/COB variance"); + cfg->spill_fx_cob_variance, cfg->cmp_mode, "flux/COB variance"); return cfg_invalid; } @@ -874,26 +786,26 @@ int cmp_cfg_aux_is_invalid(const struct cmp_cfg *cfg) case DATA_TYPE_OFFSET: case DATA_TYPE_F_CAM_OFFSET: cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_offset_mean, cfg->spill_offset_mean, - cfg->cmp_mode, cfg->data_type, "offset mean"); + cfg->cmp_mode, "offset mean"); cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_offset_variance, cfg->spill_offset_variance, - cfg->cmp_mode, cfg->data_type, "offset variance"); + cfg->cmp_mode, "offset variance"); break; case DATA_TYPE_BACKGROUND: case DATA_TYPE_F_CAM_BACKGROUND: cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_background_mean, cfg->spill_background_mean, - cfg->cmp_mode, cfg->data_type, "background mean"); + cfg->cmp_mode, "background mean"); cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_background_variance, cfg->spill_background_variance, - cfg->cmp_mode, cfg->data_type, "background variance"); + cfg->cmp_mode, "background variance"); cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_background_pixels_error, cfg->spill_background_pixels_error, - cfg->cmp_mode, cfg->data_type, "background outlier pixls num"); + cfg->cmp_mode, "background outlier pixls num"); break; case DATA_TYPE_SMEARING: cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_smearing_mean, cfg->spill_smearing_mean, - cfg->cmp_mode, cfg->data_type, "smearing mean"); + cfg->cmp_mode, "smearing mean"); cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_smearing_variance, cfg->spill_smearing_variance, - cfg->cmp_mode, cfg->data_type, "smearing variance"); + cfg->cmp_mode, "smearing variance"); cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_smearing_pixels_error, cfg->spill_smearing_pixels_error, - cfg->cmp_mode, cfg->data_type, "smearing outlier pixls num"); + cfg->cmp_mode, "smearing outlier pixls num"); break; default: debug_print("Error: The compression data type is not an auxiliary science compression data type."); @@ -918,7 +830,7 @@ int cmp_cfg_icu_is_invalid(const struct cmp_cfg *cfg) if (!cfg) return 1; - cfg_invalid += cmp_cfg_gen_par_is_invalid(cfg, ICU_CHECK); + cfg_invalid += cmp_cfg_gen_par_is_invalid(cfg); cfg_invalid += cmp_cfg_icu_buffers_is_invalid(cfg); @@ -926,7 +838,7 @@ int cmp_cfg_icu_is_invalid(const struct cmp_cfg *cfg) cfg_invalid += cmp_cfg_icu_max_used_bits_out_of_limit(cfg->max_used_bits); if (cmp_imagette_data_type_is_used(cfg->data_type)) - cfg_invalid += cmp_cfg_imagette_is_invalid(cfg, ICU_CHECK); + cfg_invalid += cmp_cfg_imagette_is_invalid(cfg); else if (cmp_fx_cob_data_type_is_used(cfg->data_type)) cfg_invalid += cmp_cfg_fx_cob_is_invalid(cfg); else if (cmp_aux_data_type_is_used(cfg->data_type)) diff --git a/lib/common/cmp_support.h b/lib/common/cmp_support.h index bc9c98e4c2858600f80814069e2a1754e1fdc620..fd90ce82baf5c373eedc5dabbe8b0ba5e6c445f8 100644 --- a/lib/common/cmp_support.h +++ b/lib/common/cmp_support.h @@ -95,12 +95,6 @@ /* imagette sample to byte conversion factor; one imagette samples has 16 bits (2 bytes) */ #define IMA_SAM2BYT 2 -/** - * @brief options for configuration check functions - */ - -enum check_opt {ICU_CHECK, RDCU_CHECK}; - /** * @brief defined compression data product types @@ -157,8 +151,8 @@ __extension__ struct cmp_cfg { void *input_buf; /**< Pointer to the data to compress buffer */ void *model_buf; /**< Pointer to the model buffer */ - void *icu_new_model_buf; /**< Pointer to the updated model buffer (not used for RDCU compression )*/ - uint32_t *icu_output_buf; /**< Pointer to the compressed data buffer (not used for RDCU compression) */ + void *icu_new_model_buf; /**< Pointer to the updated model buffer */ + uint32_t *icu_output_buf; /**< Pointer to the compressed data buffer */ uint32_t samples; /**< Number of samples to compress, length of the data and model buffer * (including the multi entity header by non-imagette data) */ @@ -174,39 +168,33 @@ struct cmp_cfg { uint32_t round; /**< lossy compression parameter */ union { uint32_t cmp_par_1; - uint32_t golomb_par; /* TODO: remove this */ /**< Golomb parameter for imagette data compression */ uint32_t cmp_par_imagette; /**< Golomb parameter for imagette data compression */ uint32_t cmp_par_exp_flags; /**< Compression parameter for exposure flags compression */ }; union { uint32_t spill_par_1; - uint32_t spill; /* TODO: remove this */ /**< Spillover threshold parameter for imagette data compression */ uint32_t spill_imagette; /**< Spillover threshold parameter for imagette data compression */ uint32_t spill_exp_flags; /**< Spillover threshold parameter for exposure flags compression */ }; union { uint32_t cmp_par_2; - uint32_t ap1_golomb_par; /**< Adaptive 2 spillover threshold for imagette data; HW only */ uint32_t cmp_par_fx; /**< Compression parameter for normal flux compression */ uint32_t cmp_par_offset_mean; /**< Compression parameter for auxiliary science mean compression */ }; union { uint32_t spill_par_2; - uint32_t ap1_spill; /**< Adaptive 2 Golomb parameter; HW only */ uint32_t spill_fx; /**< Spillover threshold parameter for normal flux compression */ uint32_t spill_offset_mean; /**< Spillover threshold parameter for auxiliary science mean compression */ }; union { uint32_t cmp_par_3; - uint32_t ap2_golomb_par; /**< Adaptive 2 spillover threshold for imagette data; HW only */ uint32_t cmp_par_ncob; /**< Compression parameter for normal center of brightness compression */ uint32_t cmp_par_offset_variance; /**< Compression parameter for auxiliary science variance compression */ }; union { uint32_t spill_par_3; - uint32_t ap2_spill; /**< Adaptive 2 Golomb parameter; HW only */ uint32_t spill_ncob; /**< Spillover threshold parameter for normal center of brightness compression */ uint32_t spill_offset_variance; /**< Spillover threshold parameter for auxiliary science variance compression */ }; @@ -350,10 +338,10 @@ 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, enum check_opt opt); +int cmp_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg); int cmp_cfg_icu_buffers_is_invalid(const struct cmp_cfg *cfg); int cmp_cfg_icu_max_used_bits_out_of_limit(const struct cmp_max_used_bits *max_used_bits); -int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg, enum check_opt opt); +int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg); int cmp_cfg_fx_cob_is_invalid(const struct cmp_cfg *cfg); int cmp_cfg_aux_is_invalid(const struct cmp_cfg *cfg); uint32_t cmp_ima_max_spill(unsigned int golomb_par); @@ -370,7 +358,6 @@ int cmp_aux_data_type_is_used(enum cmp_data_type data_type); int cmp_mode_is_supported(enum cmp_mode cmp_mode); int model_mode_is_used(enum cmp_mode cmp_mode); int raw_mode_is_used(enum cmp_mode cmp_mode); -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); diff --git a/lib/decompress/decmp.c b/lib/decompress/decmp.c index 0ee3784fdef978f69a4d351e16f7b3c61f547871..dcd8c334a1637d13c86edbf48d700ee02bee3150 100644 --- a/lib/decompress/decmp.c +++ b/lib/decompress/decmp.c @@ -445,8 +445,8 @@ static int decompress_imagette(const struct cmp_cfg *cfg, struct bit_decoder *de break; } - configure_decoder_setup(&setup, dec, cfg->cmp_mode, cfg->golomb_par, - cfg->spill, cfg->round, max_data_bits); + configure_decoder_setup(&setup, dec, cfg->cmp_mode, cfg->cmp_par_imagette, + cfg->spill_imagette, cfg->round, max_data_bits); for (i = 0; ; i++) { err = decode_value(&setup, &decoded_value, model); @@ -1799,7 +1799,7 @@ static int decompressed_data_internal(const struct cmp_cfg *cfg, enum decmp_type return -1; if (cmp_imagette_data_type_is_used(cfg->data_type)) { - if (cmp_cfg_imagette_is_invalid(cfg, ICU_CHECK)) + if (cmp_cfg_imagette_is_invalid(cfg)) return -1; } else if (cmp_fx_cob_data_type_is_used(cfg->data_type)) { if (cmp_cfg_fx_cob_is_invalid(cfg)) @@ -2021,16 +2021,12 @@ static int cmp_ent_read_header(struct cmp_entity *ent, struct cmp_cfg *cfg) case DATA_TYPE_IMAGETTE_ADAPTIVE: case DATA_TYPE_SAT_IMAGETTE_ADAPTIVE: case DATA_TYPE_F_CAM_IMAGETTE_ADAPTIVE: - cfg->ap1_golomb_par = cmp_ent_get_ima_ap1_golomb_par(ent); - cfg->ap1_spill = cmp_ent_get_ima_ap1_spill(ent); - cfg->ap2_golomb_par = cmp_ent_get_ima_ap2_golomb_par(ent); - cfg->ap2_spill = cmp_ent_get_ima_ap2_spill(ent); - /* fall through */ + /* we do not read in adaptive parameters */ case DATA_TYPE_IMAGETTE: case DATA_TYPE_SAT_IMAGETTE: case DATA_TYPE_F_CAM_IMAGETTE: - cfg->spill = cmp_ent_get_ima_spill(ent); - cfg->golomb_par = cmp_ent_get_ima_golomb_par(ent); + cfg->cmp_par_imagette = cmp_ent_get_ima_golomb_par(ent); + cfg->spill_imagette = cmp_ent_get_ima_spill(ent); break; case DATA_TYPE_OFFSET: case DATA_TYPE_F_CAM_OFFSET: @@ -2382,8 +2378,8 @@ int decompress_rdcu_data(uint32_t *compressed_data, const struct cmp_info *info, cfg.cmp_mode = info->cmp_mode_used; cfg.model_value = info->model_value_used; cfg.round = info->round_used; - cfg.spill = info->spill_used; - cfg.golomb_par = info->golomb_par_used; + cfg.spill_imagette = info->spill_used; + cfg.cmp_par_imagette = info->golomb_par_used; cfg.samples = info->samples_used; cfg.icu_output_buf = compressed_data; cfg.buffer_length = (info->cmp_size+7)/8; diff --git a/lib/icu_compress/cmp_icu.c b/lib/icu_compress/cmp_icu.c index ec5787bd7a00b61c92493a89cd7bbe8a47d03df6..d9816c0372c54837c767539ae23f2471ecd51ed6 100644 --- a/lib/icu_compress/cmp_icu.c +++ b/lib/icu_compress/cmp_icu.c @@ -548,8 +548,8 @@ static uint32_t compress_imagette(const struct cmp_cfg *cfg, uint32_t stream_len break; } - configure_encoder_setup(&setup, cfg->golomb_par, cfg->spill, cfg->round, - max_data_bits, cfg); + configure_encoder_setup(&setup, cfg->cmp_par_imagette, + cfg->spill_imagette, cfg->round, max_data_bits, cfg); for (i = 0;; i++) { stream_len = encode_value(get_unaligned(&data_buf[i]), @@ -1751,14 +1751,14 @@ static uint32_t compress_smearing(const struct cmp_cfg *cfg, uint32_t stream_len static uint32_t cmp_cfg_icu_is_invalid_error_code(const struct cmp_cfg *cfg) { - RETURN_ERROR_IF(cmp_cfg_gen_par_is_invalid(cfg, ICU_CHECK) , PAR_GENERIC, ""); + RETURN_ERROR_IF(cmp_cfg_gen_par_is_invalid(cfg) , PAR_GENERIC, ""); RETURN_ERROR_IF(cmp_cfg_icu_buffers_is_invalid(cfg), PAR_BUFFERS, ""); if (cfg->cmp_mode != CMP_MODE_RAW) RETURN_ERROR_IF(cmp_cfg_icu_max_used_bits_out_of_limit(cfg->max_used_bits), PAR_MAX_USED_BITS, ""); if (cmp_imagette_data_type_is_used(cfg->data_type)) { - RETURN_ERROR_IF(cmp_cfg_imagette_is_invalid(cfg, ICU_CHECK), PAR_SPECIFIC, ""); + RETURN_ERROR_IF(cmp_cfg_imagette_is_invalid(cfg), PAR_SPECIFIC, ""); } else if (cmp_fx_cob_data_type_is_used(cfg->data_type)) { RETURN_ERROR_IF(cmp_cfg_fx_cob_is_invalid(cfg), PAR_SPECIFIC, ""); } else if (cmp_aux_data_type_is_used(cfg->data_type)) { diff --git a/lib/rdcu_compress/cmp_rdcu_cfg.c b/lib/rdcu_compress/cmp_rdcu_cfg.c index 69935250219a41a4ebb1af741d898cf5acb6fa5e..081633cd1cdba260b77444ab3853a7357ef5f84a 100644 --- a/lib/rdcu_compress/cmp_rdcu_cfg.c +++ b/lib/rdcu_compress/cmp_rdcu_cfg.c @@ -48,7 +48,7 @@ static int rdcu_cfg_gen_pars_are_invalid(const struct rdcu_cfg *rcfg) if (!rcfg) return 1; - if (!rdcu_supported_cmp_mode_is_used(rcfg->cmp_mode)) { + if (!cmp_mode_is_supported(rcfg->cmp_mode)) { debug_print("Error: selected cmp_mode: %i is not supported for a RDCU compression.", rcfg->cmp_mode); rcfg_invalid++; } diff --git a/programs/cmp_guess.c b/programs/cmp_guess.c index 65aa81f7d1f24079c98303d85edc5d858e63b4d0..6b1b3a2140bc1967364e272597d879206156523f 100644 --- a/programs/cmp_guess.c +++ b/programs/cmp_guess.c @@ -269,7 +269,7 @@ uint32_t cmp_guess(struct rdcu_cfg *rcfg, int level) if (!rcfg->model_buf) return 0; - if (!rdcu_supported_cmp_mode_is_used(rcfg->cmp_mode)) { + if (!cmp_mode_is_supported(rcfg->cmp_mode)) { printf("This compression mode is not implied yet.\n"); return 0; } diff --git a/header_pars.c b/programs/header_pars.c similarity index 100% rename from header_pars.c rename to programs/header_pars.c diff --git a/test/cmp_icu/test_cmp_icu.c b/test/cmp_icu/test_cmp_icu.c index 4f8c15fee6dbe207a4019f50771a40cbbced051e..1574976f2800bd62933409b960ca0afe44a5b250 100644 --- a/test/cmp_icu/test_cmp_icu.c +++ b/test/cmp_icu/test_cmp_icu.c @@ -2194,10 +2194,9 @@ void test_support_function_call_NULL(void) cfg.data_type = DATA_TYPE_IMAGETTE; cfg.cmp_mode = CMP_MODE_DIFF_ZERO; - TEST_ASSERT_TRUE(cmp_cfg_gen_par_is_invalid(NULL, ICU_CHECK)); - TEST_ASSERT_TRUE(cmp_cfg_gen_par_is_invalid(&cfg, RDCU_CHECK+1)); + TEST_ASSERT_TRUE(cmp_cfg_gen_par_is_invalid(NULL)); TEST_ASSERT_TRUE(cmp_cfg_icu_buffers_is_invalid(NULL)); - TEST_ASSERT_TRUE(cmp_cfg_imagette_is_invalid(NULL, RDCU_CHECK)); + TEST_ASSERT_TRUE(cmp_cfg_imagette_is_invalid(NULL)); TEST_ASSERT_TRUE(cmp_cfg_fx_cob_is_invalid(NULL)); TEST_ASSERT_TRUE(cmp_cfg_aux_is_invalid(NULL)); TEST_ASSERT_TRUE(cmp_cfg_aux_is_invalid(&cfg)); diff --git a/test/decmp/test_decmp.c b/test/decmp/test_decmp.c index 4b404939d242bd20d243df8bbd5284ed46dc9b44..438c3313938f9e5a0e393b57605ccdf3eb47c9d5 100644 --- a/test/decmp/test_decmp.c +++ b/test/decmp/test_decmp.c @@ -1027,8 +1027,8 @@ void test_decompress_imagette_model(void) cfg.buffer_length = 4; cfg.samples = 5; cfg.model_value = 16; - cfg.golomb_par = 4; - cfg.spill = 48; + cfg.cmp_par_imagette = 4; + cfg.spill_imagette = 48; cfg.max_used_bits = &MAX_USED_BITS_SAFE; bit_init_decoder(&dec, cfg.icu_output_buf, cfg.buffer_length);