Skip to content

Commit b17085e

Browse files
committed
test: fix Layer Mul reference for upstream MagicDiv change
1 parent 353fdee commit b17085e

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

memory-bank/coverage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ submodule checkout cannot build `AvsCore` reliably.
7979
| `Layer` | Generic planar fast average blend | 8- and 16-bit SSE2 and AVX2 | Fixed boundary-value planes plus fixed-seed dual-input dimensions with SIMD blocks and scalar tails, distinct pitches, and valid even 16-bit alignment offsets; independent rounded integer average; active-output hashes, overlay immutability, row padding, and allocation guard checks |
8080
| `Layer` | Packed RGB32 alpha blend | 8-bit SSE4.1 and AVX2 wrappers; overlay-alpha and separate-mask paths | Fixed packed channel and alpha anchors plus a fixed-seed width-13 partial-opacity case for both mask paths; independent magic-divide reference; vector blocks plus scalar tail; active-output hashes, input immutability, row padding, and allocation guard checks. Public C counterpart is file-local. |
8181
| `Layer` | Planar RGB alpha-weighted add | 8-/16-bit C/SSE4.1/AVX2 paths and 32-bit float C templates reached through the AVX2 getter; three-plane and four-plane alpha branches | Fixed boundary-anchor RGB/RGBA planes with full and partial opacity plus fixed-seed 8-bit RGBA and 16-bit RGB partial-opacity cases, and finite-anchor width-7/height-3 float cases with distinct pitches; independent integer/float per-plane and luma-weight references; integer active-output hashes, float tolerance checks, overlay/mask immutability, row padding, and allocation guard checks. Public C counterpart is file-local. |
82-
| `Layer` | Planar RGB multiply blend | 8-/16-bit C and 32-bit float C templates reached through the AVX2 getter; per-channel and overlay-luma multiply; no alpha, overlay-alpha masking, and RGBA alpha blending branches | Fixed-seed width-13/height-5 8-bit and width-19/height-3 16-bit cases plus finite-anchor width-7/height-3 float cases with distinct pitches; independent integer and floating-point luma, per-channel product, alpha-weight, and alpha-plane references; active-output hashes for integer cases, float tolerance checks, overlay/mask immutability, row padding, and allocation guard checks. Public C getter is file-local, so coverage uses the exported AVX2 getter wrapper. |
82+
| `Layer` | Planar RGB multiply blend | 8-/16-bit C and 32-bit float C templates reached through the AVX2 getter; per-channel and overlay-luma multiply; no alpha, overlay-alpha masking, and RGBA alpha blending branches | Fixed-seed width-13/height-5 8-bit and width-19/height-3 16-bit cases plus finite-anchor width-7/height-3 float cases with distinct pitches; independent integer products normalized by the sample maximum (`2^bits-1`), plus floating-point luma, per-channel product, alpha-weight, and alpha-plane references; active-output hashes for integer cases, float tolerance checks, overlay/mask immutability, row padding, and allocation guard checks. Public C getter is file-local, so coverage uses the exported AVX2 getter wrapper. |
8383
| `Layer` | Planar RGB lighten/darken threshold blend | 8-/16-bit C and 32-bit float C templates reached through the AVX2 getter; Lighten and Darken modes; no alpha, overlay-alpha masking, and RGBA alpha blending branches | Fixed-seed width-13/height-5 8-bit and width-19/height-3 16-bit cases with distinct pitches and thresholds plus finite-anchor width-7/height-3 float cases; independent Rec.601 luma threshold selection, integer/float alpha weighting, and alpha-plane references; integer active-output hashes, float tolerance checks, overlay/mask immutability, row padding, and allocation guard checks. Public C getter is file-local, so coverage uses the exported AVX2 getter wrapper. |
8484
| `Turn` | Planar quarter-turn rotation, left and right | 8-, 16-, and 32-bit C, SSE2, and AVX2 kernels | Fixed deterministic input; independent coordinate reference; scalar differential comparison; active-output hash; padding, guards, and source immutability checks |
8585
| `Turn` | Packed RGB quarter-turn rotation, left and right | RGB24/RGB48 C kernels; RGB32/RGB64 C, SSE2, and AVX2 kernels | Fixed deterministic input; pixel-group coordinate reference using the upstream packed-RGB direction convention; scalar differential comparison; active-output hash; padding and guard checks |
@@ -179,7 +179,7 @@ submodule checkout cannot build `AvsCore` reliably.
179179
| `Invert` | Public selected-plane inversion filter | Public `Invert` class for 8-bit YV24 input | Direct constructor for selected `Y` and `U` channels; independent luma/chroma inversion and unselected-plane copy references, source full-pitch immutability, frame requests, and output memory checks |
180180
| `Subtract` | Public centered difference filter | Public `Subtract` class for 8-bit YV24 inputs | Direct constructor with strict two-frame source sequences; independent luma/chroma centered-difference and clamp references, source full-pitch immutability, frame requests, and output memory checks |
181181
| `MergeRGB` | Public packed/planar RGB component assembly filter | Public `MergeRGB` class producing RGBAP8 from independent RGBP8 and RGBAP8 channel clips | Direct constructor with independent planar GBR and alpha sources; active-plane assembly references, planar GBR/A mapping, repeated frame output equivalence, bounded channel-dimension and alpha-source validation before frame requests, source full-pitch immutability, cache hints, frame requests, and output memory checks |
182-
| `Layer` | Public alpha-weighted and operation-specific composition filter | Public `Layer` class for YV12, YV16, YUVA420, YV24, YUVA444, YUV420PS/YUV444PS/YUVA420PS, RGB32, BGR64, and RGBAP16; `Add`, `Mul`, `Lighten`, `Darken`, `Fast`, `mulovr`, and packed `Subtract(chroma=false)` paths | Direct constructors with strict two-source frame sequences; independent weighted, alpha-masked, strict luma-threshold, simple-average including float YUV `Fast` with YUVA base-alpha preservation, overlay-luma multiply, float overlay-luma `mulovr` with MPEG-1/MPEG-2/TopLeft placement, and inverted-overlay RGB references, float YUV Lighten/Darken with MPEG-1/MPEG-2/TopLeft placement, 4:2:0/4:2:2 chroma geometry, YUVA base-alpha preservation, weighted YUV base-frame property selection for `_ChromaLocation`/`_ColorRange`/`_FieldBased`, packed 8/16-bit channels, planar GBR/A order, source full-pitch immutability, cache hints, frame requests, and output memory checks. The YUVA420PS overlay-alpha contract retains an expected red for a current upstream defect; script conversion and other factory paths remain separate gaps |
182+
| `Layer` | Public alpha-weighted and operation-specific composition filter | Public `Layer` class for YV12, YV16, YUVA420, YV24, YUVA444, YUV420PS/YUV444PS/YUVA420PS, RGB32, BGR64, and RGBAP16; `Add`, `Mul`, `Lighten`, `Darken`, `Fast`, `mulovr`, and packed `Subtract(chroma=false)` paths | Direct constructors with strict two-source frame sequences; independent weighted, alpha-masked, strict luma-threshold, simple-average including float YUV `Fast` with YUVA base-alpha preservation, overlay-luma multiply, integer planar-RGB products normalized by the sample maximum, float overlay-luma `mulovr` with MPEG-1/MPEG-2/TopLeft placement, and inverted-overlay RGB references, float YUV Lighten/Darken with MPEG-1/MPEG-2/TopLeft placement, 4:2:0/4:2:2 chroma geometry, YUVA base-alpha preservation, weighted YUV base-frame property selection for `_ChromaLocation`/`_ColorRange`/`_FieldBased`, packed 8/16-bit channels, planar GBR/A order, source full-pitch immutability, cache hints, frame requests, and output memory checks. The YUVA420PS overlay-alpha contract retains an expected red for a current upstream defect; script conversion and other factory paths remain separate gaps |
183183
| `Overlay` | Public masked overlay filter and format conversion behavior | Public `Overlay` class for YV12, YV16, and YUVA420 with forced 4:4:4 and native subsampled `Blend` working formats; YV24/RGBP16/YUV444PS/RGBPS `Add`/`Subtract` modes; YV24 `Lighten`/`Darken` Y-driven threshold modes; YV24 `Multiply` luma-driven mode; and YV24 `Difference`/`Exclusion`/`SoftLight`/`HardLight` special blend modes | Direct constructor with strict two-frame sources and a full-scale mask; independent omitted-mask/full-mask active-plane equivalence, native YV12/YV16/YUVA420 blend plane geometry, YV24 full-opacity endpoint equivalence, 4:2:0/4:2:2 conversion, alpha output coverage, YV24 8-bit full/half-opacity YUV overshoot and underflow chroma compensation, RGBP16 16-bit full/half-opacity channel rounding and saturation, YUV444PS float full/half-opacity add/subtract with luma-driven chroma compensation, RGBPS float unsaturated per-channel arithmetic, YV24 Y-driven lighten/darken selection with full and half opacity, YV24 luma-driven multiply with full and half opacity, YV24 special-mode full/half-opacity paths with Y overshoot/underflow UV compensation, YV24 blend base-frame property selection for `_ChromaLocation`/`_ColorRange`/`_FieldBased`, source full-pitch immutability, cache hints, frame requests, and output memory checks. Script conversion remains a separate gap |
184184
| `VerticalReduceBy2` | Public vertical 2:1 reduction filter | Public `VerticalReduceBy2` class for 8-bit YV24 | Direct constructor with a fixed six-row input; independent 1:2:1 interior and 1:3 final-row references across Y/U/V, source full-pitch immutability, frame requests, and output memory checks |
185185
| `HorizontalReduceBy2` | Public horizontal 2:1 reduction filter | Public `HorizontalReduceBy2` class for 8-bit YV24 | Direct constructor with a fixed eight-pixel input; independent 1:2:1 interior and 1:1 final-column references across Y/U/V, source full-pitch immutability, frame requests, and output memory checks |

tests/layer/layer_planarrgb_mul_test_helpers.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,19 @@ void apply_layer_planarrgb_mul_reference(
180180
std::uint64_t target = 0;
181181
if (test_case.chroma) {
182182
target = (static_cast<std::uint64_t>(overlay[plane]->view().row(y)[x]) *
183-
destination_value) >>
184-
test_case.bits_per_pixel;
183+
destination_value) /
184+
max_value;
185185
} else if (plane < 3) {
186186
const auto overlay_luma =
187187
(kCyb * static_cast<std::uint64_t>(overlay[1]->view().row(y)[x]) +
188188
kCyg * static_cast<std::uint64_t>(overlay[0]->view().row(y)[x]) +
189189
kCyr * static_cast<std::uint64_t>(overlay[2]->view().row(y)[x])) >>
190190
15;
191-
target = (overlay_luma * destination_value) >> test_case.bits_per_pixel;
191+
target = (overlay_luma * destination_value) / max_value;
192192
} else {
193193
target = (static_cast<std::uint64_t>(overlay[3]->view().row(y)[x]) *
194-
destination_value) >>
195-
test_case.bits_per_pixel;
194+
destination_value) /
195+
max_value;
196196
}
197197
destination[plane]->view().row(y)[x] = static_cast<T>(
198198
(destination_value * inverse_alpha + target * alpha + half) / max_value);

tests/layer/layer_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,22 +1054,22 @@ std::vector<LayerPlanarRgbMulCase> layer_planarrgb_mul_cases() {
10541054
return {
10551055
make_layer_planarrgb_mul_case(
10561056
true, false, false, 8, width_8, height_8, destination_pitch_8, overlay_pitch_8, 0,
1057-
opacity_8, "Partial173", seed_8, "4526897b232aa349"),
1057+
opacity_8, "Partial173", seed_8, "d7d14f69613e8ab7"),
10581058
make_layer_planarrgb_mul_case(
10591059
true, true, false, 8, width_8, height_8, destination_pitch_8, overlay_pitch_8,
1060-
mask_pitch_8, opacity_8, "Partial173", seed_8, "b4eb9f389ef05d26"),
1060+
mask_pitch_8, opacity_8, "Partial173", seed_8, "cbde729c940360ea"),
10611061
make_layer_planarrgb_mul_case(
10621062
false, true, true, 8, width_8, height_8, destination_pitch_8, overlay_pitch_8,
1063-
mask_pitch_8, opacity_8, "Partial173", seed_8, "6d45d21ee6daf4f9"),
1063+
mask_pitch_8, opacity_8, "Partial173", seed_8, "5da3d80d721eb390"),
10641064
make_layer_planarrgb_mul_case(
10651065
false, false, false, 16, width_16, height_16, destination_pitch_16, overlay_pitch_16, 0,
1066-
opacity_16, "Partial39321", seed_16, "ad3c8ab8c4db317a"),
1066+
opacity_16, "Partial39321", seed_16, "22b6fd463dc8a1df"),
10671067
make_layer_planarrgb_mul_case(
10681068
false, true, false, 16, width_16, height_16, destination_pitch_16, overlay_pitch_16,
1069-
mask_pitch_16, opacity_16, "Partial39321", seed_16, "ac465b016bff2ec2"),
1069+
mask_pitch_16, opacity_16, "Partial39321", seed_16, "f14bf6c13c9f2146"),
10701070
make_layer_planarrgb_mul_case(
10711071
true, true, true, 16, width_16, height_16, destination_pitch_16, overlay_pitch_16,
1072-
mask_pitch_16, opacity_16, "Partial39321", seed_16, "923705c83b096da5"),
1072+
mask_pitch_16, opacity_16, "Partial39321", seed_16, "26015322e993a08b"),
10731073
};
10741074
}
10751075

tests/layer_filter/layer_filter_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@ std::uint16_t layer_mul_u16(std::uint16_t base, std::uint16_t overlay,
20542054
constexpr std::uint64_t half = 32767;
20552055
constexpr std::uint64_t opacity = 32768;
20562056
const auto effective_alpha = (static_cast<std::uint64_t>(mask) * opacity + half) / max_value;
2057-
const auto product = (static_cast<std::uint64_t>(base) * alpha_target) >> 16;
2057+
const auto product = (static_cast<std::uint64_t>(base) * alpha_target) / max_value;
20582058
return static_cast<std::uint16_t>(
20592059
(static_cast<std::uint64_t>(base) * (max_value - effective_alpha) +
20602060
product * effective_alpha + half) /

0 commit comments

Comments
 (0)