Click here to Skip to main content
12,945,927 members (52,426 online)
Click here to Skip to main content


26 bookmarked
Posted 20 Oct 2007

Embedded Zerotree Image Codec with Bior97 SSE Optimized Wavelet-transform

, 20 Oct 2007 GPL3
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
Highly skilled Engineer with 14 years of experience in academia, R&D and commercial product development supporting full software life-cycle from idea to implementation and further support. During my academic career I was able to succeed in MIT Computers in Cardiology 2006 international challenge, as a R&D and SW engineer gain CodeProject MVP, find algorithmic solutions to quickly resolve tough customer problems to pass product requirements in tight deadlines. My key areas of expertise involve Object-Oriented
Analysis and Design OOAD, OOP, machine learning, natural language processing, face recognition, computer vision and image processing, wavelet analysis, digital signal processing in cardiology.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 20 Oct 2007
Article Copyright 2007 by Chesnokov Yuriy
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid