Skip to content

Commit

Permalink
tests: add fast gaussian blur test
Browse files Browse the repository at this point in the history
The test tolerance is set to 5% to allow OpenGL/Vulkan software implementations
to pass.
  • Loading branch information
mbouron committed Dec 6, 2023
1 parent f6e1b5d commit 5791440
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,25 @@ def blur_gaussian(cfg: ngl.SceneCfg):
),
)
return ngl.Group(children=(blur, ngl.RenderTexture(blurred_texture)))


@test_fingerprint(keyframes=10, tolerance=5)
@ngl.scene()
def blur_fast_gaussian(cfg: ngl.SceneCfg):
cfg.aspect_ratio = (1, 1)
cfg.duration = 10

noise = ngl.RenderNoise(type="blocky", octaves=3, scale=(9, 9))
noise_texture = ngl.Texture2D(data_src=noise)
blurred_texture = ngl.Texture2D()
blur = ngl.FastGaussianBlur(
source=noise_texture,
destination=blurred_texture,
bluriness=ngl.AnimatedFloat(
[
ngl.AnimKeyFrameFloat(0, 0),
ngl.AnimKeyFrameFloat(cfg.duration, 1),
]
),
)
return ngl.Group(children=(blur, ngl.RenderTexture(blurred_texture)))
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ foreach backend : backends

tests_blur = [
'gaussian',
'fast_gaussian',
]

tests_color = [
Expand Down
10 changes: 10 additions & 0 deletions tests/refs/blur_fast_gaussian.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
D1F7C0A0777038F3FA181A85868C977F D1F7C0A0777038F3FA181A85868C977F D1F7C0A0777038F3FA181A85868C977F 00000000000000000000000000000000
C1F7C0A0F5F03873FA1C0A85868D97FF C1F7C0A0F5F03873FA1C0A85868D97FF C1F7C0A0F5F03873FA1C0A85868D97FF 00000000000000000000000000000000
E1F7E0A0E5E0B870F81C8A85878D97FD E1F7E0A0E5E0B870F81C8A85878D97FD E1F7E0A0E5E0B870F81C8A85878D97FD 00000000000000000000000000000000
E1F5E0A0E5E0F870F8149285878D95ED E1F5E0A0E5E0F870F8149285878D95ED E1F5E0A0E5E0F870F8149285878D95ED 00000000000000000000000000000000
A1F5E0A0E1E0F870F8149285878D95ED A1F5E0A0E1E0F870F8149285878D95ED A1F5E0A0E1E0F870F8149285878D95ED 00000000000000000000000000000000
A1E5E1E0E1E0F070F8158205878D95AD A1E5E1E0E1E0F070F8158205878D95AD A1E5E1E0E1E0F070F8158205878D95AD 00000000000000000000000000000000
A1E0A1E0E170F050F005800586A595AD A1E0A1E0E170F050F005800586A595AD A1E0A1E0E170F050F005800586A595AD 00000000000000000000000000000000
A1E0A1E0E170F050F005800584A585AD A1E0A1E0E170F050F005800584A585AD A1E0A1E0E170F050F005800584A585AD 00000000000000000000000000000000
A1A0A1E0E160F050F005800584A585AD A1A0A1E0E160F050F005800584A585AD A1A0A1E0E160F050F005800584A585AD 00000000000000000000000000000000
A0A0E160E160F010E005800584A585AD A0A0E160E160F010E005800584A585AD A0A0E160E160F010E005800584A585AD 00000000000000000000000000000000

0 comments on commit 5791440

Please sign in to comment.