
This disc contains updated versions of the compression tools supplied with
the Acorn Replay Starter Kit.  The updated versions allow them to operate
on StrongARM.

The !ARMovie  supplied on this disc contains a newly developed
ARMovie Codec - 'Moving Blocks HQ'.  This is an improvement
over 'Moving Blocks'.

HQ stands for 'High Quality' - the new compressor gives improved quality
of movies for a given data rate over that given by Moving Blocks.  It
provides better coding of new data, and enhanced motion search.

Purposes of Applications:

!AREncode - desktop movie compression utility
!ARWork   - temporary work directory for ARMovie tools

                              AREncode
                              --------


AREncode is an application for compressing Replay movies. It is the desktop
front end to the Replay compressor program and to the Join program.

AREncode acts as a desktop front end to the Replay Type 1 compressor (Moving
Lines and Moving Blocks algorithms) as well as other compressors using the same
control interface. It offers a quick and simple control mechanism, as well as
allowing you to configure precisely all the elements of the compression process.

AREncode takes any Replay file and passes it through the chosen compressor to
produce a new compressed Replay file. The process usually involves two steps:

*       Compressing - creating chunks of compressed data

*       Joining - connecting these chunks together, along with sound files and header
        information, which can come from another movie.

The next section is a quick guide to compressing and joining a Replay file. The rest
of the chapter describes in detail how you can fine-tune the compression process.


COMPRESSING
-----------

Here's how to start compressing a movie:

1       Double-click on the AREncode application to install it on the icon bar.

2       Drag a Replay file from a directory display or from an application such as
        ReplayDIY or Empire and drop it on the AREncode icon bar icon. The
        Compress window will open, showing the helpful sprite and textual header of
        the movie source file.

You can also load a file for compression by clicking on the icon bar icon. This
brings up a blank Compress window, into which you can drag an
uncompressed movie file.

3       If you want to, edit the Header text (the descriptive text in the Name, Date & ©
        and Author fields) and drag a new helpful sprite to the window.

4       Choose whether to compress in single- or multi-tasking mode (you can change
        this during compression if you want). The default is single-tasking.

5       If in single-tasking mode, choose which screen mode is to be used (can be any
        mode with 8bpp or more).

6       Click on Compress. This starts the compression process.

*       In single-tasking mode, the screen will clear, the header of the new file will
        be displayed and compression will start, displaying the output frame (and
        possibly the source too) as well as a scrolling progress display of frame
        sizes and quality levels (1 is the highest quality).

*       In multi-tasking mode, the Compress window will close and a Summary
        window will open. This will display the same textual information as
        described above in a small scrolling window.

Below is an example of the first few lines of the Summary text. After the header
information, there is compression information for each frame, in this order: Frame
number, Quality, Time for frame, Frame size.

You can see that, in the example, there wasn't enough memory to compress the
second frame (i.e. frame 1) at quality level 7, so AREncode kept trying lower quality
levels (i.e. higher q numbers):

MovingLines Batch Compressor v 0.21 15th March 1994
Sound data size is 48000
For a 1 buffer read, video data is 145000 (5800 bytes per
frame)
computer needs at least 940752 bytes free to decompress
Chosen frame size is 5800
>>Students at Acorn World `93
>>31st December 1993
>>Dick Wallin
Frame 0 q7 13678 (1098)
Frame 1 <9198:retry> q8 <8974:retry> q9 <8854:retry> q10
Cut - using 7625 bytes. <8764:retry> q11 <8656:retry> q12
...


JOINING
-------

When compression has finished, the Joining process will start automatically. This
always takes place in multi-tasking mode (if compression was single-tasking, you'll
be asked to press Space or click a mouse button to return to the desktop and start
the Joining process).

Note: If there's not enough disc space on the current drive to join the movie, see
Insufficient disc space in the User Guide.

The Summary window will alter (or appear) and display a Joining message. The
movie components will be put together to create the finished, compressed movie.

1       When the Save box pops up, choose the location for the compressed movie.

2       Bring up the icon bar menu and Quit AREncode.

3       Load the compressed movie into ARPlayer (or another Replay player
        application) and play back.

Note: You shouldn't try and save directly from AREncode to another application as
it will either do nothing, or take a copy of the movie, wasting disc space.

If the Delete working files on joining icon in the Control window was ticked, all
the working files will be deleted when the compressed movie is successfully
created and saved (if it wasn't, you'll have to delete them manually). You can
also delete the original uncompressed movie now, unless you want to keep it for
future use.


FINE-TUNING THE COMPRESSION PROCESS
-----------------------------------

AREncode gives you a lot of control over the way a movie is compressed. You can,
for example

*       specify how the source (uncompressed) movie will be handled by the
        compressor (e.g. alter its frame rate)

*       choose which type of compressor to use, and alter various parameters
        associated with the compression process

*       apply various filters to enhance the compressed movie

*       choose different sound tracks to include in a movie, and specify how they are
        processed.

Fine-tuning the source movie
----------------------------
You can tell AREncode how to handle the original uncompressed movie when it's
sent to the compressor. Press menu over the Compress window and move the
pointer to the right of Movie setup:

Altering the frame rate of a movie

By default, every frame in the source movie will be used in the compressed movie.
By altering the Frame rate divisor you can change this to create a movie with a
lower frame rate than the original.

The Frame rate icon tells you the original frame rate of the movie. By setting the
Frame rate divisor to 2 you could, for example, create a 12.5fps movie from one that
originally ran at 25fps. The number of frames per chunk changes automatically as
you alter the frame rate.

Changing the number of frames in a movie chunk

Movies are compressed in sections, known as chunks. By default movies are made
with 2 second chunks. You can change this by altering the Frames per chunk field.
A lower number will mean less memory is needed to play the movie, but it will be
less likely to play smoothly from a device with low transfer rate/high access time
such as CD-ROM.

Choosing the movie's start point

Choose Start at to set the frame number of the source movie at which to begin
compressing. This allows you to trim the start of your movie. Remember that this is
specified in frames, and that frames are numbered from zero (not one).

Creating multiple versions of a movie

If you want to make several different versions of a movie, experimenting with
compression parameters, you'll probably want to keep them in the same directory.
The Index option prefixes the working files for each version by the same index value.
The output movie will also be postfixed by this value. If the Index flag is
turned on, then it will change as the Frame rate divisor is changed.

Including key frames

By default, if key frames have been created (see Using key frames) then
they are included in the compressed movie. You can change this by unticking the
Join keys icon. For example, you might want to exclude the key frames after
creating them to save memory, or perhaps make one version of a movie with key
frames and one without. If you do, then remember to untick the Delete working
files option in the Control window before joining the first version of the movie.

Applying a movie setup

There are three action buttons in the Movie setup window:

*       Click on Default to reset all values back to their defaults
*       Click on Cancel to just reset the values back to their state when you opened
        the Movie setup window or when you last pressed OK.
*       Click on OK to register the current settings in the Movie default window for use
        in the next compression.

The Movie setup window will disappear when you press any of the action buttons.

Fine-tuning the compressor
--------------------------
You can choose which type of compressor to use, and change a number of
parameters associated with the compression process. Press Menu over the
Compress window and choose Configure compressor-. The Configure
compressor window will appear:

Choosing a compressor

If you have more than one compressor installed, the Compressor field will show
which one will be used. It's usually set to Moving lines. To change this, click on the
popup icon to the right and choose from the menu of available compressors.

Two compressors are supported: Moving Lines and Moving Blocks. The latter will
generally be faster and produce better results (it is designed to compress YUV
movies, and does not compress RGB colour space movies) but you should
experiment - the results will depend to a certain extent on your source material.

Using key frames

If Make keys is enabled, the state of the compressor will be output at the start of
every compressed chunk. These key frames are then bound into the compressed
movie at the joining stage. They make the movie larger but allow you to restart it
during playback from any point with only a small delay. If you will definitely only
want to play the movie from the start, disable this option.

Changing the compression mode

There are three modes in which the compressor can run (although two of these are
different ways of specifying the same thing). The window options will change to
reflect the mode you choose.

Quality mode: In this mode the quality level of the compressed frame is fixed at
the chosen level, no matter what the size of the output produced. Note that you
may need up to 8MB of RAM to run in this mode (depending on chunk size). The
highest quality is zero; the lowest is 99. Quality zero is defined to be the same
quality as the original movie.

Frame size mode: In this mode you choose an average frame size in bytes and the
compressor will adjust the quality to try and ensure this size, recompressing
frames as necessary. There are two other options in this mode:

*       Faster matching gives a slight improvement in speed if you're using Moving
        lines compression.

*       Limit to ARM2 ensures that, whatever frame size you enter, the results will
        always be displayable on an ARM2 machine.

Device bandwidth mode: This works in the same way as Frame size mode, with the
compressor adjusting quality levels. However, rather than specifying an actual
frame size, you specify the characteristics of the delivery device (the Device
latency and Data rate) and the compressor works out the average frame size.

The default values are for a standard CD-ROM. Assume double buffers assumes
the playback machine has enough memory for double-buffered chunks. This allows
a slightly larger frame size.

Note that the preceding options describe the operation of the Moving Lines
compressor. Other compressors may not necessarily support all these options (e.g.
they may only have a fixed quality mode, or no fixed frame size mode). Consult the
documentation that comes with the compressor for more information.

Applying the compressor configuration settings

There are three action buttons in the Movie setup window:

*       Click on Default to reset all values back to their defaults.

*       Click on Cancel to just reset the values back to their state when you opened
        the Configure compressor window or when you last pressed OK.

*       Click on OK to register the current settings for use in the next compression.

Filtering a movie
-----------------
You can enhance your compressed movies by applying various filters during the
compression process. Press Menu over the Compress window and choose
Filters-. The Filters window will appear:

Image processing filters can make a big difference to the quality of compressed
scenes. Here's a brief description of each of the filters supplied with Replay:

DirectY       Linear filter, dependent on edge direction.

SharpenY      Enhances changes in the luminance (i.e.             0  -1   0
              emphasises the edges) by using a three by          -1   5  -1
              three filter.                                       0  -1   0

SMedian5      Replaces a pixel with the median of the pixel
              and its four adjacent neighbours.

SMedian9      Replaces a pixel with the median of the pixel
              and its eight adjacent neighbours.

SmoothY5      Smooths the luminance using a three by three        0   1   0
              filter using the following weights (divided by      1   4   1
              eight).                                             0   1   0

SmoothY9      Smooths the luminance using a three by three        1   2   1
              filter using the following weights (divided by      2   4   2
              16).                                                1   2   1

TClamp        Ignores differences between successive frames
              if they are smaller than a predefined threshold.

Adding filters

The lefthand area in the Filters window shows you all the available filters. To add a
filter, point at its name and drag it onto the In use window.

You can apply as many of the available filters as you want. To add more filters, just
drag them from the Available list and drop them onto the In use list. Note that
filters are added exactly where you're pointing when you drop them, so you can
position a new filter anywhere in the In use list.

Changing the order in which filters are applied

Filters are applied in the order in which they appear in the In use list. To change a
filter's position in the In use list, drag it to the new position and drop it in place
(you can drag from either the In use list or from the Available list, it doesn't
matter).

Removing filters

To remove a filter, point at its name in the In use list and drag it back onto the
Available list. Alternatively, just double-click with Adjust.

Applying the filters

When you're happy with your choice of filters, and you've got them in the right
order, click on OK. If you don't want the current settings in the Filters window to
apply, click on Cancel instead.

Handling movie sound tracks
---------------------------
Press Menu over the AREncode window and choose Sound tracks-.

Adding and deleting sound tracks

When you initially load a movie into AREncode, its own sound tracks (if any) will
be used by default. The Sound tracks window will show one source file, and how
ever many Sound tracks exist in the source movie. Use the arrow icons next to the
Sound track icon to see a description of each of the tracks in the file.

There are two ways you can add soundtracks to a movie:

*       Drop another movie containing the desired track onto the Sound tracks
        window. All the current movie's soundtracks will be replaced by the new
        soundtracks.

*       Click on Insert in the Sound tracks window to open a blank Source file field.
        Drop another movie containing the desired track onto the Sound tracks
        window. The new soundtracks will be added to those of the current movie.

You have to include all the tracks from a new source file in the order in which they
occur. You can't pick and choose or rearrange the order. You can, however, control
the order in which the various source files are used: they will always be inserted
after the currently-displayed file.

You can include as many sound files as you like in a movie, but they can only be
read from an existing ARMovie file (which may or may not have video in it as well).

You can also delete a file from the list and use the arrow icons next to the Source
file icon to scroll through the files to be used.

Note that a directory of the extracted components of a Replay file may contain
sound files in raw data format. These will show up in the Sound tracks window as
one file with a number of sound tracks, and their format will be shown (as read
from the Header text file) but no filename will be shown in the icon.

Compressing movie sound tracks

16-bit sound tracks (sound samples), although very high quality, take up a lot of
disc space. If you choose Compress to ADPCM, any 16-bit sound tracks will be
compressed to 4-bit ADPCM with only a small loss in quality.

Applying and saving sound track settings

There are a couple of ways of applying changes to the Sound tracks window:

*       If you start the compression process while the Sound tracks window is still
        displayed, any changes you've made will be taken into account.

*       If you click on Update, any changes you've made to the Sound tracks window
        will be saved for the current AREncode session and the window will disappear.

Note: You can Cancel any changes you've made, redisplay the window and start
again. Settings in the Sound tracks window are not saved between sessions - but
do remember to save any other choices first.

Saving new default configuration settings
-----------------------------------------
As long as you're using a copy of AREncode that's on a writable device, you can
save the current settings as defaults, so they'll be used next time you start
AREncode. Saved settings include:

*       source file handling settings in the Movie setup window

*       compressor configuration settings in the Configure compressor window

*       filter configuration.

To do this, choose Save choices from the icon bar menu.

Note: Information in the Sound tracks window is not saved.


STARTING AND STOPPING A SESSION
-------------------------------

When you click on Compress in the Compress window, AREncode will start to
process the movie according to your configuration settings. You can start and stop
the compression process if you need to.

Single-tasking mode
-------------------
If the screen mode you've chosen is large enough, the display will consist of the
source frame in the lower righthand corner and the compressed version in the
lower lefthand corner.

In single-tasking mode you can stop the compression process and return to the
Desktop as follows:

*       Press Space to stop at the end of the current frame, saving the compression
        state. This is the preferred method of returning to the Desktop.

*       Press Escape to stop the task immediately (this will not save any compression
        state information) so you'll only be able to restart from the last checkpoint.

Multi-tasking mode
------------------
When you choose to compress a movie in multi-tasking mode, a Summary window
will appear on the screen:

This window shows the progress of the compression task. You have the following
controls during the compression process:

Abort is equivalent to pressing Escape in single-tasking mode. It will stop the task
immediately, without saving the current state, so you will only be able to restart
from the last checkpoint.

Suspend is equivalent to pressing Space in single-tasking mode. It will send a
message to the task asking it to stop and save state at the end of the current frame.
This may take a while if the current frame needs several retries.

When the frame does finish, the Compress window will be reopened. At this point
the Continue icon will be selectable, since there is now a saved state from which to
restart. You can set the single-tasking mode, if you want. At this point, you can Quit
AREncode, or even switch off your computer. To restart compression, drop the
original movie onto the Compress window and click on Continue. On restarting,
the correct settings will be used (settings in the Configure compressor window will
be overridden if necessary).

Pause will freeze the task until you press Continue. All state information is
preserved in memory, it simply stops anything happening to the task when Pause
mode is engaged. Use this if you temporarily need the full power of the processor
(but note that no memory will be returned to you).

Pressing the Close icon whilst the task is running kills the task (you're asked to
confirm this) and then behaves as if you'd pressed Abort.

Saving the Compressor window text
---------------------------------
During compression in multi-tasking mode, you have the opportunity to save the
output from the Summary window in a text file, for future reference.

To do this, click on the Save log- icon in the top righthand corner of the
Compressor - running window. This will display a Save as box, which you can drag
to an open directory display:

Saving a compressed movie
-------------------------
Once the compression process has completed, you'll need to save the finished
movie file.

When a movie has been successfully joined, a save box will open automatically.
Drag the Save as icon to your chosen destination directory, or simply click on Save
to save it in the work directory.

Note: If you click on Cancel, the movie will be deleted from the work directory.

Working files
-------------
AREncode produces working files during the compression process.

Open work directory opens a directory display showing all the working files
created. If no movie is loaded then it will show the work root directory, in which
individual work directories are created.

When you've finished compressing a movie you'll probably want to delete the
working files. If you've ticked Delete working files on joining in the Control
window then they will be removed as soon as you save the compressed movie. If
not, choose Delete working files from the Control window menu. You can then
choose which working directories to delete (if you click with Adjust, the menu will
stay open and any directories you delete will be shaded).

Typical working files are Log, Header, Sprite, Keys directories, Image directories,
the output movie, StoppedC, StoppedD and StoppedF.

Note that if there are no working directories (because you haven't created any or
have deleted them all) then the main menu entry will be greyed out.


JOINING AN EXTRACTED MOVIE
--------------------------

If you've used the Save data option in ARPlayer to extract a movie into its
constituent parts, you can rejoin those parts to make a compressed movie again.

To do this:

1       Drag the directory icon containing the extracted movie onto the Compress
        window. The Join icon will then become selectable:

2       Click on the Join icon.

A Summary window will appear, followed by a Save as box:

Before joining you can change some aspects of the movie such as

*       the sound tracks used

*       whether to compress 16-bit sound down to format 2 ADPCM (4 bits per
        sample)

*       whether key frames are used

*       the descriptive text

*       the helpful sprite.

3       Drag the Save as icon to a suitable directory display to save the joined movie.

Joining a sound-only movie
--------------------------
You can use AREncode to join sound-only movies. To do this, drag a directory onto
the AREncode icon bar icon. The directory should contain one or more sound files
and a header file. As long as the header file says that there is no video, the Join
button in the Compress window will be selectable.

If you're not sure how to construct a header file, see ARMovie file format.


DISC USE
--------

Working files are stored within the !ARWork application. This application should be
placed on your (writable) work drive (i.e. the one with the most free space).

All files are stored within the directory - !ARWork.Work.AREncode - which is
known as the work root directory.

Within the work root there may be a directory +Sources. This will contain any
movies that were dragged to AREncode direct from another application and so
copies needed to be taken. Otherwise, when compression starts, a directory will be
created with the same name as the leaf name of the source file.

For example, if ADFS::NerveNet.$.Movies.Type3.Film93 is started
compressing, the directory Film93 will be created in the work root and it will be
the work directory for this compression session.

The joined movie will by default be given the same name as the source (e.g.
Film93). The following files will be created within the work directory:

*       Header - a textual header describing the parameters of the compressed
        movie data. Some of this information comes from the source movie, some
        from the options set up in AREncode.

*       Sprite - the default sprite.

*       ImagesN - the compressed data chunks, as many directories as are necessary
        to store all the chunks in numbered from 0. The chunks will be labelled 00, 01,
        02 up to 76

*       KeysN - the key frames for the chunks. Numbering as for ImagesN.

*       StoppedC, StoppedD and StoppedF - saved state. Check points save the
        state every 20 minutes in case of accidents. They are also saved when you
        press Space (in single-tasking mode ) or Suspend (in multi-tasking mode)
        while compression is in progress.

If the Index feature is used (see Using key frames) these file names
(except Sprite) will all be prefixed by the appropriate index value. The output
movie will be postfixed by the same index value.


HINTS AND TIPS
--------------

This section contains some useful hints on using AREncode, and deals with some
problems you might encounter.

Has a movie been compressed?
----------------------------
You can tell whether a movie has already been compressed by dropping it onto an
ARPlayer window and choosing File/Movie info-. The video field for an
uncompressed movie will say something like

Type 3: YYUV uncompressed

Resources not found
-------------------
When you start up AREncode, you might see a message telling you that the
ARMovie resources could not be found. This should only occur if !Boot has not
been run successfully on start up.

Insufficient memory
-------------------
Lack of memory will probably manifest itself with the following error:

No room for this DIM at line xxxx

The solution is to quit some running applications, shrink dynamic areas down as
small as possible (e.g. the font cache, RAM disc and System sprite areas are not
needed) or change to a screen mode using less memory. Note that the
single-tasking mode requires approximately 128kB more than the multi-tasking
mode.

Exact memory usage depends on the configure options selected but is usually not
far short of 2MB, and in practice you'll often need up to 4MB to compress a movie.

Insufficient disc space
-----------------------
Lack of disc space could be more of a problem. If compression has finished
successfully, but there is not enough disc space to join the finished movie, you can
try the following to make more space (first close the Summary window, which will
cause the AREncode window to reopen):

*       If you have enough disc space on a different drive from that containing the
        ARWork directory, then choose Save encoded movie from the application
        menu. This will join the movie directly to the location you choose.

*       Delete some unrelated files on the work drive and choose Join from the
        Control window to try again.

*       If the movie has no sound, or you do not wish to use the original sound, then
        you could delete the source movie. Choose Join from the Control window to try
        again.

Invalid movie file
------------------
When you drag an ARMovie file onto AREncode, the file is scanned. Then, if there
is a work directory of the same name, it is scanned for relevant components (e.g.
Header files). That way, when you restart a compression session, AREncode knows
about any changes that have been made to the header details of a given movie, and
will incorporate those changes.

The header file in the work directory is scanned using the same routines as are
used to scan the header of a Replay file. If, for any reason, the header file in the
work directory is invalid, you'll see the message

Not a movie file

After this, the header file is ignored. It's safe to continue - AREncode will just use
the original header file.

Helpful sprite creation
-----------------------
If you're creating a helpful sprite yourself, you need to create it in the correct mode
for the machine on which you intend the movie to be played. For example, don't
use the new RISC 3.5 or later sprite modes if the movie is going to be played on a
RISC OS 3 machine.
