Skip to content

Commit 25a0366

Browse files
Hangjie22CoderFocusLuo
authored andcommitted
Enhance PSNR Check for Luma (Y) Channel in VPP Sharpen Filter
The current implementation of the PSNR check for the Luma (Y) channel raises exceptions for actual values exceeding reference values. This behavior is not reflective of typical processing scenarios where higher actual values are expected. Updated the `compare` function to only raise exceptions if the actual Luma (Y) value is lower than the reference value. Signed-off-by: Wang Hangjie <[email protected]>
1 parent b8c939c commit 25a0366

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/mixin/vpp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ def compare(k, ref, actual):
132132
assert actual[-2] == 100, "Cb(U) should not be affected by SHARPEN filter"
133133
assert actual[-1] == 100, "Cr(V) should not be affected by SHARPEN filter"
134134
assert ref is not None, "Invalid reference value"
135-
assert abs(ref[-3] - actual[-3]) < 0.25, "Luma (Y) out of baseline range"
135+
# Only assert if actual Luma (Y) is lower than reference, using specified range condition
136+
if actual[-3] < ref[-3]:
137+
# Ensure the difference is within the acceptable range [0, 0.25)
138+
assert 0 <= ref[-3] - actual[-3] < 0.25, f"Luma (Y) is lower than reference value: {actual[-3]} < {ref[-3]}"
136139

137140
metrics2.check(
138141
metric = dict(type = "psnr"), compare = compare,

0 commit comments

Comments
 (0)