mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-15 21:39:59 +02:00
Compare commits
6 Commits
fcff86c71b
...
1.2.1
Author | SHA1 | Date | |
---|---|---|---|
67bc8b1c3e | |||
0bc4bb021f | |||
8c7137950b | |||
9b1980bbc6 | |||
a4797af712 | |||
4f18399571 |
@ -83,7 +83,7 @@ static void ApplyAlphaMultiply_NEON(uint8_t* rgba, int alpha_first,
|
|||||||
static int DispatchAlpha_NEON(const uint8_t* WEBP_RESTRICT alpha,
|
static int DispatchAlpha_NEON(const uint8_t* WEBP_RESTRICT alpha,
|
||||||
int alpha_stride, int width, int height,
|
int alpha_stride, int width, int height,
|
||||||
uint8_t* WEBP_RESTRICT dst, int dst_stride) {
|
uint8_t* WEBP_RESTRICT dst, int dst_stride) {
|
||||||
uint32_t alpha_mask = 0xffffffffu;
|
uint32_t alpha_mask = 0xffu;
|
||||||
uint8x8_t mask8 = vdup_n_u8(0xff);
|
uint8x8_t mask8 = vdup_n_u8(0xff);
|
||||||
uint32_t tmp[2];
|
uint32_t tmp[2];
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -107,6 +107,7 @@ static int DispatchAlpha_NEON(const uint8_t* WEBP_RESTRICT alpha,
|
|||||||
dst += dst_stride;
|
dst += dst_stride;
|
||||||
}
|
}
|
||||||
vst1_u8((uint8_t*)tmp, mask8);
|
vst1_u8((uint8_t*)tmp, mask8);
|
||||||
|
alpha_mask *= 0x01010101;
|
||||||
alpha_mask &= tmp[0];
|
alpha_mask &= tmp[0];
|
||||||
alpha_mask &= tmp[1];
|
alpha_mask &= tmp[1];
|
||||||
return (alpha_mask != 0xffffffffu);
|
return (alpha_mask != 0xffffffffu);
|
||||||
@ -135,7 +136,7 @@ static void DispatchAlphaToGreen_NEON(const uint8_t* WEBP_RESTRICT alpha,
|
|||||||
static int ExtractAlpha_NEON(const uint8_t* WEBP_RESTRICT argb, int argb_stride,
|
static int ExtractAlpha_NEON(const uint8_t* WEBP_RESTRICT argb, int argb_stride,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
uint8_t* WEBP_RESTRICT alpha, int alpha_stride) {
|
uint8_t* WEBP_RESTRICT alpha, int alpha_stride) {
|
||||||
uint32_t alpha_mask = 0xffffffffu;
|
uint32_t alpha_mask = 0xffu;
|
||||||
uint8x8_t mask8 = vdup_n_u8(0xff);
|
uint8x8_t mask8 = vdup_n_u8(0xff);
|
||||||
uint32_t tmp[2];
|
uint32_t tmp[2];
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -157,6 +158,7 @@ static int ExtractAlpha_NEON(const uint8_t* WEBP_RESTRICT argb, int argb_stride,
|
|||||||
alpha += alpha_stride;
|
alpha += alpha_stride;
|
||||||
}
|
}
|
||||||
vst1_u8((uint8_t*)tmp, mask8);
|
vst1_u8((uint8_t*)tmp, mask8);
|
||||||
|
alpha_mask *= 0x01010101;
|
||||||
alpha_mask &= tmp[0];
|
alpha_mask &= tmp[0];
|
||||||
alpha_mask &= tmp[1];
|
alpha_mask &= tmp[1];
|
||||||
return (alpha_mask == 0xffffffffu);
|
return (alpha_mask == 0xffffffffu);
|
||||||
|
@ -347,24 +347,24 @@ static void GetCombinedEntropyUnrefined_MIPS32(const uint32_t X[],
|
|||||||
static void AddVector_MIPS32(const uint32_t* pa, const uint32_t* pb,
|
static void AddVector_MIPS32(const uint32_t* pa, const uint32_t* pb,
|
||||||
uint32_t* pout, int size) {
|
uint32_t* pout, int size) {
|
||||||
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||||
const uint32_t end = ((size) / 4) * 4;
|
const int end = ((size) / 4) * 4;
|
||||||
const uint32_t* const LoopEnd = pa + end;
|
const uint32_t* const LoopEnd = pa + end;
|
||||||
int i;
|
int i;
|
||||||
ASM_START
|
ASM_START
|
||||||
ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout)
|
ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout)
|
||||||
ASM_END_0
|
ASM_END_0
|
||||||
for (i = end; i < size; ++i) pout[i] = pa[i] + pb[i];
|
for (i = 0; i < size - end; ++i) pout[i] = pa[i] + pb[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddVectorEq_MIPS32(const uint32_t* pa, uint32_t* pout, int size) {
|
static void AddVectorEq_MIPS32(const uint32_t* pa, uint32_t* pout, int size) {
|
||||||
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||||
const uint32_t end = ((size) / 4) * 4;
|
const int end = ((size) / 4) * 4;
|
||||||
const uint32_t* const LoopEnd = pa + end;
|
const uint32_t* const LoopEnd = pa + end;
|
||||||
int i;
|
int i;
|
||||||
ASM_START
|
ASM_START
|
||||||
ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout)
|
ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout)
|
||||||
ASM_END_1
|
ASM_END_1
|
||||||
for (i = end; i < size; ++i) pout[i] += pa[i];
|
for (i = 0; i < size - end; ++i) pout[i] += pa[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef ASM_END_1
|
#undef ASM_END_1
|
||||||
|
@ -577,7 +577,7 @@ static int BackwardReferencesHashChainDistanceOnly(
|
|||||||
(CostModel*)WebPSafeCalloc(1ULL, cost_model_size);
|
(CostModel*)WebPSafeCalloc(1ULL, cost_model_size);
|
||||||
VP8LColorCache hashers;
|
VP8LColorCache hashers;
|
||||||
CostManager* cost_manager =
|
CostManager* cost_manager =
|
||||||
(CostManager*)WebPSafeMalloc(1ULL, sizeof(*cost_manager));
|
(CostManager*)WebPSafeCalloc(1ULL, sizeof(*cost_manager));
|
||||||
int offset_prev = -1, len_prev = -1;
|
int offset_prev = -1, len_prev = -1;
|
||||||
double offset_cost = -1;
|
double offset_cost = -1;
|
||||||
int first_offset_is_constant = -1; // initialized with 'impossible' value
|
int first_offset_is_constant = -1; // initialized with 'impossible' value
|
||||||
|
@ -976,15 +976,16 @@ static int GetBackwardReferences(int width, int height,
|
|||||||
const VP8LHashChain* const hash_chain_tmp =
|
const VP8LHashChain* const hash_chain_tmp =
|
||||||
(lz77_types_best[i] == kLZ77Standard) ? hash_chain : &hash_chain_box;
|
(lz77_types_best[i] == kLZ77Standard) ? hash_chain : &hash_chain_box;
|
||||||
const int cache_bits = (i == 1) ? 0 : *cache_bits_best;
|
const int cache_bits = (i == 1) ? 0 : *cache_bits_best;
|
||||||
if (VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits,
|
double bit_cost_trace;
|
||||||
hash_chain_tmp, &refs[i],
|
if (!VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits,
|
||||||
refs_tmp)) {
|
hash_chain_tmp, &refs[i],
|
||||||
double bit_cost_trace;
|
refs_tmp)) {
|
||||||
VP8LHistogramCreate(histo, refs_tmp, cache_bits);
|
goto Error;
|
||||||
bit_cost_trace = VP8LHistogramEstimateBits(histo);
|
}
|
||||||
if (bit_cost_trace < bit_costs_best[i]) {
|
VP8LHistogramCreate(histo, refs_tmp, cache_bits);
|
||||||
BackwardRefsSwap(refs_tmp, &refs[i]);
|
bit_cost_trace = VP8LHistogramEstimateBits(histo);
|
||||||
}
|
if (bit_cost_trace < bit_costs_best[i]) {
|
||||||
|
BackwardRefsSwap(refs_tmp, &refs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1912,11 +1912,16 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
|
|||||||
const WebPWorkerInterface* const worker_interface = WebPGetWorkerInterface();
|
const WebPWorkerInterface* const worker_interface = WebPGetWorkerInterface();
|
||||||
int ok_main;
|
int ok_main;
|
||||||
|
|
||||||
|
if (enc_main == NULL || !VP8LBitWriterInit(&bw_side, 0)) {
|
||||||
|
WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
|
||||||
|
VP8LEncoderDelete(enc_main);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Analyze image (entropy, num_palettes etc)
|
// Analyze image (entropy, num_palettes etc)
|
||||||
if (enc_main == NULL ||
|
if (!EncoderAnalyze(enc_main, crunch_configs, &num_crunch_configs_main,
|
||||||
!EncoderAnalyze(enc_main, crunch_configs, &num_crunch_configs_main,
|
|
||||||
&red_and_blue_always_zero) ||
|
&red_and_blue_always_zero) ||
|
||||||
!EncoderInit(enc_main) || !VP8LBitWriterInit(&bw_side, 0)) {
|
!EncoderInit(enc_main)) {
|
||||||
err = VP8_ENC_ERROR_OUT_OF_MEMORY;
|
err = VP8_ENC_ERROR_OUT_OF_MEMORY;
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user