100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth range given to batch 22), each with at least one independent contract-edge defect and plain public docs. Claude reviewed 100/100 USABLE against current digests; no ID or source overlap with main or batch 22. Difficulty is unmeasured. progress.md records the wrap-up: all Codex sessions and Qwen schedulers stopped for the user's rollout, Qwen results so far (57 HARD of 373), and what is left on each batch branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
124 lines
5.2 KiB
C++
124 lines
5.2 KiB
C++
#include "quant.hpp"
|
|
#include <array>
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
static aq::Profile read_profile()
|
|
{
|
|
aq::Profile value{};
|
|
std::cin >> value.num >> value.den >> value.zero >> value.low >> value.high;
|
|
return value;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
aq::Bank bank;
|
|
char operation;
|
|
while (std::cin >> operation) {
|
|
if (operation == 'S') {
|
|
std::size_t channel;
|
|
std::cin >> channel;
|
|
auto profile = read_profile();
|
|
std::cout << static_cast<int>(bank.configure(channel, profile));
|
|
} else if (operation == 'R') {
|
|
std::size_t count, supplied;
|
|
int null_input;
|
|
std::cin >> count >> null_input >> supplied;
|
|
std::vector<aq::Profile> profiles;
|
|
for (std::size_t i = 0; i < supplied; ++i) {
|
|
profiles.push_back(read_profile());
|
|
}
|
|
std::cout << static_cast<int>(bank.replace(count, null_input ? nullptr : profiles.data()));
|
|
} else if (operation == 'E') {
|
|
std::size_t channel;
|
|
std::cin >> channel;
|
|
std::cout << static_cast<int>(bank.erase(channel));
|
|
} else if (operation == 'X') {
|
|
bank.reset();
|
|
std::cout << 'X';
|
|
} else if (operation == 'G') {
|
|
std::size_t channel;
|
|
std::cin >> channel;
|
|
aq::Profile output{901, 902, 903, 904, 905};
|
|
auto status = bank.get(channel, output);
|
|
std::cout << static_cast<int>(status) << ' ' << output.num << ' ' << output.den;
|
|
std::cout << ' ' << output.zero << ' ' << output.low << ' ' << output.high;
|
|
} else if (operation == 'Y') {
|
|
std::size_t channel;
|
|
std::cin >> channel;
|
|
std::cout << bank.ready(channel);
|
|
} else if (operation == 'N') {
|
|
std::cout << bank.count();
|
|
} else if (operation == 'V') {
|
|
std::cout << bank.revision();
|
|
} else if (operation == 'C') {
|
|
auto value = bank.counters();
|
|
std::cout << value.quantized << ' ' << value.dequantized << ' ' << value.converted;
|
|
std::cout << ' ' << value.clipped_low << ' ' << value.clipped_high;
|
|
} else if (operation == 'Z') {
|
|
bank.clear_counters();
|
|
std::cout << 'Z';
|
|
} else if (operation == 'Q') {
|
|
std::size_t channel;
|
|
aq::Rational value{};
|
|
std::cin >> channel >> value.num >> value.den;
|
|
int output = -777;
|
|
auto status = bank.quantize(channel, value, output);
|
|
std::cout << static_cast<int>(status) << ' ' << output;
|
|
} else if (operation == 'D') {
|
|
std::size_t channel;
|
|
int value;
|
|
std::cin >> channel >> value;
|
|
aq::Rational output{919, -313};
|
|
auto status = bank.dequantize(channel, value, output);
|
|
std::cout << static_cast<int>(status) << ' ' << output.num << ' ' << output.den;
|
|
} else if (operation == 'T') {
|
|
std::size_t source, destination;
|
|
int value;
|
|
std::cin >> source >> destination >> value;
|
|
int output = -777;
|
|
auto status = bank.convert(source, destination, value, output);
|
|
std::cout << static_cast<int>(status) << ' ' << output;
|
|
} else if (operation == 'B' || operation == 'U') {
|
|
int layout, null_input, null_output;
|
|
std::size_t channels, frames, block, count, capacity, supplied;
|
|
std::cin >> layout >> channels >> frames >> block >> count >> capacity;
|
|
std::cin >> null_input >> null_output >> supplied;
|
|
if (operation == 'B') {
|
|
std::vector<aq::Rational> input;
|
|
for (std::size_t i = 0; i < supplied; ++i) {
|
|
aq::Rational value{};
|
|
std::cin >> value.num >> value.den;
|
|
input.push_back(value);
|
|
}
|
|
std::array<int, 258> output;
|
|
output.fill(-777);
|
|
auto status = bank.quantize_many(static_cast<aq::Layout>(layout), channels, frames,
|
|
block, null_input ? nullptr : input.data(), count,
|
|
null_output ? nullptr : output.data() + 1, capacity);
|
|
std::cout << static_cast<int>(status);
|
|
for (auto value : output) {
|
|
std::cout << ' ' << value;
|
|
}
|
|
} else {
|
|
std::vector<int> input;
|
|
for (std::size_t i = 0; i < supplied; ++i) {
|
|
int value;
|
|
std::cin >> value;
|
|
input.push_back(value);
|
|
}
|
|
std::array<aq::Rational, 258> output;
|
|
output.fill(aq::Rational{919, -313});
|
|
auto status = bank.dequantize_many(static_cast<aq::Layout>(layout), channels, frames,
|
|
block, null_input ? nullptr : input.data(), count,
|
|
null_output ? nullptr : output.data() + 1, capacity);
|
|
std::cout << static_cast<int>(status);
|
|
for (auto value : output) {
|
|
std::cout << ' ' << value.num << ' ' << value.den;
|
|
}
|
|
}
|
|
}
|
|
std::cout << '\n';
|
|
}
|
|
}
|