Lines Matching refs:hLdacAbr
98 HANDLE_LDAC_ABR hLdacAbr; in ldac_ABR_get_handle() local
100 if ((hLdacAbr = (HANDLE_LDAC_ABR)malloc(sizeof(LDAC_ABR_PARAMS))) == NULL) { in ldac_ABR_get_handle()
104 hLdacAbr->TxQD_Info.pHist = NULL; in ldac_ABR_get_handle()
105 return hLdacAbr; in ldac_ABR_get_handle()
109 void ldac_ABR_free_handle(HANDLE_LDAC_ABR hLdacAbr) in ldac_ABR_free_handle() argument
112 if (hLdacAbr != NULL) { in ldac_ABR_free_handle()
113 if (hLdacAbr->TxQD_Info.pHist) { in ldac_ABR_free_handle()
114 free(hLdacAbr->TxQD_Info.pHist); in ldac_ABR_free_handle()
116 free(hLdacAbr); in ldac_ABR_free_handle()
121 int ldac_ABR_Init( HANDLE_LDAC_ABR hLdacAbr, unsigned int interval_ms ) in ldac_ABR_Init() argument
123 ABRDBG( "hLdacAbr:0x%x, interval_ms:%u", (unsigned int)hLdacAbr, interval_ms ); in ldac_ABR_Init()
124 if (hLdacAbr == NULL) return -1; in ldac_ABR_Init()
128 hLdacAbr->numToEvaluate = LDAC_ABR_OBSERVING_TIME_MS / interval_ms; in ldac_ABR_Init()
129 hLdacAbr->TxQD_Info.sum = 0; in ldac_ABR_Init()
130 hLdacAbr->TxQD_Info.cnt = 0; in ldac_ABR_Init()
131 hLdacAbr->TxQD_Info.idx = 0; in ldac_ABR_Init()
132 hLdacAbr->TxQD_Info.szHist = hLdacAbr->numToEvaluate + 1; in ldac_ABR_Init()
133 if (hLdacAbr->TxQD_Info.pHist) free(hLdacAbr->TxQD_Info.pHist); in ldac_ABR_Init()
134 if ((hLdacAbr->TxQD_Info.pHist = in ldac_ABR_Init()
135 (unsigned char*)malloc(hLdacAbr->TxQD_Info.szHist * sizeof(unsigned char))) == NULL){ in ldac_ABR_Init()
138 clear_data(hLdacAbr->TxQD_Info.pHist, hLdacAbr->TxQD_Info.szHist * sizeof(unsigned char)); in ldac_ABR_Init()
140 hLdacAbr->nSteadyState = 0; in ldac_ABR_Init()
141 hLdacAbr->nPenalty = 1; in ldac_ABR_Init()
142 hLdacAbr->abrQualityModeIdSteady = aEqmidToAbrQualityModeID[LDACBT_EQMID_HQ]; in ldac_ABR_Init()
143 hLdacAbr->cntToIncQuality = LDAC_ABR_OBSERVING_COUNT_FOR_INIT; in ldac_ABR_Init()
145 hLdacAbr->thCritical = LDAC_ABR_THRESHOLD_CRITICAL_DEFAULT; in ldac_ABR_Init()
146 hLdacAbr->thDangerousTrend = LDAC_ABR_THRESHOLD_DANGEROUSTREND_DEFAULT; in ldac_ABR_Init()
147 hLdacAbr->thSafety4HQSQ = LDAC_ABR_THRESHOLD_SAFETY_FOR_HQSQ_DEFAULT; in ldac_ABR_Init()
153 int ldac_ABR_set_thresholds( HANDLE_LDAC_ABR hLdacAbr, unsigned int thCritical, in ldac_ABR_set_thresholds() argument
158 if (hLdacAbr == NULL) return -1; in ldac_ABR_set_thresholds()
161 hLdacAbr->thCritical = thCritical; in ldac_ABR_set_thresholds()
162 hLdacAbr->thDangerousTrend = thDangerousTrend; in ldac_ABR_set_thresholds()
163 hLdacAbr->thSafety4HQSQ = thSafety4HQSQ; in ldac_ABR_set_thresholds()
168 int ldac_ABR_Proc( HANDLE_LDAC_BT hLDAC, HANDLE_LDAC_ABR hLdacAbr, in ldac_ABR_Proc() argument
178 if (hLdacAbr == NULL) return -1; in ldac_ABR_Proc()
194 if ((i = hLdacAbr->TxQD_Info.idx - 1) < 0 ) i = hLdacAbr->TxQD_Info.szHist - 1; in ldac_ABR_Proc()
195 TxQD_prev = hLdacAbr->TxQD_Info.pHist[i]; in ldac_ABR_Proc()
197 hLdacAbr->TxQD_Info.sum -= hLdacAbr->TxQD_Info.pHist[hLdacAbr->TxQD_Info.idx]; in ldac_ABR_Proc()
198 hLdacAbr->TxQD_Info.pHist[hLdacAbr->TxQD_Info.idx] = (unsigned char)TxQD_curr; in ldac_ABR_Proc()
199 if (++hLdacAbr->TxQD_Info.idx >= hLdacAbr->TxQD_Info.szHist) hLdacAbr->TxQD_Info.idx = 0; in ldac_ABR_Proc()
201 hLdacAbr->TxQD_Info.sum += TxQD_curr; in ldac_ABR_Proc()
202 ++hLdacAbr->TxQD_Info.cnt; in ldac_ABR_Proc()
206 qd += (hLdacAbr->nPenalty * 1000000); in ldac_ABR_Proc()
207 qd += (hLdacAbr->cntToIncQuality *1000); in ldac_ABR_Proc()
208 qd += (hLdacAbr->nSteadyState); in ldac_ABR_Proc()
214 if (TxQD_curr >= hLdacAbr->thCritical) { in ldac_ABR_Proc()
222 else if ((TxQD_curr > hLdacAbr->thDangerousTrend) && (TxQD_curr > TxQD_prev)) { in ldac_ABR_Proc()
226 else if ((TxQD_curr > hLdacAbr->thSafety4HQSQ) && in ldac_ABR_Proc()
231 else if (hLdacAbr->TxQD_Info.cnt >= hLdacAbr->numToEvaluate) { in ldac_ABR_Proc()
233 hLdacAbr->TxQD_Info.cnt = hLdacAbr->numToEvaluate; in ldac_ABR_Proc()
235 ave10 = (hLdacAbr->TxQD_Info.sum * 10) / hLdacAbr->TxQD_Info.cnt; in ldac_ABR_Proc()
242 ++hLdacAbr->nSteadyState; in ldac_ABR_Proc()
245 qd += (hLdacAbr->nPenalty * 1000000); in ldac_ABR_Proc()
246 qd += (hLdacAbr->cntToIncQuality *1000); in ldac_ABR_Proc()
247 qd += (hLdacAbr->nSteadyState); in ldac_ABR_Proc()
250 if (hLdacAbr->TxQD_Info.sum == 0) { in ldac_ABR_Proc()
251 if (--hLdacAbr->cntToIncQuality <= 0) { in ldac_ABR_Proc()
257 hLdacAbr->TxQD_Info.cnt = 0; // reset the number of sample for average proc. in ldac_ABR_Proc()
262 hLdacAbr->cntToIncQuality = LDAC_ABR_OBSERVING_COUNT_TO_JUDGE_INC_QUALITY in ldac_ABR_Proc()
264 if (abrQualityModeID >= hLdacAbr->abrQualityModeIdSteady) { in ldac_ABR_Proc()
265 hLdacAbr->cntToIncQuality *= hLdacAbr->nPenalty; in ldac_ABR_Proc()
272 ABRDBG("Nothing %d, hLdacAbr->TxQD_Info.cnt %u", TxQ, hLdacAbr->TxQD_Info.cnt); in ldac_ABR_Proc()
299 if (hLdacAbr->nSteadyState < LDAC_ABR_NUM_STEADY_STATE_TO_JUDGE_STEADY) { in ldac_ABR_Proc()
300 hLdacAbr->abrQualityModeIdSteady = abrQualityModeIDNew - 1; in ldac_ABR_Proc()
301 if (hLdacAbr->abrQualityModeIdSteady < 0) hLdacAbr->abrQualityModeIdSteady = 0; in ldac_ABR_Proc()
302 hLdacAbr->nPenalty *= 2; in ldac_ABR_Proc()
303 if(hLdacAbr->nPenalty > LDAC_ABR_PENALTY_MAX) { in ldac_ABR_Proc()
304 hLdacAbr->nPenalty = LDAC_ABR_PENALTY_MAX; // MAX PENALTY in ldac_ABR_Proc()
325 if (abrQualityModeIDNew < hLdacAbr->abrQualityModeIdSteady) { in ldac_ABR_Proc()
326 hLdacAbr->nPenalty = 1; in ldac_ABR_Proc()
329 … if (hLdacAbr->nSteadyState > LDAC_ABR_NUM_STEADY_STATE_TO_RESET_PENALTY_FOR_HQ) { in ldac_ABR_Proc()
330 hLdacAbr->nPenalty = 1; in ldac_ABR_Proc()
335 hLdacAbr->nSteadyState = 0; in ldac_ABR_Proc()
337 hLdacAbr->TxQD_Info.cnt = 0; in ldac_ABR_Proc()
338 hLdacAbr->cntToIncQuality = LDAC_ABR_OBSERVING_COUNT_TO_JUDGE_INC_QUALITY in ldac_ABR_Proc()
340 if (hLdacAbr->cntToIncQuality <= 0) { in ldac_ABR_Proc()
342 hLdacAbr->cntToIncQuality = 1; in ldac_ABR_Proc()
344 hLdacAbr->cntToIncQuality *= hLdacAbr->nPenalty; in ldac_ABR_Proc()