sc_new w h
Create a new physical ScImage of size w by h blocks and return a pointer to that ScImage.
sc_free scImage
Deallocate scImage.
sc_clip scImage x y w h
Create a virtual ScImage with scImage as the parent. The new ScImage starst at block (x,y) in scImage and w by h blocks. A pointer to the new (virtual) ScImage is returned.
sc_reclip scImage x y w h clipped
This function is identical to ScClip, except that it destructively modifies the virtual ScImage clipped (instead of creating a new virtual ScImage). Warning : memory leaks will occurs if clipped is a physical ScImage.
sc_copy src dest
Copy ScImage src into dest. The width and height copied in the minimum of the width and height of src and dest.
sc_copy_dc_ac src dest
This function is similar to ScCopy except that only the DC and AC components of src are copied. The intracoded, skipMB, and skipBlock flags are not copied. This is useful for copying ScImage that originated from JPEG or MPEG I-Frame, since these three flags are not meaningful in them.
sc_i_to_byte scImage dest
This function perform an Inverse DCT on the data in scImage and puts the result into ByteImage dest. It is the programmer's responsibility to ensure that dest is large enough to hold the decoded data. If scImage is of size w by h, dest must be at least 8w by 8h. Assumes scImage contains dequantized values.
sc_p_to_y scImage v prev dest
sc_p_to_uv scImage v prev dest
These functions perform MPEG P-frame decoding on scImage and store the result into ByteImage dest. These functions use VectorImage v for the motion vectors and prev for the reference frame pixel data.
ScPToY is used to decode the Y plane in MPEG P-frame; ScPToUV is used to decode the U and V planes. In ScPToUV, each vector in v is treated as a motion-vector the corresponding block in scImage; in ScPToY, each vector in v is treated as a motion vector for every 4 blocks in scImage. It is the programmer's responsibility to ensure that dest, v, and prev are of large enough for the operations. Assumes scImage contains dequantized values.
sc_b_to_y scImage fwd bwd past future dest
sc_b_to_uv scImage fwd bwd past future dest
These functions perform MPEG B-frame decoding on scImage and store the result into dest. Both functions use VectorImages fwd and bwd for the forward and backward motion-vectors, and ByteImages past and future for the past and future reference frame pixel data.
ScBToY is used to decode the Y plane in MPEG B-frame; ScBToUV is used to decode the U and V planes. ScBToY treats uses one vector in v for each group of 4 blocks in scImage, whereas ScBToUV uses one vector in v for every block in scImage. It is the programmer's responsibility to ensure that dest, fwd, bwd, past, and future of large enough for the operations. Assumes scImage contains dequantized values.
sc_dequantize scIn qScale qTable scOut
Dequantize the values in scIn using quantizer scales in qScale and an 8x8 quantizer matrix qTable into scOut. The matrix qTable is stored in row-major order (not zig-zag order). The dimensions of qScale is equal to the macroblock dimensions of scIn (for Y plane half the width and height of scIn; for U and V planes the same dimensions as scIn). One of the default tables defined above can be used for qTable. scIn and scOut may point to the same ScImage.
When the function completes, every coefficient in scIn will be scaled by q*s/8, where q is obtained from the appropriate entry from qTable, and s is obtained from qScale (at the corresponding location on the image).
sc_non_i_dequantize scIn qScale qTable niqTable scOut
Dequantize the values in scIn using quantizer scales in qScale and quantizer matrices qTable, niqTable into scOut. Blocks in scIn maybe intra coded or non-intra coded. The dimensions of qScale is equal to the macroblock dimensions of scIn (for Y plane half the width and height of scIn; for U and V planes the same dimensions as scIn). One of the default tables defined above can be used for qTable. and niqTable. scIn and scOut may point to the same ScImage.
byte_to_sc byteImage scImage
Perform a discrete cosine transform (DCT) on byteImage, zig-zag encode it, and store the result in scImage. The resulting data in scImage is lossless (up to round-off error) version of byteImage in the DCT domain. To further compress the result use the ScQuantize function described below. For Jpeg encoding, JpegScanEncode will perform this quantization.
sc_quantize scIn qScale qTable scOut
Quantize scIn using the quantizer scales in qScale and a quantizer matrix qTable. The dimensions of qScale is equal to the macroblock dimensions of scIn (for Y plane half the width and height of scIn; for U and V planes the same dimensions as scIn). One of the default tables defined above can be used for qTable. scIn and scOut may point to the same ScImage.
byte_to_sc_i byte qScale qTable sc
This function is equivalent to calling ByteToSc followed by ScQuantize. It performs DCT tranformation and quantization on the values of byte and outputs them in sc. It is the programmer's responsibility to allocate space for sc.
byte_y_to_sc_p curr prev fmv qScale qTable niqTable sc
byte_uv_to_sc_p curr prev fmv qScale qTable niqTable sc
These functions are used for MPEG P-frame encoding on curr. Using the forward motion vectors in fmv, perform DCT and quantization. For intra coded macroblocks, use qTable for regular I-frame compression on the macroblock of curr. For non-intra coded macroblocks, calculate the difference between the block in curr and the motion-compensated one in prev. Then DCT transform and quantize using niqTable. The exists field in each Vector of fmv determines if the macroblock is intra coded (exists = 0) or non-intra coded (exists = 1). The output is stored in sc which should be allocated by the programmer.
byte_y_to_sc_b curr prev next fmv bmv qScale qTable niqTable sc
byte_uv_to_sc_b curr prev next fmv bmv qScale qTable niqTable sc
These functions are used for MPEG B-frame encoding on curr. For intra coded macroblocks, use qTable for regular I-frame compression on the macroblock of curr. For non-intra coded macroblocks, calculate the difference values between the macroblock in curr and the interpolated one between prev and next. Then DCT transform and quantize using niqTable. The macroblock may also be skipped and nothing is done. The exists field in each Vector of fmv and bmfdetermines if the macroblock is intra coded (exists = 0), non-intra coded (exists = 1) or skipped (exists = 2). The output is stored in sc which should be allocated by the programmer.
sc_get_x scImage
sc_get_y scImage
sc_get_width scImage
sc_get_height scImage
sc_get_virtual scImage
Return the appropriate attribute of scImage -- its x or y offset from its parent (non-zero if scImage is virtual), the width and height of scImage in blocks, and whether or not scImage is virtual.
ByteImage , VectorImage , JPEG , MPEG
Last updated : Saturday, November 14, 1998, 08:31 PM