1 /**
2  * Copyright (C) 2020 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 
17 #include "sac_bitdec.h"
18 #include "sac_dec_conceal.h"
19 #include <iostream>
20 
21 #define MAX_PARAMETER_SETS (9)
22 #define MAX_NUM_OTT (5)
23 #define ARR_SIZE (16)
24 
25 typedef signed char SCHAR;
26 
main()27 int main() {
28   spatialDec decoder;
29   memset(&decoder, 0x0, sizeof(spatialDec));
30 
31   decoder.numOttBoxes = MAX_NUM_OTT;
32 
33   SPATIAL_SPECIFIC_CONFIG pConfigCurrent;
34   memset(&pConfigCurrent, 0x0, sizeof(SPATIAL_SPECIFIC_CONFIG));
35   decoder.pConfigCurrent = &pConfigCurrent;
36 
37   SCHAR ottCLDidxPrev[ARR_SIZE] = {};
38   decoder.ottCLDidxPrev = (SCHAR **)&ottCLDidxPrev;
39 
40   int smgTime = 1;
41   decoder.smgTime = &smgTime;
42 
43   UCHAR smgData[ARR_SIZE] = {};
44   decoder.smgData = (UCHAR **)&smgData;
45 
46   SMOOTHING_STATE smoothState;
47   memset(&smoothState, 0x0, sizeof(SMOOTHING_STATE));
48   decoder.smoothState = &smoothState;
49 
50   decoder.arbitraryDownmix = 0;
51   (decoder.concealInfo).concealState = SpatialDecConcealState_Ok;
52 
53   const size_t allocSize = MAX_NUM_OTT * MAX_NUM_PARAMETERS;
54 
55   SPATIAL_BS_FRAME frame;
56   memset(&frame, 0x0, sizeof(SPATIAL_BS_FRAME));
57 
58   frame.numParameterSets = MAX_PARAMETER_SETS;
59 
60   LOSSLESSDATA CLDLosslessData[allocSize] = {};
61   frame.CLDLosslessData = CLDLosslessData;
62 
63   LOSSLESSDATA ICCLosslessData[allocSize] = {};
64   frame.ICCLosslessData = ICCLosslessData;
65 
66   LOSSLESSDATA IPDLosslessData[allocSize] = {};
67   frame.IPDLosslessData = IPDLosslessData;
68 
69   for (int i = 0; i < MAX_NUM_OTT; ++i) {
70     for (int j = 0; j < MAX_PARAMETER_SETS; ++j) {
71       (frame.CLDLosslessData[i]).bsXXXDataMode[j] = 2;
72     }
73     LOSSLESSSTATE lossLessState;
74     (frame.CLDLosslessData[i]).state = &lossLessState;
75   }
76 
77   SpatialDecDecodeFrame(&decoder, &frame);
78   return EXIT_SUCCESS;
79 }
80