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,
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 /* processSubbandLL is used for the LL subband only. */
processSubbandLL(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)37 void processSubbandLL(const int32_t qCode, const int32_t ditherVal,
38 Subband_data* SubbandDataPt, IQuantiser_data* iqDataPt) {
39 /* Inverse quantisation */
40 invertQuantisation(qCode, ditherVal, iqDataPt);
41
42 /* Predictor pole coefficient update */
43 updatePredictorPoleCoefficients(iqDataPt->invQ,
44 SubbandDataPt->m_predData.m_zeroVal,
45 &SubbandDataPt->m_PoleCoeffData);
46
47 /* Predictor filtering */
48 performPredictionFilteringLL(iqDataPt->invQ, SubbandDataPt);
49 }
50
51 /* processSubbandHL is used for the HL subband only. */
processSubbandHL(const int32_t qCode,const int32_t ditherVal,Subband_data * SubbandDataPt,IQuantiser_data * iqDataPt)52 void processSubbandHL(const int32_t qCode, const int32_t ditherVal,
53 Subband_data* SubbandDataPt, IQuantiser_data* iqDataPt) {
54 /* Inverse quantisation */
55 invertQuantisationHL(qCode, ditherVal, iqDataPt);
56
57 /* Predictor pole coefficient update */
58 updatePredictorPoleCoefficients(iqDataPt->invQ,
59 SubbandDataPt->m_predData.m_zeroVal,
60 &SubbandDataPt->m_PoleCoeffData);
61
62 /* Predictor filtering */
63 performPredictionFilteringHL(iqDataPt->invQ, SubbandDataPt);
64 }
65