Coverage Report

Created: 2026-05-24 07:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libheif/libheif/image-items/avc.cc
Line
Count
Source
1
/*
2
 * HEIF AVC codec.
3
 * Copyright (c) 2023 Brad Hards <bradh@frogmouth.net>
4
 * Copyright (c) 2025 Dirk Farin <dirk.farin@gmail.com>
5
 *
6
 * This file is part of libheif.
7
 *
8
 * libheif is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Lesser General Public License as
10
 * published by the Free Software Foundation, either version 3 of
11
 * the License, or (at your option) any later version.
12
 *
13
 * libheif is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with libheif.  If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
#include "avc.h"
23
#include "context.h"
24
#include "codecs/avc_dec.h"
25
#include "codecs/avc_boxes.h"
26
#include <utility>
27
28
#include "codecs/avc_enc.h"
29
30
31
ImageItem_AVC::ImageItem_AVC(HeifContext* ctx, heif_item_id id)
32
867
  : ImageItem(ctx, id)
33
867
{
34
867
  m_encoder = std::make_shared<Encoder_AVC>();
35
867
}
36
37
38
ImageItem_AVC::ImageItem_AVC(HeifContext* ctx)
39
0
  : ImageItem(ctx)
40
0
{
41
0
  m_encoder = std::make_shared<Encoder_AVC>();
42
0
}
43
44
45
Result<std::shared_ptr<Decoder>> ImageItem_AVC::get_decoder() const
46
7.10k
{
47
7.10k
  return {m_decoder};
48
7.10k
}
49
50
51
std::shared_ptr<Encoder> ImageItem_AVC::get_encoder() const
52
0
{
53
0
  return m_encoder;
54
0
}
55
56
57
Error ImageItem_AVC::initialize_decoder()
58
846
{
59
846
  auto avcC_box = get_property<Box_avcC>();
60
846
  if (!avcC_box) {
61
62
    return Error{heif_error_Invalid_input,
62
62
                 heif_suberror_No_av1C_box};
63
62
  }
64
65
784
  m_decoder = std::make_shared<Decoder_AVC>(avcC_box);
66
67
784
  return Error::Ok;
68
846
}
69
70
void ImageItem_AVC::set_decoder_input_data()
71
784
{
72
784
  DataExtent extent;
73
784
  extent.set_from_image_item(get_context()->get_heif_file(), get_id());
74
75
784
  m_decoder->set_data_extent(std::move(extent));
76
784
}