mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-07-26 10:38:52 +00:00
Remove sine table lookup from proc_ook (#3201)
This commit is contained in:
@@ -22,25 +22,19 @@
|
||||
|
||||
#include "proc_ook.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
#include "sine_table_int8.hpp"
|
||||
#include "event_m4.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
inline void OOKProcessor::write_sample(const buffer_c8_t& buffer, uint8_t bit_value, size_t i) {
|
||||
int8_t re, im;
|
||||
|
||||
if (bit_value) {
|
||||
phase = (phase + 200); // What ?
|
||||
sphase = phase + (64 << 18);
|
||||
|
||||
re = (sine_table_i8[(sphase & 0x03FC0000) >> 18]);
|
||||
im = (sine_table_i8[(phase & 0x03FC0000) >> 18]);
|
||||
re = INT8_MAX;
|
||||
im = 0;
|
||||
} else {
|
||||
re = 0;
|
||||
im = 0;
|
||||
}
|
||||
|
||||
buffer.p[i] = {re, im};
|
||||
}
|
||||
|
||||
@@ -125,11 +119,8 @@ inline size_t OOKProcessor::duval_algo_step() {
|
||||
void OOKProcessor::scan_process(const buffer_c8_t& buffer) {
|
||||
size_t buf_ptr = 0;
|
||||
|
||||
// transmit any leftover bits from previous step
|
||||
if (!scan_encode(buffer, buf_ptr))
|
||||
return;
|
||||
|
||||
while (1) {
|
||||
// Encode the sequence into required format. First call transmits any leftover bits from previous step
|
||||
while (scan_encode(buffer, buf_ptr)) {
|
||||
// calculate next chunk of deBruijn sequence
|
||||
duval_length = duval_algo_step();
|
||||
|
||||
@@ -151,10 +142,6 @@ void OOKProcessor::scan_process(const buffer_c8_t& buffer) {
|
||||
duval_bit = 0;
|
||||
duval_sample_bit = 0;
|
||||
duval_symbol = 0;
|
||||
|
||||
// encode the sequence into required format
|
||||
if (!scan_encode(buffer, buf_ptr))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ class OOKProcessor : public BasebandProcessor {
|
||||
uint16_t bit_pos{0};
|
||||
uint8_t cur_bit{0};
|
||||
uint32_t sample_count{0};
|
||||
uint32_t tone_phase{0}, phase{0}, sphase{0};
|
||||
int32_t tone_sample{0}, sig{0}, frq{0};
|
||||
|
||||
TXProgressMessage txprogress_message{};
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
#ifndef __SINE_TABLE_I8_H__
|
||||
#define __SINE_TABLE_I8_H__
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
|
||||
static const int8_t sine_table_i8[256] = {
|
||||
static constexpr int8_t sine_table_i8[256] = {
|
||||
0, 2, 5, 8, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45,
|
||||
48, 51, 54, 57, 59, 62, 65, 67, 70, 73, 75, 78, 80, 83, 85, 87,
|
||||
90, 92, 94, 96, 98, 100, 102, 104, 105, 107, 109, 110, 112, 113, 115, 116,
|
||||
|
||||
Reference in New Issue
Block a user