Select Git revision
cmp_icu.c 88.89 KiB
/**
* @file cmp_icu.c
* @author Dominik Loidolt (dominik.loidolt@univie.ac.at)
* @date 2020
*
* @copyright GPLv2
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* @brief software compression library
* @see Data Compression User Manual PLATO-UVIE-PL-UM-0001
*
* To compress data, first create a compression configuration with the
* cmp_cfg_icu_create() function.
* Then set the different data buffers with the data to compressed, the model
* data and the compressed data with the cmp_cfg_icu_buffers() function.
* Then set the compression data type specific compression parameters. For
* imagette data use the cmp_cfg_icu_imagette() function. For flux and center of
* brightness data use the cmp_cfg_fx_cob() function. And for background, offset
* and smearing data use the cmp_cfg_aux() function.
* Finally, you can compress the data with the icu_compress_data() function.
*/
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include "../common/byteorder.h"
#include "../common/cmp_debug.h"
#include "../common/cmp_data_types.h"
#include "../common/cmp_support.h"
#include "../common/cmp_entity.h"
#include "../cmp_icu.h"
#include "../cmp_chunk.h"
/**
* @brief default implementation of the get_timestamp() function
*
* @returns 0
*/
static uint64_t default_get_timestamp(void)
{
return 0;
}
/**
* @brief function pointer to a function returning a current PLATO timestamp
* initialised with the compress_chunk_init() function
*/
static uint64_t (*get_timestamp)(void) = default_get_timestamp;
/**
* @brief holding the version_identifier for the compression header
* initialised with the compress_chunk_init() function
*/
static uint32_t version_identifier;