mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 15:22:12 +02:00
apply clang-format
(Debian clang-format version 19.1.7 (3+build4)) with `--style=Google`. Manual changes: * clang-format disabled around macros with stringification (mostly assembly) * some inline assembly strings were adjusted to avoid awkward line breaks * trailing commas, `//` or suffixes (`ull`) added to help array formatting * thread_utils.c: parameter comments were changed to the more common /*...=*/ style to improve formatting The automatically generated code under swig/ was skipped. Bug: 433996651 Change-Id: Iea3f24160d78d2a2653971cdf13fa932e47ff1b3
This commit is contained in:
@@ -35,13 +35,9 @@ static WEBP_INLINE uint32_t VP8GetARGBIndex(uint32_t idx) {
|
||||
return (idx >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static WEBP_INLINE uint8_t VP8GetAlphaIndex(uint8_t idx) {
|
||||
return idx;
|
||||
}
|
||||
static WEBP_INLINE uint8_t VP8GetAlphaIndex(uint8_t idx) { return idx; }
|
||||
|
||||
static WEBP_INLINE uint32_t VP8GetARGBValue(uint32_t val) {
|
||||
return val;
|
||||
}
|
||||
static WEBP_INLINE uint32_t VP8GetARGBValue(uint32_t val) { return val; }
|
||||
|
||||
static WEBP_INLINE uint8_t VP8GetAlphaValue(uint32_t val) {
|
||||
return (val >> 8) & 0xff;
|
||||
@@ -74,8 +70,8 @@ static WEBP_INLINE int VP8LNearLosslessBits(int near_lossless_quality) {
|
||||
// Practically, we can get rid of the call to log() as the two values match to
|
||||
// very high degree (the ratio of these two is 0.99999x).
|
||||
// Keeping a high threshold for now.
|
||||
#define APPROX_LOG_WITH_CORRECTION_MAX 65536
|
||||
#define APPROX_LOG_MAX 4096
|
||||
#define APPROX_LOG_WITH_CORRECTION_MAX 65536
|
||||
#define APPROX_LOG_MAX 4096
|
||||
// VP8LFastLog2 and VP8LFastSLog2 are used on elements from image histograms.
|
||||
// The histogram values cannot exceed the maximum number of pixels, which
|
||||
// is (1 << 14) * (1 << 14). Therefore S * log(S) < (1 << 33).
|
||||
@@ -138,7 +134,7 @@ static WEBP_INLINE void VP8LPrefixEncodeNoLUT(int distance, int* const code,
|
||||
*code = 2 * highest_bit + second_highest_bit;
|
||||
}
|
||||
|
||||
#define PREFIX_LOOKUP_IDX_MAX 512
|
||||
#define PREFIX_LOOKUP_IDX_MAX 512
|
||||
typedef struct {
|
||||
int8_t code;
|
||||
int8_t extra_bits;
|
||||
@@ -172,16 +168,16 @@ static WEBP_INLINE void VP8LPrefixEncode(int distance, int* const code,
|
||||
}
|
||||
|
||||
// Sum of each component, mod 256.
|
||||
static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE
|
||||
uint32_t VP8LAddPixels(uint32_t a, uint32_t b) {
|
||||
static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE uint32_t
|
||||
VP8LAddPixels(uint32_t a, uint32_t b) {
|
||||
const uint32_t alpha_and_green = (a & 0xff00ff00u) + (b & 0xff00ff00u);
|
||||
const uint32_t red_and_blue = (a & 0x00ff00ffu) + (b & 0x00ff00ffu);
|
||||
return (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu);
|
||||
}
|
||||
|
||||
// Difference of each component, mod 256.
|
||||
static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE
|
||||
uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {
|
||||
static WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW WEBP_INLINE uint32_t
|
||||
VP8LSubPixels(uint32_t a, uint32_t b) {
|
||||
const uint32_t alpha_and_green =
|
||||
0x00ff00ffu + (a & 0xff00ff00u) - (b & 0xff00ff00u);
|
||||
const uint32_t red_and_blue =
|
||||
@@ -197,19 +193,19 @@ uint32_t VP8LSubPixels(uint32_t a, uint32_t b) {
|
||||
|
||||
// The predictor is added to the output pixel (which
|
||||
// is therefore considered as a residual) to get the final prediction.
|
||||
#define GENERATE_PREDICTOR_ADD(PREDICTOR, PREDICTOR_ADD) \
|
||||
static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \
|
||||
int num_pixels, uint32_t* WEBP_RESTRICT out) { \
|
||||
int x; \
|
||||
assert(upper != NULL); \
|
||||
for (x = 0; x < num_pixels; ++x) { \
|
||||
const uint32_t pred = (PREDICTOR)(&out[x - 1], upper + x); \
|
||||
out[x] = VP8LAddPixels(in[x], pred); \
|
||||
} \
|
||||
}
|
||||
#define GENERATE_PREDICTOR_ADD(PREDICTOR, PREDICTOR_ADD) \
|
||||
static void PREDICTOR_ADD(const uint32_t* in, const uint32_t* upper, \
|
||||
int num_pixels, uint32_t* WEBP_RESTRICT out) { \
|
||||
int x; \
|
||||
assert(upper != NULL); \
|
||||
for (x = 0; x < num_pixels; ++x) { \
|
||||
const uint32_t pred = (PREDICTOR)(&out[x - 1], upper + x); \
|
||||
out[x] = VP8LAddPixels(in[x], pred); \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // WEBP_DSP_LOSSLESS_COMMON_H_
|
||||
|
Reference in New Issue
Block a user