Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
instant-ngp-tomography
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Pickles
instant-ngp-tomography
Commits
ce5548e6
Commit
ce5548e6
authored
2 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
`save_exr`: fix incorrect header
parent
5af105bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tinyexr_wrapper.cu
+17
-19
17 additions, 19 deletions
src/tinyexr_wrapper.cu
with
17 additions
and
19 deletions
src/tinyexr_wrapper.cu
+
17
−
19
View file @
ce5548e6
...
@@ -54,28 +54,28 @@ __global__ void interleave_and_cast_kernel(const uint32_t num_pixels, bool has_a
...
@@ -54,28 +54,28 @@ __global__ void interleave_and_cast_kernel(const uint32_t num_pixels, bool has_a
*
((
uint64_t
*
)
&
out
[
i
*
4
])
=
*
((
uint64_t
*
)
&
rgba_out
[
0
]);
*
((
uint64_t
*
)
&
out
[
i
*
4
])
=
*
((
uint64_t
*
)
&
rgba_out
[
0
]);
}
}
void
save_exr
(
const
float
*
data
,
int
width
,
int
height
,
int
n
C
hannels
,
int
channel
S
tride
,
const
char
*
outfilename
)
{
void
save_exr
(
const
float
*
data
,
int
width
,
int
height
,
int
n
_c
hannels
,
int
channel
_s
tride
,
const
char
*
outfilename
)
{
EXRHeader
header
;
EXRHeader
header
;
InitEXRHeader
(
&
header
);
InitEXRHeader
(
&
header
);
EXRImage
image
;
EXRImage
image
;
InitEXRImage
(
&
image
);
InitEXRImage
(
&
image
);
image
.
num_channels
=
n
C
hannels
;
image
.
num_channels
=
n
_c
hannels
;
std
::
vector
<
std
::
vector
<
float
>>
images
(
n
C
hannels
);
std
::
vector
<
std
::
vector
<
float
>>
images
(
n
_c
hannels
);
std
::
vector
<
float
*>
image_ptr
(
n
C
hannels
);
std
::
vector
<
float
*>
image_ptr
(
n
_c
hannels
);
for
(
int
i
=
0
;
i
<
n
C
hannels
;
++
i
)
{
for
(
int
i
=
0
;
i
<
n
_c
hannels
;
++
i
)
{
images
[
i
].
resize
(
width
*
height
);
images
[
i
].
resize
(
width
*
height
);
}
}
for
(
int
i
=
0
;
i
<
n
C
hannels
;
++
i
)
{
for
(
int
i
=
0
;
i
<
n
_c
hannels
;
++
i
)
{
image_ptr
[
i
]
=
images
[
n
C
hannels
-
i
-
1
].
data
();
image_ptr
[
i
]
=
images
[
n
_c
hannels
-
i
-
1
].
data
();
}
}
for
(
size_t
i
=
0
;
i
<
(
size_t
)
width
*
height
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
(
size_t
)
width
*
height
;
i
++
)
{
for
(
int
c
=
0
;
c
<
n
C
hannels
;
++
c
)
{
for
(
int
c
=
0
;
c
<
n
_c
hannels
;
++
c
)
{
images
[
c
][
i
]
=
data
[
channel
S
tride
*
i
+
c
];
images
[
c
][
i
]
=
data
[
channel
_s
tride
*
i
+
c
];
}
}
}
}
...
@@ -83,18 +83,16 @@ void save_exr(const float* data, int width, int height, int nChannels, int chann
...
@@ -83,18 +83,16 @@ void save_exr(const float* data, int width, int height, int nChannels, int chann
image
.
width
=
width
;
image
.
width
=
width
;
image
.
height
=
height
;
image
.
height
=
height
;
header
.
num_channels
=
n
C
hannels
;
header
.
num_channels
=
n
_c
hannels
;
header
.
channels
=
(
EXRChannelInfo
*
)
malloc
(
sizeof
(
EXRChannelInfo
)
*
header
.
num_channels
);
header
.
channels
=
(
EXRChannelInfo
*
)
malloc
(
sizeof
(
EXRChannelInfo
)
*
header
.
num_channels
);
// Must be (A)BGR order, since most of EXR viewers expect this channel order.
// Must be (A)BGR order, since most of EXR viewers expect this channel order.
strncpy
(
header
.
channels
[
0
].
name
,
"B"
,
255
);
header
.
channels
[
0
].
name
[
strlen
(
"B"
)]
=
'\0'
;
const
char
*
channel_names
[]
=
{
if
(
nChannels
>
1
)
{
"R"
,
"G"
,
"B"
,
"A"
strncpy
(
header
.
channels
[
1
].
name
,
"G"
,
255
);
header
.
channels
[
1
].
name
[
strlen
(
"G"
)]
=
'\0'
;
};
}
if
(
nChannels
>
2
)
{
for
(
size_t
i
=
0
;
i
<
n_channels
;
++
i
)
{
strncpy
(
header
.
channels
[
2
].
name
,
"R"
,
255
);
header
.
channels
[
2
].
name
[
strlen
(
"R"
)]
=
'\0'
;
strncpy
(
header
.
channels
[
i
].
name
,
channel_names
[
n_channels
-
i
-
1
],
255
);
}
if
(
nChannels
>
3
)
{
strncpy
(
header
.
channels
[
3
].
name
,
"A"
,
255
);
header
.
channels
[
3
].
name
[
strlen
(
"A"
)]
=
'\0'
;
}
}
header
.
pixel_types
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
header
.
num_channels
);
header
.
pixel_types
=
(
int
*
)
malloc
(
sizeof
(
int
)
*
header
.
num_channels
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment