.TH "jpcpack.c" 3 "Fri Jun 3 2022" "Version 1.6.4" "NCEPLIBS-g2c" \" -*- nroff -*- .ad l .nh .SH NAME jpcpack.c \- Pack up a data field into a JPEG2000 code stream\&. .SH SYNOPSIS .br .PP \fC#include \fP .br \fC#include \fP .br \fC#include 'grib2\&.h'\fP .br .SS "Functions" .in +1c .ti -1c .RI "int \fBenc_jpeg2000\fP (unsigned char *, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP, \fBg2int\fP, char *, \fBg2int\fP)" .br .RI "This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i\&.e\&., ISO/IEC 15444-1) using JasPer Software version 1\&.500\&.4 (or 1\&.700\&.2) written by the University of British Columbia, Image Power Inc, and others\&. " .ti -1c .RI "void \fBjpcpack\fP (\fBg2float\fP *fld, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP *idrstmpl, unsigned char *cpack, \fBg2int\fP *lcpack)" .br .RI "This subroutine packs up a data field into a JPEG2000 code stream\&. " .in -1c .SH "Detailed Description" .PP Pack up a data field into a JPEG2000 code stream\&. .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2003-08-17 .RE .PP .PP Definition in file \fBjpcpack\&.c\fP\&. .SH "Function Documentation" .PP .SS "int enc_jpeg2000 (unsigned char * cin, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP nbits, \fBg2int\fP ltype, \fBg2int\fP ratio, \fBg2int\fP retry, char * outjpc, \fBg2int\fP jpclen)" .PP This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i\&.e\&., ISO/IEC 15444-1) using JasPer Software version 1\&.500\&.4 (or 1\&.700\&.2) written by the University of British Columbia, Image Power Inc, and others\&. JasPer is available at http://www.ece.uvic.ca/~mdadams/jasper/\&. .PP PROGRAM HISTORY LOG: .IP "\(bu" 2 2002-12-02 Gilbert .IP "\(bu" 2 2004-12-16 Gilbert - Added retry argument/option to allow option of increasing the maximum number of guard bits to the JPEG2000 algorithm\&. .PP .PP \fBParameters\fP .RS 4 \fIcin\fP Packed matrix of Grayscale image values to encode\&. .br \fIwidth\fP width of image\&. .br \fIheight\fP height of image\&. .br \fInbits\fP depth (in bits) of image\&. i\&.e number of bits used to hold each data value\&. .br \fIltype\fP indicator of lossless or lossy compression\&. .IP "\(bu" 2 1, for lossy compression .IP "\(bu" 2 != 1, for lossless compression .PP .br \fIratio\fP target compression ratio\&. (ratio:1) Used only when ltype == 1\&. .br \fIretry\fP Pointer to option type\&. If 1 try increasing number of guard bits otherwise, no additional options\&. .br \fIoutjpc\fP Output encoded JPEG2000 code stream\&. .br \fIjpclen\fP Number of bytes allocated for new JPEG2000 code stream in outjpc\&. .RE .PP \fBReturns\fP .RS 4 .IP "\(bu" 2 > 0 = Length in bytes of encoded JPEG2000 code stream .IP "\(bu" 2 -3 = Error decode jpeg2000 code stream\&. .IP "\(bu" 2 -5 = decoded image had multiple color components\&. Only grayscale is expected\&. .PP .RE .PP \fBNote\fP .RS 4 Requires JasPer Software version 1\&.500\&.4 or 1\&.700\&.2\&. .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2002-12-02 .RE .PP .PP Definition at line 56 of file enc_jpeg2000\&.c\&. .PP References MAXOPTSSIZE\&. .PP Referenced by jpcpack()\&. .SS "void jpcpack (\fBg2float\fP * fld, \fBg2int\fP width, \fBg2int\fP height, \fBg2int\fP * idrstmpl, unsigned char * cpack, \fBg2int\fP * lcpack)" .PP This subroutine packs up a data field into a JPEG2000 code stream\&. After the data field is scaled, and the reference value is subtracted out, it is treated as a grayscale image and passed to a JPEG2000 encoder\&. It also fills in GRIB2 Data Representation Template 5\&.40 or 5\&.40000 with the appropriate values\&. .PP PROGRAM HISTORY LOG: .IP "\(bu" 2 2003-08-17 Gilbert .IP "\(bu" 2 2004-11-92 Gilbert - Fixed bug encountered when packing a near constant field\&. .IP "\(bu" 2 2004-07-19 Gilbert - Added check on whether the jpeg2000 encoding was successful\&. If not, try again with different encoder options\&. .IP "\(bu" 2 2005-05-10 Gilbert - Imposed minimum size on cpack, used to hold encoded bit string\&. .PP .PP \fBParameters\fP .RS 4 \fIfld\fP Contains the data values to pack\&. .br \fIwidth\fP number of points in the x direction\&. .br \fIheight\fP number of points in the y direction\&. .br \fIidrstmpl\fP Contains the array of values for Data Representation Template 5\&.40 or 5\&.40000\&. .IP "\(bu" 2 0 Reference value - ignored on input, set by jpcpack routine\&. .IP "\(bu" 2 1 Binary Scale Factor - used on input, unchanged by jpcpack routine\&. .IP "\(bu" 2 2 Decimal Scale Factor - used on input, unchanged by jpcpack routine\&. .IP "\(bu" 2 3 number of bits for each data value - ignored on input .IP "\(bu" 2 4 Original field type - currently ignored on input Data values assumed to be reals\&. Set to 0 on output\&. .IP "\(bu" 2 5 if 0 use lossless compression, if 1 use lossy compression\&. .IP "\(bu" 2 6 Desired compression ratio, if idrstmpl[5]=1\&. Set to 255, if idrstmpl[5]=0\&. .PP .br \fIcpack\fP The packed data field\&. .br \fIlcpack\fP length of packed field in cpack\&. .RE .PP \fBAuthor\fP .RS 4 Stephen Gilbert .RE .PP \fBDate\fP .RS 4 2003-08-17 .RE .PP .PP Definition at line 49 of file jpcpack\&.c\&. .PP References enc_jpeg2000(), int_power(), mkieee(), and sbits()\&. .PP Referenced by g2_addfield()\&. .SH "Author" .PP Generated automatically by Doxygen for NCEPLIBS-g2c from the source code\&.