-
Notifications
You must be signed in to change notification settings - Fork 0
/
pfm_denoiser.bat
105 lines (91 loc) · 2.39 KB
/
pfm_denoiser.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
@ECHO off
REM win_batch_DN pfm_denoiser.bat v1.0.0
REM Created by jackjt8
REM https://github.com/jackjt8/win_batch_DN
REM ~~~~
REM Get and setup
REM
REM Intel Open Image Denoise Binary Packages (CPU must support SSE4.1)
REM https://github.com/DeclanRussell/IntelOIDenoiser
REM
REM Change dn_path to the location of denoise.exe
REM ie ...\oidn-1.2.0.x64.vc14.windows\bin\denoise.exe
REM
REM Drag and drop one or more .pfm files onto this .bat file to denoise them.
SET dn_path="D:\Programs\oidn-1.2.0.x64.vc14.windows\bin\denoise.exe"
:Loop
IF "%1"=="" GOTO Break
:loop
IF NOT "%~x1"==".pfm" GOTO PFMerror
ECHO ===
ECHO Input %~n1%~x1
ECHO Output %~n1.denoised%~x1
ECHO ===
REM check input
ECHO %~n1 | FINDSTR /C:".albedo" >nul && (
ECHO ### ERROR Wrong input - expected hdr but got albedo
GOTO Break
)
ECHO %~n1 | FINDSTR /C:".normal" >nul && (
ECHO ### ERROR Wrong input - expected hdr but got normal
GOTO Break
)
ECHO %~n1 | FINDSTR /C:".denoised" >nul && (
ECHO ### ERROR Wrong input - expected hdr but got a denoised image
GOTO Break
)
REM check input done
DIR /b /a-d %~dp1%~n1*%~x1 > %temp%\pfmFileList
FIND %temp%\pfmFileList ".albedo.">nul
if errorlevel 1 (
REM missing albedo
FIND %temp%\pfmFileList ".normal.">nul
if errorlevel 1 (
REM missing normal
GOTO denoise_h
) else (
REM found normal
GOTO denoise_hn
)
) else (
REM found albedo
FIND %temp%\pfmFileList ".normal.">nul
if errorlevel 1 (
REM missing normal
GOTO denoise_ha
) else (
REM found normal
GOTO denoise_han
)
)
:postdenoise
DEL %temp%\pfmFileList
SHIFT
IF NOT "%1"=="" (GOTO loop) ELSE (GOTO Break)
REM you should not end up here. If the following message shows I messed up.
ECHO ### ERROR missed postdenoise and loop/break point
GOTO Break
:denoise_h
ECHO Found hdr
%dn_path% -hdr "%1" -o "%~dp1%~n1.denoised%~x1"
GOTO postdenoise
:denoise_ha
ECHO Found HDR and Albedo
%dn_path% -hdr "%1" -o "%~dp1%~n1.denoised%~x1" -alb "%~dp1%~n1.albedo%~x1"
GOTO postdenoise
:denoise_hn
ECHO ### ERROR %~1 Found normal but missing albedo?
PAUSE
GOTO Break
:denoise_han
ECHO Found HDR, Albedo, and Normal
%dn_path% -hdr "%1" -o "%~dp1%~n1.denoised%~x1" -alb "%~dp1%~n1.albedo%~x1" -nrm "%~dp1%~n1.normal%~x1"
GOTO postdenoise
:PFMerror
ECHO ### ERROR %1
ECHO ### Is not a .pfm (or this script broke)
:Break
ECHO .
ECHO == END ==
ECHO .
PAUSE