mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
Remove some errors when compiling the code as C++.
This fixes some cases from
https://bugs.chromium.org/p/webp/issues/detail?id=137
Change-Id: I58f3a617bf973dbe4c5794004a01e2aea39ba53a
(cherry picked from commit 28ce304344
)
This commit is contained in:
parent
a4a8e5f32c
commit
24eb39401b
@ -67,7 +67,7 @@ static int ALPHInit(ALPHDecoder* const dec, const uint8_t* data,
|
||||
}
|
||||
|
||||
dec->method_ = (data[0] >> 0) & 0x03;
|
||||
dec->filter_ = (data[0] >> 2) & 0x03;
|
||||
dec->filter_ = (WEBP_FILTER_TYPE)((data[0] >> 2) & 0x03);
|
||||
dec->pre_processing_ = (data[0] >> 4) & 0x03;
|
||||
rsrv = (data[0] >> 6) & 0x03;
|
||||
if (dec->method_ < ALPHA_NO_COMPRESSION ||
|
||||
|
@ -113,10 +113,10 @@ WebPAnimDecoder* WebPAnimDecoderNewInternal(
|
||||
dec->info_.frame_count = WebPDemuxGetI(dec->demux_, WEBP_FF_FRAME_COUNT);
|
||||
|
||||
// Note: calloc() because we fill frame with zeroes as well.
|
||||
dec->curr_frame_ = WebPSafeCalloc(
|
||||
dec->curr_frame_ = (uint8_t*)WebPSafeCalloc(
|
||||
dec->info_.canvas_width * NUM_CHANNELS, dec->info_.canvas_height);
|
||||
if (dec->curr_frame_ == NULL) goto Error;
|
||||
dec->prev_frame_disposed_ = WebPSafeCalloc(
|
||||
dec->prev_frame_disposed_ = (uint8_t*)WebPSafeCalloc(
|
||||
dec->info_.canvas_width * NUM_CHANNELS, dec->info_.canvas_height);
|
||||
if (dec->prev_frame_disposed_ == NULL) goto Error;
|
||||
|
||||
|
@ -239,7 +239,7 @@ VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES];
|
||||
//------------------------------------------------------------------------------
|
||||
// 4x4
|
||||
|
||||
#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
|
||||
#define AVG3(a, b, c) ((uint8_t)(((a) + 2 * (b) + (c) + 2) >> 2))
|
||||
#define AVG2(a, b) (((a) + (b) + 1) >> 1)
|
||||
|
||||
static void VE4(uint8_t* dst) { // vertical
|
||||
|
@ -335,7 +335,7 @@ static void Intra16Preds(uint8_t* dst,
|
||||
// luma 4x4 prediction
|
||||
|
||||
#define DST(x, y) dst[(x) + (y) * BPS]
|
||||
#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
|
||||
#define AVG3(a, b, c) ((uint8_t)(((a) + 2 * (b) + (c) + 2) >> 2))
|
||||
#define AVG2(a, b) (((a) + (b) + 1) >> 1)
|
||||
|
||||
static void VE4(uint8_t* dst, const uint8_t* top) { // vertical
|
||||
|
@ -592,8 +592,8 @@ static int HistoQueueInit(HistoQueue* const histo_queue, const int max_index) {
|
||||
histo_queue->max_size = max_index * max_index;
|
||||
// We allocate max_size + 1 because the last element at index "size" is
|
||||
// used as temporary data (and it could be up to max_size).
|
||||
histo_queue->queue = WebPSafeMalloc(histo_queue->max_size + 1,
|
||||
sizeof(*histo_queue->queue));
|
||||
histo_queue->queue = (HistogramPair*)WebPSafeMalloc(
|
||||
histo_queue->max_size + 1, sizeof(*histo_queue->queue));
|
||||
return histo_queue->queue != NULL;
|
||||
}
|
||||
|
||||
@ -659,7 +659,8 @@ static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo) {
|
||||
int i, j;
|
||||
VP8LHistogram** const histograms = image_histo->histograms;
|
||||
// Indexes of remaining histograms.
|
||||
int* const clusters = WebPSafeMalloc(image_histo_size, sizeof(*clusters));
|
||||
int* const clusters =
|
||||
(int*)WebPSafeMalloc(image_histo_size, sizeof(*clusters));
|
||||
// Priority queue of histogram pairs.
|
||||
HistoQueue histo_queue;
|
||||
|
||||
|
@ -88,8 +88,9 @@ int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height) {
|
||||
}
|
||||
|
||||
int WebPPictureAllocYUVA(WebPPicture* const picture, int width, int height) {
|
||||
const WebPEncCSP uv_csp = picture->colorspace & WEBP_CSP_UV_MASK;
|
||||
const int has_alpha = picture->colorspace & WEBP_CSP_ALPHA_BIT;
|
||||
const WebPEncCSP uv_csp =
|
||||
(WebPEncCSP)((int)picture->colorspace & WEBP_CSP_UV_MASK);
|
||||
const int has_alpha = (int)picture->colorspace & WEBP_CSP_ALPHA_BIT;
|
||||
const int y_stride = width;
|
||||
const int uv_width = (width + 1) >> 1;
|
||||
const int uv_height = (height + 1) >> 1;
|
||||
|
@ -34,8 +34,8 @@
|
||||
// Palette reordering for smaller sum of deltas (and for smaller storage).
|
||||
|
||||
static int PaletteCompareColorsForQsort(const void* p1, const void* p2) {
|
||||
const uint32_t a = WebPMemToUint32(p1);
|
||||
const uint32_t b = WebPMemToUint32(p2);
|
||||
const uint32_t a = WebPMemToUint32((uint8_t*)p1);
|
||||
const uint32_t b = WebPMemToUint32((uint8_t*)p2);
|
||||
assert(a != b);
|
||||
return (a < b) ? -1 : 1;
|
||||
}
|
||||
@ -224,9 +224,8 @@ static int AnalyzeEntropy(const uint32_t* argb,
|
||||
{
|
||||
double entropy_comp[kHistoTotal];
|
||||
double entropy[kNumEntropyIx];
|
||||
EntropyIx k;
|
||||
EntropyIx last_mode_to_analyze =
|
||||
use_palette ? kPalette : kSpatialSubGreen;
|
||||
int k;
|
||||
int last_mode_to_analyze = use_palette ? kPalette : kSpatialSubGreen;
|
||||
int j;
|
||||
// Let's add one zero to the predicted histograms. The zeros are removed
|
||||
// too efficiently by the pix_diff == 0 comparison, at least one of the
|
||||
@ -263,7 +262,7 @@ static int AnalyzeEntropy(const uint32_t* argb,
|
||||
*min_entropy_ix = kDirect;
|
||||
for (k = kDirect + 1; k <= last_mode_to_analyze; ++k) {
|
||||
if (entropy[*min_entropy_ix] > entropy[k]) {
|
||||
*min_entropy_ix = k;
|
||||
*min_entropy_ix = (EntropyIx)k;
|
||||
}
|
||||
}
|
||||
*red_and_blue_always_zero = 1;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "./muxi.h"
|
||||
#include "../utils/utils.h"
|
||||
|
||||
#define UNDEFINED_CHUNK_SIZE (-1)
|
||||
#define UNDEFINED_CHUNK_SIZE ((uint32_t)(-1))
|
||||
|
||||
const ChunkInfo kChunks[] = {
|
||||
{ MKFOURCC('V', 'P', '8', 'X'), WEBP_CHUNK_VP8X, VP8X_CHUNK_SIZE },
|
||||
@ -439,7 +439,7 @@ static int IsNotCompatible(int feature, int num_items) {
|
||||
return (feature != 0) != (num_items > 0);
|
||||
}
|
||||
|
||||
#define NO_FLAG 0
|
||||
#define NO_FLAG ((WebPFeatureFlags)0)
|
||||
|
||||
// Test basic constraints:
|
||||
// retrieval, maximum number of chunks by index (use -1 to skip)
|
||||
|
Loading…
Reference in New Issue
Block a user