Compare commits
4 commits
main
...
split-work
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c2dbe7b6a | |||
| bd5ec9f5a7 | |||
| 1eab7bcd37 | |||
| 09ae1714ad |
3 changed files with 36 additions and 7 deletions
2
.github/workflows/pip.yml
vendored
2
.github/workflows/pip.yml
vendored
|
|
@ -4,8 +4,6 @@ on:
|
|||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
|
|
|||
26
.github/workflows/wheels.yml
vendored
26
.github/workflows/wheels.yml
vendored
|
|
@ -4,8 +4,6 @@ on:
|
|||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
|
@ -33,19 +31,37 @@ jobs:
|
|||
|
||||
|
||||
build_wheels:
|
||||
name: Wheels on ${{ matrix.os }}
|
||||
name: Wheels on ${{ matrix.os }}${{ matrix.extra }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
arch_linux: ["auto"]
|
||||
extra: [""]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
arch_linux: "aarch64"
|
||||
extra: "- aarch64"
|
||||
- os: ubuntu-latest
|
||||
arch_linux: "ppc64le"
|
||||
extra: "- ppc64le"
|
||||
- os: ubuntu-latest
|
||||
arch_linux: "s390x"
|
||||
extra: "- s390x"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
if: runner.os == 'Linux'
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- uses: pypa/cibuildwheel@v2.14.1
|
||||
env:
|
||||
CIBW_ARCHS_MACOS: auto universal2
|
||||
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
|
||||
CIBW_ARCHS_LINUX: ${{ matrix.arch_linux }}
|
||||
CIBW_PRERELEASE_PYTHONS: true
|
||||
|
||||
- name: Verify clean directory
|
||||
|
|
|
|||
15
src/main.cpp
15
src/main.cpp
|
|
@ -1,4 +1,5 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <algorithm>
|
||||
|
||||
extern "C" {
|
||||
#include "au/au_header.c"
|
||||
|
|
@ -18,6 +19,14 @@ extern "C" {
|
|||
#define STRINGIFY(x) #x
|
||||
#define MACRO_STRINGIFY(x) STRINGIFY(x)
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <endian.h>
|
||||
#else
|
||||
// all others assumed to be little-endian
|
||||
#define htole16(x) (x)
|
||||
#define le16toh(x) (x)
|
||||
#endif
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
#define MAX_SAMPLE_RATE 32000
|
||||
|
|
@ -38,6 +47,9 @@ py::bytes encode(py::bytes bytes_in, size_t input_frame_size=320, size_t output_
|
|||
size_t e = std::min(std::size(data_in), i + 2*input_frame_size);
|
||||
std::fill(std::copy(reinterpret_cast<Word16*>(&data_in[i]), reinterpret_cast<Word16*>(&data_in[e]), input), std::end(input), 0);
|
||||
|
||||
for(size_t i=0; i < MAX_FRAMESIZE; i++)
|
||||
input[i] = le16toh(input[i]);
|
||||
|
||||
auto mag_shift = samples_to_rmlt_coefs(input, history, mlt_coefs, input_frame_size);
|
||||
|
||||
/* Encode the mlt coefs */
|
||||
|
|
@ -47,6 +59,9 @@ py::bytes encode(py::bytes bytes_in, size_t input_frame_size=320, size_t output_
|
|||
mag_shift,
|
||||
out_words);
|
||||
|
||||
for(size_t i=0; i < MAX_BITS_PER_FRAME / 16; i++)
|
||||
out_words[i] = htole16(out_words[i]);
|
||||
|
||||
result.append(reinterpret_cast<char*>(&out_words[0]), output_frame_size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue