mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-28 06:38:20 +01:00
MIPS: dspr2: add some specific mips code to commit I2c3f2b12f8df15b785fad5a9c56316e954ae0c53
added some C-code tuning also Change-Id: I67ce70a063ef6b5821b9158a4defd6987eccbb9a
This commit is contained in:
parent
e564062522
commit
80b8099fd8
@ -758,7 +758,6 @@ static WEBP_INLINE uint32_t Rotate8b(uint32_t V) {
|
|||||||
static WEBP_INLINE void CopySmallPattern(const uint8_t* data_src,
|
static WEBP_INLINE void CopySmallPattern(const uint8_t* data_src,
|
||||||
uint8_t* data_dst,
|
uint8_t* data_dst,
|
||||||
int length, uint32_t pattern) {
|
int length, uint32_t pattern) {
|
||||||
int ilength = length;
|
|
||||||
uint32_t* pdata;
|
uint32_t* pdata;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -768,17 +767,16 @@ static WEBP_INLINE void CopySmallPattern(const uint8_t* data_src,
|
|||||||
pattern = Rotate8b(pattern);
|
pattern = Rotate8b(pattern);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
ilength -= j;
|
length -= j;
|
||||||
data_src += j;
|
data_src += j;
|
||||||
// Copy the pattern 4 bytes at a time.
|
// Copy the pattern 4 bytes at a time.
|
||||||
pdata = (uint32_t*)data_dst;
|
pdata = (uint32_t*)data_dst;
|
||||||
for (i = 0; i < (ilength >> 2); ++i) {
|
for (i = 0; i < (length >> 2); ++i) {
|
||||||
pdata[i] = pattern;
|
pdata[i] = pattern;
|
||||||
}
|
}
|
||||||
// Finish with left-overs. 'pattern' is still correctly positioned,
|
// Finish with left-overs. 'pattern' is still correctly positioned,
|
||||||
// so no Rotate8b() call is needed.
|
// so no Rotate8b() call is needed.
|
||||||
data_dst = (uint8_t*)pdata;
|
for (i <<= 2; i < length; ++i) {
|
||||||
for (i <<= 2; i < ilength; ++i) {
|
|
||||||
data_dst[i] = data_src[i];
|
data_dst[i] = data_src[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -793,6 +791,8 @@ static WEBP_INLINE void CopyBlock(uint8_t* data_dst, int dist, int length) {
|
|||||||
#if defined(__arm__) || defined(_M_ARM) // arm doesn't like multiply that much
|
#if defined(__arm__) || defined(_M_ARM) // arm doesn't like multiply that much
|
||||||
pattern |= pattern << 8;
|
pattern |= pattern << 8;
|
||||||
pattern |= pattern << 16;
|
pattern |= pattern << 16;
|
||||||
|
#elif defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
|
__asm__ volatile ("replv.qb %0, %0" : "+r"(pattern));
|
||||||
#else
|
#else
|
||||||
pattern = 0x01010101u * pattern;
|
pattern = 0x01010101u * pattern;
|
||||||
#endif
|
#endif
|
||||||
@ -801,6 +801,8 @@ static WEBP_INLINE void CopyBlock(uint8_t* data_dst, int dist, int length) {
|
|||||||
pattern = *(const uint16_t*)data_src;
|
pattern = *(const uint16_t*)data_src;
|
||||||
#if defined(__arm__) || defined(_M_ARM)
|
#if defined(__arm__) || defined(_M_ARM)
|
||||||
pattern |= pattern << 16;
|
pattern |= pattern << 16;
|
||||||
|
#elif defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
|
__asm__ volatile ("replv.ph %0, %0" : "+r"(pattern));
|
||||||
#else
|
#else
|
||||||
pattern = 0x00010001u * pattern;
|
pattern = 0x00010001u * pattern;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user