History

resolve conflict

volvet committed 12 years ago

Commit ec84f4b1 parent 3958118124 files · +15352 −15696Browse files

Showing the changes to codec/processing/src/downsample/downsample.h (1 of 124 files). Show all

Unified · Split

codec/processing/src/downsample/downsample.h+128−0
@@ -0,0 +1,128 @@
1+/*!
2+ * \copy
3+ * Copyright (c) 2011-2013, Cisco Systems
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright
14+ * notice, this list of conditions and the following disclaimer in
15+ * the documentation and/or other materials provided with the
16+ * distribution.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ * \file : downsample.h
32+ *
33+ * \brief : downsample class of wels video processor class
34+ *
35+ * \date : 2011/03/33
36+ *
37+ * \description : 1. rewrite the package code of downsample class
38+ *
39+ *************************************************************************************
40+ */
41+
42+#ifndef WELSVP_DOWNSAMPLE_H
43+#define WELSVP_DOWNSAMPLE_H
44+
45+#include "../common/util.h"
46+#include "../common/WelsFrameWork.h"
47+#include "../../interface/IWelsVP.h"
48+
49+WELSVP_NAMESPACE_BEGIN
50+
51+
52+typedef void (HalveDownsampleFunc) (uint8_t* pDst, const int32_t kiDstStride,
53+ uint8_t* pSrc, const int32_t kiSrcStride,
54+ const int32_t kiSrcWidth, const int32_t kiSrcHeight);
55+
56+typedef void (GeneralDownsampleFunc) (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
57+ const int32_t kiDstHeight,
58+ uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight);
59+
60+typedef HalveDownsampleFunc* PHalveDownsampleFunc;
61+typedef GeneralDownsampleFunc* PGeneralDownsampleFunc;
62+
63+HalveDownsampleFunc DyadicBilinearDownsampler_c;
64+GeneralDownsampleFunc GeneralBilinearFastDownsampler_c;
65+GeneralDownsampleFunc GeneralBilinearAccurateDownsampler_c;
66+
67+typedef struct {
68+ // align_index: 0 = x32; 1 = x16; 2 = x8; 3 = common case left;
69+ PHalveDownsampleFunc pfHalfAverage[4];
70+ PGeneralDownsampleFunc pfGeneralRatioLuma;
71+ PGeneralDownsampleFunc pfGeneralRatioChroma;
72+} SDownsampleFuncs;
73+
74+
75+#ifdef X86_ASM
76+WELSVP_EXTERN_C_BEGIN
77+// used for scr width is multipler of 8 pixels
78+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx8_sse;
79+// iSrcWidth= x16 pixels
80+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx16_sse;
81+// iSrcWidth= x32 pixels
82+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_sse;
83+// used for scr width is multipler of 16 pixels
84+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx16_ssse3;
85+// iSrcWidth= x32 pixels
86+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_ssse3;
87+// iSrcWidth= x16 pixels
88+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx16_sse4;
89+// iSrcWidth= x32 pixels
90+HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_sse4;
91+
92+GeneralDownsampleFunc GeneralBilinearFastDownsamplerWrap_sse2;
93+GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_sse2;
94+
95+void GeneralBilinearFastDownsampler_sse2 (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
96+ const int32_t kiDstHeight,
97+ uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight,
98+ const uint32_t kuiScaleX, const uint32_t kuiScaleY);
99+void GeneralBilinearAccurateDownsampler_sse2 (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth,
100+ const int32_t kiDstHeight,
101+ uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight,
102+ const uint32_t kuiScaleX, const uint32_t kuiScaleY);
103+WELSVP_EXTERN_C_END
104+#endif
105+
106+
107+
108+
109+class CDownsampling : public IStrategy {
110+ public:
111+ CDownsampling (int32_t iCpuFlag);
112+ ~CDownsampling();
113+
114+ EResult Process (int32_t iType, SPixMap* pSrc, SPixMap* pDst);
115+
116+ private:
117+ void InitDownsampleFuncs (SDownsampleFuncs& sDownsampleFunc, int32_t iCpuFlag);
118+
119+ int32_t GetAlignedIndex (const int32_t kiSrcWidth);
120+
121+ private:
122+ SDownsampleFuncs m_pfDownsample;
123+ int32_t m_iCPUFlag;
124+};
125+
126+WELSVP_NAMESPACE_END
127+
128+#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t