summaryrefslogtreecommitdiff
path: root/include/ia_imaging/awb_fr_public.h
blob: 15f28532c0c9a4f9f8c430b1913a49858232c889 (plain)
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
126
127
128
129
/*
 * Copyright (C) 2015 - 2017 Intel Corporation.
 *
 * 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.
 */

#ifndef _AWB_FR_PUBLIC_H_
#define _AWB_FR_PUBLIC_H_

/** @file
* CSS-API header file for 2500/Skycam Auto White Balance Filter Response (AWB) kernel/accelerator.
*/
//#include <type_support.h>

/* All structs in this file will be visible to the CSS API User.
 * The User will be able to set each one of the config params separately by
 * specifying a different config type (see sh_config_type in sh_css.h).
 * If one of those config structs is not set explicitly, a default value will
 * be used instead.
 */

#define AWB_FR_MIN_GRID_WIDTH   16
#define AWB_FR_MIN_GRID_HEIGHT  16
#define AWB_FR_MAX_GRID_WIDTH   32
#define AWB_FR_MAX_GRID_HEIGHT  24
#define AWB_FR_MIN_BLOCK_WIDTH  3
#define AWB_FR_MIN_BLOCK_HEIGHT 3
#define AWB_FR_MAX_BLOCK_WIDTH  6 /**< HSD1403986067 bug in c0, restrict max block width to 6 instead of 7 */
#define AWB_FR_MAX_BLOCK_HEIGHT 6 /**< HSD1403986067 bug in c0, restrict max block height to 6 instead of 7 */

typedef struct awb_fr_public_coeffs_config {
    unsigned char A1;		/**< default value 0 */
    unsigned char A2;		/**< default value 0 */
    unsigned char A3;		/**< default value 0 */
    unsigned char A4;		/**< default value 0 */
    unsigned char A5;		/**< default value 0 */
    unsigned char A6;		/**< default value 128 */
    unsigned int  sign_vec;	/**< default value 0 */
} awb_fr_public_coeffs_config_t;


typedef struct awb_fr_public_nf_config {
    //TODO - this is calculate by log2 of the sum ofcoeffs, should it be exposed to user?
    unsigned char bayer_nf;

} awb_fr_public_nf_config_t;

/**
* constraint: this grid has to be totally internal to the processed frame plane
*             with margins of 10 per horizontal direction and 2 per vertical direction
*             therefore, we'll set its default value to represent the smallest size;
*             this will restrain the processed resolution the less
*/
struct awb_fr_public_grid_config{
    unsigned char grid_width;	/**< default value 16, Note: according to HAS - 32 */
    unsigned char grid_height;	/**< default value 16, Note: according to HAS - 24 */
    unsigned char block_width;  /**< default value 3, Log2 the width of each cell (8,16,32,64,128) */
    unsigned char block_height;	/**< default value 3, Log2 the width of each cell (8,16,32,64,128) */
    unsigned short x_start;	/**< default value 10, X top left corner of the grid x_start is even */
    unsigned short y_start;	/**< default value  2, Y top left corner of the grid y_start is even */
    unsigned char af_bayer_en;	/**< default value  1, awb_fr ff enable/disable meta data generation */
};

struct awb_fr_public_config {
    awb_fr_public_coeffs_config_t bayer_coeffs;
    awb_fr_public_nf_config_t     nf;
    struct awb_fr_public_grid_config   grid;
};

struct ia_css_2500_awb_fr_kernel_config {
    struct awb_fr_public_config awb_fr;
};

// awb_fr public meta-data
typedef struct awb_fr_public_bayer_item{
    unsigned short gr_avg; /**< Average level of GreenR color */
    unsigned short r_avg;  /**< Average level of Red color */
    unsigned short b_avg;  /**< Average level of Blue color */
    unsigned short gb_avg; /**< Average level of GreenB color */

} awb_fr_public_bayer_item_t;

/** Based on max grid width + spare for bubbles */
#define AWB_FR_PUBLIC_NUM_OF_ITEMS_IN_SET  (AWB_FR_MAX_GRID_WIDTH + 20)
#define AWB_FR_PUBLIC_NUM_OF_SETS_IN_BUFFER AWB_FR_MAX_GRID_HEIGHT

#define AWB_FR_BUFF_RATIO 2 /**< AWB_FR stats buffer ratio */

typedef struct awb_fr_public_raw_buffer{
	awb_fr_public_bayer_item_t bayer_table[AWB_FR_PUBLIC_NUM_OF_ITEMS_IN_SET *
					       AWB_FR_PUBLIC_NUM_OF_SETS_IN_BUFFER * AWB_FR_BUFF_RATIO]; /**< awb_fr statistics table */
} awb_fr_public_raw_buffer_t;

/** @brief Print AWB_FR public configuration
 *
 * @param	cfg	The pointer to configuration data
 * @return	None
 *
 * Print AWB_FR public configuration.
 */
void ia_css_awb_fr_public_cfg_dump(
	const struct ia_css_2500_awb_fr_kernel_config *cfg);

/** @brief Compare two AWB_FR public configurations
 *
 * @param	cfg1	The pointer to first configuration data
 * @param	cfg2	The pointer to second configuration data
 * @param	cfg_dump	Configurations are printed in case of
 *   			   mismatch
 * @return	true - match, false - not match
 *
 * Compare two AWB_FR public configurations
 */
bool ia_css_awb_fr_public_cfg_compare(
	const struct ia_css_2500_awb_fr_kernel_config *cfg1,
	const struct ia_css_2500_awb_fr_kernel_config *cfg2,
	bool cfg_dump);

#endif /* _AWB_FR_PUBLIC_H_ */