/src/libwebp/src/dsp/lossless_common.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2012 Google Inc. All Rights Reserved. |
2 | | // |
3 | | // Use of this source code is governed by a BSD-style license |
4 | | // that can be found in the COPYING file in the root of the source |
5 | | // tree. An additional intellectual property rights grant can be found |
6 | | // in the file PATENTS. All contributing project authors may |
7 | | // be found in the AUTHORS file in the root of the source tree. |
8 | | // ----------------------------------------------------------------------------- |
9 | | // |
10 | | // Image transforms and color space conversion methods for lossless decoder. |
11 | | // |
12 | | // Authors: Vikas Arora (vikaas.arora@gmail.com) |
13 | | // Jyrki Alakuijala (jyrki@google.com) |
14 | | // Vincent Rabaud (vrabaud@google.com) |
15 | | |
16 | | #ifndef WEBP_DSP_LOSSLESS_COMMON_H_ |
17 | | #define WEBP_DSP_LOSSLESS_COMMON_H_ |
18 | | |
19 | | #include "src/dsp/cpu.h" |
20 | | #include "src/utils/utils.h" |
21 | | #include "src/webp/types.h" |
22 | | |
23 | | #ifdef __cplusplus |
24 | | extern "C" { |
25 | | #endif |
26 | | |
27 | | //------------------------------------------------------------------------------ |
28 | | // Decoding |
29 | | |
30 | | // color mapping related functions. |
31 | 0 | static WEBP_INLINE uint32_t VP8GetARGBIndex(uint32_t idx) { |
32 | 0 | return (idx >> 8) & 0xff; |
33 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8GetARGBIndex Unexecuted instantiation: lossless.c:VP8GetARGBIndex Unexecuted instantiation: lossless_sse2.c:VP8GetARGBIndex Unexecuted instantiation: lossless_sse41.c:VP8GetARGBIndex Unexecuted instantiation: vp8l_enc.c:VP8GetARGBIndex Unexecuted instantiation: palette.c:VP8GetARGBIndex Unexecuted instantiation: lossless_enc.c:VP8GetARGBIndex Unexecuted instantiation: lossless_enc_sse2.c:VP8GetARGBIndex Unexecuted instantiation: backward_references_enc.c:VP8GetARGBIndex Unexecuted instantiation: histogram_enc.c:VP8GetARGBIndex Unexecuted instantiation: near_lossless_enc.c:VP8GetARGBIndex Unexecuted instantiation: predictor_enc.c:VP8GetARGBIndex Unexecuted instantiation: backward_references_cost_enc.c:VP8GetARGBIndex |
34 | | |
35 | 0 | static WEBP_INLINE uint8_t VP8GetAlphaIndex(uint8_t idx) { |
36 | 0 | return idx; |
37 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8GetAlphaIndex Unexecuted instantiation: lossless.c:VP8GetAlphaIndex Unexecuted instantiation: lossless_sse2.c:VP8GetAlphaIndex Unexecuted instantiation: lossless_sse41.c:VP8GetAlphaIndex Unexecuted instantiation: vp8l_enc.c:VP8GetAlphaIndex Unexecuted instantiation: palette.c:VP8GetAlphaIndex Unexecuted instantiation: lossless_enc.c:VP8GetAlphaIndex Unexecuted instantiation: lossless_enc_sse2.c:VP8GetAlphaIndex Unexecuted instantiation: backward_references_enc.c:VP8GetAlphaIndex Unexecuted instantiation: histogram_enc.c:VP8GetAlphaIndex Unexecuted instantiation: near_lossless_enc.c:VP8GetAlphaIndex Unexecuted instantiation: predictor_enc.c:VP8GetAlphaIndex Unexecuted instantiation: backward_references_cost_enc.c:VP8GetAlphaIndex |
38 | | |
39 | 0 | static WEBP_INLINE uint32_t VP8GetARGBValue(uint32_t val) { |
40 | 0 | return val; |
41 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8GetARGBValue Unexecuted instantiation: lossless.c:VP8GetARGBValue Unexecuted instantiation: lossless_sse2.c:VP8GetARGBValue Unexecuted instantiation: lossless_sse41.c:VP8GetARGBValue Unexecuted instantiation: vp8l_enc.c:VP8GetARGBValue Unexecuted instantiation: palette.c:VP8GetARGBValue Unexecuted instantiation: lossless_enc.c:VP8GetARGBValue Unexecuted instantiation: lossless_enc_sse2.c:VP8GetARGBValue Unexecuted instantiation: backward_references_enc.c:VP8GetARGBValue Unexecuted instantiation: histogram_enc.c:VP8GetARGBValue Unexecuted instantiation: near_lossless_enc.c:VP8GetARGBValue Unexecuted instantiation: predictor_enc.c:VP8GetARGBValue Unexecuted instantiation: backward_references_cost_enc.c:VP8GetARGBValue |
42 | | |
43 | 0 | static WEBP_INLINE uint8_t VP8GetAlphaValue(uint32_t val) { |
44 | 0 | return (val >> 8) & 0xff; |
45 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8GetAlphaValue Unexecuted instantiation: lossless.c:VP8GetAlphaValue Unexecuted instantiation: lossless_sse2.c:VP8GetAlphaValue Unexecuted instantiation: lossless_sse41.c:VP8GetAlphaValue Unexecuted instantiation: vp8l_enc.c:VP8GetAlphaValue Unexecuted instantiation: palette.c:VP8GetAlphaValue Unexecuted instantiation: lossless_enc.c:VP8GetAlphaValue Unexecuted instantiation: lossless_enc_sse2.c:VP8GetAlphaValue Unexecuted instantiation: backward_references_enc.c:VP8GetAlphaValue Unexecuted instantiation: histogram_enc.c:VP8GetAlphaValue Unexecuted instantiation: near_lossless_enc.c:VP8GetAlphaValue Unexecuted instantiation: predictor_enc.c:VP8GetAlphaValue Unexecuted instantiation: backward_references_cost_enc.c:VP8GetAlphaValue |
46 | | |
47 | | //------------------------------------------------------------------------------ |
48 | | // Misc methods. |
49 | | |
50 | | // Computes sampled size of 'size' when sampling using 'sampling bits'. |
51 | | static WEBP_INLINE uint32_t VP8LSubSampleSize(uint32_t size, |
52 | 0 | uint32_t sampling_bits) { |
53 | 0 | return (size + (1 << sampling_bits) - 1) >> sampling_bits; |
54 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LSubSampleSize Unexecuted instantiation: lossless.c:VP8LSubSampleSize Unexecuted instantiation: lossless_sse2.c:VP8LSubSampleSize Unexecuted instantiation: lossless_sse41.c:VP8LSubSampleSize Unexecuted instantiation: vp8l_enc.c:VP8LSubSampleSize Unexecuted instantiation: palette.c:VP8LSubSampleSize Unexecuted instantiation: lossless_enc.c:VP8LSubSampleSize Unexecuted instantiation: lossless_enc_sse2.c:VP8LSubSampleSize Unexecuted instantiation: backward_references_enc.c:VP8LSubSampleSize Unexecuted instantiation: histogram_enc.c:VP8LSubSampleSize Unexecuted instantiation: near_lossless_enc.c:VP8LSubSampleSize Unexecuted instantiation: predictor_enc.c:VP8LSubSampleSize Unexecuted instantiation: backward_references_cost_enc.c:VP8LSubSampleSize |
55 | | |
56 | | // Converts near lossless quality into max number of bits shaved off. |
57 | 0 | static WEBP_INLINE int VP8LNearLosslessBits(int near_lossless_quality) { |
58 | | // 100 -> 0 |
59 | | // 80..99 -> 1 |
60 | | // 60..79 -> 2 |
61 | | // 40..59 -> 3 |
62 | | // 20..39 -> 4 |
63 | | // 0..19 -> 5 |
64 | 0 | return 5 - near_lossless_quality / 20; |
65 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LNearLosslessBits Unexecuted instantiation: lossless.c:VP8LNearLosslessBits Unexecuted instantiation: lossless_sse2.c:VP8LNearLosslessBits Unexecuted instantiation: lossless_sse41.c:VP8LNearLosslessBits Unexecuted instantiation: vp8l_enc.c:VP8LNearLosslessBits Unexecuted instantiation: palette.c:VP8LNearLosslessBits Unexecuted instantiation: lossless_enc.c:VP8LNearLosslessBits Unexecuted instantiation: lossless_enc_sse2.c:VP8LNearLosslessBits Unexecuted instantiation: backward_references_enc.c:VP8LNearLosslessBits Unexecuted instantiation: histogram_enc.c:VP8LNearLosslessBits Unexecuted instantiation: near_lossless_enc.c:VP8LNearLosslessBits Unexecuted instantiation: predictor_enc.c:VP8LNearLosslessBits Unexecuted instantiation: backward_references_cost_enc.c:VP8LNearLosslessBits |
66 | | |
67 | | // ----------------------------------------------------------------------------- |
68 | | // Faster logarithm for integers. Small values use a look-up table. |
69 | | |
70 | | // The threshold till approximate version of log_2 can be used. |
71 | | // Practically, we can get rid of the call to log() as the two values match to |
72 | | // very high degree (the ratio of these two is 0.99999x). |
73 | | // Keeping a high threshold for now. |
74 | 0 | #define APPROX_LOG_WITH_CORRECTION_MAX 65536 |
75 | 0 | #define APPROX_LOG_MAX 4096 |
76 | | // VP8LFastLog2 and VP8LFastSLog2 are used on elements from image histograms. |
77 | | // The histogram values cannot exceed the maximum number of pixels, which |
78 | | // is (1 << 14) * (1 << 14). Therefore S * log(S) < (1 << 33). |
79 | | // No more than 32 bits of precision should be chosen. |
80 | | // To match the original float implementation, 23 bits of precision are used. |
81 | 0 | #define LOG_2_PRECISION_BITS 23 |
82 | | #define LOG_2_RECIPROCAL 1.44269504088896338700465094007086 |
83 | | // LOG_2_RECIPROCAL * (1 << LOG_2_PRECISION_BITS) |
84 | 0 | #define LOG_2_RECIPROCAL_FIXED_DOUBLE 12102203.161561485379934310913085937500 |
85 | 0 | #define LOG_2_RECIPROCAL_FIXED ((uint64_t)12102203) |
86 | 0 | #define LOG_LOOKUP_IDX_MAX 256 |
87 | | extern const uint32_t kLog2Table[LOG_LOOKUP_IDX_MAX]; |
88 | | extern const uint64_t kSLog2Table[LOG_LOOKUP_IDX_MAX]; |
89 | | typedef uint32_t (*VP8LFastLog2SlowFunc)(uint32_t v); |
90 | | typedef uint64_t (*VP8LFastSLog2SlowFunc)(uint32_t v); |
91 | | |
92 | | extern VP8LFastLog2SlowFunc VP8LFastLog2Slow; |
93 | | extern VP8LFastSLog2SlowFunc VP8LFastSLog2Slow; |
94 | | |
95 | 0 | static WEBP_INLINE uint32_t VP8LFastLog2(uint32_t v) { |
96 | 0 | return (v < LOG_LOOKUP_IDX_MAX) ? kLog2Table[v] : VP8LFastLog2Slow(v); |
97 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LFastLog2 Unexecuted instantiation: lossless.c:VP8LFastLog2 Unexecuted instantiation: lossless_sse2.c:VP8LFastLog2 Unexecuted instantiation: lossless_sse41.c:VP8LFastLog2 Unexecuted instantiation: vp8l_enc.c:VP8LFastLog2 Unexecuted instantiation: palette.c:VP8LFastLog2 Unexecuted instantiation: lossless_enc.c:VP8LFastLog2 Unexecuted instantiation: lossless_enc_sse2.c:VP8LFastLog2 Unexecuted instantiation: backward_references_enc.c:VP8LFastLog2 Unexecuted instantiation: histogram_enc.c:VP8LFastLog2 Unexecuted instantiation: near_lossless_enc.c:VP8LFastLog2 Unexecuted instantiation: predictor_enc.c:VP8LFastLog2 Unexecuted instantiation: backward_references_cost_enc.c:VP8LFastLog2 |
98 | | // Fast calculation of v * log2(v) for integer input. |
99 | 0 | static WEBP_INLINE uint64_t VP8LFastSLog2(uint32_t v) { |
100 | 0 | return (v < LOG_LOOKUP_IDX_MAX) ? kSLog2Table[v] : VP8LFastSLog2Slow(v); |
101 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LFastSLog2 Unexecuted instantiation: lossless.c:VP8LFastSLog2 Unexecuted instantiation: lossless_sse2.c:VP8LFastSLog2 Unexecuted instantiation: lossless_sse41.c:VP8LFastSLog2 Unexecuted instantiation: vp8l_enc.c:VP8LFastSLog2 Unexecuted instantiation: palette.c:VP8LFastSLog2 Unexecuted instantiation: lossless_enc.c:VP8LFastSLog2 Unexecuted instantiation: lossless_enc_sse2.c:VP8LFastSLog2 Unexecuted instantiation: backward_references_enc.c:VP8LFastSLog2 Unexecuted instantiation: histogram_enc.c:VP8LFastSLog2 Unexecuted instantiation: near_lossless_enc.c:VP8LFastSLog2 Unexecuted instantiation: predictor_enc.c:VP8LFastSLog2 Unexecuted instantiation: backward_references_cost_enc.c:VP8LFastSLog2 |
102 | | |
103 | 0 | static WEBP_INLINE uint64_t RightShiftRound(uint64_t v, uint32_t shift) { |
104 | 0 | return (v + (1ull << shift >> 1)) >> shift; |
105 | 0 | } Unexecuted instantiation: vp8l_dec.c:RightShiftRound Unexecuted instantiation: lossless.c:RightShiftRound Unexecuted instantiation: lossless_sse2.c:RightShiftRound Unexecuted instantiation: lossless_sse41.c:RightShiftRound Unexecuted instantiation: vp8l_enc.c:RightShiftRound Unexecuted instantiation: palette.c:RightShiftRound Unexecuted instantiation: lossless_enc.c:RightShiftRound Unexecuted instantiation: lossless_enc_sse2.c:RightShiftRound Unexecuted instantiation: backward_references_enc.c:RightShiftRound Unexecuted instantiation: histogram_enc.c:RightShiftRound Unexecuted instantiation: near_lossless_enc.c:RightShiftRound Unexecuted instantiation: predictor_enc.c:RightShiftRound Unexecuted instantiation: backward_references_cost_enc.c:RightShiftRound |
106 | | |
107 | 0 | static WEBP_INLINE int64_t DivRound(int64_t a, int64_t b) { |
108 | 0 | return ((a < 0) == (b < 0)) ? ((a + b / 2) / b) : ((a - b / 2) / b); |
109 | 0 | } Unexecuted instantiation: vp8l_dec.c:DivRound Unexecuted instantiation: lossless.c:DivRound Unexecuted instantiation: lossless_sse2.c:DivRound Unexecuted instantiation: lossless_sse41.c:DivRound Unexecuted instantiation: vp8l_enc.c:DivRound Unexecuted instantiation: palette.c:DivRound Unexecuted instantiation: lossless_enc.c:DivRound Unexecuted instantiation: lossless_enc_sse2.c:DivRound Unexecuted instantiation: backward_references_enc.c:DivRound Unexecuted instantiation: histogram_enc.c:DivRound Unexecuted instantiation: near_lossless_enc.c:DivRound Unexecuted instantiation: predictor_enc.c:DivRound Unexecuted instantiation: backward_references_cost_enc.c:DivRound |
110 | | |
111 | 0 | #define WEBP_INT64_MAX ((int64_t)((1ull << 63) - 1)) |
112 | 0 | #define WEBP_UINT64_MAX (~0ull) |
113 | | |
114 | | // ----------------------------------------------------------------------------- |
115 | | // PrefixEncode() |
116 | | |
117 | | // Splitting of distance and length codes into prefixes and |
118 | | // extra bits. The prefixes are encoded with an entropy code |
119 | | // while the extra bits are stored just as normal bits. |
120 | | static WEBP_INLINE void VP8LPrefixEncodeBitsNoLUT(int distance, int* const code, |
121 | 0 | int* const extra_bits) { |
122 | 0 | const int highest_bit = BitsLog2Floor(--distance); |
123 | 0 | const int second_highest_bit = (distance >> (highest_bit - 1)) & 1; |
124 | 0 | *extra_bits = highest_bit - 1; |
125 | 0 | *code = 2 * highest_bit + second_highest_bit; |
126 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: lossless.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: lossless_sse2.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: lossless_sse41.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: vp8l_enc.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: palette.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: lossless_enc.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: lossless_enc_sse2.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: backward_references_enc.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: histogram_enc.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: near_lossless_enc.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: predictor_enc.c:VP8LPrefixEncodeBitsNoLUT Unexecuted instantiation: backward_references_cost_enc.c:VP8LPrefixEncodeBitsNoLUT |
127 | | |
128 | | static WEBP_INLINE void VP8LPrefixEncodeNoLUT(int distance, int* const code, |
129 | | int* const extra_bits, |
130 | 0 | int* const extra_bits_value) { |
131 | 0 | const int highest_bit = BitsLog2Floor(--distance); |
132 | 0 | const int second_highest_bit = (distance >> (highest_bit - 1)) & 1; |
133 | 0 | *extra_bits = highest_bit - 1; |
134 | 0 | *extra_bits_value = distance & ((1 << *extra_bits) - 1); |
135 | 0 | *code = 2 * highest_bit + second_highest_bit; |
136 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: lossless.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: lossless_sse2.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: lossless_sse41.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: vp8l_enc.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: palette.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: lossless_enc.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: lossless_enc_sse2.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: backward_references_enc.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: histogram_enc.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: near_lossless_enc.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: predictor_enc.c:VP8LPrefixEncodeNoLUT Unexecuted instantiation: backward_references_cost_enc.c:VP8LPrefixEncodeNoLUT |
137 | | |
138 | 0 | #define PREFIX_LOOKUP_IDX_MAX 512 |
139 | | typedef struct { |
140 | | int8_t code_; |
141 | | int8_t extra_bits_; |
142 | | } VP8LPrefixCode; |
143 | | |
144 | | // These tables are derived using VP8LPrefixEncodeNoLUT. |
145 | | extern const VP8LPrefixCode kPrefixEncodeCode[PREFIX_LOOKUP_IDX_MAX]; |
146 | | extern const uint8_t kPrefixEncodeExtraBitsValue[PREFIX_LOOKUP_IDX_MAX]; |
147 | | static WEBP_INLINE void VP8LPrefixEncodeBits(int distance, int* const code, |
148 | 0 | int* const extra_bits) { |
149 | 0 | if (distance < PREFIX_LOOKUP_IDX_MAX) { |
150 | 0 | const VP8LPrefixCode prefix_code = kPrefixEncodeCode[distance]; |
151 | 0 | *code = prefix_code.code_; |
152 | 0 | *extra_bits = prefix_code.extra_bits_; |
153 | 0 | } else { |
154 | 0 | VP8LPrefixEncodeBitsNoLUT(distance, code, extra_bits); |
155 | 0 | } |
156 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LPrefixEncodeBits Unexecuted instantiation: lossless.c:VP8LPrefixEncodeBits Unexecuted instantiation: lossless_sse2.c:VP8LPrefixEncodeBits Unexecuted instantiation: lossless_sse41.c:VP8LPrefixEncodeBits Unexecuted instantiation: vp8l_enc.c:VP8LPrefixEncodeBits Unexecuted instantiation: palette.c:VP8LPrefixEncodeBits Unexecuted instantiation: lossless_enc.c:VP8LPrefixEncodeBits Unexecuted instantiation: lossless_enc_sse2.c:VP8LPrefixEncodeBits Unexecuted instantiation: backward_references_enc.c:VP8LPrefixEncodeBits Unexecuted instantiation: histogram_enc.c:VP8LPrefixEncodeBits Unexecuted instantiation: near_lossless_enc.c:VP8LPrefixEncodeBits Unexecuted instantiation: predictor_enc.c:VP8LPrefixEncodeBits Unexecuted instantiation: backward_references_cost_enc.c:VP8LPrefixEncodeBits |
157 | | |
158 | | static WEBP_INLINE void VP8LPrefixEncode(int distance, int* const code, |
159 | | int* const extra_bits, |
160 | 0 | int* const extra_bits_value) { |
161 | 0 | if (distance < PREFIX_LOOKUP_IDX_MAX) { |
162 | 0 | const VP8LPrefixCode prefix_code = kPrefixEncodeCode[distance]; |
163 | 0 | *code = prefix_code.code_; |
164 | 0 | *extra_bits = prefix_code.extra_bits_; |
165 | 0 | *extra_bits_value = kPrefixEncodeExtraBitsValue[distance]; |
166 | 0 | } else { |
167 | 0 | VP8LPrefixEncodeNoLUT(distance, code, extra_bits, extra_bits_value); |
168 | 0 | } |
169 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LPrefixEncode Unexecuted instantiation: lossless.c:VP8LPrefixEncode Unexecuted instantiation: lossless_sse2.c:VP8LPrefixEncode Unexecuted instantiation: lossless_sse41.c:VP8LPrefixEncode Unexecuted instantiation: vp8l_enc.c:VP8LPrefixEncode Unexecuted instantiation: palette.c:VP8LPrefixEncode Unexecuted instantiation: lossless_enc.c:VP8LPrefixEncode Unexecuted instantiation: lossless_enc_sse2.c:VP8LPrefixEncode Unexecuted instantiation: backward_references_enc.c:VP8LPrefixEncode Unexecuted instantiation: histogram_enc.c:VP8LPrefixEncode Unexecuted instantiation: near_lossless_enc.c:VP8LPrefixEncode Unexecuted instantiation: predictor_enc.c:VP8LPrefixEncode Unexecuted instantiation: backward_references_cost_enc.c:VP8LPrefixEncode |
170 | | |
171 | | // Sum of each component, mod 256. |
172 | | static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE |
173 | 0 | uint32_t VP8LAddPixels(uint32_t a, uint32_t b) { |
174 | 0 | const uint32_t alpha_and_green = (a & 0xff00ff00u) + (b & 0xff00ff00u); |
175 | 0 | const uint32_t red_and_blue = (a & 0x00ff00ffu) + (b & 0x00ff00ffu); |
176 | 0 | return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); |
177 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LAddPixels Unexecuted instantiation: lossless.c:VP8LAddPixels Unexecuted instantiation: lossless_sse2.c:VP8LAddPixels Unexecuted instantiation: lossless_sse41.c:VP8LAddPixels Unexecuted instantiation: vp8l_enc.c:VP8LAddPixels Unexecuted instantiation: palette.c:VP8LAddPixels Unexecuted instantiation: lossless_enc.c:VP8LAddPixels Unexecuted instantiation: lossless_enc_sse2.c:VP8LAddPixels Unexecuted instantiation: backward_references_enc.c:VP8LAddPixels Unexecuted instantiation: histogram_enc.c:VP8LAddPixels Unexecuted instantiation: near_lossless_enc.c:VP8LAddPixels Unexecuted instantiation: predictor_enc.c:VP8LAddPixels Unexecuted instantiation: backward_references_cost_enc.c:VP8LAddPixels |
178 | | |
179 | | // Difference of each component, mod 256. |
180 | | static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE |
181 | 0 | uint32_t VP8LSubPixels(uint32_t a, uint32_t b) { |
182 | 0 | const uint32_t alpha_and_green = |
183 | 0 | 0x00ff00ffu + (a & 0xff00ff00u) - (b & 0xff00ff00u); |
184 | 0 | const uint32_t red_and_blue = |
185 | 0 | 0xff00ff00u + (a & 0x00ff00ffu) - (b & 0x00ff00ffu); |
186 | 0 | return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); |
187 | 0 | } Unexecuted instantiation: vp8l_dec.c:VP8LSubPixels Unexecuted instantiation: lossless.c:VP8LSubPixels Unexecuted instantiation: lossless_sse2.c:VP8LSubPixels Unexecuted instantiation: lossless_sse41.c:VP8LSubPixels Unexecuted instantiation: vp8l_enc.c:VP8LSubPixels Unexecuted instantiation: palette.c:VP8LSubPixels Unexecuted instantiation: lossless_enc.c:VP8LSubPixels Unexecuted instantiation: lossless_enc_sse2.c:VP8LSubPixels Unexecuted instantiation: backward_references_enc.c:VP8LSubPixels Unexecuted instantiation: histogram_enc.c:VP8LSubPixels Unexecuted instantiation: near_lossless_enc.c:VP8LSubPixels Unexecuted instantiation: predictor_enc.c:VP8LSubPixels Unexecuted instantiation: backward_references_cost_enc.c:VP8LSubPixels |
188 | | |
189 | | //------------------------------------------------------------------------------ |
190 | | // Transform-related functions used in both encoding and decoding. |
191 | | |
192 | | // Macros used to create a batch predictor that iteratively uses a |
193 | | // one-pixel predictor. |
194 | | |
195 | | // The predictor is added to the output pixel (which |
196 | | // is therefore considered as a residual) to get the final prediction. |
197 | | #define GENERATE_PREDICTOR_ADD(PREDICTOR, PREDICTOR_ADD) \ |
198 | | static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \ |
199 | 0 | int num_pixels, uint32_t* out) { \ |
200 | 0 | int x; \ |
201 | 0 | assert(upper != NULL); \ |
202 | 0 | for (x = 0; x < num_pixels; ++x) { \ |
203 | 0 | const uint32_t pred = (PREDICTOR)(&out[x - 1], upper + x); \ |
204 | 0 | out[x] = VP8LAddPixels(in[x], pred); \ |
205 | 0 | } \ |
206 | 0 | } Unexecuted instantiation: lossless.c:PredictorAdd2_C Unexecuted instantiation: lossless.c:PredictorAdd3_C Unexecuted instantiation: lossless.c:PredictorAdd4_C Unexecuted instantiation: lossless.c:PredictorAdd5_C Unexecuted instantiation: lossless.c:PredictorAdd6_C Unexecuted instantiation: lossless.c:PredictorAdd7_C Unexecuted instantiation: lossless.c:PredictorAdd8_C Unexecuted instantiation: lossless.c:PredictorAdd9_C Unexecuted instantiation: lossless.c:PredictorAdd10_C Unexecuted instantiation: lossless.c:PredictorAdd11_C Unexecuted instantiation: lossless.c:PredictorAdd12_C Unexecuted instantiation: lossless.c:PredictorAdd13_C Unexecuted instantiation: lossless_sse2.c:PredictorAdd5_SSE2 Unexecuted instantiation: lossless_sse2.c:PredictorAdd6_SSE2 Unexecuted instantiation: lossless_sse2.c:PredictorAdd7_SSE2 Unexecuted instantiation: lossless_sse2.c:PredictorAdd13_SSE2 |
207 | | |
208 | | #ifdef __cplusplus |
209 | | } // extern "C" |
210 | | #endif |
211 | | |
212 | | #endif // WEBP_DSP_LOSSLESS_COMMON_H_ |