Coverage Report

Created: 2025-11-24 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openexr/src/lib/OpenEXR/ImfB44Compressor.cpp
Line
Count
Source
1
//
2
// SPDX-License-Identifier: BSD-3-Clause
3
// Copyright (c) Contributors to the OpenEXR Project.
4
//
5
6
//-----------------------------------------------------------------------------
7
//
8
//  class B44Compressor
9
//
10
//  This compressor is lossy for HALF channels; the compression rate
11
//  is fixed at 32/14 (approximately 2.28).  FLOAT and UINT channels
12
//  are not compressed; their data are preserved exactly.
13
//
14
//  Each HALF channel is split into blocks of 4 by 4 pixels.  An
15
//  uncompressed block occupies 32 bytes, which are re-interpreted
16
//  as sixteen 16-bit unsigned integers, t[0] ... t[15].  Compression
17
//  shrinks the block to 14 bytes.  The compressed 14-byte block
18
//  contains
19
//
20
//   - t[0]
21
//
22
//   - a 6-bit shift value
23
//
24
//   - 15 densely packed 6-bit values, r[0] ... r[14], which are
25
//         computed by subtracting adjacent pixel values and right-
26
//     shifting the differences according to the stored shift value.
27
//
28
//     Differences between adjacent pixels are computed according
29
//     to the following diagram:
30
//
31
//     0 -------->  1 -------->  2 -------->  3
32
//               |     3            7           11
33
//               |
34
//               | 0
35
//               |
36
//               v
37
//     4 -------->  5 -------->  6 -------->  7
38
//               |     4            8           12
39
//               |
40
//               | 1
41
//               |
42
//               v
43
//     8 -------->  9 --------> 10 --------> 11
44
//               |     5            9           13
45
//               |
46
//               | 2
47
//               |
48
//               v
49
//    12 --------> 13 --------> 14 --------> 15
50
//                     6           10           14
51
//
52
//      Here
53
//
54
//               5 ---------> 6
55
//                     8
56
//
57
//      means that r[8] is the difference between t[5] and t[6].
58
//
59
//   - optionally, a 4-by-4 pixel block where all pixels have the
60
//     same value can be treated as a special case, where the
61
//     compressed block contains only 3 instead of 14 bytes:
62
//     t[0], followed by an "impossible" 6-bit shift value and
63
//     two padding bits.
64
//
65
//  This compressor can handle positive and negative pixel values.
66
//  NaNs and infinities are replaced with zeroes before compression.
67
//
68
//-----------------------------------------------------------------------------
69
70
#include "ImfB44Compressor.h"
71
72
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
73
74
B44Compressor::B44Compressor (
75
    const Header& hdr,
76
    size_t        maxScanLineSize,
77
    int           numScanLines,
78
    bool          optFlatFields)
79
0
    : Compressor (hdr,
80
0
                  optFlatFields ? EXR_COMPRESSION_B44A : EXR_COMPRESSION_B44,
81
0
                  maxScanLineSize,
82
0
                  numScanLines)
83
0
{
84
0
}
85
86
B44Compressor::~B44Compressor ()
87
0
{
88
0
}
89
90
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT