Coverage Report

Created: 2026-01-20 07:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libheif/libheif/codecs/uncompressed/unc_enc.cc
Line
Count
Source
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 "unc_enc.h"
22
#include "unc_boxes.h"
23
#include "error.h"
24
#include "context.h"
25
#include "api_structs.h"
26
#include <cstring>
27
#include <image-items/unc_image.h>
28
29
#include <string>
30
31
32
Result<Encoder::CodedImageData> Encoder_uncompressed::encode(const std::shared_ptr<HeifPixelImage>& image,
33
                                                     struct heif_encoder* encoder,
34
                                                     const struct heif_encoding_options& options,
35
                                                     enum heif_image_input_class input_class)
36
0
{
37
0
  Encoder::CodedImageData codedImage;
38
39
0
  Result<Encoder::CodedImageData> codingResult = ImageItem_uncompressed::encode_static(image, options);
40
0
  if (!codingResult) {
41
0
    return codingResult.error();
42
0
  }
43
44
0
  codedImage = *codingResult;
45
46
  // codedImage.bitstream = std::move(vec);
47
48
0
  codedImage.codingConstraints.intra_pred_used = false;
49
0
  codedImage.codingConstraints.all_ref_pics_intra = true;
50
0
  codedImage.codingConstraints.max_ref_per_pic = 0;
51
52
0
  return {codedImage};
53
0
}
54
55
56
std::shared_ptr<class Box_VisualSampleEntry> Encoder_uncompressed::get_sample_description_box(const CodedImageData& data) const
57
0
{
58
0
  auto uncv = std::make_shared<Box_uncv>();
59
0
  uncv->get_VisualSampleEntry().compressorname = "iso23001-17";
60
61
0
  for (auto prop : data.properties) {
62
0
    switch (prop->get_short_type()) {
63
0
      case fourcc("cmpd"):
64
0
      case fourcc("uncC"):
65
0
      case fourcc("cmpC"):
66
0
      case fourcc("icef"):
67
0
      case fourcc("cpat"):
68
0
        uncv->append_child_box(prop);
69
0
      break;
70
0
    }
71
0
  }
72
73
0
  return uncv;
74
0
}