1 #ifndef __LIBSCALER_SWSCALER_H__
2 #define __LIBSCALER_SWSCALER_H__
3 
4 #include "libscaler-common.h"
5 
6 class CScalerSW {
7     protected:
8         char *m_pSrc[3];
9         char *m_pDst[3];
10         unsigned int m_nSrcLeft, m_nSrcTop;
11         unsigned int m_nSrcWidth, m_nSrcHeight;
12         unsigned int m_nSrcStride;
13         unsigned int m_nDstLeft, m_nDstTop;
14         unsigned int m_nDstWidth, m_nDstHeight;
15         unsigned int m_nDstStride;
16     public:
CScalerSW()17         CScalerSW() { Clear(); }
~CScalerSW()18         virtual ~CScalerSW() { };
19         void Clear();
20         virtual bool Scale() = 0;
21 
SetSrcRect(unsigned int left,unsigned int top,unsigned int width,unsigned int height,unsigned int stride)22         void SetSrcRect(unsigned int left, unsigned int top, unsigned int width, unsigned int height, unsigned int stride) {
23             m_nSrcLeft = left;
24             m_nSrcTop = top;
25             m_nSrcWidth = width;
26             m_nSrcHeight = height;
27             m_nSrcStride = stride;
28         }
29 
SetDstRect(unsigned int left,unsigned int top,unsigned int width,unsigned int height,unsigned int stride)30         void SetDstRect(unsigned int left, unsigned int top, unsigned int width, unsigned int height, unsigned int stride) {
31             m_nDstLeft = left;
32             m_nDstTop = top;
33             m_nDstWidth = width;
34             m_nDstHeight = height;
35             m_nDstStride = stride;
36         }
37 };
38 
39 class CScalerSW_YUYV: public CScalerSW {
40     public:
CScalerSW_YUYV(char * src,char * dst)41         CScalerSW_YUYV(char *src, char *dst) {
42             m_pSrc[0] = src;
43             m_pDst[0] = dst;
44         }
45 
46         virtual bool Scale();
47 };
48 
49 class CScalerSW_NV12: public CScalerSW {
50     public:
CScalerSW_NV12(char * src0,char * src1,char * dst0,char * dst1)51         CScalerSW_NV12(char *src0, char *src1, char *dst0, char *dst1) {
52             m_pSrc[0] = src0;
53             m_pDst[0] = dst0;
54             m_pSrc[1] = src1;
55             m_pDst[1] = dst1;
56         }
57 
58         virtual bool Scale();
59 };
60 
61 #endif //__LIBSCALER_SWSCALER_H__
62