• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * xcam_smart_description.h - libxcam smart analysis description
3  *
4  *  Copyright (c) 2015 Intel Corporation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Author: Zong Wei <wei.zong@intel.com>
19  *         Wind Yuan <feng.yuan@intel.com>
20  */
21 
22 #ifndef C_XCAM_SMART_ANALYSIS_DESCRIPTION_H
23 #define C_XCAM_SMART_ANALYSIS_DESCRIPTION_H
24 
25 #include <base/xcam_common.h>
26 #include <base/xcam_params.h>
27 #include <base/xcam_3a_result.h>
28 #include <base/xcam_buffer.h>
29 
30 XCAM_BEGIN_DECLARE
31 
32 #define XCAM_SMART_ANALYSIS_LIB_DESCRIPTION "xcam_smart_analysis_desciption"
33 
34 typedef struct _XCamSmartAnalysisContext XCamSmartAnalysisContext;
35 
36 typedef XCamReturn (*XcamPostResultsFunc) (
37     XCamSmartAnalysisContext *context,
38     const XCamVideoBuffer *buffer,
39     XCam3aResultHead *results[], uint32_t res_count);
40 
41 
42 #define XCAM_SMART_PLUGIN_PRIORITY_HIGH     1
43 #define XCAM_SMART_PLUGIN_PRIORITY_DEFAULT  10
44 #define XCAM_SMART_PLUGIN_PRIORITY_LOW      100
45 
46 /*  \brief C interface of Smart Analysis Description
47   *     <version>          xcam version
48   *     <size>               description structure size, sizeof (XCamSmartAnalysisDescription)
49   *     <priority>           smart plugin priority; the less value the higher priority; 0, highest priority
50   *     <name>             smart pluign name, or use file name if NULL
51   */
52 typedef struct _XCamSmartAnalysisDescription {
53     uint32_t                        version;
54     uint32_t                        size;
55     uint32_t                        priority;
56     const char                     *name;
57 
58     /*! \brief initialize smart analysis context.
59     *
60     * \param[out]        context            create context handle
61     * \param[out]        async_mode     0, sync mode; 1, async mode
62     * \param[in]          post_func         plugin can use post_func to post results in async mode
63     */
64     XCamReturn (*create_context)  (XCamSmartAnalysisContext **context,
65                                    uint32_t *async_mode, XcamPostResultsFunc post_func);
66     /*! \brief destroy smart analysis context.
67     *
68     * \param[in]        context            create context handle
69     */
70     XCamReturn (*destroy_context) (XCamSmartAnalysisContext *context);
71 
72     /*! \brief update smart analysis context parameters.
73     *
74     * \param[in]        context            context handle
75     * \param[in]        params            new parameters
76     */
77     XCamReturn (*update_params)   (XCamSmartAnalysisContext *context, const XCamSmartAnalysisParam *params);
78 
79     /*! \brief analyze data and get result,.
80     *
81     * \param[in]        context            context handle
82     * \param[in]        buffer              image buffer
83     * \param[out]      results             analysis results array, only for sync mode (<async_mode> = 0)
84     * \param[in/out]  res_count        in, max results array size; out, return results count.
85     */
86     XCamReturn (*analyze)         (XCamSmartAnalysisContext *context, XCamVideoBuffer *buffer,
87                                    XCam3aResultHead *results[], uint32_t *res_count);
88 
89     /*! \brief free smart results.
90     *
91     * \param[in]        context            context handle
92     * \param[in]        results             analysis results
93     * \param[in]        res_count         analysis results count
94     */
95     void       (*free_results)    (XCamSmartAnalysisContext *context, XCam3aResultHead *results[], uint32_t res_count);
96 } XCamSmartAnalysisDescription;
97 
98 XCAM_END_DECLARE
99 
100 #endif //C_XCAM_SMART_ANALYSIS_DESCRIPTION_H
101