Skip to content

Commit 0a5acf2

Browse files
committed
test: cover public video trim length mode
1 parent e882302 commit 0a5acf2

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

memory-bank/coverage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ submodule checkout cannot build `AvsCore` reliably.
185185
| `StackVertical` | Public vertical clip stacking | Public `StackVertical` class for two short 8-bit YV24 sources | Direct constructor with fixed-height panels; independent plane-row placement of the upper then lower source, source request traces, source full-pitch immutability, cache hints, and output memory checks |
186186
| `StackHorizontal` | Public horizontal clip stacking | Public `StackHorizontal` class for two short 8-bit YV24 sources | Direct constructor with fixed-width panels; independent plane-column placement of the left then right source, source request traces, source full-pitch immutability, cache hints, and output memory checks |
187187
| `Exprfilter` | Public expression filter arithmetic, planar format routing, and LUT initialization | Public `Exprfilter` direct construction for seeded YV24 8-bit, RGBAP16, and Y8 `lut_x` cases; scalar C, Vector-C, SSE2, and AVX2 JIT variants where supported | Fixed-seed non-vector-width plane arithmetic with spatial coordinates, GBR/alpha order and 16-bit stores, one-dimensional LUT construction followed by a later frame request, source full-pitch immutability, cache-hint responses, strict frame requests, and output memory checks. Relative addressing, float square-root domain behavior, and finding-only format-override cases remain in `finding.B10` |
188-
| `Field topology` | Public field separation, weaving, patterned selection, interleaving, and single-frame edit remapping | Public `SeparateFields`, `DoubleWeaveFields`, `DoubleWeaveFrames`, and `SelectEvery` classes for short YV12/YV24 sequences; `Weave` behavior through the public `DoubleWeaveFields` plus `SelectEvery` composition; public `Interleave` for two short YV24 sources; public `FreezeFrame`, `DeleteFrame`, and `DuplicateFrame` classes for short YV24 sequences | Direct constructors with explicit TFF/BFF metadata, field-row extraction, adjacent-field and adjacent-frame interleaving, frame-rate/count updates, patterned frame selection, alternating multi-source frame selection with FPS scaling, freeze-range remapping to a selected source frame, delete/duplicate index shifting with updated frame counts, source request traces, source full-pitch immutability, cache hints, and output memory checks. The final advertised frame of both `DoubleWeave` implementations remains an expected red because the current upstream code requests a past-end child frame. |
188+
| `Field topology` | Public field separation, weaving, patterned selection, interleaving, trim, and single-frame edit remapping | Public `SeparateFields`, `DoubleWeaveFields`, `DoubleWeaveFrames`, and `SelectEvery` classes for short YV12/YV24 sequences; `Weave` behavior through the public `DoubleWeaveFields` plus `SelectEvery` composition; public `Interleave` for two short YV24 sources; public `Trim` in `Length` mode for short YV24 sequences; public `FreezeFrame`, `DeleteFrame`, and `DuplicateFrame` classes for short YV24 sequences | Direct constructors with explicit TFF/BFF metadata, field-row extraction, adjacent-field and adjacent-frame interleaving, frame-rate/count updates, patterned frame selection, alternating multi-source frame selection with FPS scaling, length-mode frame-window remapping, freeze-range remapping to a selected source frame, delete/duplicate index shifting with updated frame counts, source request traces, source full-pitch immutability, cache hints, and output memory checks. The final advertised frame of both `DoubleWeave` implementations remains an expected red because the current upstream code requests a past-end child frame. |
189189

190190
| `Layer` | Public float YUV `Mul` product composition and neutral-chroma mode | `YUV444PS`, `YUV420PS`, and `YUVA420PS` through the direct `Layer` constructor | Independent per-plane product/overlay references across MPEG-1, MPEG-2, and TopLeft placement; `use_chroma=false` neutral-chroma references for YUV444PS and YUV420PS; overlay-alpha mask averaging, base-alpha preservation, source immutability, cache hints, frame requests, and output memory checks |
191191
| `Layer` | Public float YUV `Add` weighted composition and neutral-chroma mode | `YUV444PS`, `YUV420PS`, and `YUVA420PS` through the direct `Layer` constructor | Independent weighted and alpha-masked references across MPEG-1, MPEG-2, and TopLeft placement; `use_chroma=false` neutral-chroma references for YUV444PS and YUV420PS; overlay-alpha mask averaging, base-alpha preservation, source immutability, cache hints, frame requests, and output memory checks. The YUVA420PS MPEG-2 alpha case retains an expected red for an upstream float mask-row bug |

tests/field_filter/field_filter_tests.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,4 +594,39 @@ TEST(EditFrameFilter, InterleavesTwoSourcesInAlternatingOrder) {
594594
}
595595
}
596596

597+
TEST(EditFrameFilter, TrimsVideoFrameRangeInLengthMode) {
598+
AviSynthEnvironment environment;
599+
constexpr int width = 5;
600+
constexpr int height = 4;
601+
const auto source_vi =
602+
make_video_info(VideoInfoSpec{width, height, VideoInfo::CS_YV24, 6, 25, 1});
603+
auto source_frames = make_field_source_frames(environment, source_vi, source_vi.num_frames);
604+
std::vector<FrameSnapshot> source_snapshots;
605+
for (const auto& frame : source_frames) {
606+
source_snapshots.push_back(FrameSnapshot::capture(frame, source_vi));
607+
}
608+
auto* source_impl = new FrameSequenceClip(source_vi, source_frames);
609+
const PClip source(source_impl);
610+
611+
// first=2, length=3 => source frames 2,3,4.
612+
Trim filter(2, 3, false, source, Trim::Length, false, environment.get());
613+
EXPECT_EQ(filter.GetVideoInfo().num_frames, 3);
614+
EXPECT_EQ(filter.GetVideoInfo().width, width);
615+
EXPECT_EQ(filter.GetVideoInfo().height, height);
616+
EXPECT_EQ(filter.SetCacheHints(CACHE_GET_MTMODE, 0), MT_NICE_FILTER);
617+
EXPECT_EQ(filter.SetCacheHints(CACHE_DONT_CACHE_ME, 0), 1);
618+
619+
for (int n = 0; n < 3; ++n) {
620+
const PVideoFrame output = filter.GetFrame(n, environment.get());
621+
expect_frame_equal(output, source_frames[static_cast<std::size_t>(n + 2)], "Yv24");
622+
EXPECT_NE(output->CheckMemory(), 1) << "output_frame=" << n;
623+
}
624+
625+
EXPECT_EQ(source_impl->frame_requests(), (std::vector<int>{2, 3, 4}));
626+
for (std::size_t i = 0; i < source_frames.size(); ++i) {
627+
EXPECT_EQ(FrameSnapshot::capture(source_frames[i], source_vi), source_snapshots[i])
628+
<< "source_frame=" << i;
629+
}
630+
}
631+
597632
} // namespace

0 commit comments

Comments
 (0)