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 67 * This function calculates various quality metrics; the initial one is PSNR. 68 * 69 * @par Description 70 * 71 * @param[in] ps_codec 72 * pointer to process context 73 * 74 * @returns none 75 * 76 ****************************************************************************** 77 */ 78 void ih264e_compute_quality_stats(process_ctxt_t *ps_proc); 79 80 /** 81 ****************************************************************************** 82 * 83 * @brief This function puts the current thread to sleep for a duration 84 * of sleep_us 85 * 86 * @par Description 87 * ithread_yield() method causes the calling thread to yield execution to another 88 * thread that is ready to run on the current processor. The operating system 89 * selects the thread to yield to. ithread_usleep blocks the current thread for 90 * the specified number of milliseconds. In other words, yield just says, 91 * end my timeslice prematurely, look around for other threads to run. If there 92 * is nothing better than me, continue. Sleep says I don't want to run for x 93 * milliseconds. Even if no other thread wants to run, don't make me run. 94 * 95 * @param[in] sleep_us 96 * thread sleep duration 97 * 98 * @returns error_status 99 * 100 ****************************************************************************** 101 */ 102 IH264E_ERROR_T ih264e_wait_for_thread(UWORD32 sleep_us); 103 104 /** 105 ****************************************************************************** 106 * 107 * @brief 108 * Encodes in synchronous api mode 109 * 110 * @par Description 111 * This routine processes input yuv, encodes it and outputs bitstream and recon 112 * 113 * @param[in] ps_codec_obj 114 * Pointer to codec object at API level 115 * 116 * @param[in] pv_api_ip 117 * Pointer to input argument structure 118 * 119 * @param[out] pv_api_op 120 * Pointer to output argument structure 121 * 122 * @returns Status 123 * 124 ****************************************************************************** 125 */ 126 WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op); 127 128 /** 129 ******************************************************************************* 130 * 131 * @brief update encoder configuration parameters 132 * 133 * @par Description: 134 * updates encoder configuration parameters from the given config set. 135 * Initialize/reinitialize codec parameters according to new configurations. 136 * 137 * @param[in] ps_codec 138 * Pointer to codec context 139 * 140 * @param[in] ps_cfg 141 * Pointer to config param set 142 * 143 * @remarks none 144 * 145 ******************************************************************************* 146 */ 147 IH264E_ERROR_T ih264e_codec_update_config(codec_t *ps_codec, cfg_params_t *ps_cfg); 148 149 #endif /* IH264E_MASTER_H_ */ 150