Made to Order Software Corporation Logo

compression

Appendix A — The geometry in SWF — Edges

Edges are used to define a shape vector based and also coordinates where images need to be drawn. The edges are always coordinates from where ever your last point was to where ever you want the next point to be (a little like a turtle in LOGO).

SoundStreamHead

Tag Info
Tag Number: 
18
Tag Type: 
Define
Tag Flash Version: 
2
Brief Description: 

Declare a sound effect which will be interleaved with a movie data so as to be loaded over a network connection while being played.

Tag Structure: 
struct swf_soundstreamhead {
	swf_tag			f_tag;		/* 18 or 45 */
	unsigned		f_compression : 4;
	unsigned		f_sound_rate : 2;
	unsigned		f_sound_size : 1;
	unsigned		f_sound_stereo : 1;
	unsigned		f_reserved : 4;
	unsigned		f_playback_rate : 2;
	unsigned		f_playback_size : 1;
	unsigned		f_playback_stereo : 1;
	unsigned short		f_sample_size;
	if(f_compression == 2) {
		signed short	f_latency_seek;
	}
};

The SoundStreamHead[2] tags define a sound effect which is to be loaded with a set of SoundStreamBlock tags. It defines the sound once and for all.

Streaming sound has a strong side effect when playing a movie: it will force a synchronization between the images and the audio. Thus some images may be dropped if the drawing isn't fast enough.

DefineSound

Tag Info
Tag Number: 
14
Tag Type: 
Define
Tag Flash Version: 
2
Brief Description: 

Declare a sound effect. This tag defines sound samples that can later be played back using either a StartSound or a DefineButtonSound. Note that the same DefineSound block can actually include multiple sound files and only part of the entire sound can be played back as required.

Tag Structure: 
struct swf_definesound {
	swf_tag			f_tag;		/* 14 */
	unsigned short		f_sound_id;
	unsigned		f_sound_format : 4;
	unsigned		f_sound_rate : 2;
	unsigned		f_sound_is_16bits : 1;
	unsigned		f_sound_is_stereo : 1;
	unsigned long		f_sound_samples_count;
	unsigned char		f_sound_data[<variable size>];
};

A DefineSound tag declares a set of samples of a sound effect or a music.

The sound samples can be compressed or not, stereo or not and 8 or 16 bits. The different modes are not all available in version 2, although the same tag is used in newer versions with additional capabilities.

The f_sound_is_16bits is always set to 1 (16bits samples) if the samples are compressed (neither Rawnor Uncompressed).

The f_sound_rate represents the rate at which the samples are defined. The rate at which it will be played on the target computers may differ. The following equation can be used to determine the ...

DefineBitsJPEG

Tag Info
Tag Number: 
6
Tag Type: 
Define
Tag Flash Version: 
1
Brief Description: 

Define a JPEG bit stream.

Tag Structure: 
struct swf_definebitsjpeg {
	swf_long_tag		f_tag;		/* 6, 21, 35 or 90 */
	unsigned short		f_image_id;
	if(f_tag == DefineBitsJPEG3 + f_tag == DefineBitsJPEG4) {
		/* sizeof(f_encoding_tables) + sizeof(f_image_data) + 2 when JPEG4 */
		unsigned long		f_offset_to_alpha;
	}
	if(f_tag == DefineBitsJPEG4) {
		unsigned short fixed	f_deblocking_filter_parameter;
	}
	if(f_tag != DefineBitsJPEG) {
		/* when DefineBitsJPEG, use JPEGTables instead */
		unsigned char		f_encoding_tables[<variable size>];
	}
	unsigned char		f_image_data[<variable size>];
	if(f_tag == DefineBitsJPEG3 || f_tag == DefineBitsJPEG41) {
		unsigned char		f_alpha[<variable size>];
	}
};
  • 1. JPEG4 optionally accepts the f_alpha field. [To be verified]

These tags define an image saved using the JPEG compression scheme.

DefineBitsJPEG (V1.0) does not include the encoding tables which are defined in the unique JPEGTables tag instead. All the DefineBitsJPEG of an SWF file use the only JPEGTables tag. Yes... This means you need a tool that is capable of reusing the same tables over and over again to make sure that all your DefineBitsJPEGs work properly (or use it just once.)

The other tags incorporate their own version of the JPEG encoding tables.

The DefineBitsJPEG3 and DefineBitsJPEG4 support an alpha channel bit plane (8 bits.) ...