aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/media/atomisp/pci/camera/util/interface/ia_css_util.h
blob: 75333166ed9b3d2e9a9c82049f2ad6dff71702fa (plain) (blame)
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
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope 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.
 */

#ifndef __IA_CSS_UTIL_H__
#define __IA_CSS_UTIL_H__

#include <ia_css_err.h>
#include <error_support.h>
#include <type_support.h>
#include <ia_css_frame_public.h>
#include <ia_css_stream_public.h>
#include <ia_css_stream_format.h>

/* @brief convert "errno" error code to "ia_css_err" error code
 *
 * @param[in]	"errno" error code
 * @return	"ia_css_err" error code
 *
 */
enum ia_css_err ia_css_convert_errno(
    int in_err);

/* @brief check vf frame info.
 *
 * @param[in] info
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
 */
enum ia_css_err ia_css_util_check_vf_info(
    const struct ia_css_frame_info *const info);

/* @brief check input configuration.
 *
 * @param[in] stream_config
 * @param[in] must_be_raw
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
 */
enum ia_css_err ia_css_util_check_input(
    const struct ia_css_stream_config *const stream_config,
    bool must_be_raw,
    bool must_be_yuv);

/* @brief check vf and out frame info.
 *
 * @param[in] out_info
 * @param[in] vf_info
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
 */
enum ia_css_err ia_css_util_check_vf_out_info(
    const struct ia_css_frame_info *const out_info,
    const struct ia_css_frame_info *const vf_info);

/* @brief check width and height
 *
 * @param[in] width
 * @param[in] height
 * @return	IA_CSS_SUCCESS or error code upon error.
 *
 */
enum ia_css_err ia_css_util_check_res(
    unsigned int width,
    unsigned int height);

/* ISP2401 */
/* @brief compare resolutions (less or equal)
 *
 * @param[in] a resolution
 * @param[in] b resolution
 * @return    true if both dimensions of a are less or
 *            equal than those of b, false otherwise
 *
 */
bool ia_css_util_res_leq(
    struct ia_css_resolution a,
    struct ia_css_resolution b);

/* ISP2401 */
/**
 * @brief Check if resolution is zero
 *
 * @param[in] resolution The resolution to check
 *
 * @returns true if resolution is zero
 */
bool ia_css_util_resolution_is_zero(
    const struct ia_css_resolution resolution);

/* ISP2401 */
/**
 * @brief Check if resolution is even
 *
 * @param[in] resolution The resolution to check
 *
 * @returns true if resolution is even
 */
bool ia_css_util_resolution_is_even(
    const struct ia_css_resolution resolution);

/* @brief check width and height
 *
 * @param[in] stream_format
 * @param[in] two_ppc
 * @return bits per pixel based on given parameters.
 *
 */
unsigned int ia_css_util_input_format_bpp(
    enum atomisp_input_format stream_format,
    bool two_ppc);

/* @brief check if input format it raw
 *
 * @param[in] stream_format
 * @return true if the input format is raw or false otherwise
 *
 */
bool ia_css_util_is_input_format_raw(
    enum atomisp_input_format stream_format);

/* @brief check if input format it yuv
 *
 * @param[in] stream_format
 * @return true if the input format is yuv or false otherwise
 *
 */
bool ia_css_util_is_input_format_yuv(
    enum atomisp_input_format stream_format);

#endif /* __IA_CSS_UTIL_H__ */