G722-numpy 1.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- g722_numpy-1.2.4/G722_numpy.egg-info/PKG-INFO +147 -0
- g722_numpy-1.2.4/G722_numpy.egg-info/SOURCES.txt +27 -0
- g722_numpy-1.2.4/G722_numpy.egg-info/dependency_links.txt +1 -0
- g722_numpy-1.2.4/G722_numpy.egg-info/requires.txt +2 -0
- g722_numpy-1.2.4/G722_numpy.egg-info/top_level.txt +1 -0
- g722_numpy-1.2.4/LICENSE +46 -0
- g722_numpy-1.2.4/MANIFEST.in +4 -0
- g722_numpy-1.2.4/PKG-INFO +147 -0
- g722_numpy-1.2.4/README.md +121 -0
- g722_numpy-1.2.4/build_tools/CheckVersion.py +24 -0
- g722_numpy-1.2.4/build_tools/__init__.py +0 -0
- g722_numpy-1.2.4/g722.h +55 -0
- g722_numpy-1.2.4/g722_codec.h +15 -0
- g722_numpy-1.2.4/g722_common.h +138 -0
- g722_numpy-1.2.4/g722_decode.c +283 -0
- g722_numpy-1.2.4/g722_decoder.h +44 -0
- g722_numpy-1.2.4/g722_encode.c +287 -0
- g722_numpy-1.2.4/g722_encoder.h +44 -0
- g722_numpy-1.2.4/g722_private.h +104 -0
- g722_numpy-1.2.4/pyproject.toml +3 -0
- g722_numpy-1.2.4/python/G722_mod.c +496 -0
- g722_numpy-1.2.4/python/G722_numpy_api.h +14 -0
- g722_numpy-1.2.4/python/G722_numpy_mod.c +191 -0
- g722_numpy-1.2.4/python/symbols.map +6 -0
- g722_numpy-1.2.4/setup.cfg +4 -0
- g722_numpy-1.2.4/setup.py +243 -0
- g722_numpy-1.2.4/tests/test_decode.py +40 -0
- g722_numpy-1.2.4/tests/test_encode.py +50 -0
- g722_numpy-1.2.4/tests/test_encode_decode.py +58 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: G722-numpy
|
|
3
|
+
Version: 1.2.4
|
|
4
|
+
Summary: Optional NumPy backend for G.722 module
|
|
5
|
+
Home-page: https://github.com/sippy/libg722
|
|
6
|
+
Author: Maksym Sobolyev
|
|
7
|
+
Author-email: sobomax@sippysoft.com
|
|
8
|
+
License: Public-Domain
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: C
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: G722==1.2.4
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
Dynamic: requires-dist
|
|
25
|
+
Dynamic: summary
|
|
26
|
+
|
|
27
|
+
# libg722
|
|
28
|
+
|
|
29
|
+
[](https://github.com/sippy/libg722/actions/workflows/build_and_test.yml)
|
|
30
|
+
|
|
31
|
+
## Introduction
|
|
32
|
+
|
|
33
|
+
The G.722 module is a bit exact implementation of the ITU G.722 specification
|
|
34
|
+
for all three specified bit rates - 64000bps, 56000bps and 48000bps. It passes
|
|
35
|
+
the ITU tests.
|
|
36
|
+
|
|
37
|
+
To allow fast and flexible interworking with narrow band telephony, the
|
|
38
|
+
encoder and decoder support an option for the linear audio to be an 8k
|
|
39
|
+
samples/second stream. In this mode the codec is considerably faster, and
|
|
40
|
+
still fully compatible with wideband terminals using G.722.
|
|
41
|
+
|
|
42
|
+
## History
|
|
43
|
+
|
|
44
|
+
The code was originally written by Milton Anderson <milton@thumper.bellcore.com>
|
|
45
|
+
from BELLCORE, and has been modified by the Chengxiang Lu and Alex Hauptmann
|
|
46
|
+
from the Speech Group, School of Computer Science, Carnegie Mellon University,
|
|
47
|
+
to be fairly fast and efficient, while retaining high fidelity.
|
|
48
|
+
|
|
49
|
+
Steve Underwood <steveu@coppice.org> improved the code a lot later on and
|
|
50
|
+
contributed it into several popular open source projects.
|
|
51
|
+
|
|
52
|
+
Himanshu Soni <sonihimanshu@gmail.com> has adjusted some coefficients
|
|
53
|
+
to avoid over/under-flows in the decoder.
|
|
54
|
+
|
|
55
|
+
Phil Schatzmann <phil.schatzmann@gmail.com> has added cmake-glue and Arduino
|
|
56
|
+
support.
|
|
57
|
+
|
|
58
|
+
Librarized by Sippy Software, Inc.
|
|
59
|
+
|
|
60
|
+
## Build and Install library:
|
|
61
|
+
|
|
62
|
+
### MacOS & Linux
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
git clone https://github.com/sippy/libg722.git
|
|
66
|
+
cmake -B libg722/build -S libg722
|
|
67
|
+
make -C libg722/build clean all test install
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Note for macOS users:** The library will be installed to `~/Library/libg722` by default. If you prefer a different location, you can specify it with:
|
|
71
|
+
```
|
|
72
|
+
cmake -B libg722/build -S libg722 -DCMAKE_INSTALL_PREFIX=/your/preferred/path
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After installation, you may need to add the library path to your environment:
|
|
76
|
+
```
|
|
77
|
+
export DYLD_LIBRARY_PATH="$HOME/Library/libg722/lib:$DYLD_LIBRARY_PATH"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### iOS
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
git clone https://github.com/sippy/libg722.git
|
|
84
|
+
cmake -B libg722/build-ios-device -S libg722 \
|
|
85
|
+
-DCMAKE_SYSTEM_NAME=iOS \
|
|
86
|
+
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
|
87
|
+
-DCMAKE_OSX_SYSROOT=iphoneos \
|
|
88
|
+
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
|
|
89
|
+
make -C libg722/build-ios-device
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Install Python module from PyPy:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
pip install G722
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Build and Install Python module from source code:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
git clone https://github.com/sippy/libg722.git
|
|
102
|
+
pip install libg722/
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This builds the **core** package (`G722`) with no hard dependency on NumPy.
|
|
106
|
+
To install NumPy decode support on demand:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
pip install "G722[numpy]"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
or:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
pip install G722-numpy
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`LIBG722_BUILD_MODE` controls build profile for the main `G722` extension:
|
|
119
|
+
- `production`: build with optimization (`-O2`, or `/O2` on Windows).
|
|
120
|
+
- `debug`: build with `-g3 -O0`.
|
|
121
|
+
- `auto` (default): if `.` is a git repository, run `git diff v{version} -- .`; build in `debug` mode when it differs, otherwise `production`. If `.` is not a git repository, use `production`.
|
|
122
|
+
|
|
123
|
+
`LIBG722_PACKAGE_VARIANT` controls which Python distribution is built from this repository:
|
|
124
|
+
- `core` (default): builds/publishes `G722`.
|
|
125
|
+
- `numpy-addon`: builds/publishes `G722-numpy` from `python/G722_numpy_mod.c`.
|
|
126
|
+
|
|
127
|
+
`G722(sample_rate, bit_rate, use_numpy=None)` accepts an optional `use_numpy` flag:
|
|
128
|
+
- `True`: return NumPy arrays from `decode()` (raises if `G722-numpy` is not installed).
|
|
129
|
+
- `False`: return Python `array('h')` from `decode()`.
|
|
130
|
+
- omitted: auto-detect the optional backend and use NumPy when available, otherwise `array('h')`.
|
|
131
|
+
|
|
132
|
+
## Pull library into your Docker container:
|
|
133
|
+
```
|
|
134
|
+
ARG BASE_IMAGE=debian:sid-slim
|
|
135
|
+
ARG LIBG722_IMAGE=sippylabs/libg722:latest-debian_sid-slim
|
|
136
|
+
FROM ${LIBG722_IMAGE} AS libg722
|
|
137
|
+
FROM ${BASE_IMAGE} AS build
|
|
138
|
+
COPY --from=libg722 /usr/local/lib/libg722.* /usr/local/lib/
|
|
139
|
+
COPY --from=libg722 /usr/local/include/g722* /usr/local/include/
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
This code is mostly Public Domain. Library test code is under BSD 2-clause
|
|
145
|
+
license.
|
|
146
|
+
|
|
147
|
+
See LICENSE for copyright details and each individual file for specifics.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
g722.h
|
|
5
|
+
g722_codec.h
|
|
6
|
+
g722_common.h
|
|
7
|
+
g722_decode.c
|
|
8
|
+
g722_decoder.h
|
|
9
|
+
g722_encode.c
|
|
10
|
+
g722_encoder.h
|
|
11
|
+
g722_private.h
|
|
12
|
+
pyproject.toml
|
|
13
|
+
setup.py
|
|
14
|
+
G722_numpy.egg-info/PKG-INFO
|
|
15
|
+
G722_numpy.egg-info/SOURCES.txt
|
|
16
|
+
G722_numpy.egg-info/dependency_links.txt
|
|
17
|
+
G722_numpy.egg-info/requires.txt
|
|
18
|
+
G722_numpy.egg-info/top_level.txt
|
|
19
|
+
build_tools/CheckVersion.py
|
|
20
|
+
build_tools/__init__.py
|
|
21
|
+
python/G722_mod.c
|
|
22
|
+
python/G722_numpy_api.h
|
|
23
|
+
python/G722_numpy_mod.c
|
|
24
|
+
python/symbols.map
|
|
25
|
+
tests/test_decode.py
|
|
26
|
+
tests/test_encode.py
|
|
27
|
+
tests/test_encode_decode.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
G722_numpy
|
g722_numpy-1.2.4/LICENSE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
*****
|
|
2
|
+
* Copyright (c) CMU 1993
|
|
3
|
+
*
|
|
4
|
+
* Computer Science, Speech Group
|
|
5
|
+
* Chengxiang Lu and Alex Hauptmann
|
|
6
|
+
*
|
|
7
|
+
* The Carnegie Mellon ADPCM program is Copyright (c) 1993 by Carnegie Mellon
|
|
8
|
+
* University. Use of this program, for any research or commercial purpose, is
|
|
9
|
+
* completely unrestricted. If you make use of or redistribute this material,
|
|
10
|
+
* we would appreciate acknowlegement of its origin.
|
|
11
|
+
*****
|
|
12
|
+
|
|
13
|
+
*****
|
|
14
|
+
* Copyright (C) 2005 Steve Underwood
|
|
15
|
+
*
|
|
16
|
+
* Despite my general liking of the GPL, I place my own contributions
|
|
17
|
+
* to this code in the public domain for the benefit of all mankind -
|
|
18
|
+
* even the slimy ones who might try to proprietize my work and use it
|
|
19
|
+
* to my detriment.
|
|
20
|
+
*****
|
|
21
|
+
|
|
22
|
+
*****
|
|
23
|
+
* Copyright (c) 2014-2025 Sippy Software, Inc., http://www.sippysoft.com
|
|
24
|
+
* All rights reserved.
|
|
25
|
+
*
|
|
26
|
+
* Redistribution and use in source and binary forms, with or without
|
|
27
|
+
* modification, are permitted provided that the following conditions
|
|
28
|
+
* are met:
|
|
29
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
30
|
+
* notice, this list of conditions and the following disclaimer.
|
|
31
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
32
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
33
|
+
* documentation and/or other materials provided with the distribution.
|
|
34
|
+
*
|
|
35
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
36
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
37
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
38
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
39
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
40
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
41
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
42
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
43
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
44
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
45
|
+
* SUCH DAMAGE.
|
|
46
|
+
*****
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
include build_tools/__init__.py build_tools/CheckVersion.py
|
|
2
|
+
include g722.h g722_codec.h g722_common.h g722_decoder.h g722_encoder.h g722_private.h
|
|
3
|
+
include g722_decode.c g722_encode.c python/G722_mod.c python/G722_numpy_mod.c
|
|
4
|
+
include python/symbols.map python/G722_numpy_api.h
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: G722-numpy
|
|
3
|
+
Version: 1.2.4
|
|
4
|
+
Summary: Optional NumPy backend for G.722 module
|
|
5
|
+
Home-page: https://github.com/sippy/libg722
|
|
6
|
+
Author: Maksym Sobolyev
|
|
7
|
+
Author-email: sobomax@sippysoft.com
|
|
8
|
+
License: Public-Domain
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: C
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: G722==1.2.4
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
Dynamic: requires-dist
|
|
25
|
+
Dynamic: summary
|
|
26
|
+
|
|
27
|
+
# libg722
|
|
28
|
+
|
|
29
|
+
[](https://github.com/sippy/libg722/actions/workflows/build_and_test.yml)
|
|
30
|
+
|
|
31
|
+
## Introduction
|
|
32
|
+
|
|
33
|
+
The G.722 module is a bit exact implementation of the ITU G.722 specification
|
|
34
|
+
for all three specified bit rates - 64000bps, 56000bps and 48000bps. It passes
|
|
35
|
+
the ITU tests.
|
|
36
|
+
|
|
37
|
+
To allow fast and flexible interworking with narrow band telephony, the
|
|
38
|
+
encoder and decoder support an option for the linear audio to be an 8k
|
|
39
|
+
samples/second stream. In this mode the codec is considerably faster, and
|
|
40
|
+
still fully compatible with wideband terminals using G.722.
|
|
41
|
+
|
|
42
|
+
## History
|
|
43
|
+
|
|
44
|
+
The code was originally written by Milton Anderson <milton@thumper.bellcore.com>
|
|
45
|
+
from BELLCORE, and has been modified by the Chengxiang Lu and Alex Hauptmann
|
|
46
|
+
from the Speech Group, School of Computer Science, Carnegie Mellon University,
|
|
47
|
+
to be fairly fast and efficient, while retaining high fidelity.
|
|
48
|
+
|
|
49
|
+
Steve Underwood <steveu@coppice.org> improved the code a lot later on and
|
|
50
|
+
contributed it into several popular open source projects.
|
|
51
|
+
|
|
52
|
+
Himanshu Soni <sonihimanshu@gmail.com> has adjusted some coefficients
|
|
53
|
+
to avoid over/under-flows in the decoder.
|
|
54
|
+
|
|
55
|
+
Phil Schatzmann <phil.schatzmann@gmail.com> has added cmake-glue and Arduino
|
|
56
|
+
support.
|
|
57
|
+
|
|
58
|
+
Librarized by Sippy Software, Inc.
|
|
59
|
+
|
|
60
|
+
## Build and Install library:
|
|
61
|
+
|
|
62
|
+
### MacOS & Linux
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
git clone https://github.com/sippy/libg722.git
|
|
66
|
+
cmake -B libg722/build -S libg722
|
|
67
|
+
make -C libg722/build clean all test install
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Note for macOS users:** The library will be installed to `~/Library/libg722` by default. If you prefer a different location, you can specify it with:
|
|
71
|
+
```
|
|
72
|
+
cmake -B libg722/build -S libg722 -DCMAKE_INSTALL_PREFIX=/your/preferred/path
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After installation, you may need to add the library path to your environment:
|
|
76
|
+
```
|
|
77
|
+
export DYLD_LIBRARY_PATH="$HOME/Library/libg722/lib:$DYLD_LIBRARY_PATH"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### iOS
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
git clone https://github.com/sippy/libg722.git
|
|
84
|
+
cmake -B libg722/build-ios-device -S libg722 \
|
|
85
|
+
-DCMAKE_SYSTEM_NAME=iOS \
|
|
86
|
+
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
|
87
|
+
-DCMAKE_OSX_SYSROOT=iphoneos \
|
|
88
|
+
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
|
|
89
|
+
make -C libg722/build-ios-device
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Install Python module from PyPy:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
pip install G722
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Build and Install Python module from source code:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
git clone https://github.com/sippy/libg722.git
|
|
102
|
+
pip install libg722/
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This builds the **core** package (`G722`) with no hard dependency on NumPy.
|
|
106
|
+
To install NumPy decode support on demand:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
pip install "G722[numpy]"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
or:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
pip install G722-numpy
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`LIBG722_BUILD_MODE` controls build profile for the main `G722` extension:
|
|
119
|
+
- `production`: build with optimization (`-O2`, or `/O2` on Windows).
|
|
120
|
+
- `debug`: build with `-g3 -O0`.
|
|
121
|
+
- `auto` (default): if `.` is a git repository, run `git diff v{version} -- .`; build in `debug` mode when it differs, otherwise `production`. If `.` is not a git repository, use `production`.
|
|
122
|
+
|
|
123
|
+
`LIBG722_PACKAGE_VARIANT` controls which Python distribution is built from this repository:
|
|
124
|
+
- `core` (default): builds/publishes `G722`.
|
|
125
|
+
- `numpy-addon`: builds/publishes `G722-numpy` from `python/G722_numpy_mod.c`.
|
|
126
|
+
|
|
127
|
+
`G722(sample_rate, bit_rate, use_numpy=None)` accepts an optional `use_numpy` flag:
|
|
128
|
+
- `True`: return NumPy arrays from `decode()` (raises if `G722-numpy` is not installed).
|
|
129
|
+
- `False`: return Python `array('h')` from `decode()`.
|
|
130
|
+
- omitted: auto-detect the optional backend and use NumPy when available, otherwise `array('h')`.
|
|
131
|
+
|
|
132
|
+
## Pull library into your Docker container:
|
|
133
|
+
```
|
|
134
|
+
ARG BASE_IMAGE=debian:sid-slim
|
|
135
|
+
ARG LIBG722_IMAGE=sippylabs/libg722:latest-debian_sid-slim
|
|
136
|
+
FROM ${LIBG722_IMAGE} AS libg722
|
|
137
|
+
FROM ${BASE_IMAGE} AS build
|
|
138
|
+
COPY --from=libg722 /usr/local/lib/libg722.* /usr/local/lib/
|
|
139
|
+
COPY --from=libg722 /usr/local/include/g722* /usr/local/include/
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
This code is mostly Public Domain. Library test code is under BSD 2-clause
|
|
145
|
+
license.
|
|
146
|
+
|
|
147
|
+
See LICENSE for copyright details and each individual file for specifics.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# libg722
|
|
2
|
+
|
|
3
|
+
[](https://github.com/sippy/libg722/actions/workflows/build_and_test.yml)
|
|
4
|
+
|
|
5
|
+
## Introduction
|
|
6
|
+
|
|
7
|
+
The G.722 module is a bit exact implementation of the ITU G.722 specification
|
|
8
|
+
for all three specified bit rates - 64000bps, 56000bps and 48000bps. It passes
|
|
9
|
+
the ITU tests.
|
|
10
|
+
|
|
11
|
+
To allow fast and flexible interworking with narrow band telephony, the
|
|
12
|
+
encoder and decoder support an option for the linear audio to be an 8k
|
|
13
|
+
samples/second stream. In this mode the codec is considerably faster, and
|
|
14
|
+
still fully compatible with wideband terminals using G.722.
|
|
15
|
+
|
|
16
|
+
## History
|
|
17
|
+
|
|
18
|
+
The code was originally written by Milton Anderson <milton@thumper.bellcore.com>
|
|
19
|
+
from BELLCORE, and has been modified by the Chengxiang Lu and Alex Hauptmann
|
|
20
|
+
from the Speech Group, School of Computer Science, Carnegie Mellon University,
|
|
21
|
+
to be fairly fast and efficient, while retaining high fidelity.
|
|
22
|
+
|
|
23
|
+
Steve Underwood <steveu@coppice.org> improved the code a lot later on and
|
|
24
|
+
contributed it into several popular open source projects.
|
|
25
|
+
|
|
26
|
+
Himanshu Soni <sonihimanshu@gmail.com> has adjusted some coefficients
|
|
27
|
+
to avoid over/under-flows in the decoder.
|
|
28
|
+
|
|
29
|
+
Phil Schatzmann <phil.schatzmann@gmail.com> has added cmake-glue and Arduino
|
|
30
|
+
support.
|
|
31
|
+
|
|
32
|
+
Librarized by Sippy Software, Inc.
|
|
33
|
+
|
|
34
|
+
## Build and Install library:
|
|
35
|
+
|
|
36
|
+
### MacOS & Linux
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
git clone https://github.com/sippy/libg722.git
|
|
40
|
+
cmake -B libg722/build -S libg722
|
|
41
|
+
make -C libg722/build clean all test install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Note for macOS users:** The library will be installed to `~/Library/libg722` by default. If you prefer a different location, you can specify it with:
|
|
45
|
+
```
|
|
46
|
+
cmake -B libg722/build -S libg722 -DCMAKE_INSTALL_PREFIX=/your/preferred/path
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After installation, you may need to add the library path to your environment:
|
|
50
|
+
```
|
|
51
|
+
export DYLD_LIBRARY_PATH="$HOME/Library/libg722/lib:$DYLD_LIBRARY_PATH"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### iOS
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
git clone https://github.com/sippy/libg722.git
|
|
58
|
+
cmake -B libg722/build-ios-device -S libg722 \
|
|
59
|
+
-DCMAKE_SYSTEM_NAME=iOS \
|
|
60
|
+
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
|
61
|
+
-DCMAKE_OSX_SYSROOT=iphoneos \
|
|
62
|
+
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
|
|
63
|
+
make -C libg722/build-ios-device
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Install Python module from PyPy:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
pip install G722
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Build and Install Python module from source code:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
git clone https://github.com/sippy/libg722.git
|
|
76
|
+
pip install libg722/
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This builds the **core** package (`G722`) with no hard dependency on NumPy.
|
|
80
|
+
To install NumPy decode support on demand:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
pip install "G722[numpy]"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
or:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
pip install G722-numpy
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`LIBG722_BUILD_MODE` controls build profile for the main `G722` extension:
|
|
93
|
+
- `production`: build with optimization (`-O2`, or `/O2` on Windows).
|
|
94
|
+
- `debug`: build with `-g3 -O0`.
|
|
95
|
+
- `auto` (default): if `.` is a git repository, run `git diff v{version} -- .`; build in `debug` mode when it differs, otherwise `production`. If `.` is not a git repository, use `production`.
|
|
96
|
+
|
|
97
|
+
`LIBG722_PACKAGE_VARIANT` controls which Python distribution is built from this repository:
|
|
98
|
+
- `core` (default): builds/publishes `G722`.
|
|
99
|
+
- `numpy-addon`: builds/publishes `G722-numpy` from `python/G722_numpy_mod.c`.
|
|
100
|
+
|
|
101
|
+
`G722(sample_rate, bit_rate, use_numpy=None)` accepts an optional `use_numpy` flag:
|
|
102
|
+
- `True`: return NumPy arrays from `decode()` (raises if `G722-numpy` is not installed).
|
|
103
|
+
- `False`: return Python `array('h')` from `decode()`.
|
|
104
|
+
- omitted: auto-detect the optional backend and use NumPy when available, otherwise `array('h')`.
|
|
105
|
+
|
|
106
|
+
## Pull library into your Docker container:
|
|
107
|
+
```
|
|
108
|
+
ARG BASE_IMAGE=debian:sid-slim
|
|
109
|
+
ARG LIBG722_IMAGE=sippylabs/libg722:latest-debian_sid-slim
|
|
110
|
+
FROM ${LIBG722_IMAGE} AS libg722
|
|
111
|
+
FROM ${BASE_IMAGE} AS build
|
|
112
|
+
COPY --from=libg722 /usr/local/lib/libg722.* /usr/local/lib/
|
|
113
|
+
COPY --from=libg722 /usr/local/include/g722* /usr/local/include/
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
This code is mostly Public Domain. Library test code is under BSD 2-clause
|
|
119
|
+
license.
|
|
120
|
+
|
|
121
|
+
See LICENSE for copyright details and each individual file for specifics.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from distutils.core import Command
|
|
3
|
+
|
|
4
|
+
class CheckVersion(Command):
|
|
5
|
+
description = "Check version number"
|
|
6
|
+
user_options = [
|
|
7
|
+
('tag=', 't', 'git tag to compare against package version'),
|
|
8
|
+
]
|
|
9
|
+
extra_compile_args = []
|
|
10
|
+
extra_link_args = []
|
|
11
|
+
|
|
12
|
+
def initialize_options(self):
|
|
13
|
+
self.tag = None
|
|
14
|
+
|
|
15
|
+
def finalize_options(self):
|
|
16
|
+
if not self.tag:
|
|
17
|
+
raise DistutilsOptionError("You must specify --tag")
|
|
18
|
+
|
|
19
|
+
def run(self):
|
|
20
|
+
pkg_version = self.distribution.get_version()
|
|
21
|
+
if self.tag == f'v{pkg_version}':
|
|
22
|
+
return
|
|
23
|
+
sys.stderr.write(f"❌ version {pkg_version} != tag {self.tag}\n")
|
|
24
|
+
sys.exit(1)
|
|
File without changes
|
g722_numpy-1.2.4/g722.h
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SpanDSP - a series of DSP components for telephony
|
|
3
|
+
*
|
|
4
|
+
* g722.h - The ITU G.722 codec.
|
|
5
|
+
*
|
|
6
|
+
* Written by Steve Underwood <steveu@coppice.org>
|
|
7
|
+
*
|
|
8
|
+
* Copyright (C) 2005 Steve Underwood
|
|
9
|
+
*
|
|
10
|
+
* Despite my general liking of the GPL, I place my own contributions
|
|
11
|
+
* to this code in the public domain for the benefit of all mankind -
|
|
12
|
+
* even the slimy ones who might try to proprietize my work and use it
|
|
13
|
+
* to my detriment.
|
|
14
|
+
*
|
|
15
|
+
* Based on a single channel G.722 codec which is:
|
|
16
|
+
*
|
|
17
|
+
***** Copyright (c) CMU 1993 *****
|
|
18
|
+
* Computer Science, Speech Group
|
|
19
|
+
* Chengxiang Lu and Alex Hauptmann
|
|
20
|
+
*
|
|
21
|
+
* $Id: g722.h,v 1.1 2012/08/07 11:33:45 sobomax Exp $
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/*! \file */
|
|
26
|
+
|
|
27
|
+
#pragma once
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
/*! \page g722_page G.722 encoding and decoding
|
|
34
|
+
\section g722_page_sec_1 What does it do?
|
|
35
|
+
The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
|
|
36
|
+
specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
|
|
37
|
+
|
|
38
|
+
To allow fast and flexible interworking with narrow band telephony, the encoder and decoder
|
|
39
|
+
support an option for the linear audio to be an 8k samples/second stream. In this mode the
|
|
40
|
+
codec is considerably faster, and still fully compatible with wideband terminals using G.722.
|
|
41
|
+
|
|
42
|
+
\section g722_page_sec_2 How does it work?
|
|
43
|
+
???.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
enum
|
|
47
|
+
{
|
|
48
|
+
G722_DEFAULT = 0x0000,
|
|
49
|
+
G722_SAMPLE_RATE_8000 = 0x0001,
|
|
50
|
+
G722_PACKED = 0x0002
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
#ifdef __cplusplus
|
|
54
|
+
}
|
|
55
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file g722_codec.h
|
|
3
|
+
* @author Phil Schatzmann
|
|
4
|
+
* @brief Include for encoder and decoder which supports C++
|
|
5
|
+
* @version 0.1
|
|
6
|
+
* @date 2022-05-08
|
|
7
|
+
*
|
|
8
|
+
* @copyright Copyright (c) 2022
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#pragma once
|
|
13
|
+
|
|
14
|
+
#include "g722_encoder.h"
|
|
15
|
+
#include "g722_decoder.h"
|