xref: /btstack/3rd-party/lc3-google/test/run.py (revision 4930cef6e21e6da2d7571b9259c7f0fb8bed3d01)
1*4930cef6SMatthias Ringwald#!/usr/bin/env python3
2*4930cef6SMatthias Ringwald#
3*4930cef6SMatthias Ringwald# Copyright 2022 Google LLC
4*4930cef6SMatthias Ringwald#
5*4930cef6SMatthias Ringwald# Licensed under the Apache License, Version 2.0 (the "License");
6*4930cef6SMatthias Ringwald# you may not use this file except in compliance with the License.
7*4930cef6SMatthias Ringwald# You may obtain a copy of the License at
8*4930cef6SMatthias Ringwald#
9*4930cef6SMatthias Ringwald#     http://www.apache.org/licenses/LICENSE-2.0
10*4930cef6SMatthias Ringwald#
11*4930cef6SMatthias Ringwald# Unless required by applicable law or agreed to in writing, software
12*4930cef6SMatthias Ringwald# distributed under the License is distributed on an "AS IS" BASIS,
13*4930cef6SMatthias Ringwald# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*4930cef6SMatthias Ringwald# See the License for the specific language governing permissions and
15*4930cef6SMatthias Ringwald# limitations under the License.
16*4930cef6SMatthias Ringwald#
17*4930cef6SMatthias Ringwald
18*4930cef6SMatthias Ringwaldimport mdct, energy, bwdet, attdet
19*4930cef6SMatthias Ringwaldimport ltpf, sns, tns, spec, encoder, decoder
20*4930cef6SMatthias Ringwald
21*4930cef6SMatthias Ringwaldok = True
22*4930cef6SMatthias Ringwald
23*4930cef6SMatthias Ringwaldfor m in [ ( mdct    , "MDCT"                   ),
24*4930cef6SMatthias Ringwald           ( energy  , "Energy Band"            ),
25*4930cef6SMatthias Ringwald           ( bwdet   , "Bandwidth Detector"     ),
26*4930cef6SMatthias Ringwald           ( attdet  , "Attack Detector"        ),
27*4930cef6SMatthias Ringwald           ( ltpf    , "Long Term Postfilter"   ),
28*4930cef6SMatthias Ringwald           ( sns     , "Spectral Noise Shaping" ),
29*4930cef6SMatthias Ringwald           ( tns     , "Temporal Noise Shaping" ),
30*4930cef6SMatthias Ringwald           ( spec    , "Spectral Quantization"  ),
31*4930cef6SMatthias Ringwald           ( encoder , "Encoder"                ),
32*4930cef6SMatthias Ringwald           ( decoder , "Decoder"                ) ]:
33*4930cef6SMatthias Ringwald
34*4930cef6SMatthias Ringwald    print('[{:^6}] {:}'.format('...', m[1]), end='\r', flush=True)
35*4930cef6SMatthias Ringwald    ret = m[0].check()
36*4930cef6SMatthias Ringwald    print('[{:^6}] {:}'.format('OK' if ret else 'FAILED', m[1]))
37*4930cef6SMatthias Ringwald
38*4930cef6SMatthias Ringwald    ok = ok and ret
39*4930cef6SMatthias Ringwald
40*4930cef6SMatthias Ringwaldexit(0 if ok else 1);
41