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