ScanAVI Help Contents

Heres help for the SCANAVI.EXE tool that comes with the WinToon SDK.

Introduction

What is ScanAVI?

How To

Open an .AVI File and View Frames

Scan an .AVI File to Make a WinToon

Scanning and Re-interleaving By Hand

Adjust Settings for Scanning

Reference

File Menu

Goto Menu

View Menu

Scan Menu

Help Menu

Scan Setttings Dialog Box

Keyboard

Log File and WinToon .AVI File Format


What is ScanAVI?

ScanAVI is a tool included in the WinToon SDK. ScanAVI will scan every frame of a movie and determine the most efficient list of dirty rectangles for repainting the screen.  These rectangles are computed based on a transparent color in the movie.

ScanAVI can be used to open a movie, scan some or all frames and save out a rect stream. The typical use is to use the Make Toon command.  This command will prompt the user for an input file, an output file, a text output file and the scan settings.  These settings are used to control the scanning process.  The settings are: overhead, density and fuzziness.

The input to ScanAVI is an RLE compressed AVI file with at least one audio track.  The output is an AVI file with exactly the same video and audio and an additional stream containing the dirty rectangle information for each frame.  Also, the output file has a 1 to 1 interleave between the video and all other streams.  This is essential for WinToon to work properly.  ScanAVI is intended to be the final stage of an AVI file preparation.


Opening an .AVI File and Viewing Frames
Open an .AVI File and View Frames

To View an .AVI file, choose the Open command from the File menu. When you open an .AVI file, ScanAVI will resize its window to fit the frame size of the .AVI file.

You can click in the scroll bar (page down and page up) to move from key frame to key frame. Click the scroll bar arrow buttons (line down and line up) to move from frame to frame.

As you click through an .AVI file, ScanAVI will display frames from the Normal, Slow, or Fast list depending on which list is set within the View menu.

If ScanAVI cannot display something, for example if you select View.Drop for a movie with no dropped-frame list or select View.Fast for a movie with no Fast list, ScanAVI will display the text Cant display frame in the top-left corner of its window.


Scan an .AVI File to Make a WinToon

To make a WinToon .AVI file, use the Make Toon command on the File menu.

Important   Once youve scanned with ScanAVI, the .AVI file contains a dirty rectangle stream in addition to the audio and video. Do not edit this .AVI file with VidEdit or other tool; if you do the tool will stomp on the dirty rectangle stream and the .AVI file will not work with WinToons stream handler.

To make a WinToon

1.	From the File menu, choose the Make Toon command.

2.	In the File Name box of the Open dialog, select or type the name of the source .AVI file.

The input to ScanAVI must be RLE compressed AVI file with at least one audio track.

3.	In the File Name box of the Save As dialog, select or type the name of the output WinToon .AVI file.

4.	In the File Name box of the Save As dialog, select or type the name of the output log file.

See the Log File and WinToon .AVI File Format topic for a description of the log file entries.

5.	In the Scan Settings dialog, adjust the overhead, density and fuzziness settings as appropriate for your .AVI file.

6.	Choose the OK button.

ScanAVI will scan the source .AVI file and save the output WinToon .AVI and text files. The output is an .AVI file with exactly the same video and audio as the input file, plus an additional stream containing the dirty rectangle information for each frame.  The output file has a 1 to 1 interleave between the video and all other streams, essential for WinToon to work properly.

If you have previously scanned without saving that scan and then start a new scan, ScanAVI will display a message Save scan results? Choose Yes to save the previous scan before starting the new scan, No to discard the previous scan before starting the new scan, or Cancel to stop the new scan.

Note that your can scan an .AVI file by hand. See Scan an .AVI File By Hand.


Scanning and Re-interleaving By Hand

You can scan an .AVI file by hand with ScanAVIs Scan commands. Note that if you scan this way, not with ScanAVIs MakeToon command, you must re-interleave the file with AVIEdit (included in the VFW development kit).

Important   Once youve scanned with ScanAVI, the .AVI file contains a dirty rectangle stream in addition to the audio and video. Do not edit this .AVI file with VidEdit or other tool; if you do the tool will stomp on the dirty rectangle stream and the .AVI file will not work with WinToons stream handler.

To make a WinToon by hand

Note that you can perform the same actions as Make Toon by performing these steps:

1.	Open an .AVI file with File.Open.

2.	Set scan options with Scan.Settings.

3.	Scan with Scan.Movie.

4.	Save with File.Save As.

5.	Re-Interleave with AVIEdit.

Reinterleaving with AVIEdit

To reinterleave use AVIEdits Compression Options dialog box.

For the video stream you must choose exactly the same keyframe frequency as the original movie.  You should also use the same compression format (RLE) and make sure the quality setting is still at 100.  AVIEdit will not do this for you!  AVIEdit defaults to key frames every 7 frames, regardless of the original format.

You must also choose to interleave both the audio and the dirty rectangle streams every 1 frames.  If you dont do this you will end up with a cartoon that might play but will behave very strangely.

To interleave WinToon .AVI file with AVIEdit

1.	Run AVIEdit (located in from the Video for Windows SDK \BIN directory).

2.	Open an.AVI file that was scanned with ScanAVI.

3.	From the File menu, choose the Save Options command.

4.	From the Compression Options dialog box, choose the Options button to set options for the .AVI files video stream.

5.	In the Compressor drop-down list of the Video Compression dialog box, choose Microsoft RLE.

6.	Move the Compression Quality slider to the 100 setting.

7.	In the Key Frame box, type 10.

8.	In the Choose A Stream drop-down list of the Compression Options dialog box, choose the audio stream.

9.	Put a check in the Interleave Every check box, and type 10 in the Frames text box.

10.	In the Choose A Stream drop-down list of the Compression Options dialog box, choose the Microsoft WinToon (dirty rectangle) stream.

11.	Put a check in the Interleave Every check box, and type 10 in the Frames text box.

12.	In the Compression Options dialog box, choose the OK button.

13.	From the File menu, choose the Save As command.

14.	Use the Save AVI File dialog box to save the WinToon .AVI file with the new settings.


Adjust Settings for Scanning

The Scan Settings dialog box is available with the Settings command on the Scan menu and from the Make Toon command. You can use this dialog box to enable ScanAVI to scan any or all of the Normal, Slow, and Fast lists, and to adjust the scan settings for each list individually.

Normal, Slow, and Fast Scan Lists

Overhead, Density, and Fuzziness Scan Settings

Recommended Scan Settings


Normal, Slow, and Fast Scan Lists

You can enable one or more adjust the scan settings for each list To choose a list, use the List drop-down list in the Scan Settings dialog.

ScanAVI can output from one to three lists (Normal, Slow, Fast) of video frames in the .AVI file. The lists are:

Normal for an average hardware setup.

Slow for a slow system; e.g. a slow VGA display.

Fast for a fast system; e.g. accelerated VLB graphics.

Different machines have different video performance.  On a slow VGA display, the overhead of extra calls to WinGBitBlt is low compared to the cost per pixel bltted.  On a faster machine, the time per pixel is much smaller and an extra calls to WinGBitBlt are simply not worth the effort.  For this reason, ScanAVI can store multiple scan results in the dirty rect stream and, at runtime, the application can choose the most efficient list.  The best list can be determined emperically at start up by using each list on a representative frame and timing the result.


Overhead, Density, and Fuzziness Scan Settings

The settings for each list are overhead, density and fuzziness.

Overhead is a rough metric of the cost of an extra rectangle compared to the cost per pixel.  The slower the pixel blt speed, the lower the overhead.

Density is a cue the scanner uses to stop recursing.  It is a percentage of non-transparent pixels in a rectangle.  Once this percentage has been reached ScanAVI assumes that it has found an efficient rectangle.

Fuzziness is the inflation amount used to check for intersecting rectangles while scanning.  The primary use of this setting is to cause small, proximate rectangles to be unioned.  This is particularly useful for animations containing text.


Recommended Scan Settings

We recommend that you enable all three lists when you scan and let the application choose the best list for the hardware at run-time. Here are recommended overhead, density, and fuzziness settings for each list:

Normal list:

Overhead: 10000

Density: 50

Fuzziness: 5

Slow:

Overhead: 5000

Density: 75

Fuzziness: 2

Fast:

Overhead: 25000

Desity: 25

Fuzziness: 8


File Menu

Here are descriptions of the File menu commands.

Open

Displays the standard File Open dialog box, which you can use to open an .AVI file. The input to ScanAVI must be RLE compressed AVI file with at least one audio track.

Close

Closes any currently open .AVI file.

Save As

If you have just scanned the file, saves the currently open .AVI file along with its dirty rectangle stream.

If you have just opened the file but have not scanned, saves a log file for the currently open .AVI file. See the Log File and WinToon .AVI File Format topic for a description of the log file entries.

Make Toon

Steps through dialog boxes to specify an input .AVI file, output WinToon .AVI file, scanning log file, and scanning settings, and then scans a WinToon. See the Scan an .AVI File to Make a WinToon topic.

Exit

Closes ScanAVI. If you have previously scanned without saving that scan and then choose the Exit command, ScanAVI will display a message Save scan results? Choose Yes to save the previous scan before closing ScanAVI, No to discard the previous scan before closing ScanAVI, or Cancel to not close ScanAVI.


Goto Menu

Here are descriptions of the Goto menu commands.

Home

Displays the first frame of the currently open movie.

Next

Displays the next frame of the currently open movie.

Prev

Displays the previous frame of the currently open movie.

End

Displays the last frame of the currently open movie.


View Menu

Here are descriptions of the View menu commands.

Normal, Slow, Fast

Click on one of these to display the Normal, Slow, or Fast list, respectively. ScanAVI puts a check mark next to the current selection.

Drop

Click on Drop to display all dropped frames.


Scan Menu

Here are descriptions of the Scan menu commands.

Frame

Scans the current frame.

Movie

Scans the entire movie according to the current scanning settings. You can save the resultant WinToon .AVI with the File menus Save As command.

Abort

Stops the current scan. If you stop a scan and then start another scan or try to exit, ScanAVI will prompt you to save the current scanning.

Clear

Discards the results of the last scan for the current frame.

Settings

Displays the Scan Settings dialog box, which you can use to adjust the scan settings.


Help Menu

Here are descriptions of the Help menu commands.

Contents

Displays the Contents topic for this help.

About

Displays information about ScanAVI.


Scan Setttings Dialog Box

Here are descriptions of the controls in the Scan Settings dialog box. You can use this dialog to adjust the scan settings for a scan.

List drop-down list selects one of the three lists (Normal, Slow, Fast)wtk_scanavi_lists to adjust settings for.

Enabled check box enables ScanAVI to scan the selected list. You can enable any or all of the three lists by first selecting the list then checking this box.

Overhead is a rough metric of the cost of an extra rectangle compared to the cost per pixel.  The slower the pixel blt speed, the lower the overhead.

Density is a cue the scanner uses to stop recursing.  It is a percentage of non-transparent pixels in a rectangle.  Once this percentage has been reached ScanAVI assumes that it has found an efficient rectangle.

Fuzziness is the inflation amount used to check for intersecting rectangles while scanning.  The primary use of this setting is to cause small, proximate rectangles to be unioned.  This is particularly useful for animations containing text.

OK button retains your changes for the scan. If you got to the Scan Settings box through the Make Toon command, choosing OK starts the scan.

Cancel button discards your changes for the scan. If you got to the Scan Settings box through the Make Toon command, choosing Cancel stops the scan.


Keyboard

ScanAVI has one accelerator key.

Key	Command
DEL	The Clear command from the View menu.


Log File and WinToon .AVI File Format

Here are descriptions of the contents of a ScanAVI log file. The log file outlines the contents of a WinToon .AVI file. The file (and log file entries) first contains a header, then definitions of the lists within the file, then the list of frames. Click here to see an example log file.

Log File Entry	Description
lpHeader->cb: n	The size of the scanned files header, where n is the number of bytes.
lpHeader->version: n	The version of SCANAVI.EXE that scanned the file, where n is the version number. This should match the version number of the WinToon run-time used to display the file.
lpHeader->transparent: n	The .AVI files transparent color, where n is a COLORREF in decimal format.
lpHeader->bTransparent: n	Index of the transparent color in color table of the movie.
lpHeader->cRectMax: n	The maximum number of rectangles in any one frame in the entire .AVI file. Note that if an application writes its own file, it must make this field accurate in order for the file to work properly with WinToon.
iList	The type of list. 0 = Normal, 1 = Slow, 2 = Fast.
vRectMax	The maximum number of rectangles in any one frame in this list.
vFuzziness, vDensity, vOverhead	The users fuzziness, density, and overhead settings for this list from the Scan Settings dialog box.
cFrame: n	The count of frames in the .AVI file.
iFrame: i	Video for Windows frame number, where i is the number.
Frame Number: i	The actual frame number stored in the dirty rectangle frame.
pFrame->cb: n	The count of n bytes in this frames data.
cRect[i]: n x, y, dx, dy	For this frame, the dirty rectangles for each list, where i is the list type, n is the count of dirty rectangles for that list, and a set of coordinates x, y, dx, dy define the bounds of a dirty rectangle in for that frame.
Cost of this frame n	The total surface area of all of the rectangles for the frame.


Example Log File

As an example of the log file entries in a SCANAVI scan, a log file for a that included Normal and Slow lists might look like this:

lpHeader->cb: 74

lpHeader->version: 151

lpHeader->transparent: 3828840

lpHeader->bTransparent: 15

lpHeader->cRectMax: 1

iList	vRectMax	vFuzziness	vDensity	vOverhead

0	1	5	50	10000

1	1	2	75	5000

cFrame: 119

iFrame: 0

Frame Number: 0

pFrame->cb: 40

cRect[0]: 1

0, 0, 160, 120

Cost of this frame 19200

cRect[1]: 1

0, 0, 160, 120

Cost of this frame 19200

iFrame: 1

Frame Number: 1

pFrame->cb: 40

cRect[0]: 1

0, 0, 160, 120

Cost of this frame 19200

cRect[1]: 1

0, 0, 160, 120

Cost of this frame 19200