summaryrefslogtreecommitdiff
path: root/isp/stats.h
blob: fb6c26a251ecd5d624e9600a6da72d55e7b6cd00 (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
/*
 * OMAP3 ISP library - OMAP3 ISP statistics
 *
 * Copyright (C) 2010-2012 Ideas on board SPRL
 *
 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef __OMAP3ISP_STATS_H
#define __OMAP3ISP_STATS_H

#include <stdint.h>

struct omap3_isp_device;

/*
 * struct omap3_isp_aewb_stats - OMAP3 ISP AEWB statistics
 * @npix: Total number of accumulated pixels
 * @unsat: Number of accumulated unsaturated pixels
 * @accum: Accumulators
 *
 * The first 4 accumulators store the accumulated pixel values for the 4 color
 * components, organized as follows.
 *
 * +---+---+
 * | 0 | 1 |
 * +---+---+
 * | 2 | 3 |
 * +---+---+
 *
 * The next 4 accumulators are similar, but store the accumulated saturated
 * (clipped) pixel values.
 */
struct omap3_isp_aewb_stats {
	uint32_t npix;
	uint32_t unsat;
	uint32_t accum[8];
};

/*
 * omap3_isp_stats_enable - Enable or disable the statistics engine
 * @isp: The ISP device
 * @enable: Whether to enable to disable the statistics engine
 *
 * The statistics engine must be enabled prior to starting the video stream.
 * When enabled, it statistics will be computed for every frame and delivered
 * through the ISP aewb_ready() callback.
 */
void omap3_isp_stats_enable(struct omap3_isp_device *isp, bool enable);

/*
 * omap3_isp_stats_get_format - Get frame format at the statistics engine input
 * @isp: The ISP device
 * @format: Frame format
 *
 * Fill the format argument with the frame format at the statistics engine
 * input.
 */
int omap3_isp_stats_get_format(struct omap3_isp_device *isp,
			       struct v4l2_mbus_framefmt *format);
/*
 * omap3_isp_aewb_configure - Configure the AEWB statistics engine
 * @isp: The ISP device
 * @rect: The region of interest, relative to the sensor output frame size
 * @saturation: Pixel saturation threshold value
 */
int omap3_isp_aewb_configure(struct omap3_isp_device *isp, struct v4l2_rect *rect,
			     unsigned int saturation);

#endif