Sync the kernel copy with the OAMD frame-level core

The kernel copy follows the new kernel. The renderer has a frame-level state
machine (normal, hold, hard cut and passthrough, the 8-plane passthrough, the
LFE clipgain ramp and interpolation when no previous state exists), the OAMD
parser carries the complete frame state (several blocks, more than 16 objects)
and the speaker renderer applies the metadata (gain and inactive flags,
zone/elevation, size, snap, divergence, ISF and bed distribution). oamd_math and
oamd_params are new modules, the ISF tables are compiled in now that the
upstream data/ directory is gone, and the binaural timeline accepts a complete
frame state. joc_core.h moves to ABI 6 (frame parameters and EMDF payload info
at v2, JOC_FRAME_STATUS_*, raw 5-bit offset_ts) and eac3joc_core.h to EJOC ABI 4
(EJOC_FRAME_STATUS_*, ejoc_frame_input v1, ejoc_renderer_render_frame,
EJOC_CORE_OUT_CHANNELS and EJOC_LFE_SLOT; the old ejoc_renderer_process stays).
joc_stream.h and joc_version.h are unchanged.

joc_kernel.vcxproj lists the two new translation units and the four new
headers. The component's layout table gains the kernel's 6.0 layout (L R Ls Rs
Lrs Rrs) after 9.1.6, and layout_table_test expects twelve layouts, so the list
the preferences page shows and the list the renderer accepts are the same
again. README, THIRD_PARTY_NOTICES and the CI comment pin the copy to commit
3f0d5e87fe41b90d9350528d2dca2ca82a637a3f; tag v1.2.0 points at the older
a276028 and is not the sync baseline.

Builds Release-Static|x64 and |Win32 with no errors. The offline test tools
build and pass on both architectures: layout_table_test reports 12 layouts, and
channel_swap_test, log_rotation_test and long_path_test pass. scan_crosscheck
agrees with the core on the upstream test material, and the render harness
delivers 7.1.4 speaker output and binaural output on both architectures, with
the speaker-path WAV byte-identical between them.

The core is still vendored under kernel/; building it from the upstream
checkout at build time is a separate change.
This commit is contained in:
TheM14 committed 2026-11-08 16:11:57 +08:00
1 parent 5b41868e94
commit defe9538fe
39 files changed
+6714 -616

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
// Port of the metadata application path of src/speaker_renderer.py HEAD.
//
// The metadata path consumes the full per-object per-block OAMD frame state and
// schedules block targets frame by frame: object gain/inactive, zone/elevation,
// snap, divergence, size kernel fusion, priority size budget, ISF basis rows and
// bed channel distribution, with the same float64 gain ramps and block alignment
// as the reference renderer.
#pragma once
#include <cstdint>
#include <memory>
#include <vector>
#include "eac3joc_core.h"
#include "foundation/status.h"
#include "oamd/oamd_parser.h"
#include "speaker/speaker_layout_lookup.h"
#include "speaker/speaker_trim.h"
namespace joc::speaker {
// One metadata target matrix: object_count x layout channel_count in the
// renderer's internal channel order, before the ramp/timing stage.
struct MetadataTargets {
std::uint32_t object_count = 0;
std::uint32_t channel_count = 0;
std::vector<double> values; // object major
double at(std::uint32_t object, std::uint32_t channel) const {
return values[static_cast<std::size_t>(object) * channel_count + channel];
}
};
// Computes the metadata target matrix of one block of a parsed frame without
// touching renderer state: the reference's _init_meta validation plus
// _block_targets. ``trim`` carries the current programme trim (bypass flags),
// ``controls`` the derived per-layout controls, ``size_budget`` the priority
// budget (0 means unlimited, the production value).
Status metadata_block_targets(const LayoutInfo& layout, const oamd::OamdUpdate& update,
std::uint32_t block_index,
const ejoc_speaker_controls& controls,
const oamd::OamdTrim* trim, std::uint32_t size_budget,
MetadataTargets* out);
// Stateful metadata-path renderer. It owns the object target ramps and the
// cross-block pending schedule; the legacy point-renderer state stays in the
// C ABI renderer, which is used for the blocks of a frame that precede the first
// metadata targets (the reference renders those with its legacy block path).
class MetaRenderer {
public:
MetaRenderer();
~MetaRenderer();
MetaRenderer(MetaRenderer&&) noexcept;
MetaRenderer& operator=(MetaRenderer&&) noexcept;
MetaRenderer(const MetaRenderer&) = delete;
MetaRenderer& operator=(const MetaRenderer&) = delete;
// Binds the target layout. Must be called once before process_frame().
Status configure(const LayoutInfo& layout);
// Drops the ramp, schedule and metadata state (the layout stays bound).
Status reset();
bool configured() const;
// True once a metadata frame has been accepted (the reference's _meta_mode).
bool engaged() const;
const char* last_error() const;
Status process_frame(ejoc_speaker_renderer_handle legacy,
const float* objects16_interleaved, std::uint32_t sample_count,
const oamd::OamdUpdate* update, std::uint32_t metadata_offset,
const ejoc_speaker_controls& controls, const oamd::OamdTrim* trim,
std::uint32_t raw_trim_mode, std::uint32_t size_budget,
double* output_interleaved);
// Computes the target matrix of one block of ``update`` into ``out`` using a
// scratch context; unlike metadata_block_targets() this validates through
// the renderer's own state-independent path.
Status block_targets(const oamd::OamdUpdate& update, std::uint32_t block_index,
const ejoc_speaker_controls& controls, const oamd::OamdTrim* trim,
std::uint32_t size_budget, MetadataTargets* out) const;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace joc::speaker