NAME

     btc3_compress - a Block Truncation Coding (BTC) scheme using
     predictive multilevel coding

SYNOPSIS

      #include "CVIPtoolkit.h"
      #include "CVIPconvert.h"
      #include "CVIPdef.h"
      #include "CVIPimage.h"
      #include "CVIPhisto.h"
      #include <sys/types.h>
      #include <sys/stat.h>

     int btc3_compress(Image  *inputImage,  char  *filename,  int
     blocksize)

      <inputImage> - pointer to an Image structure
      <filename> - character array
      <blocksize> - blocksize

     Image *btc3_decompress(char *filename)

      <filename> - character array

PATH

     $CVIPHOME/COMPRESSION/m_btc.c

DESCRIPTION

     Predictive multilevel BTC is another form of  block  trunca-
     tion  coding  (see  btc2)  that improves the resulting image
     fidelity compared to the  use  of  the  standard  BTC,  when
     applied to visually complex images. The improvement with the
     predictive method comes  from  the  use  of  interblock  and
     intrablock prediction and vector encoding/decoding, in place
     of the conventional two-level moment-preserving quantizer.

     The function code was developed from "Multilevel Block Trun-
     cation  Coding  Using  a  Minimax  Error Criterion for High-
     Fidelity Compression of Digital Images.", Yiyan Wu and David
     C.  Coll, IEEE TRANSACTIONS ON COMMUNICATIONS. VOL.41, NO.8,
     AUGUST 1993

TYPES AND CONSTANTS

     None

RETURN VALUES

     btc3_compress: 0 on success, -1 on failure

     btc3_decompression:  an  uncompressed   image   pointer   on
     success,a NULL pointer on failure

HISTORY

     History information recorded: None

EXAMPLE

      #include <CVIPtoolkit.h>
      #include <CVIPimage.h>
      #include <CVIPconvert.h>
      #include <CVIPdef.h>
      #include <CVIPhisto.h>
      #include <CVIPcompress.h>

      void main() {
        Image *cvipImage, *outImage;
        IMAGE_FORMAT format;
        char *inputfile, *outputfile;
        int blocksize;

        print_CVIP("\n\t\tEnter the Input File Name:  ");
        inputfile =(char *) getString_CVIP();

        cvipImage = read_Image(inputfile, 1);
        view_Image(cvipImage, inputfile);

        print_CVIP("\n\t\tEnter the block size:");
        blocksize = getInt_CVIP(10, 0, 64);
        print_CVIP("\n\t\tEnter the Compressed File Name:");
        outputfile =(char *) getString_CVIP();

        if (btc3_compress(cvipImage,outputfile,blocksize)<0) {
          error_CVIP("btc3_compress", "compression failed");
          exit(1);
        } else if ((outImage=btc3_decompress(outputfile))==NULL){
          error_CVIP("btc3_decompress", "decompression failed");
          exit(1);
        } else view_Image(outImage, outputfile);

        free(inputfile);
        free(outputfile);
      }

BUGS

     None at this time

SEE ALSO

     libcompress,        btc_compress(),        btc_decompress(),
     btc2_compress(), btc2_decompress()

AUTHOR

     Copyright (C) 1996 SIUE - by Scott  Umbaugh,  Zhen  Li,  and
     Hong Niu.