# Lossless Compression of Large Aperture Static Imaging Spectrometer Data +
## 3 Compression Scheme
### The CCSDS-123 Standard
#### 3.2.1 Predictor  
The predictor's task is to calculate the set of predicted sample values, \(\left\{\hat{s}_{z,y,x}\right\}\), and mapped prediction residuals, \(\left\{\delta_{z,y,x}\right\}\), from the input image samples, \(\left\{s_{z,y,x}\right\}\), where x and y are the coordinates of the spatial dimensions, and the z index refers to the OPD band of the rearranged LADIS data. The prediction at sample \(s_{z,y,x}\) is based on a set of previously sampled values, which include both the current band and \(P\) previous bands.  
Two distinct prediction modes, namely, full and reduced, are offered by the standard. Each mode requires central local differences, \(d_{z,y,x}\), from \(P\) previous bands, and the full mode additionally makes use of three directional local differences, \(d_{z,y,x}^{N}\), \(d_{z,y,x}^{W}\), and \(d_{z,y,x}^{NW}\), in the current band. Figure 6 illustrates the two prediction modes, where only the differences depicted in blue are used in the calculation.  
Local differences refer to the differences between the local sum values, \(\sigma_{z,y,x}\), and the scaled values of the previous samples within the current band. In the case of the full prediction mode, the local differences vector, \(\mathbf{U}_{z,y,x}\), is defined as  
\[\mathbf{U}_{z,y,x}=\begin{bmatrix}d_{z,y,x}^{N}\\ d_{z,y,x}^{NW}\\ d_{z,y,x}^{NW}\\ d_{z-1,y,x}\\ d_{z-2,y,x}\\ \vdots\\ d_{z-P_{z}^{*},y,x}\end{bmatrix}=\begin{bmatrix}4s_{z,y-1,x}-\sigma_{z,y,x}\\ 4s_{z,y,x-1}-\sigma_{z,y,x}\\ 4s_{z,y-1,x-1}-\sigma_{z,y,x}\\ 4s_{z-1,y,x}-\sigma_{z-1,y,x}\\ 4s_{z-2,y,x}-\sigma_{z-2,y,x}\\ \vdots\\ 4s_{z-P_{z}^{*},y,x}-\sigma_{z-P_{z}^{*},y,x}\end{bmatrix} \tag{2}\]  
where \(P_{z}^{*}=\min\{z,P\}\). Under the reduced mode, the first three components are not needed. There are two methods of calculating the local sum values, \(\sigma_{z,y,x}\): neighbor-oriented and column-oriented.  
Figure 5: Photo-acquisition space, \(\phi_{(X,Y,F)}\), and the OPD-image space, \(\phi_{(x,y,z)}\).  
The predicted central local difference, \(\hat{d}_{z,y,x}=\mathbf{W}_{z,y,x}^{\top}\mathbf{L}_{z,y,x}\), is a scaled prediction of \(d_{z,y,x}\). The weight vector, \(\mathbf{W}_{z,y,x}\), plays the role of measuring the contribution of each component of the local difference vector in the prediction procedure. The components of the weight vector are adaptively updated based on the sign of the prediction error, \(e_{z,y,x}=2s_{z,y,x}-\overset{\sim}{s}_{z,y,x}\). The value of the weight update scaling exponent, \(\rho_{z,y,x}\), is determined by three user-specified parameters: the weight update scaling exponent initial parameter, \(\
u_{min}\); the weight update scaling exponent final parameter, \(\
u_{max}\); and the weight update scaling exponent change interval, \(t_{inc}\). The rate at which the weights adapt to the image is impacted by \(\rho_{z,y,x}\). A smaller value of \(\rho_{z,y,x}\) results in faster adaptation but a worse steady-state performance. The resolution of the weight values is controlled by the weight component resolution parameter, \(\Omega\).  
The main prediction calculation of the standard used to calculate the scaled prediction sample value, \(\overset{\sim}{s}_{z,y,x}\), from the predicted central local difference, \(\hat{d}_{z}(t)\), involves a parameter, \(R\), to consider the register size. We can refer to the standard to obtain specific details. Reducing the register size increases the probability of overflow occurring in the calculation leading to a large prediction error. Although the compression will still be lossless, the compression effectiveness still suffers to an extent. Finally, to use the variable-length codes, the prediction residual, \(\Delta_{z,y,x}=s_{z,y,x}-\left\lfloor\frac{\overset{\sim}{s}_{z,y,x}}{2}\right\rfloor\), is mapped to a nonnegative integer denoted as the mapped prediction residual, \(\delta_{z,y,x}\), from which the decompressor can reconstruct the original sample value.