Compare commits

...

4 commits

Author SHA1 Message Date
3c2dbe7b6a
fix big-endian build for completeness sake 2023-07-28 13:02:50 -05:00
bd5ec9f5a7
Merge pull request #4 from jepler/ci-linux-arm
ci: build aarch64 wheel (for raspberry pi os 64-bit)
2023-07-28 08:37:12 -05:00
1eab7bcd37
build emulated arches on linux
.. this will produce an aarch64 wheel, for use on e.g., 64-bit raspberry
pi os.
2023-07-25 09:41:16 -05:00
09ae1714ad
CI should work on all branches
e.g., jepler forks g722_1_mod and creates branch ci-linux-arm.
before creating a pull request, jepler iteratively pushes a series
of changes to the fork and once the CI is green pull-requests it.
2023-07-25 09:40:16 -05:00
3 changed files with 36 additions and 7 deletions

View file

@ -4,8 +4,6 @@ on:
workflow_dispatch: workflow_dispatch:
pull_request: pull_request:
push: push:
branches:
- main
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}

View file

@ -4,8 +4,6 @@ on:
workflow_dispatch: workflow_dispatch:
pull_request: pull_request:
push: push:
branches:
- main
release: release:
types: types:
- published - published
@ -33,19 +31,37 @@ jobs:
build_wheels: build_wheels:
name: Wheels on ${{ matrix.os }} name: Wheels on ${{ matrix.os }}${{ matrix.extra }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] 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: steps:
- uses: actions/checkout@v3 - 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 - uses: pypa/cibuildwheel@v2.14.1
env: env:
CIBW_ARCHS_MACOS: auto universal2 CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_ARCHS_LINUX: ${{ matrix.arch_linux }}
CIBW_PRERELEASE_PYTHONS: true CIBW_PRERELEASE_PYTHONS: true
- name: Verify clean directory - name: Verify clean directory

View file

@ -1,4 +1,5 @@
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <algorithm>
extern "C" { extern "C" {
#include "au/au_header.c" #include "au/au_header.c"
@ -18,6 +19,14 @@ extern "C" {
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(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; namespace py = pybind11;
#define MAX_SAMPLE_RATE 32000 #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); 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); 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); auto mag_shift = samples_to_rmlt_coefs(input, history, mlt_coefs, input_frame_size);
/* Encode the mlt coefs */ /* 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, mag_shift,
out_words); 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); result.append(reinterpret_cast<char*>(&out_words[0]), output_frame_size);
} }