| 1 |
/* Copyright (C) 2008 Vincent Penquerc'h. |
| 2 |
This file is part of the Kate codec library. |
| 3 |
Written by Vincent Penquerc'h. |
| 4 |
|
| 5 |
Use, distribution and reproduction of this library is governed |
| 6 |
by a BSD style source license included with this source in the |
| 7 |
file 'COPYING'. Please read these terms before distributing. */ |
| 8 |
|
| 9 |
|
| 10 |
/** |
| 11 |
|
| 12 |
\page format_fp Format - floating point value |
| 13 |
|
| 14 |
Floating point values are stored as a series of digitized fixed point |
| 15 |
values in the Kate bitstream format. Several distinct streams of |
| 16 |
floating point values may be saved at the same time. A stream has a |
| 17 |
constant format (number of bits saved per value). Streams may be |
| 18 |
merged together (eg, merging 2 streams of V values yields a single |
| 19 |
stream of 2*V values). Streams stored together always have the same |
| 20 |
number of values. |
| 21 |
|
| 22 |
When loading N streams, the bitstream format is as follows: |
| 23 |
|
| 24 |
\li 1 bit, being 1 if the streams are merged. |
| 25 |
|
| 26 |
If the streams to load are merged, the different streams are stored |
| 27 |
as a single stream. In this case, N is set to 1, and the number of values |
| 28 |
is equal to the total number of values in all streams (eg, the original |
| 29 |
N times the number of values in a single stream). |
| 30 |
|
| 31 |
Then, for each stream: |
| 32 |
|
| 33 |
\li 4bits being the number of zero bits in the high bits of the integer part of a number (`head'). |
| 34 |
\li 4bits being the number of bits in the low bits of the fractional part of a number (`tail'). |
| 35 |
|
| 36 |
Then, for each value: |
| 37 |
|
| 38 |
\li if head is strictly positive, a bit representing the sign of the number. |
| 39 |
\li 32-(head+tail) bits, representing the middle bits of the absolute value of the number. |
| 40 |
|
| 41 |
Each number may then be reconstructed by concatenating the given number of high zero bits (`head'), |
| 42 |
the middle bits, the given number of low zero bits (`tail'), and negating the number if the sign |
| 43 |
bit was 1. |
| 44 |
|
| 45 |
|
| 46 |
*/ |
| 47 |
|