TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: HERMAN SCHONFELD
from: DANIAL GIBSON
date: 1997-04-14 16:54:00
subject: Re: Video

HS>If you use a table of precalculated [ * ] values it's even 
faste
HS>eg.
HS>char *screen= (char *) 0xA0000;
HS>#if your using watcom - char *screen=(char *) 0x0A000;
HS>int ytable[320];
HS>void pre_calc(void)
HS>{
HS>  int loop1;
HS>  for (loop1=0; loop1<319; loop1++)
HS>    ytable[loop1] := loop1 * 320;
HS>};
HS>void putpixel(int x, int y, unsigned char colour)
HS>{
HS>  char *plot;
HS>  plot = &screen[ytable[y] + x];
HS>  *plot = (unsigned char)colour;
HS>};
It wasn't faster on mine (686-120, Borland C, Win95). In theory it's
faster, but not when you take into account all the dereferencing and
addressing that goes on. An imul doesn't take that long so you can't
really do much to replace it. Your method (on my computer) gives about
the same performance as a simple y*320+x, except it requires more code
and memory. It may be faster on other chips though.
Danial.
PS. Thanks for the info on DCT. I have 1 question though. You said that
it compresses it based on how fast it changes. Does this mean that it
would start with a number, then for each subsequent pixel, add a certain
number to the previous number to get the value for the pixel?
___ X SLMR 2.1a X
___
 X SLMR 2.1a X 
--- Maximus/2 3.00
---------------
* Origin: Hunter Connection OS/2 BBS 24hrs (049) 57-1801 (3:622/403)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.