1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include "AptxParameters.h"
17 #include "SubbandFunctions.h"
18 #include "SubbandFunctionsCommon.h"
19 
20 /*  This function carries out all subband processing (common to both encode and
21  * decode). */
processSubband(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)22 void processSubband(const int32_t qCode, const int32_t ditherVal, Subband_data* SubbandDataPt,
23                     IQuantiser_data* iqDataPt) {
24   /* Inverse quantisation */
25   invertQuantisation(qCode, ditherVal, iqDataPt);
26 
27   /* Predictor pole coefficient update */
28   updatePredictorPoleCoefficients(iqDataPt->invQ, SubbandDataPt->m_predData.m_zeroVal,
29                                   &SubbandDataPt->m_PoleCoeffData);
30 
31   /* Predictor filtering */
32   performPredictionFiltering(iqDataPt->invQ, SubbandDataPt);
33 }
34 
35 /* processSubbandLL is used for the LL subband only. */
processSubbandLL(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)36 void processSubbandLL(const int32_t qCode, const int32_t ditherVal, Subband_data* SubbandDataPt,
37                       IQuantiser_data* iqDataPt) {
38   /* Inverse quantisation */
39   invertQuantisation(qCode, ditherVal, iqDataPt);
40 
41   /* Predictor pole coefficient update */
42   updatePredictorPoleCoefficients(iqDataPt->invQ, SubbandDataPt->m_predData.m_zeroVal,
43                                   &SubbandDataPt->m_PoleCoeffData);
44 
45   /* Predictor filtering */
46   performPredictionFilteringLL(iqDataPt->invQ, SubbandDataPt);
47 }
48 
49 /* processSubbandHL is used for the HL subband only. */
processSubbandHL(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)50 void processSubbandHL(const int32_t qCode, const int32_t ditherVal, Subband_data* SubbandDataPt,
51                       IQuantiser_data* iqDataPt) {
52   /* Inverse quantisation */
53   invertQuantisationHL(qCode, ditherVal, iqDataPt);
54 
55   /* Predictor pole coefficient update */
56   updatePredictorPoleCoefficients(iqDataPt->invQ, SubbandDataPt->m_predData.m_zeroVal,
57                                   &SubbandDataPt->m_PoleCoeffData);
58 
59   /* Predictor filtering */
60   performPredictionFilteringHL(iqDataPt->invQ, SubbandDataPt);
61 }
62