Coverage Report

Created: 2026-07-25 07:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openh264/codec/processing/src/common/WelsFrameWork.h
Line
Count
Source
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        :  WelsFrameWork.h
32
 *
33
 * \brief       :  framework of wels video processor class
34
 *
35
 * \date        :  2011/01/04
36
 *
37
 * \description :
38
 *
39
 *************************************************************************************
40
 */
41
42
#ifndef WELSVP_WELSFRAMEWORK_H
43
#define WELSVP_WELSFRAMEWORK_H
44
45
#include "IWelsVP.h"
46
#include "util.h"
47
#include "WelsThreadLib.h"
48
49
WELSVP_NAMESPACE_BEGIN
50
51
EResult CreateSpecificVpInterface (IWelsVP** ppCtx);
52
EResult DestroySpecificVpInterface (IWelsVP* pCtx);
53
54
EResult CreateSpecificVpInterface (IWelsVPc** ppCtx);
55
EResult DestroySpecificVpInterface (IWelsVPc* pCtx);
56
57
0
#define MAX_STRATEGY_NUM (METHOD_MASK - 1)
58
59
class IStrategy : public IWelsVP {
60
 public:
61
0
  IStrategy() {
62
0
    m_eMethod  = METHOD_NULL;
63
0
    m_eFormat  = VIDEO_FORMAT_I420;
64
0
    m_iIndex   = 0;
65
0
    m_bInit    = false;
66
0
  }
67
68
0
  virtual ~IStrategy() {}
69
70
 public:
71
0
  virtual EResult Init (int32_t iType, void* pCfg)  {
72
0
    return RET_SUCCESS;
73
0
  }
74
0
  virtual EResult Uninit (int32_t iType)              {
75
0
    return RET_SUCCESS;
76
0
  }
77
0
  virtual EResult Flush (int32_t iType)               {
78
0
    return RET_SUCCESS;
79
0
  }
80
0
  virtual EResult Get (int32_t iType, void* pParam) {
81
0
    return RET_SUCCESS;
82
0
  }
83
0
  virtual EResult Set (int32_t iType, void* pParam) {
84
0
    return RET_SUCCESS;
85
0
  }
86
0
  virtual EResult SpecialFeature (int32_t iType, void* pIn, void* pOut) {
87
0
    return RET_SUCCESS;
88
0
  }
89
  virtual EResult Process (int32_t iType, SPixMap* pSrc, SPixMap* pDst) = 0;
90
91
 public:
92
  EMethods       m_eMethod;
93
  EVideoFormat m_eFormat;
94
  int32_t           m_iIndex;
95
  bool            m_bInit;
96
};
97
98
class CVpFrameWork : public IWelsVP {
99
 public:
100
  CVpFrameWork (uint32_t uiThreadsNum, EResult& ret);
101
  ~CVpFrameWork();
102
103
 public:
104
  EResult Init (int32_t iType, void* pCfg);
105
106
  EResult Uninit (int32_t iType);
107
108
  EResult Flush (int32_t iType);
109
110
  EResult Process (int32_t iType, SPixMap* pSrc, SPixMap* pDst);
111
112
  EResult Get (int32_t iType, void* pParam);
113
114
  EResult Set (int32_t iType, void* pParam);
115
116
  EResult SpecialFeature (int32_t iType, void* pIn, void* pOut);
117
118
 private:
119
  bool  CheckValid (EMethods eMethod, SPixMap& sSrc, SPixMap& sDst);
120
  IStrategy* CreateStrategy (EMethods eMethod, int32_t iCpuFlag);
121
122
 private:
123
  IStrategy* m_pStgChain[MAX_STRATEGY_NUM];
124
125
  WELS_MUTEX m_mutes;
126
};
127
128
WELSVP_NAMESPACE_END
129
130
#endif