1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /**
22 *******************************************************************************
23 * @file
24 *  ih264e_master.h
25 *
26 * @brief
27 *  Contains declarations of functions used by master thread
28 *
29 * @author
30 *  ittiam
31 *
32 * @remarks
33 *  None
34 *
35 *******************************************************************************
36 */
37 
38 #ifndef IH264E_MASTER_H_
39 #define IH264E_MASTER_H_
40 
41 /*****************************************************************************/
42 /* Extern Function Declarations                                              */
43 /*****************************************************************************/
44 
45 /**
46 ******************************************************************************
47 *
48 * @brief
49 *  This function joins all the spawned threads after successful completion of
50 *  their tasks
51 *
52 * @par   Description
53 *
54 * @param[in] ps_codec
55 *  pointer to codec context
56 *
57 * @returns  none
58 *
59 ******************************************************************************
60 */
61 void ih264e_join_threads(codec_t *ps_codec);
62 
63 /**
64 ******************************************************************************
65 *
66 * @brief This function puts the current thread to sleep for a duration
67 *  of sleep_us
68 *
69 * @par Description
70 *  ithread_yield() method causes the calling thread to yield execution to another
71 *  thread that is ready to run on the current processor. The operating system
72 *  selects the thread to yield to. ithread_usleep blocks the current thread for
73 *  the specified number of milliseconds. In other words, yield just says,
74 *  end my timeslice prematurely, look around for other threads to run. If there
75 *  is nothing better than me, continue. Sleep says I don't want to run for x
76 *  milliseconds. Even if no other thread wants to run, don't make me run.
77 *
78 * @param[in] sleep_us
79 *  thread sleep duration
80 *
81 * @returns error_status
82 *
83 ******************************************************************************
84 */
85 IH264E_ERROR_T ih264e_wait_for_thread(UWORD32 sleep_us);
86 
87 /**
88 ******************************************************************************
89 *
90 * @brief
91 *  Encodes in synchronous api mode
92 *
93 * @par Description
94 *  This routine processes input yuv, encodes it and outputs bitstream and recon
95 *
96 * @param[in] ps_codec_obj
97 *  Pointer to codec object at API level
98 *
99 * @param[in] pv_api_ip
100 *  Pointer to input argument structure
101 *
102 * @param[out] pv_api_op
103 *  Pointer to output argument structure
104 *
105 * @returns  Status
106 *
107 ******************************************************************************
108 */
109 WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op);
110 
111 /**
112 *******************************************************************************
113 *
114 * @brief update encoder configuration parameters
115 *
116 * @par Description:
117 *  updates encoder configuration parameters from the given config set.
118 *  Initialize/reinitialize codec parameters according to new configurations.
119 *
120 * @param[in] ps_codec
121 *  Pointer to codec context
122 *
123 * @param[in] ps_cfg
124 *  Pointer to config param set
125 *
126 * @remarks none
127 *
128 *******************************************************************************
129 */
130 IH264E_ERROR_T ih264e_codec_update_config(codec_t *ps_codec, cfg_params_t *ps_cfg);
131 
132 #endif /* IH264E_MASTER_H_ */
133