mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-21 19:32:52 +01:00
alpha_processing: fix visual studio warnings
similar to '* const', __restrict needs to be included in the declaration to avoid warnings like: src\dsp\alpha_processing.c(429): warning C4028: formal parameter 1 different from declaration this change also moves WEBP_RESTRICT to dsp.h to avoid a circular dependency between it and utils.h which already includes dsp.h Change-Id: Ib070d358a372e76fae4be5445ab288940b9baac0
This commit is contained in:
parent
298d26eac2
commit
8f5946634e
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "src/dsp/dsp.h"
|
#include "src/dsp/dsp.h"
|
||||||
#include "src/utils/utils.h"
|
|
||||||
|
|
||||||
// Tables can be faster on some platform but incur some extra binary size (~2k).
|
// Tables can be faster on some platform but incur some extra binary size (~2k).
|
||||||
#if !defined(USE_TABLES_FOR_ALPHA_MULT)
|
#if !defined(USE_TABLES_FOR_ALPHA_MULT)
|
||||||
@ -180,7 +179,8 @@ void WebPMultRow_C(uint8_t* WEBP_RESTRICT const ptr,
|
|||||||
#undef MFIX
|
#undef MFIX
|
||||||
|
|
||||||
void (*WebPMultARGBRow)(uint32_t* const ptr, int width, int inverse);
|
void (*WebPMultARGBRow)(uint32_t* const ptr, int width, int inverse);
|
||||||
void (*WebPMultRow)(uint8_t* const ptr, const uint8_t* const alpha,
|
void (*WebPMultRow)(uint8_t* WEBP_RESTRICT const ptr,
|
||||||
|
const uint8_t* WEBP_RESTRICT const alpha,
|
||||||
int width, int inverse);
|
int width, int inverse);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -401,16 +401,22 @@ static void PackRGB_C(const uint8_t* WEBP_RESTRICT r,
|
|||||||
|
|
||||||
void (*WebPApplyAlphaMultiply)(uint8_t*, int, int, int, int);
|
void (*WebPApplyAlphaMultiply)(uint8_t*, int, int, int, int);
|
||||||
void (*WebPApplyAlphaMultiply4444)(uint8_t*, int, int, int);
|
void (*WebPApplyAlphaMultiply4444)(uint8_t*, int, int, int);
|
||||||
int (*WebPDispatchAlpha)(const uint8_t*, int, int, int, uint8_t*, int);
|
int (*WebPDispatchAlpha)(const uint8_t* WEBP_RESTRICT, int, int, int,
|
||||||
void (*WebPDispatchAlphaToGreen)(const uint8_t*, int, int, int, uint32_t*, int);
|
uint8_t* WEBP_RESTRICT, int);
|
||||||
int (*WebPExtractAlpha)(const uint8_t*, int, int, int, uint8_t*, int);
|
void (*WebPDispatchAlphaToGreen)(const uint8_t* WEBP_RESTRICT, int, int, int,
|
||||||
void (*WebPExtractGreen)(const uint32_t* argb, uint8_t* alpha, int size);
|
uint32_t* WEBP_RESTRICT, int);
|
||||||
|
int (*WebPExtractAlpha)(const uint8_t* WEBP_RESTRICT, int, int, int,
|
||||||
|
uint8_t* WEBP_RESTRICT, int);
|
||||||
|
void (*WebPExtractGreen)(const uint32_t* WEBP_RESTRICT argb,
|
||||||
|
uint8_t* WEBP_RESTRICT alpha, int size);
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r, const uint8_t* g,
|
void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r, const uint8_t* g,
|
||||||
const uint8_t* b, int, uint32_t*);
|
const uint8_t* b, int, uint32_t*);
|
||||||
#endif
|
#endif
|
||||||
void (*WebPPackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b,
|
void (*WebPPackRGB)(const uint8_t* WEBP_RESTRICT r,
|
||||||
int len, int step, uint32_t* out);
|
const uint8_t* WEBP_RESTRICT g,
|
||||||
|
const uint8_t* WEBP_RESTRICT b,
|
||||||
|
int len, int step, uint32_t* WEBP_RESTRICT out);
|
||||||
|
|
||||||
int (*WebPHasAlpha8b)(const uint8_t* src, int length);
|
int (*WebPHasAlpha8b)(const uint8_t* src, int length);
|
||||||
int (*WebPHasAlpha32b)(const uint8_t* src, int length);
|
int (*WebPHasAlpha32b)(const uint8_t* src, int length);
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#if defined(WEBP_USE_NEON)
|
#if defined(WEBP_USE_NEON)
|
||||||
|
|
||||||
#include "src/dsp/neon.h"
|
#include "src/dsp/neon.h"
|
||||||
#include "src/utils/utils.h"
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#if defined(WEBP_USE_SSE2)
|
#if defined(WEBP_USE_SSE2)
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
|
|
||||||
#include "src/utils/utils.h"
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
static int DispatchAlpha_SSE2(const uint8_t* WEBP_RESTRICT alpha,
|
static int DispatchAlpha_SSE2(const uint8_t* WEBP_RESTRICT alpha,
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include <smmintrin.h>
|
#include <smmintrin.h>
|
||||||
|
|
||||||
#include "src/utils/utils.h"
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
static int ExtractAlpha_SSE41(const uint8_t* WEBP_RESTRICT argb,
|
static int ExtractAlpha_SSE41(const uint8_t* WEBP_RESTRICT argb,
|
||||||
|
@ -26,6 +26,23 @@ extern "C" {
|
|||||||
|
|
||||||
#define BPS 32 // this is the common stride for enc/dec
|
#define BPS 32 // this is the common stride for enc/dec
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// WEBP_RESTRICT
|
||||||
|
|
||||||
|
// Declares a pointer with the restrict type qualifier if available.
|
||||||
|
// This allows code to hint to the compiler that only this pointer references a
|
||||||
|
// particular object or memory region within the scope of the block in which it
|
||||||
|
// is declared. This may allow for improved optimizations due to the lack of
|
||||||
|
// pointer aliasing. See also:
|
||||||
|
// https://en.cppreference.com/w/c/language/restrict
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define WEBP_RESTRICT __restrict__
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define WEBP_RESTRICT __restrict
|
||||||
|
#else
|
||||||
|
#define WEBP_RESTRICT
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// CPU detection
|
// CPU detection
|
||||||
|
|
||||||
@ -578,26 +595,29 @@ extern void (*WebPApplyAlphaMultiply4444)(
|
|||||||
|
|
||||||
// Dispatch the values from alpha[] plane to the ARGB destination 'dst'.
|
// Dispatch the values from alpha[] plane to the ARGB destination 'dst'.
|
||||||
// Returns true if alpha[] plane has non-trivial values different from 0xff.
|
// Returns true if alpha[] plane has non-trivial values different from 0xff.
|
||||||
extern int (*WebPDispatchAlpha)(const uint8_t* alpha, int alpha_stride,
|
extern int (*WebPDispatchAlpha)(const uint8_t* WEBP_RESTRICT alpha,
|
||||||
int width, int height,
|
int alpha_stride, int width, int height,
|
||||||
uint8_t* dst, int dst_stride);
|
uint8_t* WEBP_RESTRICT dst, int dst_stride);
|
||||||
|
|
||||||
// Transfer packed 8b alpha[] values to green channel in dst[], zero'ing the
|
// Transfer packed 8b alpha[] values to green channel in dst[], zero'ing the
|
||||||
// A/R/B values. 'dst_stride' is the stride for dst[] in uint32_t units.
|
// A/R/B values. 'dst_stride' is the stride for dst[] in uint32_t units.
|
||||||
extern void (*WebPDispatchAlphaToGreen)(const uint8_t* alpha, int alpha_stride,
|
extern void (*WebPDispatchAlphaToGreen)(const uint8_t* WEBP_RESTRICT alpha,
|
||||||
int width, int height,
|
int alpha_stride, int width, int height,
|
||||||
uint32_t* dst, int dst_stride);
|
uint32_t* WEBP_RESTRICT dst,
|
||||||
|
int dst_stride);
|
||||||
|
|
||||||
// Extract the alpha values from 32b values in argb[] and pack them into alpha[]
|
// Extract the alpha values from 32b values in argb[] and pack them into alpha[]
|
||||||
// (this is the opposite of WebPDispatchAlpha).
|
// (this is the opposite of WebPDispatchAlpha).
|
||||||
// Returns true if there's only trivial 0xff alpha values.
|
// Returns true if there's only trivial 0xff alpha values.
|
||||||
extern int (*WebPExtractAlpha)(const uint8_t* argb, int argb_stride,
|
extern int (*WebPExtractAlpha)(const uint8_t* WEBP_RESTRICT argb,
|
||||||
int width, int height,
|
int argb_stride, int width, int height,
|
||||||
uint8_t* alpha, int alpha_stride);
|
uint8_t* WEBP_RESTRICT alpha,
|
||||||
|
int alpha_stride);
|
||||||
|
|
||||||
// Extract the green values from 32b values in argb[] and pack them into alpha[]
|
// Extract the green values from 32b values in argb[] and pack them into alpha[]
|
||||||
// (this is the opposite of WebPDispatchAlphaToGreen).
|
// (this is the opposite of WebPDispatchAlphaToGreen).
|
||||||
extern void (*WebPExtractGreen)(const uint32_t* argb, uint8_t* alpha, int size);
|
extern void (*WebPExtractGreen)(const uint32_t* WEBP_RESTRICT argb,
|
||||||
|
uint8_t* WEBP_RESTRICT alpha, int size);
|
||||||
|
|
||||||
// Pre-Multiply operation transforms x into x * A / 255 (where x=Y,R,G or B).
|
// Pre-Multiply operation transforms x into x * A / 255 (where x=Y,R,G or B).
|
||||||
// Un-Multiply operation transforms x into x * 255 / A.
|
// Un-Multiply operation transforms x into x * 255 / A.
|
||||||
@ -610,29 +630,35 @@ void WebPMultARGBRows(uint8_t* ptr, int stride, int width, int num_rows,
|
|||||||
int inverse);
|
int inverse);
|
||||||
|
|
||||||
// Same for a row of single values, with side alpha values.
|
// Same for a row of single values, with side alpha values.
|
||||||
extern void (*WebPMultRow)(uint8_t* const ptr, const uint8_t* const alpha,
|
extern void (*WebPMultRow)(uint8_t* WEBP_RESTRICT const ptr,
|
||||||
|
const uint8_t* WEBP_RESTRICT const alpha,
|
||||||
int width, int inverse);
|
int width, int inverse);
|
||||||
|
|
||||||
// Same a WebPMultRow(), but for several 'num_rows' rows.
|
// Same a WebPMultRow(), but for several 'num_rows' rows.
|
||||||
void WebPMultRows(uint8_t* ptr, int stride,
|
void WebPMultRows(uint8_t* WEBP_RESTRICT ptr, int stride,
|
||||||
const uint8_t* alpha, int alpha_stride,
|
const uint8_t* WEBP_RESTRICT alpha, int alpha_stride,
|
||||||
int width, int num_rows, int inverse);
|
int width, int num_rows, int inverse);
|
||||||
|
|
||||||
// Plain-C versions, used as fallback by some implementations.
|
// Plain-C versions, used as fallback by some implementations.
|
||||||
void WebPMultRow_C(uint8_t* const ptr, const uint8_t* const alpha,
|
void WebPMultRow_C(uint8_t* WEBP_RESTRICT const ptr,
|
||||||
|
const uint8_t* WEBP_RESTRICT const alpha,
|
||||||
int width, int inverse);
|
int width, int inverse);
|
||||||
void WebPMultARGBRow_C(uint32_t* const ptr, int width, int inverse);
|
void WebPMultARGBRow_C(uint32_t* const ptr, int width, int inverse);
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
// ARGB packing function: a/r/g/b input is rgba or bgra order.
|
// ARGB packing function: a/r/g/b input is rgba or bgra order.
|
||||||
extern void (*WebPPackARGB)(const uint8_t* a, const uint8_t* r,
|
extern void (*WebPPackARGB)(const uint8_t* WEBP_RESTRICT a,
|
||||||
const uint8_t* g, const uint8_t* b, int len,
|
const uint8_t* WEBP_RESTRICT r,
|
||||||
uint32_t* out);
|
const uint8_t* WEBP_RESTRICT g,
|
||||||
|
const uint8_t* WEBP_RESTRICT b,
|
||||||
|
int len, uint32_t* WEBP_RESTRICT out);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// RGB packing function. 'step' can be 3 or 4. r/g/b input is rgb or bgr order.
|
// RGB packing function. 'step' can be 3 or 4. r/g/b input is rgb or bgr order.
|
||||||
extern void (*WebPPackRGB)(const uint8_t* r, const uint8_t* g, const uint8_t* b,
|
extern void (*WebPPackRGB)(const uint8_t* WEBP_RESTRICT r,
|
||||||
int len, int step, uint32_t* out);
|
const uint8_t* WEBP_RESTRICT g,
|
||||||
|
const uint8_t* WEBP_RESTRICT b,
|
||||||
|
int len, int step, uint32_t* WEBP_RESTRICT out);
|
||||||
|
|
||||||
// This function returns true if src[i] contains a value different from 0xff.
|
// This function returns true if src[i] contains a value different from 0xff.
|
||||||
extern int (*WebPHasAlpha8b)(const uint8_t* src, int length);
|
extern int (*WebPHasAlpha8b)(const uint8_t* src, int length);
|
||||||
|
@ -29,23 +29,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// WEBP_RESTRICT
|
|
||||||
|
|
||||||
// Declares a pointer with the restrict type qualifier if available.
|
|
||||||
// This allows code to hint to the compiler that only this pointer references a
|
|
||||||
// particular object or memory region within the scope of the block in which it
|
|
||||||
// is declared. This may allow for improved optimizations due to the lack of
|
|
||||||
// pointer aliasing. See also:
|
|
||||||
// https://en.cppreference.com/w/c/language/restrict
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#define WEBP_RESTRICT __restrict__
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define WEBP_RESTRICT __restrict
|
|
||||||
#else
|
|
||||||
#define WEBP_RESTRICT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Memory allocation
|
// Memory allocation
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user