Click here to Skip to main content
15,896,154 members
Articles / Desktop Programming / MFC

Embedded Zerotree Image Codec with Bior97 SSE Optimized Wavelet-transform

Rate me:
Please Sign up or sign in to vote.
4.80/5 (14 votes)
20 Oct 2007GPL36 min read 56.5K   3.3K   26  
This article demonstrates the use of Embedded zero tree still image codec with JPEG 2000 wavelet-filter.

#ifndef Vec1D_h
#define Vec1D_h


/*
  arrange -3 -2 -1 0 +1 +2  indeces array

    vec1D v(6,-3);
     v(-3) = val1;
     v(-2) = val2;
     ...
     v[2] = val6

*/


class vec1D          //16 bit MMX aligned array
{
public:
        vec1D(unsigned int size = 1, int offset = 0, const float* data = 0);
        vec1D(const vec1D& v);
        ~vec1D();

        inline int first() const;                       //return first index into array  m_data[0]
        inline int last() const;                        //return last index into array   m_data[size-1]
        inline unsigned int size() const;               //total size of array
        inline const float* data() const;               //return m_data pointer    
        inline const float* data(int i) const;          //return m_data pointer    
        inline float& operator()(int x);                //operator m_data[x]
        inline float operator()(int x) const;           //const operator m_data[x] for funcs( const vec1D& v )
        inline float& operator[](int x);                //operator m_data[x]
        inline float operator[](int x) const;           //const operator m_data[x] for funcs( const vec1D& v )
        inline const vec1D& operator=(const vec1D& v);  //operator =

private:
        int m_offset;
        int m_last;
        unsigned int m_size;
        float* m_data;

        void init(const vec1D& v);
        void close();

};


inline int vec1D::first() const
{ 
        return m_offset; 
}

inline int vec1D::last() const
{ 
        return m_last; 
}

inline unsigned int vec1D::size() const
{ 
        return m_size; 
}

inline float& vec1D::operator()(int x)
{ 
        return m_data[x];
}

inline float vec1D::operator()(int x) const
{
        return m_data[x];
}

inline float& vec1D::operator[](int x)
{ 
        return m_data[x];
}

inline float vec1D::operator[](int x) const
{
        return m_data[x];
}

inline const vec1D& vec1D::operator=(const vec1D& v)
{
        if (this != &v)
                init(v);
        
        return *this;    
}

inline const float* vec1D::data() const
{ 
        return &m_data[first()]; 
}

inline const float* vec1D::data(int i) const
{
        return &m_data[i]; 
}


#endif

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)


Written By
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.

Comments and Discussions