Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
fm_core.h
1/*
2 * Copyright 2012 Google Inc.
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#pragma once
18
19#include "fm_op_kernel.h"
20#include <array>
21
22#define div_n(base, inv_n) ((int)((((int64_t)(base)) * (int64_t)(inv_n)) >> 30))
23
24// TRICKY: neon_fm_kernel claims (n%12)==8 not allowed.
25// make it 132 to allow 128 output with 4 byte padding
26const static int DX_MAX_N = 132;
27
29public:
30 int in;
31 int out;
32};
33
34// operator should be considered inaudible when gain_out is below this
35const int kGainLevelThresh = 1120;
36
37enum FmOperatorFlags {
38 OUT_BUS_ONE = 1 << 0,
39 OUT_BUS_TWO = 1 << 1,
40 OUT_BUS_ADD = 1 << 2,
41 IN_BUS_ONE = 1 << 4,
42 IN_BUS_TWO = 1 << 5,
43 FB_IN = 1 << 6,
44 FB_OUT = 1 << 7
45};
46
48public:
49 int ops[6];
50};
51
52class FmCore {
53public:
54 virtual ~FmCore() {};
55 static void dump();
56 virtual void render(int32_t* output, int n, FmOpParams* params, int algorithm, int32_t* fb_buf,
57 int32_t feedback_gain);
58 const static FmAlgorithm algorithms[32];
59 bool neon = false;
60
61protected:
62 // NEON alignment is 16 bytes (128 bits)
63 alignas(16) std::array<int32_t, DX_MAX_N> buf0_;
64 alignas(16) std::array<int32_t, DX_MAX_N> buf1_;
65
66 constexpr int32_t* buf(int bus) { return (bus == 0) ? buf0_.data() : buf1_.data(); }
67};
Definition fm_core.h:47
Definition fm_core.h:52
Definition fm_core.h:28
Definition param.cpp:27
Definition fm_op_kernel.h:21