Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6731 Discussions

## Convrt/ReduceBits 8u1u rotate content of resulting byte ?

New Contributor I
421 Views
Convrt/ReduceBits 8u1u rotate content of resulting byte ?
is there a simple way of rotating content of resulting byte of hose functions ? (bit 7 becomes 0 ... 0 -> 7 etc)
Edit:
maybe reversing bit order is more appropriate name
3 Replies
Employee
421 Views
Hello,

Could you give a sample to show the functionality, for example, the input data type and size, the output date type? Convert_8u1u or ReduceBit 8u1u just convert, no rotate

If shift by bit, intel compiler's intrinsics function seems be able to do this. for example

 Intrinsics for IA-32 and Intel 64 Architectures unsigned int _rotl(unsigned int value, int shift) Implements 32-bit left rotate of value by shift positions. unsigned int _rotr(unsigned int value, int shift) Implements 32-bit right rotate of value by shift positions. unsigned short _rotwl(unsigned short value, int shift) Implements 16-bit left rotate of value by shift positions. unsigned short _rotwr(unsigned short value, int shift) Implements 16-bit right rotate of value by shift positions.

### Best Regards,Ying H.

Valued Contributor II
421 Views
Quoting Aris Basic
...
is there a simple way of rotating content of resulting byte of hose functions ? (bit 7 becomes 0 ... 0 -> 7 etc)
Edit:
maybe reversing bit order is more appropriate name
...

A lookup table of 255 reversed bytes.Speaking about performance nothing would compare with it.

Best regards,
Sergey

Valued Contributor II
421 Views
This is a follow up and a genericexample provided:

...
const int iSize = < some value >;
unsigned byte ubData[ iSize ] = { 0x0 };

unsigned byte ubLUT[ 256 ] =
{
//Lookup Table ( LUT )of 256 unsigned bytes initialized with the bit reversed values
...
};
...
// ubData initialization / usage code / etc
...
for(inti = 0;i <iSize; i++ )
{
ubData = ubLUT[ ubData ];
}
...

Best regards,
Sergey