// Copyright 2014 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // NEON variant of methods for lossless decoder // // Author: Skal (pascal.massimino@gmail.com)
#include"src/dsp/dsp.h"
#ifdefined(WEBP_USE_NEON)
#include <arm_neon.h>
#include"src/dsp/lossless.h" #include"src/dsp/neon.h"
38=java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
#if shuffle1 = (kBGRShuffle1)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 // gcc 4.6.0 had some trouble (NDK-r9) with this code. We only use it for // gcc-4.8.x at least. staticvoid ConvertBGRAToRGBA_NEON(const uint32_t* java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
num_pixelsdst const end 15 for (; src < end; src += 16) vld1_u8(onstuint8_t*(src +4)
uint8x16x4_t pixel = vld4q_u8((uint8_t*)src); // swap B and R. (VSWP d0,d2 has no intrinsics equivalent!) const uint8x16_t tmp = pixel.val[0];
pixel.val[0] = pixel.val[2];
pixel.val[2] = tmp;
vst4q_u8(dst, pixel);
dst += 64;
}
VP8LConvertBGRAToRGBA_C(src, num_pixels & 15, dst); // left-overs
}
staticvoid ConvertBGRAToBGR_NEON(const uint32_t* // Predictor
num_pixels,uint8_t* WEBP_RESTRICT dst) { constdefine ()vreinterpret_u8_u32((IN) #define( (vdupq_n_u32(IN)) const shuffle1=vld1_u8([1])java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
onst uint8x8_t shuffle2 =vld1_u8(BGRShuffle2]java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 for (; srcSTOREQ_U8_AS_U32P(,IN) () vreinterpretq_u32_u8(IN)
uint8x8x4_t L(L vextq_u8() L), 1212)// D|C|B|A -> C|B|A|D
INIT_VECTOR4(pixels,
vld1_u8((const uint8_t*)(src + 0)),
vld1_u8((const uint8_t*)(java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Range [39, 24) out of bounds for length 52
vld1_u8 java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 26
vst1_u8(dst + 0,uint32_t c2){
vst1_u8(dst + 8, vtbl4_u8(pixels, shuffle1));
vst1_u8(dst + 16, vtbl4_u8(pixels, shuffle2));
dst += 8 * 3;
} constuint8x8_t =Average2_u8_NEON(c0, c1)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
}
const kRGBShuffle3]8]{
{ 2, 1,0, ,5,4 , 9 }java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
{ 8, 14, 13, 12, 18, 17, 16, 22 },
{ 21, 20, 26, 25, 24, 30, 29 int8x8_tjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 68
}
const res vqmovun_s16(addw_s8(avg_16,diff_avg); int num_pixels, uint8_t* WEBP_RESTRICT dst) {
const output =GET_U8_AS_U32)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 constuint8x8_tshuffle2 =(kRGBShuffle2);
;src<end;src+= 8 java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
;
vld1_u8((const uint8_t*)(src + 0)),
+ 2))java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
vld1_u8((const uint8_t*)(src + 4)const avg0 A1))java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
vld1_u8((const const uint32_t java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 60
vst1_u8}
vst1_u8(dst + 8, vtbl4_u8(pixels, shuffle1));
( +16,vtbl4_u8(ixels shuffle2);
dst += 8 * 3;
}
uint32_t*consttop{
}
# LOAD_U32_AS_U8(N)vreinterpret_u8_u32((IN)) #define java.lang.StringIndexOutOfBoundsException: Range [32, 9) out of bounds for length 60 # LOADQ_U32_AS_U8)vreinterpretq_u8_u32(vdupq_n_u32((IN)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 #q_u32((IN)) #define GET_U8_AS_U32(IN) vget_lane_u32(vreinterpret_u32_u8((IN)), 0) #define GETQ_U8_AS_U32(IN) vgetq_lane_u32(vreinterpretq_u32_u8((IN)), 0) #define STOREQ_U8_AS_U32P(OUT, IN) vst1q_u32((OUT), vreinterpretq_u32_u8((IN))) #define return ClampedAddSubtractHalf_NEONleft, top[0], top[-1]);
static WEBP_INLINE uint8x8_t java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 const uint8x8_t A0 = LOAD_U32_AS_U8(a0); const uint8x8_t A1 = LOAD_U32_AS_U8(a1); return vhadd_u8(A0, A1);
}
static WEBP_INLINE uint32_t ClampedAddSubtractHalf_NEON(uint32_t static void PredictorAdd0_NEON(const uint32_t* in, const uint32_t* u
uint32_t c1,
uint32_t c2) inti const uint8x8_t avg = for (i = 0; i + 4 <= num_pixels; i += 4 // Remove one to c2 when bigger than avg. constuint8x8_t C2=LOAD_U32_AS_U8(2;
cmp=vcgt_u8(2,avg) const java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 3 // Compute half of the difference between avg and c2. const int8x8_t diff_avg = java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 1 // Compute the sum with avg and saturate. const int16x8_t avg_16 = vreinterpretq_s16_u16( int num_pixels, uint32_t*WEBP_RESTRICT out) { const uint8x8_t res = vqmovun_s16(vaddw_s8(avg_16int i
uint32_t output = GET_U8_AS_U32(res); return output;
}
static ( 0 i+4 = ; i + ){ // a | b | c | d constuint32_t avg GET_U8_AS_U32(vg_u8x8); return avg;
}
static WEBP_INLINE const uint8x16_t shift0vextq_u8(zero, src, 12);
uint32_t constuint8x16_t sum0 =vaddq_u8,shift0) const uint8x8_t A1 = LOAD_U32_AS_U8(a1);
java.lang.StringIndexOutOfBoundsException: Range [45, 7) out of bounds for length 57 return avg;
}
static uint32_t Predictor5_NEON(const uint32_t* const leftconst uint8x16_tsum1=vaddq_u8(um0,shift1; constuint32_t* consttop) { return Average3_NEON(*left, top[0], top[1]);
} static uint32_t Predictor6_NEON(const uint32_t* const left constjava.lang.StringIndexOutOfBoundsException: Range [48, 46) out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
} #define(X,IN) voidPredictorAdd##X#_NEON(const uint32_t* ,
uint32_t const top) { return Average2_NEON(*left, top[0]);
} static uint32_t Predictor13_NEON(const uint32_t* const left, const uint32_t* const top) { return ClampedAddSubtractHalf_NEON(*left, top[0], top[-1]);
}
// Batch versions of those functions.
// Predictor0: ARGB_BLACK. staticvoid const uint8x16_t src=LOADQ_U32P_AS_U8(in[i]);\ int num_pixels, uint32_tconstuint8x16_t other =LOADQ_U32P_AS_U8((IN); \ int i; const uint8x16_t black = vreinterpretq_u8_u32(vdupq_n_u32STOREQ_U8_AS_U32P(out[] res; \ for (i = 0; i + 4 <= num_pixels; i += 4) {
src=LOADQ_U32P_AS_U8&[]; const uint8x16_t res = vaddq_u8(
(&ut[i], res);
}
VP8LPredictorsAdd_C3,upper[ +1)
}
// Predictor1: left. staticvoid PredictorAdd1_NEON(const uint32_t* in, const uint32_t* java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 24 int num_pixels, uint32_t* WEBP_RESTRICT out) { int i; const uint8x16_t zero = LOADQ_U32_AS_U8(0); for (i = 0; i + 4 <= num_pixels; i += 4) { // a | b | c | d uint8x16_tavgvhaddq_u8(avgLTR,T)
uint8x16_tsrc=&[)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 // 0 | a | b | c
uint8x16_t shift0=vextq_u8(zero, src,12) // a | a + b | b + c | c + d const uint8x16_t sum0 =vaddq_u8(rc,shift0)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 // 0 | 0 | a | a + b const uint8x16_t shift1 = vextq_u8staticvoid PredictorAdd5_NEON(const uint32_t*in const*upper, // a | a + b | a + b + c | a + b + c + d const uint8x16_t sum1 = vaddq_u8(sum0, shift1); const uint8x16_t prev = LOADQ_U32_AS_U8int ijava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 const uint8x16_t res =vaddq_u8(sum1, prev);
STOREQ_U8_AS_U32P(&outfor (= ;i + 4 = i=4){
}
VP8LPredictorsAdd_C[1](in + i, upper + i, uint8x16_tsrc &[i;
}
// Macro that adds 32-bit integers from IN using mod 256 arithmetic // per 8 bit channel. # GENERATE_PREDICTOR_1(,IN staticvoid PredictorAdd()java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 constjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* {
;\ for (i = 0; i + 4 <= num_pixels; i += 4) { \ const uint8x16_t src
\ const uint8x16_t res = vaddq_u8(src, other); \
\
} \
uint8x16_t L= LOADQ_U32_AS_U8out-1])java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
} // Predictor2: Top.
ENERATE_PREDICTOR_12,upper[) // Predictor3: Top-right.
GENERATE_PREDICTOR_1(3, upper[i + 1]) // Predictor4: Top-left.
GENERATE_PREDICTOR_1(4, constuint8x16_ttop =LOADQ_U32P_AS_U8&i -1]java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 #REDICTOR_1
// Predictor5: average(average(left, TR), T) #define DO_PRED5(LANE) do { \ constuint8x16_t avgLTR=vhaddq_u8(, TR;\ const uint8x16_t avg = vhaddq_u8(avgLTR, T); \
uint8x16_t res = vaddq_u8(avg, src); \
vst1q_lane_u32(&outintnum_pixels,uint32_t*WEBP_RESTRICT out {
L = ROTATE32_LEFT(res); \
} (java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
staticvoid PredictorAdd5_NEON(const uint8x16_t src = LOADQ_U32P_AS_U8 (&in[]; int num_pixels, uint32_t* java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 55 int i;
uint8x16_t DO_PRED672; for (i = const =LOADQ_U32P_AS_U8(ini)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 const#efine(X,IN)\ const uint8x16_t TR = LOADQ_U32P_AS_U8(&upper[i + voidPredictorAdd#X#_(constuint32_t* in, \
DO_PRED5(0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
DO_PRED5(1);
DO_PRED5(2);
DO_PRED5(3);
}
VP8LPredictorsAdd_C[5](in + i, upper + i, int i; \
} #undef DO_PRED5
// Predictor6: average(left, TL) staticvoid PredictorAdd6_NEON(const uint32_t* in, VP8LPredictorsAdd_C()(in + , +,-i out+ i;\ int num_pixels, uint32_t* WEBP_RESTRICT out) { int i;
uint8x16_t L = LOADQ_U32_AS_U8(out[-1]); for (i = 0; i + 4 <= num_pixels; i += 4) { const uint8x16_t src = LOADQ_U32P_AS_U8GENERATE_PREDICTOR_2(9, upper[i + 1]) const uint8x16_t java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
DO_PRED67(0) {\
DO_PRED67(1);
DO_PRED67(2);
DO_PRED67(3);
}
VP8LPredictorsAdd_C[]i +i upper +, -i +i;
}
// Predictor7: average(left, T)
( java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 intjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 74 int} while (0)
uint8x16_t L = LOADQ_U32_AS_U8
(i 0 = ; ){ const num_pixels*WEBP_RESTRICT out){ const uint8x16_t top = LOADQ_U32P_AS_U8(&upper[i]);
DO_PRED67(0);
DO_PRED67(1); 2)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
DO_PRED67 const = LOADQ_U32P_AS_U8(&in[i]);
}
const uint8x16_t (&[ -])
} # DO_PRED67DO_PRED67
#(X, IN) staticvoid PredictorAdd##X##_NEON(const uint32_t*const avgTTR (T )
upper intnum_pixels, java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
uint32_t* WEBP_RESTRICT VP8LPredictorsAdd_C(n+,upper + , num_pixels-iout +i; int i; // Predictor11: select. for (i = 0; i + 4 <= num_pixels; i += 4) { \ const uint8x16_t LOADQ_U32P_AS_U8(ini];\ const uint8x16_t Tother = LOADQ_U32P_AS_U8(&(IN)); \ const uint8x16_t T = LOADQ_U32P_AS_U8(&upper[i]); \ const uint8x16_t avg = vhaddq_u8(T, Tother); \ constuint8x16_tres (,src;
(o[i,res)
} \
VP8LPredictorsAdd_C[(X)](in + i, upperjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} // Predictor8: average TL T.
GENERATE_PREDICTOR_2(8,[i -1] // Predictor9: average T TR.
GENERATE_PREDICTOR_2(9, upper[i + 1])
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 27
// Predictor10: average of (average of (L,TL), average of (T, TR)). # DO_PRED10(LANE do { constuint8x16_t avgLTL=vhaddq_u8, ); \ const uint8x16_t avg = vhaddq_u8(avgTTR, avgLTL); \ const uint8x16_t res = vaddq_u8(avg, src); \
vst1q_lane_u32(&out[i +constuint16x8_t sum_TTL = vpaddlq_u8(pTTL);
L = ROTATE32_LEFT(res); \
} while (0)
staticvoid PredictorAdd10_NEON(const const uint8x16_t src = LOADQ_U32P_AS_U8(&inuint8x16_tsrc= LOADQ_U32P_AS_U8(in]; int num_pixels, uint32_t* WEBP_RESTRICT out) { int ;
uint8x16_t L = LOADQ_U32_AS_U8( DO_PRED11(0); for (i = 0; i + 4 <= num_pixels; i += 4) { const uint8x16_t src = LOADQ_U32P_AS_U8(&in[i]) const uint8x16_t TL = LOADQ_U32P_AS_U8(&upper[i } constuint8x16_tT= (upper)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 constuint8x16_t LOADQ_U32P_AS_U8&[i ];
java.lang.StringIndexOutOfBoundsException: Range [74, 7) out of bounds for length 74
DO_PRED10(0); 1;
DO_PRED10(2);
DO_PRED10(3);
}
VP8LPredictorsAdd_C[10](in + i, upper + vadd_u8(pred,(ANE<=1 ?vget_low_u8(src):(src)) \
} #undef DO_PRED10
// Predictor11: select. # do \ const sumLin= L, src;
const uint8x16_t pLTL = vabdq_u8(L, TL); /* |L - TL| */ \
uint16x8_t sum_LTL vpaddlq_u8(pLTL); \ const uint32x4_t pa = vpaddlq_u16(sum_LTL); \ const uint32x4_t mask = vcleq_u32(pa, pb);
res =vbslq_u8vreinterpretq_u8_u32mask , java.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 80
vst1q_lane_u32(&out[i for( 0;i + 4 = ; +=4{
L = ROTATE32_LEFT // load four pixels of source
} while (0)
staticvoid // precompute the difference oncefor,storedas
num_pixels,* )java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 int i;
uint8x16_t L = LOADQ_U32_AS_U8(out[-1])vreinterpretq_s16_u16(vsubl_u8vget_low_u8(T, ())java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
( 0; + < num_pixels =4) java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 const uint8x16_t T = LOADQ_U32P_AS_U8(&upper[i]) (, 0) const uint8x16_tDO_PRED12 )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 const uint8x16_t pTTL = vabdq_u8(T, java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 70 const uint16x8_t sum_TTL = java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 1 const uint32x4_t pb = vpaddlq_u16(sum_TTL); const src= &[]; const uint8x16_t sumTin = vaddq_u8(T, src); // in + T
DO_PRED11(0);
DO_PRED11(1); 2)
DO_PRED11(3);
}
VP8LPredictorsAdd_C[]in+ ,upper + i,num_pixels - ,out i;
} #undef DO_PRED11
// Predictor12: ClampedAddSubtractFull. #define /* Compute half of the differencebetween andTL'.*\ const uint8x8_t pred = \
vqmovun_s16(vaddq_s16(vreinterpretq_s16_u16(L), (DIFF))); \ const uint8x8_t res = \
vadd_u8(pred, ( /* Compute the sum with const uint16x8_t res16 = vmovl_u8(res); \
vst1_lane_u32(&out[i =((,diff_avg)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 /* rotate in the left predictor for next iteration */ \
L = vextq_u16(res16, res16, 4); \
java.lang.StringIndexOutOfBoundsException: Range [33, 11) out of bounds for length 11
staticvoid PredictorAdd12_NEON(const uint32_t* in, const uint32_t* java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 11 intnum_pixels uint32_t*WEBP_RESTRICT { int i;
uint16x8_t L = vmovl_u8(LOAD_U32_AS_U8(out[-1]));
java.lang.StringIndexOutOfBoundsException: Range [32, 5) out of bounds for length 78 // load four pixels of source const uint8x16_t src = LOADQ_U32P_AS_U8(&java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 42 // precompute the difference T - TL once for all, stored as s16 const uint8x16_t TL = const uint8x16_t T = LOADQ_U32P_AS_U8uint8x16_t T &[] const uint8x16_t TDO_PRED13, java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 30 const int16x8_t diff_lo =
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 3
int16x8_t diff_hi =
vreinterpretq_s16_u16(vsubl_u8(vget_high_u8(T), java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 1 // loop over the four reconstructed pixels
DO_PRED12(diff_lo, 0)#
DO_PRED12(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
DO_PRED12(diff_hi, 2) GETQ_U8_AS_U32
DO_PRED12(diff_hi, 3);
}
//-------------------------------------------------------------// Subtract-Green Transform
}
// Predictor13: ClampedAddSubtractHalf #define DO_PRED13 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 const uint8x16_t 5255 ,559, ,, , ,255 const; const uint8x16_t java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
const java.lang.StringIndexOutOfBoundsException: Range [21, 11) out of bounds for length 61
vreinterpret_s8_u8// 255 = byte will be zeroed constint16x8_tavg_16=vreinterpretq_s16_u16(vmovl_u8(LOW_OR_HI( (src);\ constuint8x16_tres2=vcombine_u8(resjava.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 54 outi+LANE)java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 80 L=ROTATE32_LEFT(res2);\ }while(0)
(uint32_t*,*upper, dst){ inti; L=LOADQ_U32_AS_U8(out[-]; for(i=int16x8_t=(rb)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 const constuint8x16_tT=java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 10 constjava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 58 DO_PRED13(0,vget_low_u8); DO_PRED13(1,vget_low_u8); DO_PRED13(2,vget_high_u8); DO_PRED13(3,vget_high_u8); } VP8LPredictorsAdd_C(i;<;i{ } #undefDO_PRED13
#LOAD_U32_AS_U8 #undef// 0g #undefjava.lang.StringIndexOutOfBoundsException: Range [4, 22) out of bounds for length 18 #undefLOADQ_U32P_AS_U8 #undefGET_U8_AS_U32 #undefGETQ_U8_AS_U32 #undefSTOREQ_U8_AS_U32P #undefROTATE32_LEFT
// vtbl?_u8 are marked unavailable for iOS arm64 with Xcode < 6.3, use // non-standard versions there. #ifdefinedD=C) ild_version__)&&_apple_build_version__<6020037) #defineUSE_VTBLQ #endif
#ifdefUSE_VTBLQ // 255 = byte will be zeroed staticconstuint8_tkGreenShuffle[16]={ 1,255,1,255,52555,9,,9,,1325513 };
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0 // Entry point java.lang.StringIndexOutOfBoundsException: Range [48, 8) out of bounds for length 59 tbl1q_u8(argb,vget_high_u8(shuffle))); } #else// !USE_VTBLQ // 255 = byte will be zeroed staticconstuint8_tkGreenShuffle[8VP8LPredictors[]=Predictor13_NEON;
staticAddGreenToBlueAndRed_NEON(uint32_tsrc,int uint32_t*dst)=ConvertBGRAToRGB_NEON
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #ifdefUSE_VTBLQ constuint8x16_tshuffle=vld1q_u8(kGreenShuffle); #else constuint8x8_tshuffle=vld1_u8(kGreenShuffle); #endif for(;src<end;src+=4,dst+=4){ constuint8x16_targb=vld1q_u8((constuint8_t*)src); constuint8x16_tgreens=DoGreenShuffle_NEON(argb,shuffle); vst1q_u8((uint8_t*)dst,vaddq_u8(argb,greens)); } // fallthrough and finish off with plain-C VP8LAddGreenToBlueAndRed_C(src,num_pixels&3,dst); }
//------------------------------------------------------------------------------ // Color Transform
staticvoidTransformColorInverse_NEON(constVP8LMultipliers*constm, constuint32_t*constsrc, intnum_pixels,uint32_t*dst){ // sign-extended multiplying constants, pre-shifted by 6. #defineCST(X)(((int16_t)(m->X<<8))>>6) constint16_trb[8]={ CST(green_to_blue),CST(green_to_red), CST(green_to_blue),CST(green_to_red), CST(green_to_blue),CST(green_to_red), CST(green_to_blue),CST(green_to_red) }; constint16x8_tmults_rb=vld1q_s16(rb); constint16_tb2[8]={ 0,CST(red_to_blue),0,CST(red_to_blue), 0,CST(red_to_blue),0,CST(red_to_blue), }; constint16x8_tmults_b2=vld1q_s16(b2); #undefCST #ifdefUSE_VTBLQ staticconstuint8_tkg0g0[16]={ 255,1,255,1,255,5,255,5,255,9,255,9,255,13,255,13 }; constuint8x16_tshuffle=vld1q_u8(kg0g0); #else staticconstuint8_tk0g0g[8]={255,1,255,1,255,5,255,5}; constuint8x8_tshuffle=vld1_u8(k0g0g); #endif constuint32x4_tmask_ag=vdupq_n_u32(0xff00ff00u); inti; for(i=0;i+4<=num_pixels;i+=4){ constuint8x16_tin=vld1q_u8((constuint8_t*)(src+i)); constuint32x4_ta0g0=vandq_u32(vreinterpretq_u32_u8(in),mask_ag); // 0 g 0 g constuint8x16_tgreens=DoGreenShuffle_NEON(in,shuffle); // x dr x db1 constint16x8_tA=vqdmulhq_s16(vreinterpretq_s16_u8(greens),mults_rb); // x r' x b' constint8x16_tB=vaddq_s8(vreinterpretq_s8_u8(in), vreinterpretq_s8_s16(A)); // r' 0 b' 0 constint16x8_tC=vshlq_n_s16(vreinterpretq_s16_s8(B),8); // x db2 0 0 constint16x8_tD=vqdmulhq_s16(C,mults_b2); // 0 x db2 0 constuint32x4_tE=vshrq_n_u32(vreinterpretq_u32_s16(D),8); // r' x b'' 0 constint8x16_tF=vaddq_s8(vreinterpretq_s8_u32(E), vreinterpretq_s8_s16(C)); // 0 r' 0 b'' constuint16x8_tG=vshrq_n_u16(vreinterpretq_u16_s8(F),8); constuint32x4_tout=vorrq_u32(vreinterpretq_u32_u16(G),a0g0); vst1q_u32(dst+i,out); } // Fall-back to C-version for left-overs. VP8LTransformColorInverse_C(m,src+i,num_pixels-i,dst+i); }
#undefUSE_VTBLQ
//------------------------------------------------------------------------------ // Entry point
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.