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
22.4k
{
37
22.4k
  enum chunk_type chunk_type;
38
39
22.4k
  switch (cmp_col_get_subservice(col)) {
40
884
  case SST_NCxx_S_SCIENCE_IMAGETTE:
41
884
    chunk_type = CHUNK_TYPE_NCAM_IMAGETTE;
42
884
    break;
43
4.71k
  case SST_NCxx_S_SCIENCE_SAT_IMAGETTE:
44
4.71k
    chunk_type = CHUNK_TYPE_SAT_IMAGETTE;
45
4.71k
    break;
46
2.09k
  case SST_NCxx_S_SCIENCE_OFFSET:
47
3.51k
  case SST_NCxx_S_SCIENCE_BACKGROUND:
48
3.51k
    chunk_type = CHUNK_TYPE_OFFSET_BACKGROUND;
49
3.51k
    break;
50
2.59k
  case SST_NCxx_S_SCIENCE_SMEARING:
51
2.59k
    chunk_type = CHUNK_TYPE_SMEARING;
52
2.59k
    break;
53
1.05k
  case SST_NCxx_S_SCIENCE_S_FX:
54
2.88k
  case SST_NCxx_S_SCIENCE_S_FX_EFX:
55
5.20k
  case SST_NCxx_S_SCIENCE_S_FX_NCOB:
56
6.26k
  case SST_NCxx_S_SCIENCE_S_FX_EFX_NCOB_ECOB:
57
6.26k
    chunk_type = CHUNK_TYPE_SHORT_CADENCE;
58
6.26k
    break;
59
769
  case SST_NCxx_S_SCIENCE_L_FX:
60
1.41k
  case SST_NCxx_S_SCIENCE_L_FX_EFX:
61
2.02k
  case SST_NCxx_S_SCIENCE_L_FX_NCOB:
62
2.80k
  case SST_NCxx_S_SCIENCE_L_FX_EFX_NCOB_ECOB:
63
2.80k
    chunk_type = CHUNK_TYPE_LONG_CADENCE;
64
2.80k
    break;
65
363
  case SST_FCx_S_SCIENCE_IMAGETTE:
66
614
  case SST_FCx_S_SCIENCE_OFFSET_VALUES:
67
1.63k
  case SST_FCx_S_BACKGROUND_VALUES:
68
1.63k
    chunk_type = CHUNK_TYPE_F_CHAIN;
69
1.63k
    break;
70
0
  case SST_NCxx_S_SCIENCE_F_FX:
71
0
  case SST_NCxx_S_SCIENCE_F_FX_EFX:
72
0
  case SST_NCxx_S_SCIENCE_F_FX_NCOB:
73
0
  case SST_NCxx_S_SCIENCE_F_FX_EFX_NCOB_ECOB:
74
0
    debug_print("Error: No chunk is defined for fast cadence subservices");
75
    /* fall through */
76
70
  default:
77
70
    chunk_type = CHUNK_TYPE_UNKNOWN;
78
70
    break;
79
22.4k
  }
80
81
22.4k
  return chunk_type;
82
22.4k
}