Coverage Report

Created: 2025-06-15 00:57

/src/cmp_tool/lib/icu_compress/cmp_chunk_type.c
Line
Count
Source (jump to first uncovered line)
1
/**
2
 * @file   cmp_chunk_type.h
3
 * @author Dominik Loidolt (dominik.loidolt@univie.ac.at)
4
 * @date   2024
5
 *
6
 * @copyright GPLv2
7
 * This program is free software; you can redistribute it and/or modify it
8
 * under the terms and conditions of the GNU General Public License,
9
 * version 2, as published by the Free Software Foundation.
10
 *
11
 * This program is distributed in the hope it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14
 * more details.
15
 *
16
 * @brief functions and definitions for determining the chunk type of PLATO data
17
 */
18
19
#include "cmp_chunk_type.h"
20
#include "../common/cmp_debug.h"
21
#include "../common/cmp_data_types.h"
22
23
24
/**
25
 * @brief get the chunk_type of a collection
26
 * @details map a sub-service to a chunk service according to
27
 *  DetailedBudgetWorking_2023-10-11
28
 *
29
 * @param col pointer to a collection header
30
 *
31
 * @returns chunk type of the collection, CHUNK_TYPE_UNKNOWN on
32
 *  failure
33
 */
34
35
enum chunk_type cmp_col_get_chunk_type(const struct collection_hdr *col)
36
120k
{
37
120k
  enum chunk_type chunk_type;
38
39
120k
  switch (cmp_col_get_subservice(col)) {
40
2.98k
  case SST_NCxx_S_SCIENCE_IMAGETTE:
41
2.98k
    chunk_type = CHUNK_TYPE_NCAM_IMAGETTE;
42
2.98k
    break;
43
21.6k
  case SST_NCxx_S_SCIENCE_SAT_IMAGETTE:
44
21.6k
    chunk_type = CHUNK_TYPE_SAT_IMAGETTE;
45
21.6k
    break;
46
3.46k
  case SST_NCxx_S_SCIENCE_OFFSET:
47
5.40k
  case SST_NCxx_S_SCIENCE_BACKGROUND:
48
5.40k
    chunk_type = CHUNK_TYPE_OFFSET_BACKGROUND;
49
5.40k
    break;
50
7.39k
  case SST_NCxx_S_SCIENCE_SMEARING:
51
7.39k
    chunk_type = CHUNK_TYPE_SMEARING;
52
7.39k
    break;
53
35.8k
  case SST_NCxx_S_SCIENCE_S_FX:
54
40.3k
  case SST_NCxx_S_SCIENCE_S_FX_EFX:
55
46.8k
  case SST_NCxx_S_SCIENCE_S_FX_NCOB:
56
51.9k
  case SST_NCxx_S_SCIENCE_S_FX_EFX_NCOB_ECOB:
57
51.9k
    chunk_type = CHUNK_TYPE_SHORT_CADENCE;
58
51.9k
    break;
59
9.11k
  case SST_NCxx_S_SCIENCE_L_FX:
60
11.7k
  case SST_NCxx_S_SCIENCE_L_FX_EFX:
61
13.8k
  case SST_NCxx_S_SCIENCE_L_FX_NCOB:
62
18.6k
  case SST_NCxx_S_SCIENCE_L_FX_EFX_NCOB_ECOB:
63
18.6k
    chunk_type = CHUNK_TYPE_LONG_CADENCE;
64
18.6k
    break;
65
1.34k
  case SST_FCx_S_SCIENCE_IMAGETTE:
66
3.21k
  case SST_FCx_S_SCIENCE_OFFSET_VALUES:
67
12.4k
  case SST_FCx_S_BACKGROUND_VALUES:
68
12.4k
    chunk_type = CHUNK_TYPE_F_CHAIN;
69
12.4k
    break;
70
4
  case SST_NCxx_S_SCIENCE_F_FX:
71
9
  case SST_NCxx_S_SCIENCE_F_FX_EFX:
72
16
  case SST_NCxx_S_SCIENCE_F_FX_NCOB:
73
23
  case SST_NCxx_S_SCIENCE_F_FX_EFX_NCOB_ECOB:
74
23
    debug_print("Error: No chunk is defined for fast cadence subservices");
75
    /* fall through */
76
155
  default:
77
155
    chunk_type = CHUNK_TYPE_UNKNOWN;
78
155
    break;
79
120k
  }
80
81
120k
  return chunk_type;
82
120k
}