Coverage Report

Created: 2025-07-23 08:18

/src/libheif/libheif/codecs/hevc_dec.cc
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * HEIF codec.
3
 * Copyright (c) 2024 Dirk Farin <dirk.farin@gmail.com>
4
 *
5
 * This file is part of libheif.
6
 *
7
 * libheif is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Lesser General Public License as
9
 * published by the Free Software Foundation, either version 3 of
10
 * the License, or (at your option) any later version.
11
 *
12
 * libheif is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License
18
 * along with libheif.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "hevc_dec.h"
22
#include "hevc_boxes.h"
23
#include "error.h"
24
#include "context.h"
25
26
#include <string>
27
28
29
Result<std::vector<uint8_t>> Decoder_HEVC::read_bitstream_configuration_data() const
30
8.80k
{
31
8.80k
  std::vector<uint8_t> data;
32
8.80k
  if (!m_hvcC->get_headers(&data)) {
33
0
    return Error{heif_error_Invalid_input,
34
0
                 heif_suberror_No_item_data};
35
0
  }
36
37
8.80k
  return data;
38
8.80k
}
39
40
41
int Decoder_HEVC::get_luma_bits_per_pixel() const
42
0
{
43
0
  return m_hvcC->get_configuration().bit_depth_luma;
44
0
}
45
46
47
int Decoder_HEVC::get_chroma_bits_per_pixel() const
48
0
{
49
0
  return m_hvcC->get_configuration().bit_depth_chroma;
50
0
}
51
52
53
Error Decoder_HEVC::get_coded_image_colorspace(heif_colorspace* out_colorspace, heif_chroma* out_chroma) const
54
8.67k
{
55
8.67k
  *out_chroma = (heif_chroma) (m_hvcC->get_configuration().chroma_format);
56
57
8.67k
  if (*out_chroma == heif_chroma_monochrome) {
58
775
    *out_colorspace = heif_colorspace_monochrome;
59
775
  }
60
7.90k
  else {
61
7.90k
    *out_colorspace = heif_colorspace_YCbCr;
62
7.90k
  }
63
64
8.67k
  return Error::Ok;
65
8.67k
}