Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Embedded Zerotree Image Codec with Bior97 SSE Optimized Wavelet-transform

, 20 Oct 2007
This article demonstrates the use of Embedded zero tree still image codec with JPEG 2000 wavelet-filter.

#ifndef CODECY_H
#define CODECY_H

struct CODECHDR {
        char hdr[16];
        unsigned int size;        //compressed size not including header
        unsigned short width;     //image width
        unsigned short height;    //image height
        unsigned short crc;       //check sum including header
        char res[6];              //reserved padding for 8byte alignement

class BaseFWT2D;
class mBior97;
class EZW;

class CodecY

        inline unsigned int width() const;
        inline unsigned int height() const;

        void initgray(unsigned int width, unsigned int height);
        unsigned char* compressgray(const unsigned char* data, unsigned int& size, unsigned int TH = 0);
        int decompressgray(unsigned char* dest, unsigned char* sour);

        int m_status;      //0 - not ready, 1 - OK initilazed
        int m_width;       //original image width
        int m_height;      //original image height

        mBior97 *bior97;   //bior97 class
        EZW *ezw;          //embedded zero-tree class

        unsigned short crc(const unsigned char* addr, unsigned int len) const;         //checksum for a frame        


inline unsigned int CodecY::width() const
        return m_width;

inline unsigned int CodecY::height() const
        return m_height;


     initgray(width, height);
     frame = compressgray(image, *size, TH);        //0 - not initialized error
                                                    //0xaddr - OK addres of compressed frame
     res = decompressgray(image, frame);            //0 - not initialized error
                                                    //-1 - not 'YBior97EZW' header
                                                    //-2 - header width,height not equal to initialized bior97
                                                    //-3 - wrong crc of the frame, data corruption?
                                                    //-4 - EZW decompression error
                                                    //W*H - OK decompressed image size


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Chesnokov Yuriy
Russian Federation Russian Federation
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 20 Oct 2007
Article Copyright 2007 by Chesnokov Yuriy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid