Jump to content
IGNORED

File compression


flux

Recommended Posts

Back in the 90s I loved my Jaguar but at some point it ended up in storage and I only decided to dig it out just the other day out of a desire to try my hand at some homebrew stuff. I have a particular project in mind, and I'm under no illusions about the long and difficult road ahead. However, one thing I didn't anticipate but recently read about while doing some initial research is the 6MB limitation for the size of a cartridge game. While I fully accept that it would be some time into development before this is a practical concern, my ultimate goal involves characters with a lot of frames of animation and also several sound (mainly voice) samples.

 

So my question is, are there any libraries for decompressing compressed assets like images and sounds? Nothing that would have to be decompressed in real time like some kind of mp3 player or anything like that, just something that could, during the loading stage, get some compressed data out of its compressed format and into memory so I can cram more of that junk into the rom.

 

I'm mainly trying to get a sense of what's available so I can adjust my goalposts accordingly.

Link to comment
Share on other sites

Thanks for the quick reply! I'll definitely be looking into this. I'm glad it will be getting rolled into the Raptor stuff because that is exactly what I intended to use (which probably goes without saying for anyone starting nowadays). I'm still waiting on my Skunkboard and SCART cable to arrive from a couple of European countries so right now my Jaguar is just sitting there not doing a lot apart from lookin' pretty but a little battle scarred. A couple scratches and some white specks of what I can only guess is paint from some overspray when a room got painted. My brother had my Jaguar for some time so who knows?

 

Wouldn't even power on at first but a can of compressed air to the cartridge slot and the cartridge seemed to clear that up. A google search on that issue brought me to this forum.

 

Incidentally, I feel a little weird like someone famous and important is bothering to answer my dumb question but I am super appreciative.

Edited by flux
Link to comment
Share on other sites

I'm still waiting on my Skunkboard and SCART cable to arrive from a couple of European countries so right now

 

Just a quick heads up, some of the newer Skunkboards I believe do not have bevelled cart edges, and some are on slightly thicker boards than a regular jaguar cart. Using one of these boards can completely destroy your cart slot if you are not careful. Not wanting to scare you off, just take a few minutes before gleefully jamming it in to check first, the bevelled edges can be sorted with a bit of time with some sandpaper / emery board I believe.

 

Other top Skunk tip is get yourself a cheap USB hub and connect to the skunk via that, crazy voodoo at work, but this usually increases throughput to the skunk significantly. Not everyone needs to do this, and thankfully the hubs are usually only a few coins or free anyway.

 

Welcome to the crazy land of 64 bits :D

  • Like 2
Link to comment
Share on other sites

  • 4 years later...

JagPEG is the predecessor of BPEG. There's some info on it, but no source code (that I know of):

Quote

-------------------------------------
JagPeg Conversion Tools version 1.5
PC Version Release 1.2
Release Date: 9/24/94

CONFIDENTIAL INFORMATION
-------------------------------------

Copyright 1993 Atari Corp. All Rights Reserved.
Author: Mike Pooler, Atari Corp.
Update: Mike Fulton, Atari Corp.

Introduction
------------

This describes how to use TGAJAG, a group of utility programs that convert a
Targa file (.TGA) to a JagPeg file (.JAG).

Background: JagPeg is Atari's version of JPEG.  A JagPeg file has a .JAG
extension, and it contains one compressed 24-bit true color bitmap.  It is
uncompressed by a program called DEJAG, which runs in the Jaguar's GPU.
DEJAG is described seperatly (see DEJAG.DOC).

The main utility for performing the conversion process is named TGAJAG.  On
MS-DOS, TGAJAG is an executable program named TGAJAG.EXE.


Input Files
-----------

TGAJAG takes the filename of a Targa file as its first argument.  The Targa
file must be:

- Uncompressed (Image type 2)

- 24-bits per pixel

- A multiple of 8 pixels in width
  (If HALF or QUAD subsampling, a multiple of 16 pixels in width)
  (Subsampling is explained below)

- A multiple of 8 pixels in height
  (If QUAD subsampling, a multiple of 16 pixels in height)

Some Targa files which meet the above requirements are stored from bottom-up,
(with the first screen-line at the end of the file), others from top-down.
Both types are supported by TGAJAG.

 

Output Files
------------

TGAJAG writes two files as output.  The first is a JagPeg file (.JAG), which
has this format:

[Word 0]  JagPeg version number (currently 1)

[Word 1]  Picture format code

        1: YCrCb with no subsampling
            2: YCrCb with HALF subsampling
            3: YCrCb with QUAD subsampling

[Word 2]  Width in 8-pixel blocks (e.g. 40 == 320 pixels)

[Word 3]  Height in 8-pixel blocks

[Data...]

The second output file from TGAJAG is a file containing a dequantization table
for the requested compression quality, which is required by the JPEG decoding
routines.  This file will named 'DQ??.DAT' (where the ?? is the quality
percentage).

 

Using TGAJAG
------------

TGAJAG for MSDOS takes a command line of the form:

   TGAJAG [-quality n] [-quiet] [-o outputfile] [-quad | -half] inputfile

The command line options may be used in any order, but only one input file
may be specified, or else an error is generated.

-quality n      Sets the JPEG compression quality/compression ratio percentage.
                The value 'n' must be between 1-100.  The higher the value,
                the higher the image quality and the less the image is
        compressed.

-quiet          Supresses status messages from being shown on screen during
                the conversion process.

-o outputfile   Allows you to specify the desired filename of the converted
                picture file that will be output.

-quad or -half  Specify either QUAD or HALF subsampling.  The default is to
                use neither QUAD or HALF subsampling.  See below for more
        information.

inputfile       This parameter is the filename of the .TGA Targa picture file
        to be converted.  You may leave off the ".TGA" extension if
        you want.  The resulting .JAG file will be placed into the
        same directory as the inputfile, but the DQ??.DAT file will
        be placed into the current directory.

Examples:

   tgajag -quality 60 cat

will convert CAT.TGA to CAT.JAG with quality setting of 60.


   tgajag -half -quality 75 ship

will convert SHIP.TGA to SHIP.JAG, using HALF subsampling, and a quality
setting of 75.

 


Image Quality
-------------

For most purposes, an image quality setting between 60 and 80 will provide
the best balance between compression ratio and quality.  High quality
settings give less lossy compression, thus larger .JAG file sizes.  Lower
numbers get you better compression and smaller files, but if the number is
too low you will get a visable degradation in visual quality (this will
appear as fuzzyness and/or blockiness).

The goal is to find a quality setting that gives you acceptable compression
and a picture that is is nearly indistinguishable from the original .TGA,
visually.  This "ideal" setting is different for different pictures, so it's
a matter of trial and error.

The default quality setting is 75, which is usually a good starting point.
If you go much above 75 you lose more and more compression without a
significant gain in image quality.

TGAJAG produces a unique "dequantize" table for each quality setting, which
is used during the decompression process (see DEJAG.DOC).

 

SUBSAMPLING
-----------

You also have the option of using HALF subsampling or QUAD subsampling.

HALF subsampling means that the picture's color components are cut to half
their horizontal size before processing by CJPEG.  (The luminance component
is left as is).  While this is quite lossy, it often produces little visable
change in the final output, while getting a good reduction in size.  We
recommend that you use HALF subsampling as your default starting point.

QUAD subsampling means that the picture's color components are cut to one
quarter the original size (half vertical, half horizontal) before processing.
Size reductions over HALF are less dramatic, visual differences are more
dramatic.  It may be worth a try, but we recommend HALF as your best option.

Remember if you use HALF or QUAD, picture width must be a multiple of 16
pixels (instead of 8).  If you use QUAD, picture height must be a mulitple of
16 pixels.

Decompression speed is DIRECTLY related to .JAG size.  A .JAG file that is
30% smaller than another will usually decompress in about 30% less time.

 


Notes
-----

Free disk space requirements for TGAJAG are such that you should have at
least double the size of your TGA file, to be safe, before running TGAJAG
(e.g.  for a 200K TGA file, have 400K free).

Note that the utilities do not all detect disk-full conditions, and they will
probably do a whole lot of nothing once disk space runs out (even if they
look like they're working).

If the final JAG file is larger than you expect, try using HALF subsampling
and/or a lower quality setting.

There is little error checking - if you feed it an illegal Targa picture (see
above), or a bad filename, it may do ungraceful things.


v1.2 Release Notes:
-------------------

The MSDOS version formerly used the batch files TGAJAG.BAT, TGAJAGH.BAT, and
TGAJAGQ.BAT to run the various steps of the conversion process.  They have
been replaced by TGAJAG.EXE, which performs the same operation, but with
better control over the various options and with better error checking.

Note also that the archive setup has been changed so that the tools install
into the JAGUAR\BIN directory instead of JAGUAR\BIN\TGAJAG.  This was done so
that you can call the conversion utilities directly from your project's
directory, rather than changing to the utilities directory.  Please note that
the JAGUAR\BIN\TGAJAG directory is no longer used by the archives at all.

To avoid filename conflicts with other utilities, the filenames of the JAGPEG
compression utilities have been changed.  Basically, a "j" was added to the
beginning of the filename.  The old names and new names are shown below.

Old Name  New Name
--------  --------
STRIP     JSTRIP
QUAD      JQUAD
MERGE     JMERGE
MERGEH    JMERGEH
MERGEQ    JMERGEQ
SPLIT     JSPLIT
SPLITH    JSPLITH
SPLITQ    JSPLITQ
MAKEQ     JMAKEQ
CJPEG     JCJPEG

Normally you don't call these programs yourself directly; they are called by
the TGAJAG program.  If you have old versions of these files, please delete
them.


v1.1 Release Notes:
-------------------
Earlier versions of the PC version of the MAKEQ tool (one of the utilities
called by TGAJAG) did not work correctly, but this has now been fixed.

Earlier versions of the TGAJAG tools used an .ABS extension for the DQ??.ABS
files they created.  This has been changed to create a DQ??.DAT file instead,
to avoid confusion with the .ABS files created by the ALN linker.

 

Link to comment
Share on other sites

13 hours ago, laymanpigeon said:

Cool and how much smaller is file size of JagPEG compared to JPEG for same resolution?

Never checked, but I don't think it claims to compress any better than ordinary JPEG. From my understanding, it's just a variation that's better suited for implementation on the Jaguar hardware.

Link to comment
Share on other sites

3 hours ago, Zerosquare said:

Never checked, but I don't think it claims to compress any better than ordinary JPEG. From my understanding, it's just a variation that's better suited for implementation on the Jaguar hardware.

Okay and its use was just for compression to fit as much in cartridge ROM?

Or could it have been stored in RAM and used in games as it is compressed?

Link to comment
Share on other sites

Welcome to the forum, I'm glad you found here. It's a great place to be at if you are a Jaguar, or indeed, any Atari fan.  Join the fun and excitement around these machines.

 

However, it takes a special kind of bravado to tell people who've been here for decades, have written games for the system, designed hardware for the system and, in SCPCDs case, designed an FPGA Jaguar how you think the Jaguar works, and then start to argue points when you are informed you are wrong.

 

Just a tip: Don't do that.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

I am indifferent if someone is glad or not that I am here.

However you do not have argument as evident by you asserting about how "I think" Jaguar's hardware works.

You can think about that and speculate what that means rather than attribute some of things I wrote as being my own interpretation of Jaguar's hardware.

  • Haha 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...