Showing the changes to processing/interface (1 of 225 files). Show all
Unified · Split
| @@ -1,304 +1,286 @@ | ||
| 1 | −/*! | |
| 2 | − * \copy | |
| 3 | − * Copyright (c) 2004-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 | − * | |
| 32 | − * \file : IWelsVP.h | |
| 33 | − * | |
| 34 | − * \brief : Interface of wels video processor class | |
| 35 | − * | |
| 36 | − * \date : 2011/01/04 | |
| 37 | − * | |
| 38 | − * \description : 1. should support both C/C++ style interface | |
| 39 | − * 2. should concern with the feature extension requirement | |
| 40 | − * 3. should care the usage of "char"==> | |
| 41 | − * 1) value char : signed char/unsigned char | |
| 42 | − * 2) string char : char | |
| 43 | − * | |
| 44 | − ************************************************************************************* | |
| 45 | − */ | |
| 46 | − | |
| 47 | −#ifndef _IWELSVP_H_ | |
| 48 | −#define _IWELSVP_H_ | |
| 49 | − | |
| 50 | −#ifdef _WIN32 | |
| 51 | −#define WELSAPI __stdcall | |
| 52 | −#else | |
| 53 | −#define WELSAPI | |
| 54 | −#endif | |
| 55 | − | |
| 56 | −#define WELSVP_MAJOR_VERSION 1 | |
| 57 | −#define WELSVP_MINOR_VERSION 1 | |
| 58 | −#define WELSVP_VERSION ((WELSVP_MAJOR_VERSION << 8) + WELSVP_MINOR_VERSION) | |
| 59 | − | |
| 60 | −typedef enum | |
| 61 | −{ | |
| 62 | − RET_SUCCESS = 0, | |
| 63 | − RET_FAILED = -1, | |
| 64 | − RET_INVALIDPARAM = -2, | |
| 65 | − RET_OUTOFMEMORY = -3, | |
| 66 | − RET_NOTSUPPORTED = -4, | |
| 67 | − RET_UNEXPECTED = -5, | |
| 68 | − RET_NEEDREINIT = -6 | |
| 69 | −} EResult; | |
| 70 | − | |
| 71 | −typedef enum | |
| 72 | −{ | |
| 73 | − VIDEO_FORMAT_NULL = 0, /* invalid format */ | |
| 74 | − /*rgb color formats*/ | |
| 75 | − VIDEO_FORMAT_RGB = 1, /* rgb 24bits */ | |
| 76 | − VIDEO_FORMAT_RGBA = 2, /* rgba */ | |
| 77 | − VIDEO_FORMAT_RGB555 = 3, /* rgb555 */ | |
| 78 | − VIDEO_FORMAT_RGB565 = 4, /* rgb565 */ | |
| 79 | − VIDEO_FORMAT_BGR = 5, /* bgr 24bits */ | |
| 80 | − VIDEO_FORMAT_BGRA = 6, /* bgr 32bits */ | |
| 81 | − VIDEO_FORMAT_ABGR = 7, /* abgr */ | |
| 82 | − VIDEO_FORMAT_ARGB = 8, /* argb */ | |
| 83 | − | |
| 84 | − /*yuv color formats*/ | |
| 85 | − VIDEO_FORMAT_YUY2 = 20, /* yuy2 */ | |
| 86 | − VIDEO_FORMAT_YVYU = 21, /* yvyu */ | |
| 87 | − VIDEO_FORMAT_UYVY = 22, /* uyvy */ | |
| 88 | − VIDEO_FORMAT_I420 = 23, /* yuv 4:2:0 planar */ | |
| 89 | − VIDEO_FORMAT_YV12 = 24, /* yuv 4:2:0 planar */ | |
| 90 | − VIDEO_FORMAT_INTERNAL = 25, /* Only Used for SVC decoder testbed */ | |
| 91 | − VIDEO_FORMAT_NV12 = 26, /* y planar + uv packed */ | |
| 92 | − VIDEO_FORMAT_I422 = 27, /* yuv 4:2:2 planar */ | |
| 93 | − VIDEO_FORMAT_I444 = 28, /* yuv 4:4:4 planar */ | |
| 94 | − VIDEO_FORMAT_YUYV = 20, /* yuv 4:2:2 packed */ | |
| 95 | − | |
| 96 | − VIDEO_FORMAT_RGB24 = 1, | |
| 97 | − VIDEO_FORMAT_RGB32 = 2, | |
| 98 | − VIDEO_FORMAT_RGB24_INV = 5, | |
| 99 | − VIDEO_FORMAT_RGB32_INV = 6, | |
| 100 | − VIDEO_FORMAT_RGB555_INV = 7, | |
| 101 | − VIDEO_FORMAT_RGB565_INV = 8, | |
| 102 | − VIDEO_FORMAT_YUV2 = 21, | |
| 103 | − VIDEO_FORMAT_420 = 23, | |
| 104 | − | |
| 105 | − VIDEO_FORMAT_VFlip = 0x80000000 | |
| 106 | −} EVideoFormat; | |
| 107 | − | |
| 108 | −typedef enum | |
| 109 | −{ | |
| 110 | − BUFFER_HOSTMEM = 0, | |
| 111 | − BUFFER_SURFACE | |
| 112 | −} EPixMapBufferProperty; | |
| 113 | − | |
| 114 | −typedef struct | |
| 115 | −{ | |
| 116 | − int iRectTop; | |
| 117 | − int iRectLeft; | |
| 118 | − int iRectWidth; | |
| 119 | − int iRectHeight; | |
| 120 | −} SRect; | |
| 121 | − | |
| 122 | −typedef struct | |
| 123 | −{ | |
| 124 | − void *pPixel[3]; | |
| 125 | − int iSizeInBits; | |
| 126 | − int iStride[3]; | |
| 127 | − SRect sRect; | |
| 128 | − EVideoFormat eFormat; | |
| 129 | − EPixMapBufferProperty eProperty;//not use? to remove? but how about the size of SPixMap? | |
| 130 | −} SPixMap; | |
| 131 | − | |
| 132 | −typedef enum | |
| 133 | −{ | |
| 134 | − METHOD_NULL = 0, | |
| 135 | − METHOD_COLORSPACE_CONVERT ,//not support yet | |
| 136 | − METHOD_DENOISE , | |
| 137 | − METHOD_SCENE_CHANGE_DETECTION , | |
| 138 | − METHOD_DOWNSAMPLE , | |
| 139 | − METHOD_VAA_STATISTICS , | |
| 140 | − METHOD_BACKGROUND_DETECTION , | |
| 141 | − METHOD_ADAPTIVE_QUANT , | |
| 142 | − METHOD_COMPLEXITY_ANALYSIS , | |
| 143 | − METHOD_IMAGE_ROTATE , | |
| 144 | − METHOD_MASK | |
| 145 | −} EMethods; | |
| 146 | − | |
| 147 | −//-----------------------------------------------------------------// | |
| 148 | −// Algorithm parameters define | |
| 149 | −//-----------------------------------------------------------------// | |
| 150 | − | |
| 151 | −typedef struct | |
| 152 | −{ | |
| 153 | − int bSceneChangeFlag; // 0:false ; 1:true | |
| 154 | −} SSceneChangeResult; | |
| 155 | − | |
| 156 | −typedef enum | |
| 157 | −{ | |
| 158 | − SIMILAR_SCENE, //similar scene | |
| 159 | − MEDIUM_CHANGED_SCENE, //medium changed scene | |
| 160 | − LARGE_CHANGED_SCENE, //large changed scene | |
| 161 | −} ESceneChangeIdc; | |
| 162 | − | |
| 163 | −typedef struct | |
| 164 | −{ | |
| 165 | − unsigned char *pCurY; // Y data of current frame | |
| 166 | − unsigned char *pRefY; // Y data of pRef frame for diff calc | |
| 167 | − int (*pSad8x8)[4]; // sad of 8x8, every 4 in the same 16x16 get together | |
| 168 | − int *pSsd16x16; // sum of square difference of 16x16 | |
| 169 | − int *pSum16x16; // sum of 16x16 | |
| 170 | − int *pSumOfSquare16x16; // sum of square of 16x16 | |
| 171 | − int (*pSumOfDiff8x8)[4]; | |
| 172 | − unsigned char (*pMad8x8)[4]; | |
| 173 | − int iFrameSad; // sad of frame | |
| 174 | −} SVAACalcResult; | |
| 175 | − | |
| 176 | −typedef struct | |
| 177 | −{ | |
| 178 | − int iCalcVar; | |
| 179 | − int iCalcBgd; | |
| 180 | − int iCalcSsd; | |
| 181 | − int iReserved; | |
| 182 | − SVAACalcResult *pCalcResult; | |
| 183 | −} SVAACalcParam; | |
| 184 | − | |
| 185 | −typedef struct | |
| 186 | −{ | |
| 187 | − signed char *pBackgroundMbFlag; | |
| 188 | − SVAACalcResult *pCalcRes; | |
| 189 | −} SBGDInterface; | |
| 190 | − | |
| 191 | −typedef enum | |
| 192 | −{ | |
| 193 | − AQ_QUALITY_MODE, //Quality mode | |
| 194 | − AQ_BITRATE_MODE, //Bitrate mode | |
| 195 | −}EAQModes; | |
| 196 | − | |
| 197 | −typedef struct | |
| 198 | −{ | |
| 199 | − unsigned short uiMotionIndex; | |
| 200 | − unsigned short uiTextureIndex; | |
| 201 | −} SMotionTextureUnit; | |
| 202 | − | |
| 203 | −typedef struct | |
| 204 | −{ | |
| 205 | − int iAdaptiveQuantMode; // 0:quality mode, 1:bitrates mode | |
| 206 | − SVAACalcResult *pCalcResult; | |
| 207 | − SMotionTextureUnit *pMotionTextureUnit; | |
| 208 | − | |
| 209 | − signed char *pMotionTextureIndexToDeltaQp; | |
| 210 | − double dAverMotionTextureIndexToDeltaQp; | |
| 211 | −} SAdaptiveQuantizationParam; | |
| 212 | − | |
| 213 | −typedef enum | |
| 214 | −{ | |
| 215 | − FRAME_SAD = 0, | |
| 216 | − GOM_SAD = -1, | |
| 217 | − GOM_VAR = -2 | |
| 218 | −} EComplexityAnalysisMode; | |
| 219 | − | |
| 220 | −typedef struct | |
| 221 | −{ | |
| 222 | − int iComplexityAnalysisMode; | |
| 223 | − int iCalcBgd; | |
| 224 | − int iMbNumInGom; | |
| 225 | − int iFrameComplexity; | |
| 226 | − int *pGomComplexity; | |
| 227 | − int *pGomForegroundBlockNum; | |
| 228 | − signed char *pBackgroundMbFlag; | |
| 229 | − unsigned int *uiRefMbType; | |
| 230 | − SVAACalcResult *pCalcResult; | |
| 231 | −} SComplexityAnalysisParam; | |
| 232 | − | |
| 233 | −///////////////////////////////////////////////////////////////////////////////////////////// | |
| 234 | − | |
| 235 | −typedef struct | |
| 236 | −{ | |
| 237 | − void *pCtx; | |
| 238 | − EResult (*Init) (void *pCtx, int iType, void *pCfg); | |
| 239 | − EResult (*Uninit) (void *pCtx, int iType); | |
| 240 | − EResult (*Flush) (void *pCtx, int iType); | |
| 241 | − EResult (*Process) (void *pCtx, int iType, SPixMap *pSrc, SPixMap *dst); | |
| 242 | − EResult (*Get) (void *pCtx, int iType, void *pParam); | |
| 243 | − EResult (*Set) (void *pCtx, int iType, void *pParam); | |
| 244 | − EResult (*SpecialFeature) (void *pCtx, int iType, void *pIn, void *pOut); | |
| 245 | −} IWelsVPc; | |
| 246 | − | |
| 247 | −#if defined(__cplusplus) && !defined(CINTERFACE) /* C++ style interface */ | |
| 248 | − | |
| 249 | −class IWelsVP | |
| 250 | −{ | |
| 251 | −public: | |
| 252 | − virtual ~IWelsVP() {} | |
| 253 | − | |
| 254 | −public: | |
| 255 | − virtual EResult Init (int iType, void *pCfg) = 0; | |
| 256 | − virtual EResult Uninit (int iType) = 0; | |
| 257 | − virtual EResult Flush (int iType) = 0; | |
| 258 | − virtual EResult Process (int iType, SPixMap *pSrc, SPixMap *dst) = 0; | |
| 259 | − virtual EResult Get (int iType, void *pParam) = 0; | |
| 260 | − virtual EResult Set (int iType, void *pParam) = 0; | |
| 261 | − virtual EResult SpecialFeature (int iType, void *pIn, void *pOut) = 0; | |
| 262 | −}; | |
| 263 | − | |
| 264 | −/* Recommend to invoke the interface via the micro for convenient */ | |
| 265 | −#define IWelsVPFunc_Init(p, a, b) (p)->Init(a, b) | |
| 266 | −#define IWelsVPFunc_Uninit(p, a) (p)->Uninit(a) | |
| 267 | −#define IWelsVPFunc_Flush(p, a) (p)->Flush(a) | |
| 268 | −#define IWelsVPFunc_Process(p, a, b, c) (p)->Process(a, b, c) | |
| 269 | −#define IWelsVPFunc_Get(p, a, b) (p)->Get(a, b) | |
| 270 | −#define IWelsVPFunc_Set(p, a, b) (p)->Set(a, b) | |
| 271 | −#define IWelsVPFunc_SpecialFeature(p, a, b, c) (p)->SpecialFeature(a, b, c) | |
| 272 | − | |
| 273 | −/* C++ interface version */ | |
| 274 | −#define WELSVP_INTERFACE_VERION (0x8000 + (WELSVP_VERSION & 0x7fff)) | |
| 275 | −#define WELSVP_EXTERNC_BEGIN extern "C" { | |
| 276 | −#define WELSVP_EXTERNC_END } | |
| 277 | − | |
| 278 | −#else /* C style interface */ | |
| 279 | − | |
| 280 | −/* Recommend to invoke the interface via the micro for convenient */ | |
| 281 | −#define IWelsVPFunc_Init(p, a, b) (p)->Init(p->h, a, b) | |
| 282 | −#define IWelsVPFunc_Uninit(p, a) (p)->Uninit(p->h, a) | |
| 283 | −#define IWelsVPFunc_Flush(p, a) (p)->Flush(p->h, a) | |
| 284 | −#define IWelsVPFunc_Process(p, a, b, c) (p)->Process(p->h, a, b, c) | |
| 285 | −#define IWelsVPFunc_Get(p, a, b) (p)->Get(p->h, a, b) | |
| 286 | −#define IWelsVPFunc_Set(p, a, b) (p)->Set(p->h, a, b) | |
| 287 | −#define IWelsVPFunc_SpecialFeature(p, a, b, c) (p)->SpecialFeature(p->h, a, b, c) | |
| 288 | − | |
| 289 | −/* C interface version */ | |
| 290 | −#define WELSVP_INTERFACE_VERION (0x0001 + (WELSVP_VERSION & 0x7fff)) | |
| 291 | −#define WELSVP_EXTERNC_BEGIN | |
| 292 | −#define WELSVP_EXTERNC_END | |
| 293 | − | |
| 294 | −#endif | |
| 295 | − | |
| 296 | −WELSVP_EXTERNC_BEGIN | |
| 297 | −EResult WELSAPI CreateVpInterface (void **ppCtx, int iVersion /*= WELSVP_INTERFACE_VERION*/); | |
| 298 | −EResult WELSAPI DestroyVpInterface (void *pCtx , int iVersion /*= WELSVP_INTERFACE_VERION*/); | |
| 299 | −WELSVP_EXTERNC_END | |
| 300 | − | |
| 301 | −////////////////////////////////////////////////////////////////////////////////////////////// | |
| 302 | −#endif // _IWELSVP_H_ | |
| 303 | − | |
| 304 | − | |
| 1 | +/*! | |
| 2 | + * \copy | |
| 3 | + * Copyright (c) 2004-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 | + * | |
| 32 | + * \file : IWelsVP.h | |
| 33 | + * | |
| 34 | + * \brief : Interface of wels video processor class | |
| 35 | + * | |
| 36 | + * \date : 2011/01/04 | |
| 37 | + * | |
| 38 | + * \description : 1. should support both C/C++ style interface | |
| 39 | + * 2. should concern with the feature extension requirement | |
| 40 | + * 3. should care the usage of "char"==> | |
| 41 | + * 1) value char : signed char/unsigned char | |
| 42 | + * 2) string char : char | |
| 43 | + * | |
| 44 | + ************************************************************************************* | |
| 45 | + */ | |
| 46 | + | |
| 47 | +#ifndef _IWELSVP_H_ | |
| 48 | +#define _IWELSVP_H_ | |
| 49 | + | |
| 50 | +#ifdef _WIN32 | |
| 51 | +#define WELSAPI __stdcall | |
| 52 | +#else | |
| 53 | +#define WELSAPI | |
| 54 | +#endif | |
| 55 | + | |
| 56 | +#define WELSVP_MAJOR_VERSION 1 | |
| 57 | +#define WELSVP_MINOR_VERSION 1 | |
| 58 | +#define WELSVP_VERSION ((WELSVP_MAJOR_VERSION << 8) + WELSVP_MINOR_VERSION) | |
| 59 | + | |
| 60 | +typedef enum { | |
| 61 | + RET_SUCCESS = 0, | |
| 62 | + RET_FAILED = -1, | |
| 63 | + RET_INVALIDPARAM = -2, | |
| 64 | + RET_OUTOFMEMORY = -3, | |
| 65 | + RET_NOTSUPPORTED = -4, | |
| 66 | + RET_UNEXPECTED = -5, | |
| 67 | + RET_NEEDREINIT = -6 | |
| 68 | +} EResult; | |
| 69 | + | |
| 70 | +typedef enum { | |
| 71 | + VIDEO_FORMAT_NULL = 0, /* invalid format */ | |
| 72 | + /*rgb color formats*/ | |
| 73 | + VIDEO_FORMAT_RGB = 1, /* rgb 24bits */ | |
| 74 | + VIDEO_FORMAT_RGBA = 2, /* rgba */ | |
| 75 | + VIDEO_FORMAT_RGB555 = 3, /* rgb555 */ | |
| 76 | + VIDEO_FORMAT_RGB565 = 4, /* rgb565 */ | |
| 77 | + VIDEO_FORMAT_BGR = 5, /* bgr 24bits */ | |
| 78 | + VIDEO_FORMAT_BGRA = 6, /* bgr 32bits */ | |
| 79 | + VIDEO_FORMAT_ABGR = 7, /* abgr */ | |
| 80 | + VIDEO_FORMAT_ARGB = 8, /* argb */ | |
| 81 | + | |
| 82 | + /*yuv color formats*/ | |
| 83 | + VIDEO_FORMAT_YUY2 = 20, /* yuy2 */ | |
| 84 | + VIDEO_FORMAT_YVYU = 21, /* yvyu */ | |
| 85 | + VIDEO_FORMAT_UYVY = 22, /* uyvy */ | |
| 86 | + VIDEO_FORMAT_I420 = 23, /* yuv 4:2:0 planar */ | |
| 87 | + VIDEO_FORMAT_YV12 = 24, /* yuv 4:2:0 planar */ | |
| 88 | + VIDEO_FORMAT_INTERNAL = 25, /* Only Used for SVC decoder testbed */ | |
| 89 | + VIDEO_FORMAT_NV12 = 26, /* y planar + uv packed */ | |
| 90 | + VIDEO_FORMAT_I422 = 27, /* yuv 4:2:2 planar */ | |
| 91 | + VIDEO_FORMAT_I444 = 28, /* yuv 4:4:4 planar */ | |
| 92 | + VIDEO_FORMAT_YUYV = 20, /* yuv 4:2:2 packed */ | |
| 93 | + | |
| 94 | + VIDEO_FORMAT_RGB24 = 1, | |
| 95 | + VIDEO_FORMAT_RGB32 = 2, | |
| 96 | + VIDEO_FORMAT_RGB24_INV = 5, | |
| 97 | + VIDEO_FORMAT_RGB32_INV = 6, | |
| 98 | + VIDEO_FORMAT_RGB555_INV = 7, | |
| 99 | + VIDEO_FORMAT_RGB565_INV = 8, | |
| 100 | + VIDEO_FORMAT_YUV2 = 21, | |
| 101 | + VIDEO_FORMAT_420 = 23, | |
| 102 | + | |
| 103 | + VIDEO_FORMAT_VFlip = 0x80000000 | |
| 104 | +} EVideoFormat; | |
| 105 | + | |
| 106 | +typedef enum { | |
| 107 | + BUFFER_HOSTMEM = 0, | |
| 108 | + BUFFER_SURFACE | |
| 109 | +} EPixMapBufferProperty; | |
| 110 | + | |
| 111 | +typedef struct { | |
| 112 | + int iRectTop; | |
| 113 | + int iRectLeft; | |
| 114 | + int iRectWidth; | |
| 115 | + int iRectHeight; | |
| 116 | +} SRect; | |
| 117 | + | |
| 118 | +typedef struct { | |
| 119 | + void* pPixel[3]; | |
| 120 | + int iSizeInBits; | |
| 121 | + int iStride[3]; | |
| 122 | + SRect sRect; | |
| 123 | + EVideoFormat eFormat; | |
| 124 | + EPixMapBufferProperty eProperty;//not use? to remove? but how about the size of SPixMap? | |
| 125 | +} SPixMap; | |
| 126 | + | |
| 127 | +typedef enum { | |
| 128 | + METHOD_NULL = 0, | |
| 129 | + METHOD_COLORSPACE_CONVERT ,//not support yet | |
| 130 | + METHOD_DENOISE , | |
| 131 | + METHOD_SCENE_CHANGE_DETECTION , | |
| 132 | + METHOD_DOWNSAMPLE , | |
| 133 | + METHOD_VAA_STATISTICS , | |
| 134 | + METHOD_BACKGROUND_DETECTION , | |
| 135 | + METHOD_ADAPTIVE_QUANT , | |
| 136 | + METHOD_COMPLEXITY_ANALYSIS , | |
| 137 | + METHOD_IMAGE_ROTATE , | |
| 138 | + METHOD_MASK | |
| 139 | +} EMethods; | |
| 140 | + | |
| 141 | +//-----------------------------------------------------------------// | |
| 142 | +// Algorithm parameters define | |
| 143 | +//-----------------------------------------------------------------// | |
| 144 | + | |
| 145 | +typedef struct { | |
| 146 | + int bSceneChangeFlag; // 0:false ; 1:true | |
| 147 | +} SSceneChangeResult; | |
| 148 | + | |
| 149 | +typedef enum { | |
| 150 | + SIMILAR_SCENE, //similar scene | |
| 151 | + MEDIUM_CHANGED_SCENE, //medium changed scene | |
| 152 | + LARGE_CHANGED_SCENE, //large changed scene | |
| 153 | +} ESceneChangeIdc; | |
| 154 | + | |
| 155 | +typedef struct { | |
| 156 | + unsigned char* pCurY; // Y data of current frame | |
| 157 | + unsigned char* pRefY; // Y data of pRef frame for diff calc | |
| 158 | + int (*pSad8x8)[4]; // sad of 8x8, every 4 in the same 16x16 get together | |
| 159 | + int* pSsd16x16; // sum of square difference of 16x16 | |
| 160 | + int* pSum16x16; // sum of 16x16 | |
| 161 | + int* pSumOfSquare16x16; // sum of square of 16x16 | |
| 162 | + int (*pSumOfDiff8x8)[4]; | |
| 163 | + unsigned char (*pMad8x8)[4]; | |
| 164 | + int iFrameSad; // sad of frame | |
| 165 | +} SVAACalcResult; | |
| 166 | + | |
| 167 | +typedef struct { | |
| 168 | + int iCalcVar; | |
| 169 | + int iCalcBgd; | |
| 170 | + int iCalcSsd; | |
| 171 | + int iReserved; | |
| 172 | + SVAACalcResult* pCalcResult; | |
| 173 | +} SVAACalcParam; | |
| 174 | + | |
| 175 | +typedef struct { | |
| 176 | + signed char* pBackgroundMbFlag; | |
| 177 | + SVAACalcResult* pCalcRes; | |
| 178 | +} SBGDInterface; | |
| 179 | + | |
| 180 | +typedef enum { | |
| 181 | + AQ_QUALITY_MODE, //Quality mode | |
| 182 | + AQ_BITRATE_MODE, //Bitrate mode | |
| 183 | +} EAQModes; | |
| 184 | + | |
| 185 | +typedef struct { | |
| 186 | + unsigned short uiMotionIndex; | |
| 187 | + unsigned short uiTextureIndex; | |
| 188 | +} SMotionTextureUnit; | |
| 189 | + | |
| 190 | +typedef struct { | |
| 191 | + int iAdaptiveQuantMode; // 0:quality mode, 1:bitrates mode | |
| 192 | + SVAACalcResult* pCalcResult; | |
| 193 | + SMotionTextureUnit* pMotionTextureUnit; | |
| 194 | + | |
| 195 | + signed char* pMotionTextureIndexToDeltaQp; | |
| 196 | + double dAverMotionTextureIndexToDeltaQp; | |
| 197 | +} SAdaptiveQuantizationParam; | |
| 198 | + | |
| 199 | +typedef enum { | |
| 200 | + FRAME_SAD = 0, | |
| 201 | + GOM_SAD = -1, | |
| 202 | + GOM_VAR = -2 | |
| 203 | +} EComplexityAnalysisMode; | |
| 204 | + | |
| 205 | +typedef struct { | |
| 206 | + int iComplexityAnalysisMode; | |
| 207 | + int iCalcBgd; | |
| 208 | + int iMbNumInGom; | |
| 209 | + int iFrameComplexity; | |
| 210 | + int* pGomComplexity; | |
| 211 | + int* pGomForegroundBlockNum; | |
| 212 | + signed char* pBackgroundMbFlag; | |
| 213 | + unsigned int* uiRefMbType; | |
| 214 | + SVAACalcResult* pCalcResult; | |
| 215 | +} SComplexityAnalysisParam; | |
| 216 | + | |
| 217 | +///////////////////////////////////////////////////////////////////////////////////////////// | |
| 218 | + | |
| 219 | +typedef struct { | |
| 220 | + void* pCtx; | |
| 221 | + EResult (*Init) (void* pCtx, int iType, void* pCfg); | |
| 222 | + EResult (*Uninit) (void* pCtx, int iType); | |
| 223 | + EResult (*Flush) (void* pCtx, int iType); | |
| 224 | + EResult (*Process) (void* pCtx, int iType, SPixMap* pSrc, SPixMap* dst); | |
| 225 | + EResult (*Get) (void* pCtx, int iType, void* pParam); | |
| 226 | + EResult (*Set) (void* pCtx, int iType, void* pParam); | |
| 227 | + EResult (*SpecialFeature) (void* pCtx, int iType, void* pIn, void* pOut); | |
| 228 | +} IWelsVPc; | |
| 229 | + | |
| 230 | +#if defined(__cplusplus) && !defined(CINTERFACE) /* C++ style interface */ | |
| 231 | + | |
| 232 | +class IWelsVP { | |
| 233 | + public: | |
| 234 | + virtual ~IWelsVP() {} | |
| 235 | + | |
| 236 | + public: | |
| 237 | + virtual EResult Init (int iType, void* pCfg) = 0; | |
| 238 | + virtual EResult Uninit (int iType) = 0; | |
| 239 | + virtual EResult Flush (int iType) = 0; | |
| 240 | + virtual EResult Process (int iType, SPixMap* pSrc, SPixMap* dst) = 0; | |
| 241 | + virtual EResult Get (int iType, void* pParam) = 0; | |
| 242 | + virtual EResult Set (int iType, void* pParam) = 0; | |
| 243 | + virtual EResult SpecialFeature (int iType, void* pIn, void* pOut) = 0; | |
| 244 | +}; | |
| 245 | + | |
| 246 | +/* Recommend to invoke the interface via the micro for convenient */ | |
| 247 | +#define IWelsVPFunc_Init(p, a, b) (p)->Init(a, b) | |
| 248 | +#define IWelsVPFunc_Uninit(p, a) (p)->Uninit(a) | |
| 249 | +#define IWelsVPFunc_Flush(p, a) (p)->Flush(a) | |
| 250 | +#define IWelsVPFunc_Process(p, a, b, c) (p)->Process(a, b, c) | |
| 251 | +#define IWelsVPFunc_Get(p, a, b) (p)->Get(a, b) | |
| 252 | +#define IWelsVPFunc_Set(p, a, b) (p)->Set(a, b) | |
| 253 | +#define IWelsVPFunc_SpecialFeature(p, a, b, c) (p)->SpecialFeature(a, b, c) | |
| 254 | + | |
| 255 | +/* C++ interface version */ | |
| 256 | +#define WELSVP_INTERFACE_VERION (0x8000 + (WELSVP_VERSION & 0x7fff)) | |
| 257 | +#define WELSVP_EXTERNC_BEGIN extern "C" { | |
| 258 | +#define WELSVP_EXTERNC_END } | |
| 259 | + | |
| 260 | +#else /* C style interface */ | |
| 261 | + | |
| 262 | +/* Recommend to invoke the interface via the micro for convenient */ | |
| 263 | +#define IWelsVPFunc_Init(p, a, b) (p)->Init(p->h, a, b) | |
| 264 | +#define IWelsVPFunc_Uninit(p, a) (p)->Uninit(p->h, a) | |
| 265 | +#define IWelsVPFunc_Flush(p, a) (p)->Flush(p->h, a) | |
| 266 | +#define IWelsVPFunc_Process(p, a, b, c) (p)->Process(p->h, a, b, c) | |
| 267 | +#define IWelsVPFunc_Get(p, a, b) (p)->Get(p->h, a, b) | |
| 268 | +#define IWelsVPFunc_Set(p, a, b) (p)->Set(p->h, a, b) | |
| 269 | +#define IWelsVPFunc_SpecialFeature(p, a, b, c) (p)->SpecialFeature(p->h, a, b, c) | |
| 270 | + | |
| 271 | +/* C interface version */ | |
| 272 | +#define WELSVP_INTERFACE_VERION (0x0001 + (WELSVP_VERSION & 0x7fff)) | |
| 273 | +#define WELSVP_EXTERNC_BEGIN | |
| 274 | +#define WELSVP_EXTERNC_END | |
| 275 | + | |
| 276 | +#endif | |
| 277 | + | |
| 278 | +WELSVP_EXTERNC_BEGIN | |
| 279 | +EResult WELSAPI CreateVpInterface (void** ppCtx, int iVersion /*= WELSVP_INTERFACE_VERION*/); | |
| 280 | +EResult WELSAPI DestroyVpInterface (void* pCtx , int iVersion /*= WELSVP_INTERFACE_VERION*/); | |
| 281 | +WELSVP_EXTERNC_END | |
| 282 | + | |
| 283 | +////////////////////////////////////////////////////////////////////////////////////////////// | |
| 284 | +#endif // _IWELSVP_H_ | |
| 285 | + | |
| 286 | + | |