summaryrefslogtreecommitdiff
path: root/libscaler/libscaler-swscaler.h
blob: 085d744d0a183b9c9f782472de5fff4f3d6ff626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef __LIBSCALER_SWSCALER_H__
#define __LIBSCALER_SWSCALER_H__

#include "libscaler-common.h"

class CScalerSW {
    protected:
        char *m_pSrc[3];
        char *m_pDst[3];
        unsigned int m_nSrcLeft, m_nSrcTop;
        unsigned int m_nSrcWidth, m_nSrcHeight;
        unsigned int m_nSrcStride;
        unsigned int m_nDstLeft, m_nDstTop;
        unsigned int m_nDstWidth, m_nDstHeight;
        unsigned int m_nDstStride;
    public:
        CScalerSW() { Clear(); }
        virtual ~CScalerSW() { };
        void Clear();
        virtual bool Scale() = 0;

        void SetSrcRect(unsigned int left, unsigned int top, unsigned int width, unsigned int height, unsigned int stride) {
            m_nSrcLeft = left;
            m_nSrcTop = top;
            m_nSrcWidth = width;
            m_nSrcHeight = height;
            m_nSrcStride = stride;
        }

        void SetDstRect(unsigned int left, unsigned int top, unsigned int width, unsigned int height, unsigned int stride) {
            m_nDstLeft = left;
            m_nDstTop = top;
            m_nDstWidth = width;
            m_nDstHeight = height;
            m_nDstStride = stride;
        }
};

class CScalerSW_YUYV: public CScalerSW {
    public:
        CScalerSW_YUYV(char *src, char *dst) {
            m_pSrc[0] = src;
            m_pDst[0] = dst;
        }

        virtual bool Scale();
};

class CScalerSW_NV12: public CScalerSW {
    public:
        CScalerSW_NV12(char *src0, char *src1, char *dst0, char *dst1) {
            m_pSrc[0] = src0;
            m_pDst[0] = dst0;
            m_pSrc[1] = src1;
            m_pDst[1] = dst1;
        }

        virtual bool Scale();
};

#endif //__LIBSCALER_SWSCALER_H__