FMEMCOPY -
FMEMZERO - On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
and coefficient-block arrays.
jcopy_block_row - GLOBAL
GLOBAL
jcopy_sample_rows - GLOBAL
GLOBAL
jdiv_round_up - Arithmetic utilities } {GLOBAL
GLOBAL
jround_up - GLOBAL
GLOBAL
jzero_far - GLOBAL
GLOBAL
jpeg_natural_order
procedure FMEMCOPY(dest,src : pointer; size : size_t);
procedure FMEMZERO(target : pointer; size : size_t);
On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
and coefficient-block arrays. This won't work on 80x86 because the arrays
are FAR and we're assuming a small-pointer memory model. However, some
DOS compilers provide far-pointer versions of memcpy() and memset() even
in the small-model libraries. These will be used if USE_FMEM is defined.
Otherwise, the routines below do it the hard way. (The performance cost
is not all that great, because these routines aren't very heavily used.) } {$ifndef NEED_FAR_POINTERS} { normal case, same as regular macros
procedure jcopy_block_row (input_row : JBLOCKROW;
output_row : JBLOCKROW;
num_blocks : JDIMENSION);
GLOBALGLOBAL
procedure jcopy_sample_rows (input_array : JSAMPARRAY;
source_row : int;
output_array : JSAMPARRAY; dest_row : int;
num_rows : int; num_cols : JDIMENSION);
GLOBALGLOBAL
function jdiv_round_up (a : long; b : long) : long;
Arithmetic utilities } {GLOBALGLOBAL
function jround_up (a : long; b : long) : long;
GLOBALGLOBAL
procedure jzero_far (target : pointer;{far} bytestozero : size_t);
GLOBALGLOBAL
jpeg_natural_order =
(0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63,
63, 63, 63, 63, 63, 63, 63, 63, { extra entries for safety in decoder }
63, 63, 63, 63, 63, 63, 63, 63)
jpeg_zigzag_order[i] is the zigzag-order position of the i'th element
of a DCT block read in natural order (left to right, top to bottom). } { jpeg_natural_order[i] is the natural-order position of the i'th element
of zigzag order.
When reading corrupted data, the Huffman decoders could attempt
to reference an entry beyond the end of this array (if the decoded
zero run length reaches past the end of the block). To prevent
wild stores without adding an inner-loop test, we put some extra
"63"s after the real entries. This will cause the extra coefficient
to be stored in location 63 of the block, not somewhere random.
The worst case would be a run-length of 15, which means we need 16
fake entries.