• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 /**
21 *******************************************************************************
22 * @file
23 *  ideint_defs.h
24 *
25 * @brief
26 *  Contains deinterlacer definitions
27 *
28 * @author
29 *  Ittiam
30 *
31 * @par List of Functions:
32 *
33 * @remarks
34 *  None
35 *
36 *******************************************************************************
37 */
38 
39 #ifndef __IDEINT_DEFS_H__
40 #define __IDEINT_DEFS_H__
41 
42 #define ADJ_SAD_THRESH (6 * (FLD_BLK_SIZE * 2)) // *2 : 2 way collapsing (col+row)
43 
44 #define RSUM_CSUM_THRESH_PER_PEL  5//0
45 
46 /* Block dimensions. All the decisions (which method to be used) are     */
47 /* made on block basis. The blk level decisions help us in               */
48 /* reducing the time-complexity of the algorithm.                        */
49 #define BLK_WD_SHIFT 3
50 #define BLK_HT_SHIFT 3
51 
52 #define BLK_WD     (1 << BLK_WD_SHIFT )
53 #define BLK_HT     (1 << BLK_HT_SHIFT)
54 
55 #define FLD_BLK_SIZE   (BLK_WD * (BLK_HT >> 1))
56 
57 
58 /* Inside the algorithm, the block itself is divided amongst further     */
59 /* smaller blocks.                                                       */
60 #define SUB_BLK_WD  (BLK_WD  >> 1)
61 #define SUB_BLK_HT (BLK_HT >> 1) /* field dimensions. */
62 
63 #define FLD_SUB_BLK_SIZE (SUB_BLK_WD * SUB_BLK_HT)
64 
65 
66 /*****************************************************************************/
67 /* Stationarity check threshold, used in deciding when to weave.             */
68 /*****************************************************************************/
69 #define ST_THRESH        ((15 * FLD_BLK_SIZE) >> 1)
70 
71 #define MOD_IDX_ST_NUM   3
72 #define MOD_IDX_ST_SHIFT 1
73 
74 #define VAR_AVG_LUMA   735
75 #define VAR_AVG_CHROMA  38
76 
77 /*****************************************************************************/
78 /* Threshold to choose the fallback method out of Bob and 3-field Kernel     */
79 /* method.                                                                   */
80 /*****************************************************************************/
81 #define FB_THRESH  (32 * FLD_BLK_SIZE)
82 
83 #define MOD_IDX_FB    4
84 
85 
86 #define EDGE_BIAS_0  5
87 #define EDGE_BIAS_1  7
88 
89 /*****************************************************************************/
90 /* Adjacent correlation bias, used in biasing the adjacent correlation over  */
91 /* the alternate one, while comparing the two; in the combing-artifact-check */
92 /* function.                                                                 */
93 /*****************************************************************************/
94 #define SAD_BIAS_ADDITIVE   (FLD_SUB_BLK_SIZE >> 1)
95 
96 /*****************************************************************************/
97 /* Mult bias is 1.125 = 9/8. Multiplication by this number is done in two    */
98 /* stpes, first multiplication by 9 and then shift by 3.                     */
99 /*****************************************************************************/
100 #define SAD_BIAS_MULT_SHIFT   3
101 
102 /*****************************************************************************/
103 /* row_sum threshold, used for making the combing artifact check more robust */
104 /* against the noise (e.g. ringing) by rejecting insignificant pixel         */
105 /* difference across two adjacent rows; in the combing artifact check        */
106 /* function.                                                                 */
107 /*****************************************************************************/
108 #define RSUM_CSUM_THRESH   (RSUM_CSUM_THRESH_PER_PEL * SUB_BLK_WD)
109 
110 /*****************************************************************************/
111 /* The 3-field filter is of type [-k 2k -k, 0.5 0.5, -k 2k -k], where k is   */
112 /* the COEFF_THREE_FIELD defined below.                                      */
113 /*****************************************************************************/
114 #define COEFF_THREE_FIELD 13
115 
116 /*****************************************************************************/
117 /* Definitions used by the variance calculations module. */
118 /*****************************************************************************/
119 #define SQR_SUB_BLK_SZ       (FLD_BLK_SIZE * FLD_BLK_SIZE)
120 #define SUB_BLK_SZ_SHIFT     5                       /* 2^5  = 32 */
121 #define SQR_SUB_BLK_SZ_SHIFT (SUB_BLK_SZ_SHIFT << 1) /* 2^10 = 1024 = 32 * 32 */
122 
123 
124 
125 #endif /* __IDEINT_DEFS_H__ */
126