Sync the kernel copy with the dbmd identity rename
This commit is contained in:
1 parent
dc3372be27
commit
c73a6842ec
7 files changed
+45
-48
No files matched your search
@@ -230,6 +230,7 @@
|
|||||||
<ClInclude Include="src\foundation\fft.h" />
|
<ClInclude Include="src\foundation\fft.h" />
|
||||||
<ClInclude Include="src\foundation\fs_utf8.h" />
|
<ClInclude Include="src\foundation\fs_utf8.h" />
|
||||||
<ClInclude Include="src\foundation\geometry.h" />
|
<ClInclude Include="src\foundation\geometry.h" />
|
||||||
|
<ClInclude Include="src\foundation\metadata_timing.h" />
|
||||||
<ClInclude Include="src\foundation\mini_json.h" />
|
<ClInclude Include="src\foundation\mini_json.h" />
|
||||||
<ClInclude Include="src\foundation\py_num.h" />
|
<ClInclude Include="src\foundation\py_num.h" />
|
||||||
<ClInclude Include="src\foundation\sha256.h" />
|
<ClInclude Include="src\foundation\sha256.h" />
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ Status build_dbmd(std::uint32_t object_count, BinauralMode mode, std::string* ou
|
|||||||
out->push_back(static_cast<char>(checksum(segment7)));
|
out->push_back(static_cast<char>(checksum(segment7)));
|
||||||
|
|
||||||
std::string segment9(248, '\0');
|
std::string segment9(248, '\0');
|
||||||
const std::string creator = "Created with EAC3JOC";
|
const std::string creator = "JustOneCacophony";
|
||||||
const std::string renderer = "EAC3JOC Python Renderer";
|
const std::string renderer = "JustOneCacophony";
|
||||||
std::memcpy(&segment9[0], creator.data(), creator.size());
|
std::memcpy(&segment9[0], creator.data(), creator.size());
|
||||||
std::memcpy(&segment9[32], renderer.data(), renderer.size());
|
std::memcpy(&segment9[32], renderer.data(), renderer.size());
|
||||||
segment9[96] = 2;
|
segment9[96] = 2;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "foundation/geometry.h"
|
#include "foundation/geometry.h"
|
||||||
|
#include "foundation/metadata_timing.h"
|
||||||
|
|
||||||
namespace joc::adm {
|
namespace joc::adm {
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ Status non_monotonic(const char* name, const char* message, int object_index, st
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
||||||
std::int64_t update_quantum_samples, std::int64_t object_delay_samples,
|
std::int64_t update_block_samples, std::int64_t object_delay_samples,
|
||||||
int object_index, std::vector<Keyframe>* out) {
|
int object_index, std::vector<Keyframe>* out) {
|
||||||
out->clear();
|
out->clear();
|
||||||
const double scale = static_cast<double>(rate);
|
const double scale = static_cast<double>(rate);
|
||||||
@@ -88,18 +89,17 @@ Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
|
|
||||||
for (std::size_t index = 1; index < events.size(); ++index) {
|
for (std::size_t index = 1; index < events.size(); ++index) {
|
||||||
const OamdEvent& event = events[index];
|
const OamdEvent& event = events[index];
|
||||||
const std::int64_t event_start = event.sample + object_delay_samples;
|
const std::int64_t event_start = timing::align_metadata_sample(
|
||||||
|
event.sample + object_delay_samples, update_block_samples);
|
||||||
if (event_start >= total_samples) {
|
if (event_start >= total_samples) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const std::int64_t effective_ramp =
|
const std::int64_t ramp = std::max<std::int64_t>(0, event.ramp_samples);
|
||||||
std::max<std::int64_t>(0, event.ramp_samples - update_quantum_samples);
|
const std::int64_t block_start = event_start;
|
||||||
const std::int64_t block_start =
|
|
||||||
event_start + (effective_ramp != 0 ? update_quantum_samples : 0);
|
|
||||||
if (block_start >= total_samples) {
|
if (block_start >= total_samples) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const std::int64_t ramp_end = block_start + effective_ramp;
|
const std::int64_t ramp_end = block_start + ramp;
|
||||||
|
|
||||||
if (block_start < points.back().sample) {
|
if (block_start < points.back().sample) {
|
||||||
return non_monotonic("non_monotonic_compact_position_updates",
|
return non_monotonic("non_monotonic_compact_position_updates",
|
||||||
@@ -107,11 +107,8 @@ Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
block_start, points.back().sample);
|
block_start, points.back().sample);
|
||||||
}
|
}
|
||||||
if (index + 1 < events.size()) {
|
if (index + 1 < events.size()) {
|
||||||
const std::int64_t next_event_start = events[index + 1].sample + object_delay_samples;
|
const std::int64_t next_block_start = timing::align_metadata_sample(
|
||||||
const std::int64_t next_effective =
|
events[index + 1].sample + object_delay_samples, update_block_samples);
|
||||||
std::max<std::int64_t>(0, events[index + 1].ramp_samples - update_quantum_samples);
|
|
||||||
const std::int64_t next_block_start =
|
|
||||||
next_event_start + (next_effective != 0 ? update_quantum_samples : 0);
|
|
||||||
if (next_block_start < ramp_end) {
|
if (next_block_start < ramp_end) {
|
||||||
return non_monotonic("overlapping_compact_position_ramps",
|
return non_monotonic("overlapping_compact_position_ramps",
|
||||||
"a new position update arrived before the previous compact "
|
"a new position update arrived before the previous compact "
|
||||||
@@ -121,11 +118,10 @@ Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
double target[3] = {event.x, event.y, event.z};
|
double target[3] = {event.x, event.y, event.z};
|
||||||
std::int64_t interpolation = effective_ramp;
|
std::int64_t interpolation = ramp;
|
||||||
const std::int64_t available = total_samples - block_start;
|
const std::int64_t available = total_samples - block_start;
|
||||||
if (effective_ramp > available) {
|
if (ramp > available) {
|
||||||
const double amount =
|
const double amount = static_cast<double>(available) / static_cast<double>(ramp);
|
||||||
static_cast<double>(available) / static_cast<double>(effective_ramp);
|
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
double y = 0.0;
|
double y = 0.0;
|
||||||
double z = 0.0;
|
double z = 0.0;
|
||||||
@@ -147,7 +143,7 @@ Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
||||||
std::int64_t update_quantum_samples, std::int64_t object_delay_samples,
|
std::int64_t update_block_samples, std::int64_t object_delay_samples,
|
||||||
int object_index, std::vector<Keyframe>* out) {
|
int object_index, std::vector<Keyframe>* out) {
|
||||||
out->clear();
|
out->clear();
|
||||||
(void)rate;
|
(void)rate;
|
||||||
@@ -164,7 +160,8 @@ Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
|
|
||||||
for (std::size_t index = 1; index < events.size(); ++index) {
|
for (std::size_t index = 1; index < events.size(); ++index) {
|
||||||
const OamdEvent& event = events[index];
|
const OamdEvent& event = events[index];
|
||||||
const std::int64_t start = event.sample + object_delay_samples;
|
const std::int64_t start =
|
||||||
|
timing::align_metadata_sample(event.sample + object_delay_samples, update_block_samples);
|
||||||
if (start >= total_samples) {
|
if (start >= total_samples) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -176,20 +173,19 @@ Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
if (start > points.back().sample) {
|
if (start > points.back().sample) {
|
||||||
append_point(&points, start, current[0], current[1], current[2], 0);
|
append_point(&points, start, current[0], current[1], current[2], 0);
|
||||||
}
|
}
|
||||||
const std::int64_t effective_ramp =
|
const std::int64_t ramp = std::max<std::int64_t>(0, event.ramp_samples);
|
||||||
std::max<std::int64_t>(0, event.ramp_samples - update_quantum_samples);
|
if (ramp == 0) {
|
||||||
if (effective_ramp == 0) {
|
|
||||||
append_point(&points, start, event.x, event.y, event.z, 0);
|
append_point(&points, start, event.x, event.y, event.z, 0);
|
||||||
current[0] = event.x;
|
current[0] = event.x;
|
||||||
current[1] = event.y;
|
current[1] = event.y;
|
||||||
current[2] = event.z;
|
current[2] = event.z;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const std::int64_t steps =
|
const std::int64_t steps = (ramp + update_block_samples - 1) / update_block_samples;
|
||||||
(effective_ramp + update_quantum_samples - 1) / update_quantum_samples;
|
const std::int64_t end = start + steps * update_block_samples;
|
||||||
const std::int64_t end = start + steps * update_quantum_samples;
|
|
||||||
if (index + 1 < events.size()) {
|
if (index + 1 < events.size()) {
|
||||||
const std::int64_t next_start = events[index + 1].sample + object_delay_samples;
|
const std::int64_t next_start = timing::align_metadata_sample(
|
||||||
|
events[index + 1].sample + object_delay_samples, update_block_samples);
|
||||||
if (next_start < end) {
|
if (next_start < end) {
|
||||||
return non_monotonic("overlapping_position_ramps",
|
return non_monotonic("overlapping_position_ramps",
|
||||||
"a new position update arrived before the previous ramp "
|
"a new position update arrived before the previous ramp "
|
||||||
@@ -197,12 +193,12 @@ Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
object_index, start, end);
|
object_index, start, end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::int64_t future = effective_ramp;
|
std::int64_t future = ramp;
|
||||||
std::int64_t elapsed = 0;
|
std::int64_t elapsed = 0;
|
||||||
double position[3] = {current[0], current[1], current[2]};
|
double position[3] = {current[0], current[1], current[2]};
|
||||||
while (future > 0) {
|
while (future > 0) {
|
||||||
const double amount =
|
const double amount =
|
||||||
std::min(static_cast<double>(update_quantum_samples) / static_cast<double>(future),
|
std::min(static_cast<double>(update_block_samples) / static_cast<double>(future),
|
||||||
1.0);
|
1.0);
|
||||||
double x = 0.0;
|
double x = 0.0;
|
||||||
double y = 0.0;
|
double y = 0.0;
|
||||||
@@ -212,14 +208,14 @@ Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_s
|
|||||||
position[0] = x;
|
position[0] = x;
|
||||||
position[1] = y;
|
position[1] = y;
|
||||||
position[2] = z;
|
position[2] = z;
|
||||||
elapsed += update_quantum_samples;
|
elapsed += update_block_samples;
|
||||||
const std::int64_t sample = start + elapsed;
|
const std::int64_t sample = start + elapsed;
|
||||||
if (sample >= total_samples) {
|
if (sample >= total_samples) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
append_point(&points, sample, position[0], position[1], position[2],
|
append_point(&points, sample, position[0], position[1], position[2],
|
||||||
update_quantum_samples);
|
update_block_samples);
|
||||||
future -= update_quantum_samples;
|
future -= update_block_samples;
|
||||||
}
|
}
|
||||||
current[0] = event.x;
|
current[0] = event.x;
|
||||||
current[1] = event.y;
|
current[1] = event.y;
|
||||||
@@ -266,9 +262,9 @@ Status TrajectoryBuilder::build(std::int64_t total_samples, TrajectoryMode mode,
|
|||||||
track.name = "JOC_Object_" + std::to_string(object);
|
track.name = "JOC_Object_" + std::to_string(object);
|
||||||
const Status status =
|
const Status status =
|
||||||
(mode == TrajectoryMode::Compact)
|
(mode == TrajectoryMode::Compact)
|
||||||
? expand_compact(events_[object - 1], total_samples, rate_, quantum_,
|
? expand_compact(events_[object - 1], total_samples, rate_, block_,
|
||||||
object_delay_, object, &track.blocks)
|
object_delay_, object, &track.blocks)
|
||||||
: expand_dense64(events_[object - 1], total_samples, rate_, quantum_,
|
: expand_dense64(events_[object - 1], total_samples, rate_, block_,
|
||||||
object_delay_, object, &track.blocks);
|
object_delay_, object, &track.blocks);
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "adm/adm_metadata.h"
|
#include "adm/adm_metadata.h"
|
||||||
|
#include "foundation/metadata_timing.h"
|
||||||
#include "foundation/status.h"
|
#include "foundation/status.h"
|
||||||
#include "oamd/oamd_parser.h"
|
#include "oamd/oamd_parser.h"
|
||||||
|
|
||||||
@@ -26,10 +27,11 @@ enum class TrajectoryMode { Compact, Dense64 };
|
|||||||
// runs, and records one event per object whenever its coordinates change.
|
// runs, and records one event per object whenever its coordinates change.
|
||||||
class TrajectoryBuilder {
|
class TrajectoryBuilder {
|
||||||
public:
|
public:
|
||||||
TrajectoryBuilder(std::uint32_t rate = 48000, std::int64_t update_quantum_samples = 64,
|
TrajectoryBuilder(std::uint32_t rate = 48000,
|
||||||
|
std::int64_t update_block_samples = timing::kMetadataBlockSamples,
|
||||||
std::int64_t object_delay_samples = 1473)
|
std::int64_t object_delay_samples = 1473)
|
||||||
: rate_(rate),
|
: rate_(rate),
|
||||||
quantum_(update_quantum_samples),
|
block_(update_block_samples),
|
||||||
object_delay_(object_delay_samples) {}
|
object_delay_(object_delay_samples) {}
|
||||||
|
|
||||||
void submit_frame(std::int64_t frame_index, const oamd::OamdUpdate* update, std::int64_t outer_offset);
|
void submit_frame(std::int64_t frame_index, const oamd::OamdUpdate* update, std::int64_t outer_offset);
|
||||||
@@ -42,7 +44,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::uint32_t rate_;
|
std::uint32_t rate_;
|
||||||
std::int64_t quantum_;
|
std::int64_t block_;
|
||||||
std::int64_t object_delay_;
|
std::int64_t object_delay_;
|
||||||
oamd::OamdState state_;
|
oamd::OamdState state_;
|
||||||
std::vector<OamdEvent> events_[kObjectCount];
|
std::vector<OamdEvent> events_[kObjectCount];
|
||||||
@@ -51,11 +53,11 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
Status expand_compact(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
||||||
std::int64_t update_quantum_samples, std::int64_t object_delay_samples,
|
std::int64_t update_block_samples, std::int64_t object_delay_samples,
|
||||||
int object_index, std::vector<Keyframe>* out);
|
int object_index, std::vector<Keyframe>* out);
|
||||||
|
|
||||||
Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
Status expand_dense64(const std::vector<OamdEvent>& events, std::int64_t total_samples, std::uint32_t rate,
|
||||||
std::int64_t update_quantum_samples, std::int64_t object_delay_samples,
|
std::int64_t update_block_samples, std::int64_t object_delay_samples,
|
||||||
int object_index, std::vector<Keyframe>* out);
|
int object_index, std::vector<Keyframe>* out);
|
||||||
|
|
||||||
} // namespace joc::adm
|
} // namespace joc::adm
|
||||||
@@ -1423,7 +1423,8 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
|||||||
}
|
}
|
||||||
|
|
||||||
::joc::io::AdmBwfWriter adm_writer;
|
::joc::io::AdmBwfWriter adm_writer;
|
||||||
::joc::adm::TrajectoryBuilder trajectory(48000, 64, cfg.object_delay_samples);
|
::joc::adm::TrajectoryBuilder trajectory(48000, ::joc::timing::kMetadataBlockSamples,
|
||||||
|
cfg.object_delay_samples);
|
||||||
const bool adm_enabled = cfg.operation == JOC_OP_ADM_BWF;
|
const bool adm_enabled = cfg.operation == JOC_OP_ADM_BWF;
|
||||||
if (adm_enabled) {
|
if (adm_enabled) {
|
||||||
const Status status = adm_writer.open(cfg.output_path);
|
const Status status = adm_writer.open(cfg.output_path);
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#include "timeline/position_timeline.h"
|
#include "timeline/position_timeline.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "foundation/geometry.h"
|
#include "foundation/geometry.h"
|
||||||
|
#include "foundation/metadata_timing.h"
|
||||||
|
|
||||||
namespace joc::timeline {
|
namespace joc::timeline {
|
||||||
|
|
||||||
@@ -145,14 +147,10 @@ Status OamdPositionTimeline::submit_update(const oamd::OamdUpdate& update,
|
|||||||
return Status::success();
|
return Status::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::int64_t ramp_duration = static_cast<std::int64_t>(update.ramp_duration_samples);
|
|
||||||
const std::int64_t effective_ramp =
|
const std::int64_t effective_ramp =
|
||||||
ramp_duration - kOamdUpdateQuantumSamples > 0 ? ramp_duration - kOamdUpdateQuantumSamples
|
std::max<std::int64_t>(0, static_cast<std::int64_t>(update.ramp_duration_samples));
|
||||||
: 0;
|
const std::int64_t transition_start =
|
||||||
std::int64_t transition_start = coded_event + object_delay_samples;
|
timing::align_metadata_sample(coded_event + object_delay_samples);
|
||||||
if (effective_ramp != 0) {
|
|
||||||
transition_start += kOamdUpdateQuantumSamples;
|
|
||||||
}
|
|
||||||
for (int index = 0; index < kTimelineObjects; ++index) {
|
for (int index = 0; index < kTimelineObjects; ++index) {
|
||||||
const bool changed = !has_previous_[index] ||
|
const bool changed = !has_previous_[index] ||
|
||||||
std::memcmp(previous_targets_[index], targets[index],
|
std::memcmp(previous_targets_[index], targets[index],
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
namespace joc::timeline {
|
namespace joc::timeline {
|
||||||
|
|
||||||
inline constexpr std::int64_t kOamdUpdateQuantumSamples = 64;
|
|
||||||
inline constexpr int kTimelineObjects = 15;
|
inline constexpr int kTimelineObjects = 15;
|
||||||
|
|
||||||
struct PositionTransition {
|
struct PositionTransition {
|
||||||
|
|||||||
Reference in new issue
Block a user