From 32bd079d76f039b3dd533cf5b2f452ceafdd3aa1 Mon Sep 17 00:00:00 2001
From: Dominik Loidolt <dominik.loidolt@univie.ac.at>
Date: Wed, 5 Oct 2022 16:29:24 +0200
Subject: [PATCH] Extension of the configuration print function; general
 refactioring and renaming

---
 cmp_tool.c                | 115 ++++++++++++++-----
 include/cmp_io.h          |  12 +-
 include/cmp_support.h     |  15 ++-
 lib/cmp_entity.c          |   8 +-
 lib/cmp_io.c              | 203 +++++++++++++++++++++++++-------
 lib/cmp_support.c         | 236 +++++++++++++++++---------------------
 lib/decmp.c               |   4 +-
 test/cmp_icu/test_decmp.c |   4 +-
 8 files changed, 380 insertions(+), 217 deletions(-)

diff --git a/cmp_tool.c b/cmp_tool.c
index 3572c23..925e39c 100644
--- a/cmp_tool.c
+++ b/cmp_tool.c
@@ -28,7 +28,7 @@
 #include "cmp_tool-config.h"
 #include "cmp_io.h"
 #include "cmp_icu.h"
-#include "cmp_rdcu.h" /*TODO: shift setup to support */
+#include "cmp_rdcu.h"
 #include "decmp.h"
 #include "cmp_guess.h"
 #include "cmp_entity.h"
@@ -42,6 +42,9 @@
 #define DEFAULT_MODEL_COUNTER 0
 
 
+/* parse a data_type option argument */
+static enum cmp_data_type parse_data_type(const char *data_type_str);
+
 /* find a good set of compression parameters for a given dataset */
 static int guess_cmp_pars(struct cmp_cfg *cfg, const char *guess_cmp_mode,
 			  int guess_level);
@@ -52,6 +55,11 @@ static int compression(struct cmp_cfg *cfg, struct cmp_info *info);
 /* decompress the data and write the results in file(s)*/
 static int decompression(struct cmp_entity *ent, uint16_t *input_model_buf);
 
+/* create a default configuration for a compression data type */
+enum cfg_default_opt {DIFF_CFG, MODEL_CFG};
+int cmp_cfg_create_default(struct cmp_cfg *cfg, enum cmp_data_type data_type,
+			   enum cfg_default_opt mode);
+
 
 /*
  * For long options that have no equivalent short option, use a
@@ -70,12 +78,12 @@ enum {
 
 static const struct option long_options[] = {
 	{"rdcu_par", no_argument, NULL, 'a'},
-	{"model_cfg", no_argument, NULL, 'n'},
+	{"model_cfg", optional_argument, NULL, 'n'},
 	{"help", no_argument, NULL, 'h'},
 	{"verbose", no_argument, NULL, 'v'},
 	{"version", no_argument, NULL, 'V'},
 	{"rdcu_pkt", no_argument, NULL, RDCU_PKT_OPTION},
-	{"diff_cfg", no_argument, NULL, DIFF_CFG_OPTION},
+	{"diff_cfg", optional_argument, NULL, DIFF_CFG_OPTION},
 	{"guess", required_argument, NULL, GUESS_OPTION},
 	{"guess_level", required_argument, NULL, GUESS_LEVEL},
 	{"last_info", required_argument, NULL, LAST_INFO},
@@ -182,6 +190,9 @@ int main(int argc, char **argv)
 			break;
 		case 'n': /* --model_cfg */
 			print_model_cfg = 1;
+			cfg.data_type = parse_data_type(optarg);
+			if (cfg.data_type == DATA_TYPE_UNKNOWN)
+				exit(EXIT_FAILURE);
 			break;
 		case 'o':
 			output_prefix = optarg;
@@ -195,6 +206,9 @@ int main(int argc, char **argv)
 			break;
 		case DIFF_CFG_OPTION:
 			print_diff_cfg = 1;
+			cfg.data_type = parse_data_type(optarg);
+			if (cfg.data_type == DATA_TYPE_UNKNOWN)
+				exit(EXIT_FAILURE);
 			break;
 		case GUESS_OPTION:
 			guess_operation = 1;
@@ -262,30 +276,18 @@ int main(int argc, char **argv)
 #endif
 
 	if (print_model_cfg == 1) {
-		cfg = rdcu_cfg_create(CMP_DEF_IMA_MODEL_DATA_TYPE, CMP_DEF_IMA_MODEL_CMP_MODE,
-				      CMP_DEF_IMA_MODEL_MODEL_VALUE, CMP_DEF_IMA_MODEL_LOSSY_PAR);
-		rdcu_cfg_buffers(&cfg, NULL, 0, NULL, CMP_DEF_IMA_MODEL_RDCU_DATA_ADR,
-				 CMP_DEF_IMA_MODEL_RDCU_MODEL_ADR, CMP_DEF_IMA_MODEL_RDCU_UP_MODEL_ADR,
-				 CMP_DEF_IMA_MODEL_RDCU_BUFFER_ADR, 0);
-		rdcu_cfg_imagette(&cfg,
-				  CMP_DEF_IMA_MODEL_GOLOMB_PAR, CMP_DEF_IMA_MODEL_SPILL_PAR,
-				  CMP_DEF_IMA_MODEL_AP1_GOLOMB_PAR, CMP_DEF_IMA_MODEL_AP1_SPILL_PAR,
-				  CMP_DEF_IMA_MODEL_AP2_GOLOMB_PAR, CMP_DEF_IMA_MODEL_AP2_SPILL_PAR);
-		print_cfg(&cfg, add_rdcu_pars);
+		if (add_rdcu_pars)
+			cfg.data_type = DATA_TYPE_IMAGETTE_ADAPTIVE;
+		cmp_cfg_create_default(&cfg, cfg.data_type, MODEL_CFG);
+		cmp_cfg_print(&cfg);
 		exit(EXIT_SUCCESS);
 	}
 
 	if (print_diff_cfg == 1) {
-		cfg = rdcu_cfg_create(CMP_DEF_IMA_DIFF_DATA_TYPE, CMP_DEF_IMA_DIFF_CMP_MODE,
-				      CMP_DEF_IMA_DIFF_MODEL_VALUE, CMP_DEF_IMA_DIFF_LOSSY_PAR);
-		rdcu_cfg_buffers(&cfg, NULL, 0, NULL, CMP_DEF_IMA_DIFF_RDCU_DATA_ADR,
-				 CMP_DEF_IMA_DIFF_RDCU_MODEL_ADR, CMP_DEF_IMA_DIFF_RDCU_UP_MODEL_ADR,
-				 CMP_DEF_IMA_DIFF_RDCU_BUFFER_ADR, 0);
-		rdcu_cfg_imagette(&cfg,
-				  CMP_DEF_IMA_DIFF_GOLOMB_PAR, CMP_DEF_IMA_DIFF_SPILL_PAR,
-				  CMP_DEF_IMA_DIFF_AP1_GOLOMB_PAR, CMP_DEF_IMA_DIFF_AP1_SPILL_PAR,
-				   CMP_DEF_IMA_DIFF_AP2_GOLOMB_PAR, CMP_DEF_IMA_DIFF_AP2_SPILL_PAR);
-		print_cfg(&cfg, add_rdcu_pars);
+		if (add_rdcu_pars)
+			cfg.data_type = DATA_TYPE_IMAGETTE_ADAPTIVE;
+		cmp_cfg_create_default(&cfg, cfg.data_type, DIFF_CFG);
+		cmp_cfg_print(&cfg);
 		exit(EXIT_SUCCESS);
 	}
 
@@ -316,7 +318,7 @@ int main(int argc, char **argv)
 		if (cmp_operation) {
 			printf("## Starting the compression ##\n");
 			printf("Importing configuration file %s ... ", cfg_file_name);
-			error = read_cmp_cfg(cfg_file_name, &cfg, verbose_en);
+			error = cmp_cfg_read(cfg_file_name, &cfg, verbose_en);
 			if (error)
 				goto fail;
 			printf("DONE\n");
@@ -359,7 +361,7 @@ int main(int argc, char **argv)
 			uint32_t cmp_size_byte;
 
 			printf("Importing decompression information file %s ... ", info_file_name);
-			error  = read_cmp_info(info_file_name, &info, verbose_en);
+			error  = cmp_info_read(info_file_name, &info, verbose_en);
 			if (error)
 				goto fail;
 			printf("DONE\n");
@@ -521,6 +523,22 @@ fail:
 }
 
 
+/* parse a data_type option argument */
+static enum cmp_data_type parse_data_type(const char *data_type_str)
+{
+	/* default data type if no optional argument is used */
+	enum cmp_data_type data_type = DATA_TYPE_IMAGETTE;
+
+	if (data_type_str) {
+		data_type = string2data_type(optarg);
+		if (data_type == DATA_TYPE_UNKNOWN)
+			printf("Do not recognize %s compression data type.\n",
+			       data_type_str);
+	}
+	return data_type;
+}
+
+
 /* find a good set of compression parameters for a given dataset */
 static int guess_cmp_pars(struct cmp_cfg *cfg, const char *guess_cmp_mode,
 			  int guess_level)
@@ -563,7 +581,7 @@ static int guess_cmp_pars(struct cmp_cfg *cfg, const char *guess_cmp_mode,
 	printf("DONE\n");
 
 	printf("Write the guessed compression configuration to file %s.cfg ... ", output_prefix);
-	error = write_cfg(cfg, output_prefix, add_rdcu_pars, verbose_en);
+	error = cmp_cfg_fo_file(cfg, output_prefix, verbose_en);
 	if (error)
 		return -1;
 	printf("DONE\n");
@@ -591,7 +609,7 @@ static int gen_rdcu_write_pkts(struct cmp_cfg *cfg)
 		/* generation of packets for parallel read/write RDCU setup */
 		struct cmp_info last_info = {0};
 
-		error  = read_cmp_info(last_info_file_name, &last_info, verbose_en);
+		error  = cmp_info_read(last_info_file_name, &last_info, verbose_en);
 		if (error) {
 			fprintf(stderr, "%s: %s: Importing last decompression information file failed.\n",
 				PROGRAM_NAME, last_info_file_name);
@@ -791,7 +809,7 @@ static int compression(struct cmp_cfg *cfg, struct cmp_info *info)
 	if (!include_cmp_header) {
 		printf("Write decompression information to file %s.info ... ",
 		       output_prefix);
-		error = write_info(info, output_prefix, add_rdcu_pars);
+		error = cmp_info_to_file(info, output_prefix, add_rdcu_pars);
 		if (error)
 			goto error_cleanup;
 		printf("DONE\n");
@@ -861,3 +879,44 @@ static int decompression(struct cmp_entity *ent, uint16_t *input_model_buf)
 
 	return 0;
 }
+
+
+/* create a default configuration for a compression data type */
+int cmp_cfg_create_default(struct cmp_cfg *cfg, enum cmp_data_type data_type,
+			   enum cfg_default_opt mode)
+{
+	if (cmp_data_type_is_invalid(data_type))
+		return -1;
+
+	if (!cfg) /* nothing to do */
+		return 0;
+
+	if (cmp_imagette_data_type_is_used(data_type)) {
+		switch (mode) {
+		case MODEL_CFG:
+			*cfg = rdcu_cfg_create(data_type, CMP_DEF_IMA_MODEL_CMP_MODE,
+					       CMP_DEF_IMA_MODEL_MODEL_VALUE, CMP_DEF_IMA_MODEL_LOSSY_PAR);
+			rdcu_cfg_buffers(cfg, NULL, 0, NULL, CMP_DEF_IMA_MODEL_RDCU_DATA_ADR,
+					 CMP_DEF_IMA_MODEL_RDCU_MODEL_ADR, CMP_DEF_IMA_MODEL_RDCU_UP_MODEL_ADR,
+					 CMP_DEF_IMA_MODEL_RDCU_BUFFER_ADR, 0);
+			rdcu_cfg_imagette(cfg,
+					  CMP_DEF_IMA_MODEL_GOLOMB_PAR, CMP_DEF_IMA_MODEL_SPILL_PAR,
+					  CMP_DEF_IMA_MODEL_AP1_GOLOMB_PAR, CMP_DEF_IMA_MODEL_AP1_SPILL_PAR,
+					  CMP_DEF_IMA_MODEL_AP2_GOLOMB_PAR, CMP_DEF_IMA_MODEL_AP2_SPILL_PAR);
+			break;
+		case DIFF_CFG:
+			*cfg = rdcu_cfg_create(data_type, CMP_DEF_IMA_DIFF_CMP_MODE,
+					       CMP_DEF_IMA_DIFF_MODEL_VALUE, CMP_DEF_IMA_DIFF_LOSSY_PAR);
+			rdcu_cfg_buffers(cfg, NULL, 0, NULL, CMP_DEF_IMA_DIFF_RDCU_DATA_ADR,
+					 CMP_DEF_IMA_DIFF_RDCU_MODEL_ADR, CMP_DEF_IMA_DIFF_RDCU_UP_MODEL_ADR,
+					 CMP_DEF_IMA_DIFF_RDCU_BUFFER_ADR, 0);
+			rdcu_cfg_imagette(cfg,
+					  CMP_DEF_IMA_DIFF_GOLOMB_PAR, CMP_DEF_IMA_DIFF_SPILL_PAR,
+					  CMP_DEF_IMA_DIFF_AP1_GOLOMB_PAR, CMP_DEF_IMA_DIFF_AP1_SPILL_PAR,
+					  CMP_DEF_IMA_DIFF_AP2_GOLOMB_PAR, CMP_DEF_IMA_DIFF_AP2_SPILL_PAR);
+			break;
+		}
+	}
+	/* TODO: implement other data types */
+	return 0;
+}
diff --git a/include/cmp_io.h b/include/cmp_io.h
index 873bf91..5eb73f3 100644
--- a/include/cmp_io.h
+++ b/include/cmp_io.h
@@ -28,8 +28,8 @@
 
 void print_help(const char *program_name);
 
-int read_cmp_cfg(const char *file_name, struct cmp_cfg *cfg, int verbose_en);
-int read_cmp_info(const char *file_name, struct cmp_info *info, int verbose_en);
+int cmp_cfg_read(const char *file_name, struct cmp_cfg *cfg, int verbose_en);
+int cmp_info_read(const char *file_name, struct cmp_info *info, int verbose_en);
 
 ssize_t read_file8(const char *file_name, uint8_t *buf, uint32_t buf_size,
 		   int verbose_en);
@@ -46,11 +46,9 @@ int write_cmp_data_file(const void *buf, uint32_t buf_size, const char
 			*output_prefix, const char *name_extension, int verbose);
 int write_input_data_to_file(void *data, uint32_t data_size, enum cmp_data_type data_type,
 			     const char *output_prefix, const char *name_extension, int verbose);
-int write_info(const struct cmp_info *info, const char *output_prefix,
-	       int rdcu_cfg);
-int write_cfg(const struct cmp_cfg *cfg, const char *output_prefix, int rdcu_cfg,
-	      int verbose);
-void print_cfg(const struct cmp_cfg *cfg, int rdcu_cfg);
+int cmp_info_to_file(const struct cmp_info *info, const char *output_prefix, int rdcu_cfg);
+int cmp_cfg_fo_file(const struct cmp_cfg *cfg, const char *output_prefix, int verbose);
+void cmp_cfg_print(const struct cmp_cfg *cfg);
 
 int atoui32(const char *dep_str, const char *val_str, uint32_t *red_val);
 int cmp_mode_parse(const char *cmp_mode_str, uint32_t *cmp_mode);
diff --git a/include/cmp_support.h b/include/cmp_support.h
index be598aa..da68901 100644
--- a/include/cmp_support.h
+++ b/include/cmp_support.h
@@ -233,6 +233,16 @@ struct cmp_info {
 				       */
 };
 
+/* structure containing flux/COB compression parameters pairs */
+struct fx_cob_par {
+	uint8_t exp_flags;
+	uint8_t fx;
+	uint8_t ncob;
+	uint8_t efx;
+	uint8_t ecob;
+	uint8_t fx_cob_variance;
+};
+
 
 int is_a_pow_of_2(unsigned int v);
 int ilog_2(uint32_t x);
@@ -248,16 +258,16 @@ int cmp_cfg_aux_is_invalid(const struct cmp_cfg *cfg);
 uint32_t cmp_ima_max_spill(unsigned int golomb_par);
 uint32_t cmp_icu_max_spill(unsigned int cmp_par);
 
-int cmp_data_type_valid(enum cmp_data_type data_type);
+int cmp_data_type_is_invalid(enum cmp_data_type data_type);
 int rdcu_supported_data_type_is_used(enum cmp_data_type data_type);
 int cmp_imagette_data_type_is_used(enum cmp_data_type data_type);
 int cmp_ap_imagette_data_type_is_used(enum cmp_data_type data_type);
 int cmp_fx_cob_data_type_is_used(enum cmp_data_type data_type);
+int cmp_cfg_fx_cob_get_need_pars(enum cmp_data_type data_type, struct fx_cob_par *par);
 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 diff_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);
@@ -269,7 +279,6 @@ unsigned int cmp_up_model(unsigned int data, unsigned int model,
 			  unsigned int model_value, unsigned int round);
 
 
-void print_cmp_cfg(const struct cmp_cfg *cfg);
 void print_cmp_info(const struct cmp_info *info);
 
 #endif /* CMP_SUPPORT_H */
diff --git a/lib/cmp_entity.c b/lib/cmp_entity.c
index daa1e11..3574062 100644
--- a/lib/cmp_entity.c
+++ b/lib/cmp_entity.c
@@ -63,7 +63,7 @@ uint32_t cmp_ent_cal_hdr_size(enum cmp_data_type data_type, int raw_mode_flag)
 	uint32_t size = 0;
 
 	if (raw_mode_flag) {
-		if (cmp_data_type_valid(data_type))
+		if (!cmp_data_type_is_invalid(data_type))
 			/* for raw data we do not need a specific header */
 			size = GENERIC_HEADER_SIZE;
 	} else {
@@ -1142,7 +1142,7 @@ enum cmp_data_type cmp_ent_get_data_type(struct cmp_entity *ent)
 	data_type = be16_to_cpu(ent->data_type);
 	data_type &= (1U << RAW_BIT_DATA_TYPE_POS)-1; /* remove uncompressed data flag */
 
-	if (!cmp_data_type_valid(data_type))
+	if (cmp_data_type_is_invalid(data_type))
 		data_type = DATA_TYPE_UNKNOWN;
 
 	return data_type;
@@ -1639,7 +1639,7 @@ void *cmp_ent_get_data_buf(struct cmp_entity *ent)
 		return NULL;
 
 	data_type = cmp_ent_get_data_type(ent);
-	if (!cmp_data_type_valid(data_type)) {
+	if (cmp_data_type_is_invalid(data_type)) {
 		debug_print("Error: Compression data type not supported.\n");
 		return NULL;
 	}
@@ -2156,7 +2156,7 @@ int cmp_ent_read_header(struct cmp_entity *ent, struct cmp_cfg *cfg)
 	int samples;
 
 	cfg->data_type = cmp_ent_get_data_type(ent);
-	if (!cmp_data_type_valid(cfg->data_type)) {
+	if (cmp_data_type_is_invalid(cfg->data_type)) {
 		debug_print("Error: Compression data type not supported.\n");
 		return -1;
 	}
diff --git a/lib/cmp_io.c b/lib/cmp_io.c
index 0dfcc8d..6c762e1 100644
--- a/lib/cmp_io.c
+++ b/lib/cmp_io.c
@@ -425,7 +425,7 @@ enum cmp_data_type string2data_type(const char *data_type_str)
 
 			if (!atoui32("Compression Data Type", data_type_str, &read_val)) {
 				data_type = read_val;
-				if (!cmp_data_type_valid(data_type))
+				if (cmp_data_type_is_invalid(data_type))
 					data_type = DATA_TYPE_UNKNOWN;
 			}
 		}
@@ -785,7 +785,7 @@ static int parse_cfg(FILE *fp, struct cmp_cfg *cfg)
  * @returns 0 on success, error otherwise
  */
 
-int read_cmp_cfg(const char *file_name, struct cmp_cfg *cfg, int verbose_en)
+int cmp_cfg_read(const char *file_name, struct cmp_cfg *cfg, int verbose_en)
 {
 	int err;
 	FILE *fp;
@@ -816,7 +816,7 @@ int read_cmp_cfg(const char *file_name, struct cmp_cfg *cfg, int verbose_en)
 
 	if (verbose_en) {
 		printf("\n\n");
-		print_cmp_cfg(cfg);
+		cmp_cfg_print(cfg);
 		printf("\n");
 	}
 
@@ -1044,7 +1044,7 @@ static int parse_info(FILE *fp, struct cmp_info *info)
  * @returns 0 on success, error otherwise
  */
 
-int read_cmp_info(const char *file_name, struct cmp_info *info, int verbose_en)
+int cmp_info_read(const char *file_name, struct cmp_info *info, int verbose_en)
 {
 	int err;
 	FILE *fp;
@@ -1551,19 +1551,29 @@ uint32_t cmp_tool_gen_version_id(const char *version)
  * @note internal use only!
  *
  * @param fp		FILE pointer
- * @param cfg		configuration to print
- * @param rdcu_cfg	if set additional RDCU parameter are printed as well
+ * @param cfg		pointer to a configuration to print
  */
 
-static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg, int rdcu_cfg)
+static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg)
 {
-	fprintf(fp, "#-------------------------------------------------------------------------------\n");
-	fprintf(fp, "# Default Configuration File\n");
+	if (!fp)
+		return;
+
+	if (!cfg) {
+		fprintf(fp, "Pointer to the compressor configuration is NULL.\n");
+		return;
+	}
+
 	fprintf(fp, "#-------------------------------------------------------------------------------\n");
 	fprintf(fp, "# Selected compression data type\n");
 	fprintf(fp, "\n");
 	fprintf(fp, "data_type = %s\n", data_type2string(cfg->data_type));
 	fprintf(fp, "\n");
+	fprintf(fp, "#-------------------------------------------------------------------------------\n");
+
+	if (cmp_data_type_is_invalid(cfg->data_type))
+		return;
+
 	fprintf(fp, "# Selected compression mode\n");
 	fprintf(fp, "# 0: raw mode\n");
 	fprintf(fp, "# 1: model mode with zero escape symbol mechanism\n");
@@ -1574,26 +1584,16 @@ static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg, int rdcu_cfg
 	fprintf(fp, "cmp_mode = %u\n", cfg->cmp_mode);
 	fprintf(fp, "\n");
 	fprintf(fp, "#-------------------------------------------------------------------------------\n");
-	fprintf(fp, "# Number of samples (16 bit value) to compress, length of the data and model buffer\n");
+	fprintf(fp, "# Number of samples to compress, length of the data and model buffer\n");
 	fprintf(fp, "\n");
 	fprintf(fp, "samples = %u\n", cfg->samples);
 	fprintf(fp, "\n");
 	fprintf(fp, "#-------------------------------------------------------------------------------\n");
-	fprintf(fp, "# Length of the compressed data buffer in number of samples (16 bit values)\n");
+	fprintf(fp, "# Length of the compressed data buffer in number of samples\n");
 	fprintf(fp, "\n");
 	fprintf(fp, "buffer_length = %u\n", cfg->buffer_length);
 	fprintf(fp, "\n");
 	fprintf(fp, "#-------------------------------------------------------------------------------\n");
-	fprintf(fp, "# Golomb parameter for dictionary selection\n");
-	fprintf(fp, "\n");
-	fprintf(fp, "golomb_par = %u\n", cfg->golomb_par);
-	fprintf(fp, "\n");
-	fprintf(fp, "#-------------------------------------------------------------------------------\n");
-	fprintf(fp, "# Spillover threshold for encoding outliers\n");
-	fprintf(fp, "\n");
-	fprintf(fp, "spill = %u\n", cfg->spill);
-	fprintf(fp, "\n");
-	fprintf(fp, "#-------------------------------------------------------------------------------\n");
 	fprintf(fp, "# Model weighting parameter\n");
 	fprintf(fp, "\n");
 	fprintf(fp, "model_value = %u\n", cfg->model_value);
@@ -1604,12 +1604,25 @@ static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg, int rdcu_cfg
 	fprintf(fp, "round = %u\n", cfg->round);
 	fprintf(fp, "\n");
 	fprintf(fp, "#-------------------------------------------------------------------------------\n");
+	fprintf(fp, "#-------------------------------------------------------------------------------\n");
+	fprintf(fp, "# Data Type Specific Compression Parameters\n");
+	fprintf(fp, "#-------------------------------------------------------------------------------\n");
+	fprintf(fp, "#-------------------------------------------------------------------------------\n");
 
-	if (rdcu_cfg) {
-		fprintf(fp, "#-------------------------------------------------------------------------------\n");
-		fprintf(fp, "# Hardware Compressor Settings (not need for SW compression)\n");
+	if (cmp_imagette_data_type_is_used(cfg->data_type)) {
+		fprintf(fp, "# Golomb parameter for dictionary selection\n");
+		fprintf(fp, "\n");
+		fprintf(fp, "golomb_par = %u\n", cfg->golomb_par);
+		fprintf(fp, "\n");
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		fprintf(fp, "# Spillover threshold for encoding outliers\n");
+		fprintf(fp, "\n");
+		fprintf(fp, "spill = %u\n", cfg->spill);
+		fprintf(fp, "\n");
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
+	}
+
+	if (cmp_ap_imagette_data_type_is_used(cfg->data_type)) {
 		fprintf(fp, "\n");
 		fprintf(fp, "# Adaptive 1 Golomb parameter; HW only\n");
 		fprintf(fp, "\n");
@@ -1633,20 +1646,17 @@ static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg, int rdcu_cfg
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
 		fprintf(fp, "# RDCU data to compress start address, the first data address in the RDCU SRAM; HW only\n");
 		fprintf(fp, "\n");
-		fprintf(fp, "rdcu_data_adr = 0x%06X\n",
-		       cfg->rdcu_data_adr);
+		fprintf(fp, "rdcu_data_adr = 0x%06X\n", cfg->rdcu_data_adr);
 		fprintf(fp, "\n");
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
 		fprintf(fp, "# RDCU model start address, the first model address in the RDCU SRAM\n");
 		fprintf(fp, "\n");
-		fprintf(fp, "rdcu_model_adr = 0x%06X\n",
-		       cfg->rdcu_model_adr);
+		fprintf(fp, "rdcu_model_adr = 0x%06X\n", cfg->rdcu_model_adr);
 		fprintf(fp, "\n");
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
 		fprintf(fp, "# RDCU updated model start address, the address in the RDCU SRAM where the updated model is stored\n");
 		fprintf(fp, "\n");
-		fprintf(fp, "rdcu_new_model_adr = 0x%06X\n",
-		       cfg->rdcu_new_model_adr);
+		fprintf(fp, "rdcu_new_model_adr = 0x%06X\n", cfg->rdcu_new_model_adr);
 		fprintf(fp, "\n");
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
 		fprintf(fp, "# RDCU compressed data start address, the first output data address in the RDCU SRAM\n");
@@ -1655,6 +1665,121 @@ static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg, int rdcu_cfg
 		fprintf(fp, "\n");
 		fprintf(fp, "#-------------------------------------------------------------------------------\n");
 	}
+
+	if (cmp_aux_data_type_is_used(cfg->data_type)) {
+		fprintf(fp, "# mean compression parameter\n");
+		fprintf(fp, "\n");
+		fprintf(fp, "cmp_par_mean = %u\n", cfg->cmp_par_mean);
+		fprintf(fp, "\n");
+		fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		fprintf(fp, "# mean spillover threshold parameter\n");
+		fprintf(fp, "\n");
+		fprintf(fp, "spill_mean = %u\n", cfg->spill_mean);
+		fprintf(fp, "\n");
+		fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		fprintf(fp, "# variance compression parameter\n");
+		fprintf(fp, "\n");
+		fprintf(fp, "cmp_par_variance = %u\n", cfg->cmp_par_variance);
+		fprintf(fp, "\n");
+		fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		fprintf(fp, "# variance spillover threshold parameter\n");
+		fprintf(fp, "\n");
+		fprintf(fp, "spill_variance = %u\n", cfg->spill_variance);
+		fprintf(fp, "\n");
+		fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		if (cfg->data_type != DATA_TYPE_OFFSET) {
+			fprintf(fp, "# outlier pixels number compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_pixels_error = %u\n", cfg->cmp_par_pixels_error);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# outlier pixels number spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_pixels_error = %u\n", cfg->spill_pixels_error);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+		/* TODO: implemented DATA_TYPE_F_CAM_OFFSET, DATA_TYPE_F_CAM_BACKGROUND */
+	}
+
+	if (cmp_fx_cob_data_type_is_used(cfg->data_type)) {
+		struct fx_cob_par needed_pars;
+
+		cmp_cfg_fx_cob_get_need_pars(cfg->data_type, &needed_pars);
+
+		if (needed_pars.exp_flags) {
+			fprintf(fp, "# exposure flags compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_exp_flags = %u\n", cfg->cmp_par_exp_flags);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# exposure flags spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_exp_flags = %u\n", cfg->spill_exp_flags);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+		if (needed_pars.fx) {
+			fprintf(fp, "# normal light flux compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_fx = %u\n", cfg->cmp_par_fx);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# normal light flux spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_fx = %u\n", cfg->spill_fx);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+		if (needed_pars.ncob) {
+			fprintf(fp, "# normal center of brightness compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_ncob = %u\n", cfg->cmp_par_ncob);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# normal center of brightness spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_nocb = %u\n", cfg->spill_ncob);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+		if (needed_pars.efx) {
+			fprintf(fp, "# extended light flux compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_efx = %u\n", cfg->cmp_par_efx);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# extended light flux spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_efx = %u\n", cfg->spill_efx);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+		if (needed_pars.ecob) {
+			fprintf(fp, "# extended center of brightness compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_ecob = %u\n", cfg->cmp_par_ecob);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# extended center of brightness spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_ecob = %u\n", cfg->spill_ecob);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+		if (needed_pars.fx_cob_variance) {
+			fprintf(fp, "# flux/COB variance compression parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "cmp_par_fx_cob_variance = %u\n", cfg->cmp_par_fx_cob_variance);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+			fprintf(fp, "# flux/COB variance  spillover threshold parameter\n");
+			fprintf(fp, "\n");
+			fprintf(fp, "spill_fx_cob_variance = %u\n", cfg->spill_fx_cob_variance);
+			fprintf(fp, "\n");
+			fprintf(fp, "#-------------------------------------------------------------------------------\n");
+		}
+	}
 }
 
 
@@ -1662,12 +1787,11 @@ static void write_cfg_internal(FILE *fp, const struct cmp_cfg *cfg, int rdcu_cfg
  * @brief prints config struct
  *
  * @param cfg		configuration to print
- * @param rdcu_cfg	if set additional RDCU parameter are printed as well
  */
 
-void print_cfg(const struct cmp_cfg *cfg, int rdcu_cfg)
+void cmp_cfg_print(const struct cmp_cfg *cfg)
 {
-	write_cfg_internal(stdout, cfg, rdcu_cfg);
+	write_cfg_internal(stdout, cfg);
 }
 
 
@@ -1676,14 +1800,12 @@ void print_cfg(const struct cmp_cfg *cfg, int rdcu_cfg)
  *
  * @param cfg		configuration to print
  * @param output_prefix prefix of the written file (.cfg is added to the prefix)
- * @param rdcu_cfg	if non-zero additional RDCU parameter are printed as well
  * @param verbose	print verbose output if not zero
  *
  * @returns 0 on success, error otherwise
  */
 
-int write_cfg(const struct cmp_cfg *cfg, const char *output_prefix, int rdcu_cfg,
-	      int verbose)
+int cmp_cfg_fo_file(const struct cmp_cfg *cfg, const char *output_prefix, int verbose)
 {
 	FILE *fp = open_file(output_prefix, ".cfg");
 
@@ -1693,12 +1815,13 @@ int write_cfg(const struct cmp_cfg *cfg, const char *output_prefix, int rdcu_cfg
 		return -1;
 	}
 
-	write_cfg_internal(fp, cfg, rdcu_cfg);
+	write_cfg_internal(fp, cfg);
 
 	fclose(fp);
 
 	if (verbose)
-		print_cfg(cfg, rdcu_cfg);
+		cmp_cfg_print(cfg);
+
 	return 0;
 }
 
@@ -1714,8 +1837,8 @@ int write_cfg(const struct cmp_cfg *cfg, const char *output_prefix, int rdcu_cfg
  * @returns 0 on success, error otherwise
  */
 
-int write_info(const struct cmp_info *info, const char *output_prefix,
-	       int rdcu_cfg)
+int cmp_info_to_file(const struct cmp_info *info, const char *output_prefix,
+		     int rdcu_cfg)
 {
 	FILE *fp = open_file(output_prefix, ".info");
 
diff --git a/lib/cmp_support.c b/lib/cmp_support.c
index 17deeed..49e56d1 100644
--- a/lib/cmp_support.c
+++ b/lib/cmp_support.c
@@ -62,10 +62,10 @@ int is_a_pow_of_2(unsigned int v)
  *
  * @param data_type	compression entity data product type to check
  *
- * @returns zero if data_type is invalid; non-zero if data_type is valid
+ * @returns non-zero if data_type is invalid; zero if data_type is valid
  */
 
-int cmp_data_type_valid(enum cmp_data_type data_type)
+int cmp_data_type_is_invalid(enum cmp_data_type data_type)
 {
 	if (data_type == DATA_TYPE_F_CAM_OFFSET)
 		debug_print("Error: DATA_TYPE_F_CAM_OFFSET is TBD and not implemented yet.\n");
@@ -73,9 +73,9 @@ int cmp_data_type_valid(enum cmp_data_type data_type)
 		debug_print("Error: DATA_TYPE_F_CAM_BACKGROUND is TBD  and not implemented yet.\n");
 
 	if (data_type <= DATA_TYPE_UNKNOWN || data_type > DATA_TYPE_F_CAM_IMAGETTE_ADAPTIVE)
-		return 0;
+		return 1;
 
-	return 1;
+	return 0;
 }
 
 
@@ -97,24 +97,6 @@ int model_mode_is_used(enum cmp_mode cmp_mode)
 }
 
 
-/**
- * @brief check if a 1d-differencing mode is selected
- *
- * @param cmp_mode	compression mode
- *
- * @returns 1 when the 1d-differencing mode is used, otherwise 0
- */
-
-int diff_mode_is_used(enum cmp_mode cmp_mode)
-{
-	if (cmp_mode == CMP_MODE_DIFF_ZERO ||
-	    cmp_mode == CMP_MODE_DIFF_MULTI)
-		return 1;
-
-	return 0;
-}
-
-
 /**
  * @brief check if the raw mode is selected
  *
@@ -472,7 +454,7 @@ int cmp_cfg_icu_gen_par_is_invalid(const struct cmp_cfg *cfg)
 	if (!cfg)
 		return 0;
 
-	if (!cmp_data_type_valid(cfg->data_type)) {
+	if (cmp_data_type_is_invalid(cfg->data_type)) {
 		debug_print("Error: selected compression data type is not supported.\n");
 		cfg_invalid++;
 	}
@@ -700,102 +682,133 @@ int cmp_cfg_imagette_is_invalid(const struct cmp_cfg *cfg, int rdcu_check)
 
 
 /**
- * @brief check if the flux/center of brightness specific compression parameters
- *	are invalid
+ * @brief get needed compression parameter pairs for a flux/center of brightness
+ *	data type
  *
- * @param cfg	pointer to the compressor configuration
+ * @param data_type	a flux/center of brightness data type
+ * @param par		pointer to a structure containing flux/COB compression
+ *			parameters pairs
  *
- * @returns 0 if the flux/center of brightness specific parameters are valid, otherwise invalid
+ * @returns 0 on success and sets the needed compression parameter pairs in the
+ *	par struct, otherwise error
  */
 
-int cmp_cfg_fx_cob_is_invalid(const struct cmp_cfg *cfg)
+ int cmp_cfg_fx_cob_get_need_pars(enum cmp_data_type data_type, struct fx_cob_par *par)
 {
-	int cfg_invalid = 0;
-	int check_exp_flags = 0, check_ncob = 0, check_efx = 0, check_ecob = 0, check_var = 0;
+	if (!par)
+		return -1;
 
-	if (!cfg)
-		return 0;
+	par->exp_flags = 0;
+	par->fx = 0;
+	par->ncob = 0;
+	par->efx = 0;
+	par->ecob = 0;
+	par->fx_cob_variance = 0;
 
-	if (!cmp_fx_cob_data_type_is_used(cfg->data_type)) {
-		debug_print("Error: The compression data type is not a flux/center of brightness compression data type.\n");
-		cfg_invalid++;
-	}
 	/* flux parameter is needed for every fx_cob data_type */
-	cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_fx, cfg->spill_fx,
-					    cfg->cmp_mode, cfg->data_type, "flux");
+	par->fx = 1;
 
-	switch (cfg->data_type) {
+	switch (data_type) {
 	case DATA_TYPE_S_FX:
-		check_exp_flags = 1;
+		par->exp_flags = 1;
 		break;
 	case DATA_TYPE_S_FX_EFX:
-		check_exp_flags = 1;
-		check_efx = 1;
+		par->exp_flags = 1;
+		par->efx = 1;
 		break;
 	case DATA_TYPE_S_FX_NCOB:
-		check_exp_flags = 1;
-		check_ncob = 1;
+		par->exp_flags = 1;
+		par->ncob = 1;
 		break;
 	case DATA_TYPE_S_FX_EFX_NCOB_ECOB:
-		check_exp_flags = 1;
-		check_ncob = 1;
-		check_efx = 1;
-		check_ecob = 1;
+		par->exp_flags = 1;
+		par->ncob = 1;
+		par->efx = 1;
+		par->ecob = 1;
 		break;
 	case DATA_TYPE_L_FX:
-		check_exp_flags = 1;
-		check_var = 1;
+		par->exp_flags = 1;
+		par->fx_cob_variance = 1;
 		break;
 	case DATA_TYPE_L_FX_EFX:
-		check_exp_flags = 1;
-		check_efx = 1;
-		check_var = 1;
+		par->exp_flags = 1;
+		par->efx = 1;
+		par->fx_cob_variance = 1;
 		break;
 	case DATA_TYPE_L_FX_NCOB:
-		check_exp_flags = 1;
-		check_ncob = 1;
-		check_var = 1;
+		par->exp_flags = 1;
+		par->ncob = 1;
+		par->fx_cob_variance = 1;
 		break;
 	case DATA_TYPE_L_FX_EFX_NCOB_ECOB:
-		check_exp_flags = 1;
-		check_ncob = 1;
-		check_efx = 1;
-		check_ecob = 1;
-		check_var = 1;
+		par->exp_flags = 1;
+		par->ncob = 1;
+		par->efx = 1;
+		par->ecob = 1;
+		par->fx_cob_variance = 1;
 		break;
 	case DATA_TYPE_F_FX:
 		break;
 	case DATA_TYPE_F_FX_EFX:
-		check_efx = 1;
+		par->efx = 1;
 		break;
 	case DATA_TYPE_F_FX_NCOB:
-		check_ncob = 1;
+		par->ncob = 1;
 		break;
 	case DATA_TYPE_F_FX_EFX_NCOB_ECOB:
-		check_ncob = 1;
-		check_efx = 1;
-		check_ecob = 1;
+		par->ncob = 1;
+		par->efx = 1;
+		par->ecob = 1;
 		break;
 	default:
+		return -1;
+	}
+	return 0;
+}
+
+
+/**
+ * @brief check if the flux/center of brightness specific compression parameters
+ *	are invalid
+ *
+ * @param cfg	pointer to the compressor configuration
+ *
+ * @returns 0 if the flux/center of brightness specific parameters are valid, otherwise invalid
+ */
+
+int cmp_cfg_fx_cob_is_invalid(const struct cmp_cfg *cfg)
+{
+	int cfg_invalid = 0;
+	struct fx_cob_par needed_pars;
+
+	if (!cfg)
+		return 0;
+
+	if (!cmp_fx_cob_data_type_is_used(cfg->data_type)) {
+		debug_print("Error: The compression data type is not a flux/center of brightness compression data type.\n");
 		cfg_invalid++;
-		break;
 	}
 
-	if (check_exp_flags)
+	cmp_cfg_fx_cob_get_need_pars(cfg->data_type, &needed_pars);
+
+	if (needed_pars.fx)
+		cfg_invalid += cmp_pars_are_invalid(cfg->cmp_par_fx, cfg->spill_fx,
+						    cfg->cmp_mode, cfg->data_type, "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");
-	if (check_ncob)
+	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");
-	if (check_efx)
+	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");
-	if (check_ecob)
+	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");
-	if (check_var)
+	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 varianc");
+			cfg->spill_fx_cob_variance, cfg->cmp_mode, cfg->data_type, "flux/COB variance");
 
 	return cfg_invalid;
 }
@@ -869,69 +882,30 @@ int cmp_cfg_is_invalid(const struct cmp_cfg *cfg)
 }
 
 
-/**
- * @brief print the cmp_cfg structure
- *
- * @param cfg	compressor configuration contains all parameters required for
- *		compression
- */
-
-void print_cmp_cfg(const struct cmp_cfg *cfg)
-{
-	size_t i;
-
-	printf("cmp_mode: %i\n", cfg->cmp_mode);
-	printf("golomb_par: %u\n", cfg->golomb_par);
-	printf("spill: %u\n", cfg->spill);
-	printf("model_value: %u\n", cfg->model_value);
-	printf("round: %u\n", cfg->round);
-	printf("ap1_golomb_par: %u\n", cfg->ap1_golomb_par);
-	printf("ap1_spill: %u\n", cfg->ap1_spill);
-	printf("ap2_golomb_par: %u\n", cfg->ap2_golomb_par);
-	printf("ap2_spill: %u\n", cfg->ap2_spill);
-	printf("input_buf: %p\n", (void *)cfg->input_buf);
-	if (cfg->input_buf != NULL) {
-		printf("input data:");
-		for (i = 0; i < cfg->samples; i++)
-			printf(" %04X", ((uint16_t *)cfg->input_buf)[i]);
-		printf("\n");
-	}
-	printf("rdcu_data_adr: 0x%06X\n", cfg->rdcu_data_adr);
-	printf("model_buf: %p\n", (void *)cfg->model_buf);
-	if (cfg->model_buf != NULL) {
-		printf("model data:");
-		for (i = 0; i < cfg->samples; i++)
-			printf(" %04X", ((uint16_t *)cfg->model_buf)[i]);
-		printf("\n");
-	}
-	printf("rdcu_model_adr: 0x%06X\n", cfg->rdcu_model_adr);
-	printf("rdcu_new_model_adr: 0x%06X\n", cfg->rdcu_new_model_adr);
-	printf("samples: %u\n", cfg->samples);
-	printf("icu_output_buf: %p\n", (void *)cfg->icu_output_buf);
-	printf("rdcu_buffer_adr: 0x%06X\n", cfg->rdcu_buffer_adr);
-	printf("buffer_length: %u\n", cfg->buffer_length);
-}
-
-
 /**
  * @brief print the cmp_info structure
  *
- * @param info	 compressor information contains information of an executed
- *		 compression
+ * @param info	pointer to a compressor information contains information of an
+ *		executed RDCU compression
  */
 
 void print_cmp_info(const struct cmp_info *info)
 {
-	printf("cmp_mode_used: %u\n", info->cmp_mode_used);
-	printf("model_value_used: %u\n", info->model_value_used);
-	printf("round_used: %u\n", info->round_used);
-	printf("spill_used: %u\n", info->spill_used);
-	printf("golomb_par_used: %u\n", info->golomb_par_used);
-	printf("samples_used: %u\n", info->samples_used);
-	printf("cmp_size: %u\n", info->cmp_size);
-	printf("ap1_cmp_size: %u\n", info->ap1_cmp_size);
-	printf("ap2_cmp_size: %u\n", info->ap2_cmp_size);
-	printf("rdcu_new_model_adr_used: 0x%06X\n", info->rdcu_new_model_adr_used);
-	printf("rdcu_cmp_adr_used: 0x%06X\n", info->rdcu_cmp_adr_used);
-	printf("cmp_err: %#X\n", info->cmp_err);
+	if (!info) {
+		debug_print("Pointer to the compressor information is NULL.\n");
+		return;
+	}
+
+	debug_print("cmp_mode_used: %u\n", info->cmp_mode_used);
+	debug_print("spill_used: %u\n", info->spill_used);
+	debug_print("golomb_par_used: %u\n", info->golomb_par_used);
+	debug_print("samples_used: %u\n", info->samples_used);
+	debug_print("cmp_size: %u\n", info->cmp_size);
+	debug_print("ap1_cmp_size: %u\n", info->ap1_cmp_size);
+	debug_print("ap2_cmp_size: %u\n", info->ap2_cmp_size);
+	debug_print("rdcu_new_model_adr_used: 0x%06X\n", info->rdcu_new_model_adr_used);
+	debug_print("rdcu_cmp_adr_used: 0x%06X\n", info->rdcu_cmp_adr_used);
+	debug_print("model_value_used: %u\n", info->model_value_used);
+	debug_print("round_used: %u\n", info->round_used);
+	debug_print("cmp_err: %#X\n", info->cmp_err);
 }
diff --git a/lib/decmp.c b/lib/decmp.c
index 3be77c9..71a2813 100644
--- a/lib/decmp.c
+++ b/lib/decmp.c
@@ -2141,7 +2141,7 @@ static int decompressed_data_internal(struct cmp_cfg *cfg)
  * @param ent			pointer to the compression entity to be decompressed
  * @param model_of_data		pointer to model data buffer (can be NULL if no
  *				model compression mode is used)
- * @param updated_model		pointer to store the updated model for the next model
+ * @param up_model_buf		pointer to store the updated model for the next model
  *				mode compression (can be the same as the model_of_data
  *				buffer for in-place update or NULL if updated model is not needed)
  * @param decompressed_data	pointer to the decompressed data buffer (can be NULL)
@@ -2177,7 +2177,7 @@ int decompress_cmp_entiy(struct cmp_entity *ent, void *model_of_data,
  *				compression entity header)
  * @param model_of_data		pointer to model data buffer (can be NULL if no
  *				model compression mode is used)
- * @param updated_model		pointer to store the updated model for the next model
+ * @param up_model_buf		pointer to store the updated model for the next model
  *				mode compression (can be the same as the model_of_data
  *				buffer for in-place update or NULL if updated model is not needed)
  * @param decompressed_data	pointer to the decompressed data buffer (can be NULL)
diff --git a/test/cmp_icu/test_decmp.c b/test/cmp_icu/test_decmp.c
index e1d7025..e89edfc 100644
--- a/test/cmp_icu/test_decmp.c
+++ b/test/cmp_icu/test_decmp.c
@@ -784,7 +784,7 @@ void test_random_compression_decompression(void)
 			cmp_size = icu_compress_data_entity(cmp_ent, &cfg);
 			if (cmp_size <= 0) {
 				printf("cmp_size: %i\n", cmp_size);
-				print_cfg(&cfg, 0);
+				cmp_cfg_print(&cfg);
 			}
 			TEST_ASSERT_GREATER_THAN(0, cmp_size);
 
@@ -794,7 +794,7 @@ void test_random_compression_decompression(void)
 
 			TEST_ASSERT_EQUAL_INT(s, decompress_size);
 			if (memcmp(cfg.input_buf, decompressed_data, s)) {
-				print_cfg(&cfg, 0);
+				cmp_cfg_print(&cfg);
 				TEST_ASSERT_FALSE(memcmp(cfg.input_buf, decompressed_data, s));
 			}
 			if (model_mode_is_used(cfg.cmp_mode))
-- 
GitLab