Click here to Skip to main content
12,402,666 members (72,894 online)
Click here to Skip to main content

Stats

36.7K views
2.8K downloads
26 bookmarked
Posted

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
{
public:
        CodecY();
        ~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);

private:
        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;
}


#endif

/*
     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.

License

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

Share

About the Author

Chesnokov Yuriy
Engineer
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...

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