Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Krita
Commits
a5d1d31d
Commit
a5d1d31d
authored
Oct 26, 2022
by
Amy spark
👉
Browse files
HEIF: fix import/export of HDR alpha channels
BUG: 460380
parent
d98f06bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/impex/heif/kis_heif_export_tools.h
View file @
a5d1d31d
...
...
@@ -288,12 +288,23 @@ inline void writeFloatLayerImpl(const int width,
}
for
(
int
ch
=
0
;
ch
<
channels
;
ch
++
)
{
uint16_t
v
=
qBound
<
uint16_t
>
(
0
,
static_cast
<
uint16_t
>
(
applyCurveAsNeeded
<
conversionPolicy
>
(
dst
[
ch
])
*
max12bit
),
max12bit
);
uint16_t
v
=
0
;
if
(
ch
==
CSTrait
::
alpha_pos
)
{
v
=
qBound
<
uint16_t
>
(
0
,
static_cast
<
uint16_t
>
(
applyCurveAsNeeded
<
ConversionPolicy
::
KeepTheSame
>
(
dst
[
ch
])
*
max12bit
),
max12bit
);
}
else
{
v
=
qBound
<
uint16_t
>
(
0
,
static_cast
<
uint16_t
>
(
applyCurveAsNeeded
<
conversionPolicy
>
(
dst
[
ch
])
*
max12bit
),
max12bit
);
}
ptr
[
2
*
(
x
*
channels
)
+
y
*
stride
+
endValue0
+
(
ch
*
2
)]
=
(
uint8_t
)(
v
>>
8
);
ptr
[
2
*
(
x
*
channels
)
+
y
*
stride
+
endValue1
+
(
ch
*
2
)]
=
...
...
plugins/impex/heif/kis_heif_import_tools.cpp
View file @
a5d1d31d
...
...
@@ -175,16 +175,19 @@ inline void readLayer(const int width,
data
[
1
]
=
value
<
Arch
,
luma
,
linearizePolicy
>
(
imgG
,
strideG
,
x
,
y
);
data
[
2
]
=
value
<
Arch
,
luma
,
linearizePolicy
>
(
imgB
,
strideB
,
x
,
y
);
if
(
hasAlpha
)
{
data
[
3
]
=
value
<
Arch
,
luma
,
linearizePolicy
>
(
imgA
,
strideA
,
x
,
y
);
}
linearize
<
Arch
,
linearizePolicy
,
applyOOTF
>
(
data
,
lCoef
.
constData
(),
displayGamma
,
displayNits
);
if
(
hasAlpha
)
{
data
[
3
]
=
value
<
Arch
,
luma
,
LinearizePolicy
::
KeepTheSame
>
(
imgA
,
strideA
,
x
,
y
);
}
if
(
luma
==
8
)
{
KoBgrU8Traits
::
fromNormalisedChannelsValue
(
it
->
rawData
(),
pixelValues
);
...
...
@@ -525,14 +528,37 @@ inline void readLayer(const int width,
data
[
i
]
=
1.0
f
;
}
const
int
alphaPos
=
[
&
]()
{
if
(
luma
==
8
)
{
return
KoBgrU8Traits
::
alpha_pos
;
}
else
if
(
luma
>
8
&&
linearizePolicy
!=
LinearizePolicy
::
KeepTheSame
)
{
return
KoBgrF32Traits
::
alpha_pos
;
}
else
{
return
KoBgrU16Traits
::
alpha_pos
;
}
}();
for
(
int
ch
=
0
;
ch
<
channels
;
ch
++
)
{
data
[
ch
]
=
valueInterleaved
<
Arch
,
luma
,
linearizePolicy
>
(
img
,
stride
,
x
,
y
,
channels
,
ch
);
if
(
ch
==
alphaPos
)
{
data
[
ch
]
=
valueInterleaved
<
Arch
,
luma
,
LinearizePolicy
::
KeepTheSame
>
(
img
,
stride
,
x
,
y
,
channels
,
ch
);
}
else
{
data
[
ch
]
=
valueInterleaved
<
Arch
,
luma
,
linearizePolicy
>
(
img
,
stride
,
x
,
y
,
channels
,
ch
);
}
}
linearize
<
Arch
,
linearizePolicy
,
applyOOTF
>
(
data
,
...
...
@@ -804,11 +830,21 @@ inline void readLayer(const int width,
}
for
(
int
ch
=
0
;
ch
<
channels
;
ch
++
)
{
data
[
ch
]
=
value
<
Arch
,
linearizePolicy
,
channels
>
(
img
,
stride
,
x
,
y
,
ch
);
if
(
ch
==
KoBgrU8Traits
::
alpha_pos
)
{
data
[
ch
]
=
value
<
Arch
,
LinearizePolicy
::
KeepTheSame
,
channels
>
(
img
,
stride
,
x
,
y
,
ch
);
}
else
{
data
[
ch
]
=
value
<
Arch
,
linearizePolicy
,
channels
>
(
img
,
stride
,
x
,
y
,
ch
);
}
}
linearize
<
Arch
,
linearizePolicy
,
applyOOTF
>
(
data
,
...
...
Amy spark
👉
@lsegovia
mentioned in commit
3b6b3414
·
Nov 01, 2022
mentioned in commit
3b6b3414
mentioned in commit 3b6b341425803cc69f4446852207d0154cfd708c
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment