Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ibs_g3expand2d(3X) — NEWS-os 4.2.1R

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

libibs(3X)

ibs_encode(3X)

ibs_getioerror(3X)

IBS_EXPAND(3X)  —  NEWS-OS Programmer’s Manual

NAME

ibs_g3expand1d_open, ibs_g3expand1d, ibs_g3skip1d, ibs_g3expand2d_open, ibs_g3expand2d, ibs_g3skip2d, ibs_expandtiff_open, ibs_expandtiff, ibs_g4expand_open, ibs_g4expand, ibs_exp_getworksize − Restores compressed data to its original form

SYNOPSIS

ibs_g3expand1d_open(iw, x, w, flag, work, inf, inarg, inbuf, inbufsize, outf, outarg)
int iw, x, w, flag;
int ∗work;
int (∗inf)();
int inarg;
char ∗inbuf;
int inbufsize;
int (∗outf)();
int outarg;

ibs_g3expand1d(imgadr, work)
char ∗imgadr;
int ∗work;

ibs_g3skip1d(work, pnbyte)
int ∗work;
int ∗pnbyte;

ibs_g3expand2d_open(iw, x, w, flag, work, inf, inarg, inbuf, inbufsize, outf, outarg)
int iw, x, w, flag;
int ∗work;
int (∗inf)();
int inarg;
char ∗inbuf;
int inbufsize;
int (∗outf)();
int outarg;

ibs_g3expand2d(imgadr, work)
char ∗imgadr;
int ∗work;

ibs_g3skip2d(work, pnbyte)
int ∗work;
int ∗pnbyte;

ibs_expandtiff_open(iw, x, w, flag, work, inf, inarg, inbuf, inbufsize, outf, outarg)
int iw, x, w, flag;
int ∗work;
int (∗inf)();
int inarg;
char ∗inbuf;
int inbufsize;
int (∗outf)();
int outarg;

ibs_expandtiff(imgadr, work)
char ∗imgadr;
int ∗work;

ibs_g4expand_open(iw, x, w, flag, work, inf, inarg, inbuf, inbufsize, outf, outarg)
int iw, x, w, flag;
int ∗work;
int (∗inf)();
int inarg;
char ∗inbuf;
int inbufsize;
int (∗outf)();
int outarg;

ibs_g4expand(imgadr, work)
char ∗imgadr;
int ∗work;

ibs_exp_getworksize(w, flag, mode)
int w, flag, mode;

DESCRIPTION

ibs_g3expand1d_open, ibs_g3expand1d and ibs_g3skip1d restore 1-dimension coded compressed data to non-compressed image data format. 

ibs_g3expand2d_open, ibs_g3expand2d and ibs_g3skip2d restore 2-dimension coded compressed data to non-compressed image data format. 

ibs_expandtiff_open and ibs_expandtiff restore compressed data using TIFF Data Compression Scheme 2 to non-compressed image data format. 

ibs_g4expand_open and ibs_g4expand restore data compressed in the high efficiency 2-dimensional method to non-compressed image data format. 

For example, to decompress 2-dimension coded data, first ibs_g3expand2d_open is called, and then ibs_g3expand2d is called once per line.  this operation and result of expansion is not dependent on the K parameter on compression time. 
Neither is it dependent on the presence or absence of fill bits.

If decompression of 1-dimension coded data or 2-dimension coded data results in error due to error of compressed data, decompression can continue, skipping the input compressed data until the next reconstitutable data, by calling ibs-g3skip1d or ibs_g3skip2d. 

ibs_g3expand1d_open, ibs_g3expand2d_open, ibs_g3expandtiff_open and ibs_g4expand_open set the variables necessary for expanding compressed files.  The area where the decompressed data is to be stored is specified by iw, x and w.
iw is the image width (in dots) of the image data. 
x specifies, in dot units where the left edge is designated as 0, the position in the line where data is actually to be placed.  w is the length (in dots) of image data. In any case, x+w must not exceed iw.
flag specifies the bit order of the code data and is used for iw, imgadr. 
If the lowest bit of flag is set to 0, the coded data will be handled according to the LSB (Least Significant Bit) format.  If it is set to 1, the data format is considered to be MSB (Most Significant Bit). 
If bit 1 of flag is 1, iw can be multiples of 8, and odd address can be used for imgdr to be described later.  If bit 1 is 0, iw must be multiples of 16, and imgadr should be even address. 
Note that the bit order for facsimile data is LSB first.
This setting is passed directly to outf.
work specifies the internal work area whose size must be greater or equal to the return value of function ibs_exp_getworksize. 
This work area must not be altered until expansion is completely finished.

inf and outf are pointers of the I/O functions used when expanding data.  It is possible to set outf to NULL, in which case the default output function is used.  In this case, the further knowledge about the input function and internal data format is not required. 
inbuf specifies the buffer to which code data is input.  the address set using inbuf must be an even number. 
inbufsize specifies the length of inbuf. I must be 4 bytes or greater.
inarg and outarg are passed directly to the I/O functions specified by inf and outf

inf is an input function; which reads in the code data.  The inf input function is invoked as follows.  The value returned is the length of the data read in, and it must be negative in case of error. 

int (∗inf)(arg, buf, size)
int arg;
char ∗buf;
int size;

The values set for ibs_g3expand1d_open, ibs_g3expand2d_open, ibs_g3expandtiff_open and ibs_g4expand_open are passed directly to the input function as arguments.  inarg is passed without modification to arg. inbuf is passed without modification to buf. inbufsize is passed without modification to size.
At the point this function is called, data of length size bytes is output from buf.

outf is a pointer to the output function that reconstitutes the image data from the change-point array and writes it to the output buffer.  If outf is set to NULL, the default output function ibs_decode is called. 
Here the output function outf is used as follows, and the return value must be such that it result in a negative value in case of an error. 

int (∗outf)(outarg, imgadr, iw, w, x, sline, flag)
int outarg;
char ∗imgadr;
int iw, w, x;
int ∗sline;
int flag;

The values passed as outarg, iw, w, x and flag are the settings of ibs_g3expand1d_open, ibs_g3expand2d_open, ibs_g3expandtiff_open and ibs_g4expand_open. 
To imgadr is passed the setting of ibs_g3expand1d, ibs_g3expand2d, ibs_g3expandtiff or ibs_g4expand. 
sline specifies the change-point array.  Its size is ( w + 2 ) ∗ 4.  sline must not be modified within this function. 
Refer to ibs_encode and ibs_decode for information on change-point arrays. 

ibs_g3expand1d, ibs_g3expand2d, ibs_expandtiff and ibs_g4expand actually expand only one line of data at a time.  When there is insufficient code data, the input function specified by inf is called. 
After expansion of a line is complete, output function outf is called. 
imgadr is 0, control is returned without calling output function after expansion of the line is complete.  If bit 1 of flag is 1, imgadr can be of any address.  But, if bit 1 is 0, even address is allowed. 

If expansion results in error with ibs_g3expand1d and ibs_g3expand2d, the input compressed data can be skipped until the next reconstitutable data, by calling ibs_g3skip1d and ibs_g3skip2d.  If they are called without any error, input compressed data are skipped until next reconstitutable data. 
pnbyte returns the skipped data in byte unit. 

ibs_exp_getworksize returns the size of the area needed by work. If, for example, images of different sizes are to be processed, the larger value must be used. The value returned is (( w + 2) ∗ 8) + 256 in current version. 

RETURN VALUES

ibs_g3expand1d_open, ibs_g3expand2d_open, ibs_expandtiff_open and ibs_g4expand_open return 0 if processing completes successfully, and −1 if a parameter error is encountered. 
If inf results in an error,  −2 is returned. 

The value returned by ibs_g3expand1d, ibs_g3expand2d, ibs_expandtiff and ibs_g4expand in case of successful completion is iw/8. 0 is returned when the data is expanded up to the RTC or EOFB.
If ibs_g3skip1d and ibs_g3skip2d have completed expansion correctly, the amount of skipped lines are returned. 
If the code data is incorrect or if the bit 1 of flag is 0, and imgadr is not an even number, −1 is returned. 
If inf results in an error, −2 is returned.  If outf results in an error, −3 is returned. 
If the work area is destroyed, −4 is returned.
If non-compressed mode is detected, −6 is returned.

To determine if any errors were returned by inf or outfm, use ibs_getioerror. 

FILES

/usr/sony/lib/libibs.a

SEE ALSO

libibs(3X), ibs_encode(3X), ibs_getioerror(3X). 
 

NEWS-OSRelease 4.2.1R

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026