Skip to content

Commit

Permalink
#1565 updates LTR, LTRNet and Passport decoders with new slope decode…
Browse files Browse the repository at this point in the history
…r. Resolves issue with LTR Standard decoder state that was combining individual calls to the same talkgroup and causing excessively long calls. (#1567)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
  • Loading branch information
DSheirer and Dennis Sheirer committed Jun 5, 2023
1 parent 5b6377c commit 19f7a51
Show file tree
Hide file tree
Showing 34 changed files with 708 additions and 464 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/github/dsheirer/audio/AudioModule.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
* Copyright (C) 2014-2023 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/github/dsheirer/bits/BinaryMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ public void add(boolean value) throws BitSetFullException
}
else
{
throw new BitSetFullException("bitset is full -- contains " +
(mPointer + 1) + "bits");
throw new BitSetFullException("bitset is full -- contains [" + mPointer + "/" + size() + "] bits");
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/io/github/dsheirer/bits/SyncPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,10 @@ public enum SyncPattern
true, true, false, false //1100 0xC
}),

/* Sync (0x158) = 1101011000 */
/* Sync (0x158) = 101011000 */
PASSPORT( new boolean[]
{
true, //0001 0x1
false, true, false, true, //0101 0x5
true, false, false, false //1000 0x8
true,false,true,false,true,true,false,false,false
} ),

LTR_STANDARD_OSW( new boolean[]
Expand Down
28 changes: 17 additions & 11 deletions src/main/java/io/github/dsheirer/buffer/FloatNativeBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.github.dsheirer.sample.SampleUtils;
import io.github.dsheirer.sample.complex.ComplexSamples;
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;

import java.util.Arrays;
import java.util.Iterator;

/**
Expand All @@ -30,6 +32,7 @@
public class FloatNativeBuffer extends AbstractNativeBuffer
{
private float[] mInterleavedComplexSamples;
private static final int BUFFER_SIZE = 2048;

/**
* Constructs an instance
Expand Down Expand Up @@ -81,48 +84,51 @@ public int sampleCount()

private class ComplexSamplesIterator implements Iterator<ComplexSamples>
{
private boolean mEmpty;
private int mBufferPointer = 0;

@Override
public boolean hasNext()
{
return !mEmpty;
return mBufferPointer < mInterleavedComplexSamples.length;
}

@Override
public ComplexSamples next()
{
if(mEmpty)
if(!hasNext())
{
throw new IllegalStateException("No more samples");
}

mEmpty = true;
return SampleUtils.deinterleave(mInterleavedComplexSamples, getTimestamp());
float[] chunk = Arrays.copyOfRange(mInterleavedComplexSamples, mBufferPointer, mBufferPointer + BUFFER_SIZE * 2);
mBufferPointer += BUFFER_SIZE * 2;

return SampleUtils.deinterleave(chunk, getTimestamp());
}
}

private class InterleavedComplexSamplesIterator implements Iterator<InterleavedComplexSamples>
{
private boolean mEmpty;

private int mBufferPointer = 0;

@Override
public boolean hasNext()
{
return !mEmpty;
return mBufferPointer < mInterleavedComplexSamples.length;
}

@Override
public InterleavedComplexSamples next()
{
if(mEmpty)
if(!hasNext())
{
throw new IllegalStateException("No more samples");
}

mEmpty = true;
return new InterleavedComplexSamples(mInterleavedComplexSamples, getTimestamp());
float[] chunk = Arrays.copyOfRange(mInterleavedComplexSamples, mBufferPointer, mBufferPointer + BUFFER_SIZE * 2);
mBufferPointer += BUFFER_SIZE * 2;

return new InterleavedComplexSamples(chunk, getTimestamp());
}
}
}
Loading

0 comments on commit 19f7a51

Please sign in to comment.