7.8 SDO_GEOR.compressJP2

Format

SDO_GEOR.compressJP2(
     inGeoRaster    IN SDO_GEORASTER, 
     compressParam  IN VARCHAR2 DEFAULT NULL, 
     outGeoRaster   IN OUT SDO_GEORASTER);

Description

Compresses the image in a GeoRaster object using JPEG 2000 compression.

Parameters

inGeoRaster

The SDO_GEORASTER object whose data is to be compressed.

compressParam

A string specifying one or more keywords for the compression parameter. For an explanation of the available keywords, see the table in the Usage Notes. If not specified, a lossless compression with default value for each keyword is applied.

outGeoRaster

The SDO_GEORASTER object to hold the result of the compression. Must be either a valid existing GeoRaster object or an empty GeoRaster object. (Empty GeoRaster objects are explained in Blank and Empty GeoRaster Objects.) Cannot be the same GeoRaster object as inGeoRaster.

Usage Notes

The output compressed image is in JPEG 2000 (JP2) file format and stored in one raster block of the outGeoRaster object. There are no pyramid raster blocks stored in the raster data table, because the pyramids are stored in the JP2 file as part of the compression.

If not specified in rlevel keyword of compressParam, the maximum number of pyramid level is calculated as: floor(log2(tsize)), where tsize is the minimal value of the tilesize parameter values for rows and columns. If the tiling parameter value isfalse, tsize is the minimal value of the image height and width.

If neither ratio nor psnr is specified, the compression is loss-less

This procedure supports 8–bit and 16–bit source GeoRaster objects. The maximum of number of tiles allowed is 65535.

The following table lists the available compressParam keywords for JPEG 2000 (JP2) compression.

Table 7-1 compressParam Keywords for JPEG 2000 (JP2) Compression

Keyword Explanation

codeBlockSize=(cbrow, cbcol)

Specifies the code block row and column size, where cbrow and cbcol are the size of the code block in rows and columns, respectively. It must be in the range of [4, 1024] and cbrow * cbcol <= 4096. By default, it is 64 x 64.

dwt=reversible | irreversible

Specifies the discrete wavelet transform, where reversible means to use the DWT 5–3 transform, and irreversible means to use the DWT 9–7 transform. Irreversible transforms always result in lossy compression.

mct=true | false

Specifies whether to use multiple component transform. By default, RGB->YCC conversion is used if there are 3 bands or more.

precinctSize=(pcrow, pccol)

Specifies the precinct size, where pcrow and pccol are the size of the precinct in rows and columns, respectively. By default it is 512 x 512 on each resolution.

progressOrder=LRCP|RLCP|RPCL|PCRL|CPRL

Specifies the progression order: LRCP (layer-resolution-component-position progressive, or rate scalable), RLCP (resolution-layer-component-position progressive, or resolution scalable), RPCL (resolution-position-component-layer progressive), PCRL (position-component-resolution-layer progressive), or CPRL (component-position-resolution-layer) progressive. By default, it is LRCP.

psnr=(p1, p2, p3, ...)

Specifies the peak signal-to-noise ratio (PSNR), where p1, p2, p3, ... are the compression PSNR for layer 1, 2, 3, and so on of the JP2 code stream. It should be in increasing order. Example: psnr=(30, 40, 50). By default, the compression is loss-less. This parameter cannot be specified together with the ratio parameter.

ratio=(r1, r2, r3, ...)

Specifies the compression ratio, where p1, p2, p3, ... are the compression ratios for layers 1, 2, 3, and so on of the JP2 code stream. It should be in decreasing order. Example: ratio=(30, 20, 10). By default, the compression is loss-less. This parameter cannot be specified together with the psnr parameter.

rlevel=n

Specifies the number of decompositions of the wavelet transform, and thus the number of pyramids of the image. By default, the level of decomposition is floor(log2(tileSize)).

tileSize=(trow, tcol)

trow and tcol specify the row and column size of the tile. If the tile size is greater than the image size, no tiling is applied.

tiling=true | false

Specifies whether to use tiling in the JPEG2000 compression. By default, tiling is true. If tiling is true and if tileSize is not set, the default tile size is 512 x 512.

Note:

For any numbers in string (VARCHAR2) parameters to GeoRaster subprograms, the period (.) must be used for any decimal points regardless of the locale.

Examples

The following example creates a JPEG 2000 compressed GeoRaster object from the original object. The JP2 file internal tile size is 512 by 512 and the compression ratio values for JP2 layers 1, 2, and 3 are 30, 20, and 10, respectively. (It refers to a table named GEORASTER_TABLE, whose definition is presented after Example 1-1 in Storage Parameters.)

DECLARE
  gr1 sdo_georaster;
  gr2 sdo_georaster;
BEGIN
  INSERT INTO georaster_table (georid, georaster)
    VALUES (4, sdo_geor.init('RDT_1'))
    RETURNING georaster INTO gr2;

  SELECT georaster INTO gr1 FROM georaster_table WHERE georid=1;

  sdo_geor.compressJP2(gr1,’tilesize=(512, 512), ratio=(30, 20, 10)’, gr2);
  UPDATE georaster_table SET georaster=gr2 WHERE georid=4;
  COMMIT;
END;
/