| Home | News | Products | Support | Download | Sales | library | Guests | Contact | WebCam | Links | |
| LanBox-Talk mail archive | |
| By date: Prev | Next | Index | By thread: Prev | Next | Index | ||||||
(warning: technical email ;) On Sun, Jun 29, 2003 at 11:39:12PM +0100, David Raison wrote: The -128 -> +127 bit is great, once you get your head into thinking two's complement math :-) Actually, it's saturated two's complement math with the sign bit flipped :) It's probably easier to think of as saturated add with an offset of 128. We flipped the sign bit to allow normal fades from the minimum value (-128) to the maximum value (+127). Because the fader algorithm is oblivious to the fact the layer is an ADD-layer, we had to make 0 the minimum value and 255 the maximum value. This implicitly requires the offset of 128. The algorithm can be abstractly represented as: mixvalue := mixvalue + addvalue - 128 if mixvalue < 0 then mixvalue := 0 else if mixvalue > 255 then mixvalue := 255 end if And the same thing for 16-bit channels, except the offset is 32768, which means an offset of 128 in the msb channel. (the actual algorithm internally is fairly bizarre though.. because it's very time-critical I sat on the implementation for a whole day and managed to make it do the whole calculation in 5 instructions of which one jump :-) BTW The layer dragging made swapping the layers a doddle. Hmm.. [hmvd:~] xmath% dict doddle No definitions found for "doddle" :-) Matthijs van Duin -- May the Forth be with you! Wow, someone who recognizes Forth :) You might care to know the LanBox-LCX contains a full Forth system, with built-in help system, assembler, disassembler, and even a debugger! It also contains hooks to patch into the lighting control app at various points. If you care for more info, just let me know. -- Matthijs van Duin -- May the Forth be with you!
| |||||||
| By date: Prev | Next | Index | By thread: Prev | Next | Index | ||||||