Subversion Repositories seema-scanner

Rev

Rev 27 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 jakw 1
#ifndef CODEC_H
2
#define CODEC_H
3
 
4
#include <vector>
5
#include <opencv2/opencv.hpp>
6
 
7
enum CodecDir {CodecDirNone = 0,
8
               CodecDirHorizontal = 1 << 0,
9
               CodecDirVertical = 1 << 1,
10
               CodecDirBoth = CodecDirHorizontal | CodecDirVertical};
11
 
12
// Base class for all encoders
13
class Encoder {
14
    public:
15
        Encoder(unsigned int _screenCols, unsigned int _screenRows, CodecDir _dir = CodecDirHorizontal) : N(0),screenCols(_screenCols), screenRows(_screenRows),  dir(_dir){}
16
        unsigned int getNPatterns(){return N;}
17
        CodecDir getDir(){return dir;}
18
        // Encoding
19
        virtual cv::Mat getEncodingPattern(unsigned int depth) = 0;
20
        virtual ~Encoder(){}
21
    protected:
22
        unsigned int N;
23
        unsigned int screenCols, screenRows;
24
        CodecDir dir;
25
};
26
 
27
class Decoder {
28
    public:
29
        Decoder(unsigned int _screenCols, unsigned int _screenRows, CodecDir _dir = CodecDirHorizontal) : N(0), screenCols(_screenCols), screenRows(_screenRows),  dir(_dir){}
30
        unsigned int getNPatterns(){return N;}
31
        CodecDir getDir(){return dir;}
32
        // Decoding
33
        virtual void setFrame(unsigned int depth, const cv::Mat frame) = 0;
34
        virtual void decodeFrames(cv::Mat &up, cv::Mat &vp, cv::Mat &mask, cv::Mat &shading) = 0;
35
        virtual ~Decoder(){}
36
    protected:
37
        unsigned int N;
38
        unsigned int screenCols, screenRows;
39
        CodecDir dir;
40
};
41
 
42
#endif // CODEC_H