IMAGE: Inline two simple indeo functions

This commit is contained in:
Willem Jan Palenstijn 2017-07-11 01:31:23 +02:00
parent 7fc69ebdea
commit 4ec3c2875b
2 changed files with 12 additions and 16 deletions

View File

@ -132,19 +132,5 @@ uint16 invertBits(uint16 val, int nbits) {
return res;
}
uint8 avClipUint8(int a) {
if (a & (~0xFF))
return (-a) >> 31;
else
return a;
}
unsigned avClipUintp2(int a, int p) {
if (a & ~((1 << p) - 1))
return -a >> 31 & ((1 << p) - 1);
else
return a;
}
} // End of namespace Indeo
} // End of namespace Image

View File

@ -82,7 +82,12 @@ extern uint32 bitswap32(uint32 x);
* @param a value to clip
* @return clipped value
*/
extern uint8 avClipUint8(int a);
inline uint8 avClipUint8(int a) {
if (a & (~0xFF))
return (-a) >> 31;
else
return a;
}
/**
* Clip a signed integer to an unsigned power of two range.
@ -90,7 +95,12 @@ extern uint8 avClipUint8(int a);
* @param p bit position to clip at
* @return clipped value
*/
extern unsigned avClipUintp2(int a, int p);
inline unsigned avClipUintp2(int a, int p) {
if (a & ~((1 << p) - 1))
return -a >> 31 & ((1 << p) - 1);
else
return a;
}
extern const uint8 ffZigZagDirect[64];