390
r
EncodeTree( InOut SET UnencodedJForestJSet,
In INTEGER common_Bytes_Encoded )
Declare BOOLEAN BitmapJJsed ^—392
BitmapJJsed <— FALSE
r~ If Common_Bytes_Encoded = N - 1
Then
Declare INTEGER BitmapJBase
BitmapJBase <— Get the low bound of the first interval
in UnencodedJforestjSet. Declare SET Bitmap_Set
BitmapjSet <— Get the subset of intervals in
Unencoded_Forest_Set whose high bound is
no greater than BitmapJSase + (B * 8).
If BitmapjSet contains two or more intervals
Then
Declare BITMAP NewJSitmap
Declare INTEGER Bit
Bit <— 0
394-J While Bit < B * 8
Do
If (BitmapJSase + Bit + 1) is contained in an
interval in BitmapjSet Then
Activate bit Bit in NewJSitmap
Endif
Increment Bit by 1
Done
Emit prefix byte for a bitmap
Emit the tfth byte of Bitmap Base
Emit the B byte(s) of NewJSitmap
Remove BitmapjSet from UnencodedJForestJSet
BitmapJJsed <— TRUE
Endif
Endif 398
|— If BitmapJJsed is FALSE
Then
Declare SET TreeJSet /
TreejSet <— Get the subset of intervals in /
UnencodedJForestJSet that share at least
one common leading byte, ignoring the
402 first CommonJBytesJSncoded bytes.
^If Tree_Set is not empty
Then
- Declare INTEGER ffe*r_Coimnoji_Bytes
New_Common_Bytes <-- Get the number of new common
leading bytes shared by all 404— intervals in 2*ree_Set.
Emit Se\rj2ommonJ3ytes as a prefix byte Emit the new common leading bytes 396 H 405 ~~ Incr«*en,t Common_Bytes_Encoded by NevjJommonjSytes
406— I' CommonJ3ytesJEncoded < N