ocp_predictor implements the predictor of CCSDS 123.0-B-2 (section 4) with the quantizer, the sample
representatives and the mapper: blocks PR-1 to PR-6 of the architecture. It takes the samples of an image in the input
order of the compressed image and produces the entropy coder input sequence: one mapped quantizer index per sample and,
with periodic error limit updating, the error limit values at the start of every update period.
The predictor shall accept images of NX, NY and NZ from 1 to 65536 samples, with a dynamic range D from 2 to 32 bits, of unsigned or signed (two's complement) samples.
3.2, 3.3
PR-IF-02
The predictor shall accept the samples in band-interleaved order with a sub-frame interleaving depth M from 1 to NZ and in band-sequential order.
5.4.2.1, 5.4.2.2.1, 5.4.2.3
PR-IF-03
The predictor shall output the entropy coder input sequence in the input order with, for every mapped quantizer index, the band z, a flag for t = 0, a flag for t = 1 and a flag for the last sample of the image.
3.4, 5.4.1, 5.4.2.2.2
PR-IF-04
With periodic error limit updating the predictor shall read the error limit values (A* or a_z for every band, then R* or r_z for every band) at the start of every frame y with y mod 2^u = 0, use them for the frames of the update period and insert them into the entropy coder input sequence before the first sample of the frame.
4.8.2.4, 5.4.2.2.2
PR-IF-05
The predictor shall signal with a pulse on Img_Start that it has accepted the first item (sample or error limit value) of an image.
A sample that comes with In_End = '1' shall be the last item of its image at the output (Out_Last), after every item of the samples taken before it; the next sample shall be the first sample of a new image (t = 0, initial weights, error limit values read at its first frame).
5.4.2
PR-FR-02
In stride order, after a sample with In_End at input index L the predictor shall take no further sample of the image, process every slot of an input index up to L, skip the slots of the indices above L without waiting for their samples, end the image when L + 1 samples have been processed and output the indices 0 to L in input order with index L as the last item.
The predictor shall use P preceding bands for prediction, P from 0 to 15, and Pz* = min(z, P) in band z.
4.2
PR-LS-02
The predictor shall implement full and reduced prediction mode.
4.3
PR-LS-03
The predictor shall compute wide neighbor-oriented, narrow neighbor-oriented, wide column-oriented and narrow column-oriented local sums, including the cases at the image edges.
4.4
PR-LS-04
The predictor shall compute the central local difference and, in full prediction mode, the three directional local differences, and form the local difference vector.
The predictor shall represent weights with Omega + 3 bits for a weight resolution Omega from 4 to 19.
4.6.1, 4.6.2
PR-PD-02
The predictor shall initialise the weights of every band with the default weight initialisation or with custom weight initialisation vectors of resolution Q from 3 to Omega + 3.
4.6.3
PR-PD-03
The predictor shall compute the predicted central local difference, the high-resolution predicted sample value with register size R from max(32, D + Omega + 2) to 64, the double-resolution and the predicted sample value.
The predictor shall compute the prediction residual and the quantizer index with step size 2 m_z(t) + 1; the first sample of every band is not quantized.
4.8.1
PR-QU-02
The predictor shall compute the maximum error for lossless, absolute error limit only, relative error limit only and both absolute and relative error limits.
4.8.2.1
PR-QU-03
The predictor shall accept absolute and relative error limits of 1 to 16 bits, band-independent or band-dependent.
4.8.2.2, 4.8.2.3
2.5 Sample representatives and weight update (PR-5)¶
ID
Requirement
CCSDS
PR-SR-01
The predictor shall compute the clipped bin center and the sample representative with resolution Theta from 0 to 4 and per-band damping and offset values.
4.9
PR-WU-01
The predictor shall compute the double-resolution prediction error and the weight update scaling exponent with the parameters vmin, vmax and tinc.
4.10.1, 4.10.2
PR-WU-02
The predictor shall update the weights after every sample with t > 0, with intra-band and inter-band weight exponent offsets from -6 to 5.
The predictor shall start a sample in the first clock cycle in which the samples it depends on (the previous sample of its band; in near-lossless compression, or when the local differences of the previous bands come from memory, the sample of the previous band at the same pixel) have left the feedback loops and the output has room for every item in flight; it shall then process one sample per clock cycle (throughput model tools/ocp_throughput.py).
none
PR-TP-02
When consecutive samples belong to the same band (BSQ order, BI order with M = 1) and C <= 3, the predictor shall continue the weight update of the band from one sample to the next without waiting (speculative weight loop, Speculation_g) in lossless compression and in near-lossless compression with absolute error limits, narrow local sums and reduced prediction.
none
PR-TP-03
In BI order with M = NZ and near-lossless compression with dependencies between the bands of a pixel (P > 0 or narrow local sums), without periodic error limit updating, the predictor shall process the samples of an image in stride order (Stride_g) and output the entropy coder input sequence in the input order.
With RuntimeConfig_g true the predictor shall compress every image with the dimensions NX, NY, NZ given for it (1 to XSize_g, YSize_g, ZSize_g) and M = min(SubFrameDepth_g, NZ): positions, flags t = 0, t = 1 and last sample, local sums at the image edges and the sequence of bands as for an image of these dimensions with constant generics.
3.2, 4.4, 5.4.2
PR-RC-02
With RuntimeConfig_g true and absolute or relative error limits the predictor shall use the band-independent error limit values given for the image.
4.8.2.2, 4.8.2.3, 4.8.2.4.1
PR-RC-03
Before the first sample of an image the predictor shall compute the conditions of its dependency checks (PR-TP-01) from the dimensions of the image, in a fixed number of clock cycles, with the same result as the elaboration computes for constant dimensions NX, NY, NZ and M; these cycles are part of the throughput model.
none
PR-RC-04
With RuntimeConfig_g true the predictor shall not use the stride order (PR-TP-03).
none
PR-RP-01
With RuntimeParams_g true, in BI order, the predictor shall compress every image with the sub-frame interleaving depth M given with its configuration (Cfg_M, from 1 to min(SubFrameDepth_g, NZ)), and compute its dependency checks with that M (PR-RC-03).
5.4.2.2.1
PR-RP-02
With RuntimeParams_g true the predictor shall compute the weight update scaling exponent of every sample with the change interval t_inc and the parameters vmin and vmax given with the configuration of its image (Cfg_WeightInterval, Cfg_WeightVmin, Cfg_WeightVmax), also while samples of two images are in the pipeline.
Sample representatives, local differences, weights and band-dependent periodic error limits shall be stored in memories with SECDED ECC; corrected single and detected double errors shall be signalled on Ecc_Sec and Ecc_Ded.
none
PR-FT-02
The predictor shall inject a single or a double bit error into the next word written into its memory selected by ErrInj_Channel (channels 0 to 11).
Speculative weight loop where it applies (PR-TP-02)
Stride_g
true
Stride order where it applies (PR-TP-03)
RuntimeConfig_g
false
Image dimensions and band-independent error limit values from the configuration inputs at every image start (section 2.7a); XSize_g, YSize_g, ZSize_g are the maxima
RamStyle_g
"auto"
Memory implementation (Open Logic)
Per-band tables are integer_vector generics; the last element repeats for the remaining bands.
The low bits of an initial weight with Q < Omega + 3 are a '0' followed by '1' bits (the note of the clause); with Q = Omega + 3 the weight equals the initialisation value.
4.7.3
At t = 0 the double-resolution predicted sample value of band z > 0 (P > 0) is twice the sample of band z - 1 at t = 0, which equals its sample representative (4.9.2, t = 0).
4.10.3
The increment floor((sgn+(e) 2^-(rho + zeta) d + 1) / 2) is computed exactly for both signs of the exponent; an increment outside the weight range is saturated before the clipping of the weight, which gives the same weight.
4.8.2.4
The error limit values are 16-bit values on the Lim stream; only the DA or DR least significant bits are used, as in the header.