Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

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

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

libibs(3X)

ibs_zoom(3X)

ibs_encode(3X)

ibs_decode(3X)

ibs_geioerror(3X)

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

NAME

ibs_2dzoom_open, ibs_2dzoom, ibs_2dzoom_getworksize, ibs_2drzoom_open, ibs_2drzoom − magnifies or reduces images data on the horizontal axis

SYNOPSIS

ibs_2dzoom_open(iniw, inx, inw, inh, outiw, outx, outw, outh,
flag, mode, work, inf, inarg, outf, outarg)
int iniw, inx, inw, inh;
int outiw, outx, outw, outh, flag, mode;
int ∗work;
int (∗inf)();
int inarg;
int (∗outf)();
int outarg;

ibs_2dzoom(inimgadr, outimgadr, work)
char ∗inimgadr, ∗outimgadr;
int ∗work;

ibs_2drzoom_open(iniw, inx, inw, inrh, outiw, outx, outw, outrh,
flag, mode, work, inf, inarg, outf, outarg)
int iniw, inx, inw, inrh;
int outiw, outx, outw, outrh, flag, mode;
int ∗work;
int (∗inf)();
int inarg;
int (∗outf)();
int outarg;

ibs_2drzoom(c, inimgadr, outimgadr, work)
int c;
char ∗inimgadr, ∗outimgadr;
int ∗work;

ibs_2dzoom_getworksize(iniw, inw, outiw, outw, flag, mode)
int iniw, inw, outiw, outw, flag, mode;

DESCRIPTION

These functions are for magnifing/reducing images on the vertical (y) axis, after magnifing/reducing them on the horizontal (x) axis on line at a time. 

ibs_2dzoom_open and ibs_2dzoom magnify or reduce image data on vertical axis using the values inh and outh as height. 

ibs_2drzoom_open and ibs_2drzoom magnify or reduce image data on vertical axis, using the values inrh and outrh as the ratio of height between input data and output data. 

ibs_2dzoom_open sets the necessary variables for performing image magnification or reduction. 

iniw, inx, inw and inh specify the input data area. 
outiw, outx, outw and outh specify the area where output data is stored. 
iniw and outiw specify the image width (in dots) of the image data.  They must be multiples of 8. 
inx and outx specify, in dot units where the left edge is designated as 0, the position in the line where data is actually to be placed. 
inw and outw specify the length (in dots) of image data.  In all cases, (inx+inw) must not exceed iniw or (outx+outw) must not exceed outiw.
inh is the height of input image while outh is the height of output image. 
flag is passed to outf without any modification. 
mode is set to 0 and function is reduction, adjoined dots are logical added. 
work specifies the internal work area whose size must be greater or equal to the return value of ibs_2dzoom_getworksize. 
This work area must not be altered until zoom is completely finished.
inf and outf are the pointers for I/O functions.  inf and outf can be set to 0, in which case the default I/O function is used.  In this case, the further knowledge about the I/O function and internal data format is not required. 
inarg and outarg are passed to inf and outf without any modification. 

inf is an input function for converting the image data, once it has been read in, into an array of change-points. 
If inf is set to 0, the default input function ibs_encode is called.  The inf input function is used as follows, and the return value must be negative in case of an error. 

int (∗inf)(inarg, imgadr, iw, w, x, sline, flag)
int inarg;char ∗imgadr;
int iw, w, x;
int ∗sline;
int flag;

The values set using ib_2dzoom_open are passed as inarg and flag.
iniw, inw and inx are passed to iw, w and x respectively without any modification. 
inimgadr is passed to imgadr
In this function, the image data specified by imgadr must not be changed. 
sline specifies the change-point array, having the size of ( inw + 2 ) ∗ 4.
Refer to ibs_encode or ibs_decode for information on change-point array. 

outf is the output function that reconstitutes image data from 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 results 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 set using ib_2dzoom_open is passed as outarg and flag.
outiw, outw and outx are passed as iw, and x.
outimgadr is passed as imgadr.
sline specifies a change-point array.  In this function, sline must not be altered. 
Refer to ibs_encode or ibs_decode for information on change-point array. 

ibs_2drzoom_open sets the necessary variables for actual magnification and reduction as ibs_2dzoom_open.  Here, the ratio of height between the input ;image and output image is set as inrh and outrh instead of inh and outh in ibs_2dzoom_open. 

ibs_2dzoom actually magnifies and reduces the image. 
inimgadr and outimgadr are used specify the input and output buffers. 
inimgadr and outimgar must be even-numbered addresses. 

ibs_2drzoom actually reduces and magnifies the data. 
It has the same function as ibs_2dzoom when c is not 0. 
When c is 0, ibs_2dzoom returns 0 after writing any line if any line is not yet written. 

ibs_2dzoom_getworksize returns the size of area needed for work. If, for example, images of different sizes are to be processed, the largest value must be used.  The value returned is (( inw + 2) ∗ 8) + outiw ∗ 2 / 8 + 256 in current version. 

EXAMPLE

When ibs_2dzoom_open and ibs_2dzoom are used,

.
.
.
w8 = iniw / 8;
ow8 = outiw / 8;
if ((err = ibs_2dzoom_open(iniw, inx, inw, inh,
outiw, outx, outw, outh, flag, mode, work, inf, inarg,
outf, outarg)) < 0) {
exit(1);
}
do {
switch(err = ibs_2dzoom(inimgadr, outimgadr, work)) {
case 1: /∗ output line is updated ∗/
outimgadr += ow8;
break;
case 2: /∗ input line is updated ∗/
inimgadr += w8;
break;
case 3: /∗ both input, output lines are updated ∗/
inimgadr += w8;
outimgadr += ow8;
break;
case 0: /∗ processing of all lines complete ∗/
goto end;
default: /∗ error ∗/
exit(1);
}
}while(1);
end:
.
.
.

In 2-dimension expansion and reduction, the expansion and reduction on horizontal axis can be executed only calling functions.  But on the vertical axis, there are choices of skipping the input lines (reduction), using the same input line again (expansion) and using new line for input and output lines.  When processings of all lines are complete, 0 is returned. 

If ibs_2drzoom_open and ibs_2drzoom are used,

.
.
.
w8 = iniw / 8;
ow8 = outiw / 8;
if((err = ibs_2drzoom_open(iniw, inx, inw, inrh,
outiw, outx, outw, outrh, flag, mode, work, inf, inarg,
outf, outarg)) < 0) {
exit(1);
}
for(c = outh; −−c >= 0;) {
switch(err = ibs_2drzoom(c, inimgadr, outimgadr, work)) {
case 1: /∗ output line only is updated ∗/
outimgadr += ow8;
break;
case 2: /∗ input line only is updated ∗/
inimgadr += w8;
break;
case 3: /∗ both input and output lines are updated ∗/
inimgadr += w8;
outimgadr += ow8;
break;
case 0: /∗ processings of all lines complete ∗/
goto end;
default: /∗ error ∗/
exit(1);
}
};
.
.
.

In case of ibs_2drzoom_open and ibs_2drzoom, inh and outh (actual height of input and output) of ibs_2dzoom_open and ibs_2dzoom is not used but inrh and outrh (ratio of height of input vs output) is used.  Here, the last line should be declared by setting c to 0. 
ibs_2drzoom returns 0 when c is 0. 

RETURN VALUE

When processings have resulted in success, ibs_2dzoom_open returns 0. 
 
ibs_2dzoom and ibs_2drzoom return either one of four values of 0, 1, 2 and 3.  Refer to example for values. 
When parameter has error, −1 is returned.

If inf has an error, −2 is returned.  If outf results in error, −3 is returned. 
If the work area
 
work is destroyed, −4 is returned. 

To determine if any errors were returned by inf and outf use ibs_getioerror. 

FILES

/usr/sony/lib/libibs.a

SEE ALSO

libibs(3X), ibs_zoom(3X), ibs_encode(3X), ibs_decode(3X), ibs_geioerror(3X)

NEWS-OSRelease 4.2.1R

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