cache removed
This commit is contained in:
+6
-21
@@ -111,12 +111,6 @@ class PiPNode : public dmf::NodeBase {
|
||||
uint64_t index = mxlGetCurrentIndex(&rate);
|
||||
log("start index=%llu", index);
|
||||
|
||||
// Cache the last good inset frame so we can composite even when the
|
||||
// hardware input hasn't delivered a frame at the exact current index.
|
||||
std::vector<uint8_t> inset_cache(
|
||||
static_cast<size_t>(inset_stride) * static_cast<size_t>(inset_h), 0);
|
||||
bool have_inset = false;
|
||||
|
||||
uint64_t frame_count = 0, stall_count = 0;
|
||||
bool fatal = false;
|
||||
|
||||
@@ -128,16 +122,14 @@ class PiPNode : public dmf::NodeBase {
|
||||
bg_reader, index, 80'000'000, &bg_grain, &bg_buf);
|
||||
|
||||
if (bg_st == MXL_STATUS_OK && bg_buf) {
|
||||
// Try to read inset at the same index. Short timeout: hardware
|
||||
// inputs often land a frame behind, so we don't wait long —
|
||||
// falling back to the cached frame is acceptable.
|
||||
// Try inset at same index (short timeout — hardware often lands one frame behind).
|
||||
// On any miss, fall back to headIndex: the ring buffer is the cache.
|
||||
mxlGrainInfo inset_grain{};
|
||||
uint8_t* inset_buf = nullptr;
|
||||
mxlStatus in_st = mxlFlowReaderGetGrain(
|
||||
inset_reader, index, 8'000'000, &inset_grain, &inset_buf);
|
||||
|
||||
if (in_st == MXL_ERR_OUT_OF_RANGE_TOO_LATE) {
|
||||
// Inset has moved ahead — grab its latest committed frame.
|
||||
if (in_st != MXL_STATUS_OK) {
|
||||
mxlFlowRuntimeInfo ri{};
|
||||
mxlFlowReaderGetRuntimeInfo(inset_reader, &ri);
|
||||
in_st = mxlFlowReaderGetGrain(
|
||||
@@ -145,13 +137,6 @@ class PiPNode : public dmf::NodeBase {
|
||||
stall_count++;
|
||||
}
|
||||
|
||||
if (in_st == MXL_STATUS_OK && inset_buf) {
|
||||
std::memcpy(inset_cache.data(), inset_buf,
|
||||
static_cast<size_t>(inset_stride) * static_cast<size_t>(inset_h));
|
||||
have_inset = true;
|
||||
}
|
||||
// TOO_EARLY (8 ms elapsed, inset not ready): use cached frame — imperceptible.
|
||||
|
||||
mxlGrainInfo out_grain{};
|
||||
uint8_t* out_buf = nullptr;
|
||||
const mxlStatus wst = mxlFlowWriterOpenGrain(
|
||||
@@ -159,10 +144,10 @@ class PiPNode : public dmf::NodeBase {
|
||||
if (wst == MXL_STATUS_OK) {
|
||||
std::memcpy(out_buf, bg_buf,
|
||||
static_cast<size_t>(bg_stride) * static_cast<size_t>(bg_h));
|
||||
if (have_inset) {
|
||||
if (in_st == MXL_STATUS_OK && inset_buf) {
|
||||
dmf::v210::scale_and_overlay(
|
||||
inset_cache.data(), inset_stride, inset_w, inset_h,
|
||||
out_buf, out_stride,
|
||||
inset_buf, inset_stride, inset_w, inset_h,
|
||||
out_buf, out_stride,
|
||||
pip_x, pip_y, clamped_w, clamped_h,
|
||||
Y0, Y1, Cb0, Cb1, Cr0, Cr1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user