mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Merge "lossless_neon: use vcreate_*() where appropriate"
This commit is contained in:
commit
57897bae09
@ -143,22 +143,20 @@ static void ConvertBGRAToRGB(const uint32_t* src,
|
||||
|
||||
static WEBP_INLINE uint32_t Average2(const uint32_t* const a,
|
||||
const uint32_t* const b) {
|
||||
const uint64x1_t a0 = { *a }, b0 = { *b };
|
||||
const uint8x8_t a1 = vreinterpret_u8_u64(a0);
|
||||
const uint8x8_t b1 = vreinterpret_u8_u64(b0);
|
||||
const uint8x8_t avg = vhadd_u8(a1, b1);
|
||||
const uint8x8_t a0 = vreinterpret_u8_u64(vcreate_u64(*a));
|
||||
const uint8x8_t b0 = vreinterpret_u8_u64(vcreate_u64(*b));
|
||||
const uint8x8_t avg = vhadd_u8(a0, b0);
|
||||
return vget_lane_u32(vreinterpret_u32_u8(avg), 0);
|
||||
}
|
||||
|
||||
static WEBP_INLINE uint32_t Average3(const uint32_t* const a,
|
||||
const uint32_t* const b,
|
||||
const uint32_t* const c) {
|
||||
const uint64x1_t a0 = { *a }, b0 = { *b }, c0 = { *c };
|
||||
const uint8x8_t a1 = vreinterpret_u8_u64(a0);
|
||||
const uint8x8_t b1 = vreinterpret_u8_u64(b0);
|
||||
const uint8x8_t c1 = vreinterpret_u8_u64(c0);
|
||||
const uint8x8_t avg1 = vhadd_u8(a1, c1);
|
||||
const uint8x8_t avg2 = vhadd_u8(avg1, b1);
|
||||
const uint8x8_t a0 = vreinterpret_u8_u64(vcreate_u64(*a));
|
||||
const uint8x8_t b0 = vreinterpret_u8_u64(vcreate_u64(*b));
|
||||
const uint8x8_t c0 = vreinterpret_u8_u64(vcreate_u64(*c));
|
||||
const uint8x8_t avg1 = vhadd_u8(a0, c0);
|
||||
const uint8x8_t avg2 = vhadd_u8(avg1, b0);
|
||||
return vget_lane_u32(vreinterpret_u32_u8(avg2), 0);
|
||||
}
|
||||
|
||||
@ -166,13 +164,12 @@ static WEBP_INLINE uint32_t Average4(const uint32_t* const a,
|
||||
const uint32_t* const b,
|
||||
const uint32_t* const c,
|
||||
const uint32_t* const d) {
|
||||
const uint64x1_t a0 = { *a }, b0 = { *b }, c0 = { *c }, d0 = { *d };
|
||||
const uint8x8_t a1 = vreinterpret_u8_u64(a0);
|
||||
const uint8x8_t b1 = vreinterpret_u8_u64(b0);
|
||||
const uint8x8_t c1 = vreinterpret_u8_u64(c0);
|
||||
const uint8x8_t d1 = vreinterpret_u8_u64(d0);
|
||||
const uint8x8_t avg1 = vhadd_u8(a1, b1);
|
||||
const uint8x8_t avg2 = vhadd_u8(c1, d1);
|
||||
const uint8x8_t a0 = vreinterpret_u8_u64(vcreate_u64(*a));
|
||||
const uint8x8_t b0 = vreinterpret_u8_u64(vcreate_u64(*b));
|
||||
const uint8x8_t c0 = vreinterpret_u8_u64(vcreate_u64(*c));
|
||||
const uint8x8_t d0 = vreinterpret_u8_u64(vcreate_u64(*d));
|
||||
const uint8x8_t avg1 = vhadd_u8(a0, b0);
|
||||
const uint8x8_t avg2 = vhadd_u8(c0, d0);
|
||||
const uint8x8_t avg3 = vhadd_u8(avg1, avg2);
|
||||
return vget_lane_u32(vreinterpret_u32_u8(avg3), 0);
|
||||
}
|
||||
@ -208,10 +205,9 @@ static uint32_t Predictor10(uint32_t left, const uint32_t* const top) {
|
||||
static WEBP_INLINE uint32_t Select(const uint32_t* const c0,
|
||||
const uint32_t* const c1,
|
||||
const uint32_t* const c2) {
|
||||
const uint64x1_t C0 = { *c0 }, C1 = { *c1 }, C2 = { *c2 };
|
||||
const uint8x8_t p0 = vreinterpret_u8_u64(C0);
|
||||
const uint8x8_t p1 = vreinterpret_u8_u64(C1);
|
||||
const uint8x8_t p2 = vreinterpret_u8_u64(C2);
|
||||
const uint8x8_t p0 = vreinterpret_u8_u64(vcreate_u64(*c0));
|
||||
const uint8x8_t p1 = vreinterpret_u8_u64(vcreate_u64(*c1));
|
||||
const uint8x8_t p2 = vreinterpret_u8_u64(vcreate_u64(*c2));
|
||||
const uint8x8_t bc = vabd_u8(p1, p2); // |b-c|
|
||||
const uint8x8_t ac = vabd_u8(p0, p2); // |a-c|
|
||||
const int16x4_t sum_bc = vreinterpret_s16_u16(vpaddl_u8(bc));
|
||||
@ -228,10 +224,9 @@ static uint32_t Predictor11(uint32_t left, const uint32_t* const top) {
|
||||
static WEBP_INLINE uint32_t ClampedAddSubtractFull(const uint32_t* const c0,
|
||||
const uint32_t* const c1,
|
||||
const uint32_t* const c2) {
|
||||
const uint64x1_t C0 = { *c0 }, C1 = { *c1 }, C2 = { *c2 };
|
||||
const uint8x8_t p0 = vreinterpret_u8_u64(C0);
|
||||
const uint8x8_t p1 = vreinterpret_u8_u64(C1);
|
||||
const uint8x8_t p2 = vreinterpret_u8_u64(C2);
|
||||
const uint8x8_t p0 = vreinterpret_u8_u64(vcreate_u64(*c0));
|
||||
const uint8x8_t p1 = vreinterpret_u8_u64(vcreate_u64(*c1));
|
||||
const uint8x8_t p2 = vreinterpret_u8_u64(vcreate_u64(*c2));
|
||||
const uint16x8_t sum0 = vaddl_u8(p0, p1); // add and widen
|
||||
const uint16x8_t sum1 = vqsubq_u16(sum0, vmovl_u8(p2)); // widen and subtract
|
||||
const uint8x8_t out = vqmovn_u16(sum1); // narrow and clamp
|
||||
@ -245,10 +240,9 @@ static uint32_t Predictor12(uint32_t left, const uint32_t* const top) {
|
||||
static WEBP_INLINE uint32_t ClampedAddSubtractHalf(const uint32_t* const c0,
|
||||
const uint32_t* const c1,
|
||||
const uint32_t* const c2) {
|
||||
const uint64x1_t C0 = { *c0 }, C1 = { *c1 }, C2 = { *c2 };
|
||||
const uint8x8_t p0 = vreinterpret_u8_u64(C0);
|
||||
const uint8x8_t p1 = vreinterpret_u8_u64(C1);
|
||||
const uint8x8_t p2 = vreinterpret_u8_u64(C2);
|
||||
const uint8x8_t p0 = vreinterpret_u8_u64(vcreate_u64(*c0));
|
||||
const uint8x8_t p1 = vreinterpret_u8_u64(vcreate_u64(*c1));
|
||||
const uint8x8_t p2 = vreinterpret_u8_u64(vcreate_u64(*c2));
|
||||
const uint8x8_t avg = vhadd_u8(p0, p1); // Average(c0,c1)
|
||||
const uint8x8_t ab = vshr_n_u8(vqsub_u8(avg, p2), 1); // (a-b)>>1 saturated
|
||||
const uint8x8_t ba = vshr_n_u8(vqsub_u8(p2, avg), 1); // (b-a)>>1 saturated
|
||||
|
Loading…
Reference in New Issue
Block a user