int QccIMGImageComponentDPCMEncode(const
QccIMGImageComponent *image_component, const QccSQScalarQuantizer *quantizer,
double out_of_bound_value, int predictor_code, QccIMGImageComponent *difference_image,
QccChannel *channel);
int QccIMGImageComponentDPCMDecode(QccChannel *channel,
const QccSQScalarQuantizer *quantizer, double out_of_bound_value, int
predictor_code, QccIMGImageComponent *image_component);
int QccIMGImageDPCMEncode(const
QccIMGImage *image, const QccSQScalarQuantizer *quantizers, const QccVector
out_of_bound_values, int predictor_code, QccIMGImage *difference_image,
QccChannel *channels);
int QccIMGImageDPCMDecode(QccChannel *channels,
const QccSQScalarQuantizer *quantizers, const QccVector out_of_bound_values,
int predictor_code, QccIMGImage *image);
QccIMGImageComponentDPCMEncode() encodes image_component with DPCM using the predictor specified by predictor_code, quantizing difference values with quantizer, and outputting the resulting quantizer indices to channel. QccChannelNormalize(3) is called if the quantization indices consist of both positive and negative numbers, which is the case unless quantizer->type is QCCSQSCALARQUANTIZER_GENERAL. If difference_image is non-NULL, the image of difference values is returned. channel must be allocated with sufficient storage space to hold all the quantizer indices (i.e., one for each pixel in image_component) prior to calling QccIMGImageComponentDPCMEncode().
QccIMGImageComponentDPCMDecode() decodes the channel produced by QccIMGImageComponentDPCMEncode(), reconstructing image_component. For sane results, predictor_code, out_of_bound_value, and quantizer must be the same as those used by QccIMGImageComponentDPCMEncode(). image_component must be allocated prior to calling QccIMGImageComponentDPCMDecode().
QccIMGImageDPCMEncode() and QccIMGImageDPCMDecode() implement DPCM encoding and decoding, respectively, for image. Essentially, QccIMGImageDPCMEncode() calls QccIMGImageComponentDPCMEncode() for each of the Y, U, and V image components of image. out_of_bound_values is a vector of three values to use in the predictor, quantizers is an array of three quantizers to apply to the prediction residuals, and channels is an array of three channels used to store the quantization indices for each of the three components. Similarly, QccIMGImageDPCMDecode() calls QccIMGImageComponentDPCMDecode() for each of the Y, U, and V image components of image.
Jain identifies six linear predictors as being particularly useful for image coding. These predictors use four pixels A, B, C, and D in the causal neighborhood surrounding current pixel X as illustrated below.
previous line ... * * * B
C D * * * ... current line ... * * * A X - - - - ...
next line ... - - - - - - - - - ...
*: previously encoded pixels -: pixels not yet encoded A, B, C, D: previously encoded pixels used by predictor X: current pixel (to be predicted)
The different predictors, specified by predictor_code in these routines, are as follows, where P is the predicted value of the current pixel, X.
In the event that the current pixel is close to the boundaries of the image component, one or more of the A, B, C, or D pixels may not be available for these predictors. In this case, the predictor substitutes out_of_bound_value for the missing pixel in the prediction formula.
A. K. Jain, Fundamentals of Digital Image Processing. Englewood Cliffs, NJ: Prentice Hall, 1989.