mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-10 23:57:25 -05:00
P25 audio work in progress - started work on exposing 88-bit (11-byte) IMBE voice frames from LDU messages. Added deinterleave, derandomize and the Golay(23,12,7) error detection and correction to LDU voice messages. Hamming edac still remains to be implemented. Plan to create a separate project to produce an imbe FormatConversionProvider that will convert 88-bit imbe frames to PCM audio that is then in a standard format for audio playback, recording, or conversion to another format like shoutcast.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
******************************************************************************/
|
||||
package bits;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -359,7 +360,39 @@ public class BinaryMessage extends BitSet
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the integer value represented by the bit array
|
||||
* Returns the byte value represented by the bit array
|
||||
* @param bits - an array of bit positions that will be treated as if they
|
||||
* were contiguous bits, with index 0 being the MSB and index
|
||||
* length - 1 being the LSB
|
||||
* @return - byte value of the bit array
|
||||
*/
|
||||
public byte getByte( int[] bits )
|
||||
{
|
||||
if( bits.length != 8 )
|
||||
{
|
||||
throw new IllegalArgumentException( "Invalid - there must be 8"
|
||||
+ "indexes to form a proper byte" );
|
||||
}
|
||||
|
||||
int value = 0;
|
||||
|
||||
for( int index: bits )
|
||||
{
|
||||
value = Integer.rotateLeft( value, 1 );
|
||||
|
||||
if( get( index ) )
|
||||
{
|
||||
value++;
|
||||
}
|
||||
}
|
||||
|
||||
mLog.debug( "Value is:" + value );
|
||||
|
||||
return (byte)( value & 0xFF );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the long value represented by the bit array
|
||||
* @param bits - an array of bit positions that will be treated as if they
|
||||
* were contiguous bits, with index 0 being the MSB and index
|
||||
* length - 1 being the LSB
|
||||
|
||||
Reference in New Issue
Block a user