|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.gsfc.drl.rtstps.core.RtStpsNode
gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode
gov.nasa.gsfc.drl.rtstps.core.ReedSolomonDecoder
public class ReedSolomonDecoder
This class does Reed Solomon error detection and correction on frames. It sends frames to a target FrameReceiver. Corrected issues related to corrections in August 2007.
Nested Class Summary | |
---|---|
static class |
ReedSolomonDecoder.Setup
This class defines setup fields that are commonly associated with a Reed Solomon block decoder component. |
Field Summary | |
---|---|
private int |
actualLength
|
private int[] |
antilog
|
private static int[] |
ANTILOG
|
static java.lang.String |
CLASSNAME
This is a class name for this STPS node type, which is also the element name. |
private int |
codewordDistance
|
private int |
codewordLength
number of symbols in field, 2 ** bitsPerSymbol - 1 |
private static int |
CORRECTED
|
private int[] |
correctionPolynomial
|
private int[] |
DUAL_ANTILOG
|
private int[] |
errorLocations
|
private int[] |
errorMagnitudes
|
private int |
frameLength
|
private int[] |
log
|
private int[] |
magnitudePolynomial
|
private static int |
OK
|
private int |
parityLength
|
private ReedSolomonDecoder.Setup |
setup
|
private int[] |
sigma
|
private int[] |
sigmab
|
private int |
skipBytes
|
private int[] |
syndrome
The syndrome polynomial |
private static int |
UNCORRECTABLE
|
Fields inherited from class gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode |
---|
output |
Fields inherited from class gov.nasa.gsfc.drl.rtstps.core.RtStpsNode |
---|
linkName, statusItemList, typeName |
Constructor Summary | |
---|---|
ReedSolomonDecoder()
Create a Reed Solomon decoder node. |
Method Summary | |
---|---|
private int |
computeErrorLocations(int degreeOfSigma)
Calculate the roots of the error location polynomial by using the Chien search. |
private int |
computeErrorLocatorPolynomial()
This is the Berlekamp Algorithm. |
private int |
computeErrorMagnitudes(int errors)
This function uses the Forney Algorithm to calculate the error magnitudes. |
private boolean |
computeSyndrome(byte[] data,
int level)
This function implements the FFT-like syndrome calculation. |
private void |
correctSymbols(byte[] data,
int level,
int errorCount)
This function xor's the error magnitudes with the appropriate symbols in error, thus correcting all symbols in error. |
private int |
decode(byte[] data)
Do Reed Solomon decoding on one frame. |
void |
finishSetup(Configuration configuration)
Finish the setup. |
int |
getParityLength()
Get the parity length in bytes, which is the full parity length for all interleaves. |
void |
load(org.w3c.dom.Element element,
Configuration configuration)
Set up this stps node with a configuration. |
void |
putFrame(Frame frame)
Give a frame to this FrameReceiver. |
void |
putFrames(Frame[] frames)
Give an array of frames to this FrameReceiver. |
private void |
setAnnotation(int state,
Frame frame)
Set a frame's Reed Solomon annotation and mark the frame for deletion if necessary. |
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode |
---|
addReceiver, flush, setOutputIsRequired |
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.RtStpsNode |
---|
clear, clone, getElementName, getLinkName, getStatusItems, setLinkName, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gov.nasa.gsfc.drl.rtstps.core.FrameReceiver |
---|
flush, getLinkName |
Methods inherited from interface gov.nasa.gsfc.drl.rtstps.core.Sender |
---|
addReceiver |
Field Detail |
---|
public static final java.lang.String CLASSNAME
private static final int OK
private static final int CORRECTED
private static final int UNCORRECTABLE
private static final int[] ANTILOG
private int[] DUAL_ANTILOG
private int codewordLength
private int actualLength
private int[] syndrome
private int frameLength
private int skipBytes
private int codewordDistance
private int parityLength
private int[] sigma
private int[] sigmab
private int[] correctionPolynomial
private int[] errorMagnitudes
private int[] errorLocations
private int[] log
private int[] antilog
private int[] magnitudePolynomial
private ReedSolomonDecoder.Setup setup
Constructor Detail |
---|
public ReedSolomonDecoder()
Method Detail |
---|
public void load(org.w3c.dom.Element element, Configuration configuration) throws RtStpsException
load
in class FrameSenderNode
RtStpsException
public void finishSetup(Configuration configuration) throws RtStpsException
finishSetup
in class FrameSenderNode
RtStpsException
public final int getParityLength()
public void putFrames(Frame[] frames) throws RtStpsException
putFrames
in interface FrameReceiver
RtStpsException
public void putFrame(Frame frame) throws RtStpsException
putFrame
in interface FrameReceiver
RtStpsException
private void setAnnotation(int state, Frame frame)
private int decode(byte[] data)
1) Calculate the syndrome vector from the received RS codeword. 2) Calculate the coefficients of the error locator polynomial. 3) Calculate the roots of the error locator polynomial. 4) Calculate the error magnitudes. 5) Correct the symbols in error with the previously calculated information. <\pre> Polynomial coefficients are stored P[0] = a*X ... P[n] = z*X
private boolean computeSyndrome(byte[] data, int level)
R_n-1 = r[0] R_n-2 = r[1] ... R1 = r[n-2] R0 = r[n-1] For CCSDS: R254 = r[0] R253 = r[1] ... R1 = r[253] R0 = r[254] Recursive syndrome formula. (mo + i) (mo + i) Si = ((...(R[n-1] * gamma + R[n-2]) * gamma + (mo + i) ...) * gamma + R[0]) POA Where gamma = alpha , therefore powerOfAlpha = (POA * (mo + i)) and 0 <= i <= (d - 2) = (2t - 1) and n = 2**bitsPerSymbol - 1, bitsPerSymbol = number of bits per symbolThis function is the most important one, since it is called for each frame. It is the first step in the decoding process, and it determines if there are errors in the data.
data
- The frame data including the sync pattern and parity.level
- The current interleave level.
private int computeErrorLocatorPolynomial()
This algorithm finds the solution of the key equation: [sigma(z)*syndrome(z)] = 0 The syndrome is given, so this algorithm finds sigma(z) of minimum degree. This is the same problem as finding the minimum-length shift register, which generates the first 2t terms of syndrome(z), which will predict s[1] from s[0] and so on. For each new syndrome symbol, the algorithm tests to see whether the current correction polynomial will predict this symbol correctly. If so, the correction polynomial is left unchanged and the correction term is modified by multiplying by z. If the current correction polynomial fails, then it is modified by adding the correction term. One then checks to determine if the new register length has increased. If it has not, then the correction polynomial that is currently being maintained is at least as good a choice as any other. If the length of the new register increases, then the previous correction polynomial becomes the better choice since the oldest symbol associated with this register must have a higher index than the oldest symbol associated with the current correction term.
private int computeErrorLocations(int degreeOfSigma)
Solve: i poa sigma(x): where x = gamma and gamma = alpha , and vf_end <= i <= (n - 1), n = 2**bitsPerSymbol - 1, bitsPerSymbol = number of bits per symbol,and vf_end = the first location in the received vector following the virtual fill symbols. I start the Chien Search at vf_end since there is no point trying to find errors in the virtual fill symbols where errors will never exist. i An error location is found for each value of gamma that makes sigma evaluate to 0.
private int computeErrorMagnitudes(int errors)
2 magnitudePolynomial(X) = 1 + (s[1]+sigma[1])*X + (s[2]+s[1]*sigma[1]+sigma[2])*X + ... v + (s[v] + sigma[1]*s[v-1] + ... + sigma[v-1]*s[1] + sigma[v])*X Where v = number of errors detected n-l If gamma is an error-location number, then the error value at location n-l is given by: -(1-mo)l l gamma * magnitudePolynomial(gamma ) e = ------------------------ n-l l l gamma * sigma'(gamma ) POA Where gamma = alpha and sigma'(X) is the derivative of sigma(X) and is given by: 2 2i sigma'(X) = sigma[1] + sigma[3]*X + ... + sigma[2i+1]*X + ... 0 <= i <= floor((t-1)/2)
private void correctSymbols(byte[] data, int level, int errorCount)
data
- The data vector.level
- Interleave levelerrorCount
- Number of correctable errors
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |