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_HD(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)22 void processSubband_HD(const int32_t qCode, const int32_t ditherVal,
23                        Subband_data* SubbandDataPt, IQuantiser_data* iqDataPt) {
24   /* Inverse quantisation */
25   invertQuantisation(qCode, ditherVal, iqDataPt);
26 
27   /* Predictor pole coefficient update */
28   updatePredictorPoleCoefficients(iqDataPt->invQ,
29                                   SubbandDataPt->m_predData.m_zeroVal,
30                                   &SubbandDataPt->m_PoleCoeffData);
31 
32   /* Predictor filtering */
33   performPredictionFiltering(iqDataPt->invQ, SubbandDataPt);
34 }
35 
36 /* processSubband_HDLL is used for the LL subband only. */
processSubband_HDLL(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)37 void processSubband_HDLL(const int32_t qCode, const int32_t ditherVal,
38                          Subband_data* SubbandDataPt,
39                          IQuantiser_data* iqDataPt) {
40   /* Inverse quantisation */
41   invertQuantisation(qCode, ditherVal, iqDataPt);
42 
43   /* Predictor pole coefficient update */
44   updatePredictorPoleCoefficients(iqDataPt->invQ,
45                                   SubbandDataPt->m_predData.m_zeroVal,
46                                   &SubbandDataPt->m_PoleCoeffData);
47 
48   /* Predictor filtering */
49   performPredictionFilteringLL(iqDataPt->invQ, SubbandDataPt);
50 }
51 
52 /* processSubband_HDLL is used for the HL subband only. */
processSubband_HDHL(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)53 void processSubband_HDHL(const int32_t qCode, const int32_t ditherVal,
54                          Subband_data* SubbandDataPt,
55                          IQuantiser_data* iqDataPt) {
56   /* Inverse quantisation */
57   invertQuantisationHL(qCode, ditherVal, iqDataPt);
58 
59   /* Predictor pole coefficient update */
60   updatePredictorPoleCoefficients(iqDataPt->invQ,
61                                   SubbandDataPt->m_predData.m_zeroVal,
62                                   &SubbandDataPt->m_PoleCoeffData);
63 
64   /* Predictor filtering */
65   performPredictionFilteringHL(iqDataPt->invQ, SubbandDataPt);
66 }
67