1 /*!
2  * \copy
3  *     Copyright (c)  2009-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    deblocking.h
33  *
34  * \brief   Interfaces introduced in frame deblocking filtering
35  *
36  * \date    05/14/2009 Created
37  *
38  *************************************************************************************
39  */
40 
41 #ifndef WELS_DEBLOCKING_H__
42 #define WELS_DEBLOCKING_H__
43 
44 #include "decoder_context.h"
45 #include "deblocking_common.h"
46 namespace WelsDec {
47 
48 /*!
49  * \brief   deblocking module initialize
50  *
51  * \param   pf
52  *          cpu
53  *
54  * \return  NONE
55  */
56 
57 void  DeblockingInit (PDeblockingFunc pDeblockingFunc,  int32_t iCpu);
58 
59 
60 /*!
61  * \brief   deblocking filtering target slice
62  *
63  * \param   dec         Wels decoder context
64  *
65  * \return  NONE
66  */
67 void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb);
68 
69 /*!
70 * \brief   AVC slice init deblocking filtering target layer
71 *
72 * \in and out param   SDeblockingFilter
73 * \in and out param   iFilterIdc
74 *
75 * \return  NONE
76 */
77 void WelsDeblockingInitFilter (PWelsDecoderContext pCtx, SDeblockingFilter& pFilter, int32_t& iFilterIdc);
78 
79 /*!
80 * \brief   AVC MB deblocking filtering target layer
81 *
82 * \param   DqLayer which has the current location of MB to be deblocked.
83 *
84 * \return  NONE
85 */
86 void WelsDeblockingFilterMB (PDqLayer pCurDqLayer, SDeblockingFilter& pFilter, int32_t& iFilterIdc,
87                              PDeblockingFilterMbFunc pDeblockMb);
88 
89 /*!
90  * \brief   pixel deblocking filtering
91  *
92  * \param   filter                deblocking filter
93  * \param   pix                   pixel value
94  * \param   stride                frame stride
95  * \param   bs                    boundary strength
96  *
97  * \return  NONE
98  */
99 
100 uint32_t DeblockingBsMarginalMBAvcbase (PDeblockingFilter  pFilter, PDqLayer pCurDqLayer, int32_t iEdge,
101                                         int32_t iNeighMb, int32_t iMbXy);
102 uint32_t DeblockingBSliceBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy);
103 
104 int32_t DeblockingAvailableNoInterlayer (PDqLayer pCurDqLayer, int32_t iFilterIdc);
105 
106 void WelsDeblockingMb (PDqLayer pCurDqLayer, PDeblockingFilter  pFilter, int32_t iBoundryFlag);
107 
GetPNzc(PDqLayer pCurDqLayer,int32_t iMbXy)108 inline int8_t* GetPNzc (PDqLayer pCurDqLayer, int32_t iMbXy) {
109   if (pCurDqLayer->pDec != NULL && pCurDqLayer->pDec->pNzc != NULL) {
110     return pCurDqLayer->pDec->pNzc[iMbXy];
111   }
112   return pCurDqLayer->pNzc[iMbXy];
113 }
114 
115 } // namespace WelsDec
116 
117 #endif //WELS_DEBLOCKING_H__
118 
119