Saturday, October 18, 2003

Multimedia Presentations Class
Multimedia: Concepts and Practice - Stephen McGloughlin
Chapter 7 - Multimedia Building Blocks: 3D Modeling and Animation

1) Chapter Overview
   a) We will learn modeling
      i) Though it is more precise then sculpting
      ii) We have fewer tools to work with
   b) Software that is available
      i) Caligari's trueSpace
      ii) New Tek's LightWave 3D / Inspire 3D
      iii) Kinetix's 3D Studio
      iv) MetaCreation's Infini-D
      v) Ray Dream Studio / Carrara
      vi) EIG.SYS's Poser
      vii) Corel's Bryce
      viii) Template Graphic's 3Space Publisher
   c) All of this used to be done by hand on celluloid from which we get the term cel.
2) What is 3D
   a) Depth Perception
      i) The main thing in a 3 D image is a sense of perspective.
         (1) Things get smaller as they go back
         (2) There is shading to indicate a light source.
      ii) How is it done
         (1) Create a shape
         (2) Apply shading
         (3) Introduce light and shadow (sometimes combined with first step)
      iii) Shading
         (1) Darker areas on the figure that is farther away from the light source
         (2) Lighter colors on the surface that is closer.
      iv) Shadows
         (1) Happens when an object is between a light source and surface
         (2) Process called raytracing determines where the light source is and figures out where each ray of light would go, what it would bounce off of and where it would create brightness and shadows.
3) Overview of Computer Animation and Video File Formats
   a) Output File
         i) The still or animated rendering of the image you created.
         ii) Most programs can provide a snapshot image in standard flat file format
         iii) If you want to be able to use your animated images elsewhere they should be stored in standard file like AVI (Windows) or MOV (Apple Quicktime) as these work on web well also. Sometimes AutoDesk's FLI is also usable.
         iv) Programs also store in their own formats which will be good for generating them again or making changes needed.
   b) 3D Data Storage File
         i) Most programs store as proprietary formats
         ii) There are a few standards
            (1) AutoDesk DXF
            (2) 3D Studio 3DS
            (3) Alias Wavefront OBJ
            (4) VRML WRL files
         iii) These formats do not contain the data to recreate or edit your projects.
4) Tips for effective 3D Graphic Generation and Manipulation
      a) Know what format your development tools can use and make sure they can 'talk' to each other.
      b) Decide if you want to model your own objects or use someone else's. (clip art type libraries).
      c) Make sure that your computer has resources to do the job
         i) Memory
         ii) Speed
         iii) Hard Drive space.
      d) Allow for time to get the job done
      e) Do Not overcomplicate the scene
      f) PRACTICE, PRACTICE, PRACTICE, and then PRACTICE some more.
      g) You are not rendering just one image but many in a movie file. Be aware that will take time and make adjustments for the non critical items.
      h) Keep it Small and Simple.
5) Feedback Animation
   a) When a user clicks a button and the program is loading you need to give them feedback that something is happening.
   b) You could use two frame animation or multiple frame animation to give them some eye candy to look at.
   c) Using the rendering program you could create each frame individually and build them into your multimedia program
6) Computer Generated Video
   a) Programs generate images as series of images or a digital video clip.
   b) Once you get a series of keyframes, tell the animation program which ones are which and then it will try to generate the images needed that go between them.
   c) This process is often called 'tweening" from the word between.
7) Internet Considerations
   a) File Size - critical as file must be downloaded before it can play
   b) Streaming - a way of starting the image downloading and then start it playing while more of the file is coming
   c) No matter which is used it is best to keep it short and simple.
8) Rendering and Rendering Options
   a) Rendering is the act of making the images and making them into a single or multiple images set.
      i) More you add to it the more time it will consume.
      ii) Image is created in a top to bottom motion.
   b) It is possible to add other options to this that will add time AND realistic effects.
      i) Motion Blur
         (1) Film cars going around a race track and grab one frame
         (2) Chances are the car will be going to fast and it will be a blur
         (3) Freeze a rendering and the car will be perfectly focused
         (4) Add motion blur and the results are more realistic
         (5) Generally 3 before and 3 after the frame are rendered and then blurred together. This increases rendering time 7 fold.
      ii) Depth of field rendering
         (1) Just as in real life eyeballs and as done in the movies it is possible to bring the foreground out of focus while focusing on the background, or vice versa.
         (2) Adds realism but also rendering time.
      iii) Special effects plug-ins.
9) Avoiding Pitfalls
   a) Leave time at the end of your project. Finding mistakes means you have to re-render the images
   b) Do not be taken in by the pricing on either end of the spectrum when it comes to software (read reviews in magazines).

Thursday, October 16, 2003

Computer architecture
Computer Systems 2nd Edition
J. Stanley Warford
Section 6.2 Stack Relative Addressing and procedure Calls

In C++ procedure call changes flow to the first line of the procedure. In assembler we have to do much more work. The higher level C++. Because of abstraction we miss the pushing of information on the stack that the machine code actually has to do. To do those we use the JSR command. The JSR pushed the program counter onto the stack and then loads the operand into the program counter. To do the JSR it should be done in immediate mode. To return from the called routine we use the RTS instruction which pops the address back off the stack and into the program counter.

Program 6.7
In program 6.7 we just make three calls to the procedure call, one after the other.

Stack-Relative Addressing
One of the steps that the JSR does is to decrement the sack counter by 2. It does this because it works from the top down in the stack. If we want to add and remove things to the stack ourselves we have to have a way to decrement and to increment the stack pointer as well. ADDSP allows us to add a value to the stack pointer.

Program 6.8
Program 6.8 uses two commands to put information on the stack.

LOADA c#/r/,i
STYBTA d#-1,s


This puts an r in the register a and then the STYBTA stores the r in the stack pointer -1. We do not have to know the memory location of the pointer as it is relative addressing.
The program after it loads the data then moves the pointer with the ADDSP d#-4,i command. This moves the pointer in negative (downward) direction which is what we need as the stack builds down from the top. Next the program pulls information of the stack and outputs it. In the end the ADDSP d#4,i sets the counter back to the original place. While this does not erase the information in memory, it does remove it from use. Now the pointer can use those memory locations again (overwriting the information there when it does).

Program 6.9
In order for us to be able to go to the subroutine, then we have to put any local variables on the stack. The reason why is that we could need the memory location or even wind up inadvertently changing the variables. For that reason, variable values should be put on the stack by loading them into register A and writing them to a stack memory location and then ADDSP d#-2,i moves the counter down. (see the same instructions above in program 6.8). Once that is done we can jump to the subroutine (in this case printBar).
The subroutine now needs to set up its memory needs. We do this by using .EQUATE at the start to set up memory locations. This sets the information on the stack. We can then use relative addressing to access them. At the end use a ADDSP with a positive number to dealocte any local variables used. It then RTS to go back to the main routine. Once there the main routine pop the information back off and go on with its business. The numbers used in this program are good for this program only. The compiler (or coder) would have to allocate memory in line with the size variables that he is using.
All of this is hidden from us by the higher level languages like C++.

Program 6.10
Program 6.9 only called a subroutine (a function in C++, but a function that does not return a value). In this case we are doing a function and this function will be returning a value. Remember stated above that the information is still on the stack when we return to the main program. That fact means that the calling routine (in our case the main program) can now call that information off of the stack and use it (even though the stack pointer is back above it, we use relative addressing).

Wednesday, October 08, 2003

Computer architecture
Computer Systems 2nd Edition
J Stanley Waford

Chapter 6 Section 1.

Branching Instructions and Flow of Control

PEP/7 has 7 branch instructions
   BRLE   Branch on less than or equal to      checks N and Z
   BRLT   Branch on less than                        checks N
   BREQ   Branch on equal to                         checks N
   BRNE   Branch on not equal to                    checks Z
   BRGE   Branch on greater than or equal to   checks N
   BRGT   Branch on greater than                   checks N and Z
   BRV    Branch on V                                    checks V
   BRC     Branch on C                                     checks C

In order for these to be done, the A register is loaded with the information needed and then the N, V, Z or C bits are checked as necessary. Based on the BIT checking the branch will take place. P. 222 has a table as to how the will branch.

LOADA      num,d
BRLT         place

would load the value of num into register A and then branch to location place if the value was less than 0.

Program 6.1
A simple C++ program that takes a value in ( cin >> number ) . and then compares it with if number < 0 . If condition is met we negate the number number = - number. We then output the number with cout << number . Of course if the number is less than zero we branch around that and just do the output.

In assembler these translate to

main:      DECI       number,2    ; ask for number input
if:            LOADA                     ;put the number in register A
               BRGE      endIF         ; branch to the endIf label if N is 0 (if A is Greater than or equal to)
               LOADA   number      ;not really necessary but reload the register with number
               NOTA                        ; get 1's compliment to start negation process
               ADDA      d#1,i         ; add 1 to it to get ones compliment
               STOREA number,d   ; store the negative back in to number
endIf      DECO         number,d   ; do the cout statement to output the answer

Parts not important to discussion have been left out
notice that is the number is negative to start with the loop takes place and we go to output the number.

Optimizing Compilers
As noted the line to reload number into register A was not needed, but it could have been. What is something had changed the register. For that reason this is not optimized code, but it is nonoptimized. A compiler from a higher level language to the assembler can be of either type. Nonoptimized will be created quicker but optimized will be tighter and smaller code. Generally go for the first in creating the code and the second in creating the program to be distributed.

Program 6.2
We add to the discussion and else to go with the if. If a condition is met we do one thing, if not we do the other and in the end we do the stuff after it. The example is used in comparing two numbers. If one is larger than the other (which is a constant) then we print "high" and if not we print "low". After that the program terminates. In this program we:

main:      DECI      num,d      ; input a number
if:            LOADA num,d      ;load number into A
               COMPA limit,i         ; compare register A with the value in limit(subtract it from register)
               BRLT      else         ; go to the else label if it is less than 0 we are checking if the number is greater
                                             ; than limit by subtracting limit from it and going to the low area.
               lines omitted here for output that say HI
               BR      endIf            ; we are done go past next section
else:      lines omitted here for output that say LOW ; this is where we go if compare is lower
endIf      STOP                        ;end program


Program 6.3
Introduces the while statement and how it is done in a program. Pretty much the same thing except that the program checks to see if a condition is met and then drops through if it has not, and loops back if it has. It uses a technique of branching around the end of a loop when it checks the condition and goes to a position outside the loop. Other wise the loop just goes back up to an earlier part of the program to be done again. Nothing new code wise.

Program 6.4 is a do .. while loop. same as above just little fancier program.

Program 6.5 introduces the for loop. In C++ one can put a loop up that starts with a fixed value, compares the value and each time through the loop it will add a value to it (in this case 1 with the i++). In this program as long as the condition is not met (i<3) then we will keep looping through. Again the looping is fairly simple it is just translating it from a C++ program that gets complicated.

Program 6.6 shows us what can be done with branching and what should not be done. It is a classic case loops done because they can not because they should be.
I will not explain it in any detail as one of the homework assignments is to say what it does.

Flow Control in Early Languages
Early computers had no higher level languages to work with. So all code was in assembler and branching was the only way to do things. When FORTRAN was introduces it used statement numbers and introduced an unconditional branch as well as a conditional branch. While not comparing a status bit (at least at higher level) it let the user branch around code if conditions were right.

Structured Programming Theorem
The debate now (1966) was started. Was it possible to write code without GOTOs using only nested if and while loops. While theoretically proven, it was ignored.

The GOTO controversy
In 1968 the debate returned. It was proven that a person trying to follow a program with a lot of GOTOs in it became lost quickly. For that reason many suggested using loops to get the job done and structured programming has pretty much become the standard. remember though, just because there are no GOTOs does not mean that the program is well structured. And even if a language only has GOTO statements they can be used to create a structured style program.

[Listening to: Shout to the Lord - Hillsongs - Shout to the Lord with Hillsongs from Australia (04:39)]

Tuesday, October 07, 2003

Computer Archtecture
A+ Guide to Manageing and Mainting Your PCs
Chapter 8 Understanding and Installing Hard Drives.

I. Hard Drive Technology
   A. Tyoes of Hard Drive Intefaces
      1. EIDE Standards
         i. First one was ATA-3
            a. allows up to 4 drives on a machine
            b. all drives must follow the ATAPI interface standards
         ii. There are several different standards
            a. Each one improes on previous
            b. There is some overlapping
            c. Special cable (80 conductor) is needed for more recent ones (over ATA/100)
         iii. Newer standards support the much larger drive capacity
         iv. There are special adapters for the larger cables if the connection on the mother baord will not support it.
         v. The can be two drives on the primary cable (master and slave) and two drives on the secondary cable (same)
      2. Other interface Standards
         i. SCSI - not discussed here
         ii. IEEE 1394 - FireWire - USB has been supported instead of firewire
         iii. Fibre Chanel - High end systems
   B. How Hard Drives Work
      1. one or more platters that spin in unison
      2. Each surface is called a head (not to be confused with a read write head)
         i. Each head has tracks and sectors
         ii. If you take a specific track and sector and go through all the heads that is called a cylinder
         iii. The whole cylinder will need to be filled before it will move on to the next one.
         iv. Hard Drives require controller boards to interpert what is going on
            a. Older systems had a card that went into IO slot as well as on the drive
            b. newer ones are just on drive
   C. IDE Technology
      1. Tracks and sectors on an IDE Drive
         i. Older drives had a fixed sectoring that broke the drive up into slices. this kept the sectors constant
         ii. New drives use zone bit recording that allow for more sectors to be in outer drive ring than in inner one.
      2. Low Level Formatting
         i. Older drives with fixed sectors would often have programs in the bios to refesh the formats on them
         ii. Newer drives have this done at factory
            a. Program may be available at the manufacture's web site to fix them should they get bad.
            b. most people just toss them away
II Communicating With the Hard Drive BIOS
   A. Calculatin Drive Capicity on Older Drives
      1. Older drives: multiply heads * cylindars * sectors per track * 512 bytes per sector and that would give you disk storage.
      2. Newer drives need to fake the system out with the help of the BIOS
   B. Adjusting for More Complex hard drive organization
      1. CHS mode - Drive tells BIOS that it has a certain combination of heads/cylindars/sectors (max size 528MB)
      2. Large Mode - ECHS mode - sends geometry to BIOS which sends different information to the OS (max size 8.4 GB)
      3. LBA mode (large than 504 MB)Sends information to OS, BIOS sees sectors as long list of numbers
      4. OS bypassses the BIOS altogether. (windows NT/2000/XP)
   C. Installations Using Legacy BIOS
      1. Newer drive older system
         1. Let BIOS see it as smaller drive
         2. Upgrade the BIOS
         3. Upgrade the Mother Board
         4. Use software to act as go-between the BIOS and the OS
         5. Use an adapter card to substitute for your BIOS
III How a Hard Drive is Logically Organized to Hold Data
   A. If using Windows you must decide
      1. Fat/16 -works with DOS and Windows95 (and all newer versions)
      2. Fat 32 - works Windows 95 with patch, and all newer versions
      3. NTFS - Works with Windows NT, Windows 2000, Windows XP
      4. Your choice will be limited to what operating system you have and if multiple OS's installed, which ones will need to read which drives
      5. Generaly the larger the drive, you should take the newer technology so that slack size is minimized.
   B. Steps after drive instaled
      1. Low level format - creates tracks and sectors - not done with newer drives
      2. Partiton - sets the drive up into one large drive or several virtual smaller ones. Use FDISK in dos/windows (diskpart in XP)
      3. High level format - Use Format command in dos/windows - creates the information needed for OS to keep track of things
   C. Hard Drive Partions and logical Drives
      1. If you choose to break you drive up into multiple virtual drives, even if you ceate three or more you will really only create two
         i. Primary partion (the one that boots usualy)
         ii. Extended partion (holds 1 or more logical drives)
      2. The Master Boot Record (MBR) is 512 bytes, and is accessed during POST to see where OS is.
      3. Active partion is always the first partion on a drive (2000/xp call it system partion)
      4. DOS/Windows 9X allow 2 partions
      5. NT/2000/XP can have 4 partions
         i. Partion can be primary (having one logical drive)
         ii. Partition can be extended (more than one logical drive), but only one of these can be on drive.
      6. Active partition is always a Primary partition.
   D. Choice of File Systems
      1. Fat 16
         i. uses 16 bits for sector cluster entry in fat
         ii. limits the amount of clusters that can be on hard drive and hence, cluster size is larger
         iii. in larger drives can create a lot of slack space when small file in size is save to a large cluster size
      2. Virtual File Allocation (VFAT)
         i. Windows 95 and Windows for Workgroups (3.11)
         ii. supports larger file names
         iii made obsolete by fat 32
      3. FAT 32
         i. WIN 95 OSR and above
         ii 32 bits for FAT entry
         iii more clusters relates to smaller cluster size, less slack space.
      4. NTFS
         i. Does not use FAT system at all
         ii. uses a database called master File Table (MFT)
         iii. Writes the information on the middle of the drive rather than the end of it.
         iv. Use on systems that will not have multiple OSs on them that are of Windows 9x nature
   E. How many logical drives
      1. Some people put OS on one drive, programs on another and data on third, (or some combination)
      2. In reality you want to have the fewest drives with the cluster size to a minimum.
      3. If you have two hard drives and each has a primary partiton and extended partions, the primary partions will take the first drive letters and the extended will take the others. This can be changed by not putting a primary partiton on the second drive.
   F. When to partion a drive.
      1. First install
      2. Giving errors, in an effort to save the drive
      3. Suspect a virus (back up important information first)
      4. Wipe clean to install a new OS
      5. FDISK is used to do it, but not user friendly, some third party software (partion Magic is one) is a bit more friendly
      6. Be careful of software used to trick out BIOS
   G. What Happens During Formatting
      1. The OS Boot record is created
      2. The FAT is ceated
      3. The Root directory is built
IV. Installing A Hard Drive
   A. Prepare for installation
      1. Jumper settings
      2. Change CMOS if needed
      3. Use FDISK to create partitions
      4. FORMAT command to format drive
      5. Install OS and other software
      6. Keep notes of everything (CMOS especially)
      7. Make sure you have bootable rescue disk
   B. Read the Documentation (nuff said)
   C. Plan the Drive Configuration
      1. Put faster drives on one channel and slower ones (CD/Zip drives) on the other
      2. Visualize the instalation and plan for what can go wrong
   D. Prepare your work area and take precautions
      1. Proper grounding (straps etc.)
      2. Make suer cables will reach
   E. Set Jumpers and DIP switches.
      1. Most hard drives have setting printed on them
      2. write the original ones down if you are changing them (especially on ones in the machine already)
   F. Mount the Drive in the Bay (and recable it)
   G. If the bay is too large - buy a kit to adapt it.
   H. Use CMOS to Change Hard Drive Settings (view what changes if any made)
   I. Setup for Large-Capicity Drives
      1. Set Ultra DMA, PIO, and DMA modes to AUTO
      2. Some BIOS will let you set to boot from SCSI drives even if IDE drive is present.
      3. Make sure you set it to boot from device you want (Floppy, CD, IDE, ZIP)
   J. Use FDISK to Partion a Drive
   K. Format Each Logical Drive (FORMAT C: /s [/s is for system files if you wish to make it bootable] )
   L. Using Windows to Partiton and Format a New Drive
      1. If new Windows and new HD install boot from CD to install (change BIOS first)
      2. If 2nd drive being istalled, and Windows 2000/XP is on first drive, you can use Disk Management to partiton and format drive.
V. Troubleshooting Hard Drive Installations
   A. If installing mixed drive types (IDE and SCSI or IDE and IDE on controller) stop and get help till you are more expereinced
   B. Make sure that you did not introduce other problems when you replaced covers/put drive in slot etc. Look for cables disconnected or memory bumped.
   C. If Drive not present recheck you set AUTODETECT in BIOS
   D. Did you FORMAT C: /s?
   E. Check the web site of drive manufacturer for suggestions.
[Listening to: Here to Eternity - For This Cause - For This Cause (03:47)]