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
9177afd7
Commit
9177afd7
authored
Oct 26, 2022
by
Amy spark
👉
Browse files
JPEG-XL: fix import/export of HDR alpha channels
CCBUG: 460380
(cherry picked from commit
e6e7b467
)
parent
64670b36
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/impex/jxl/JPEGXLExport.cpp
View file @
9177afd7
...
...
@@ -86,11 +86,11 @@ inline QByteArray writeLayer(const int width,
for
(
int
x
=
0
;
x
<
width
;
x
++
)
{
CSTrait
::
normalisedChannelsValue
(
it
->
rawDataConst
(),
pixelValues
);
if
(
!
convertToRec2020
&&
!
isLinear
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
channels
;
i
++
)
{
src
[
i
]
=
static_cast
<
double
>
(
dst
[
i
]);
}
profile
->
linearizeFloatValue
(
pixelValuesLinear
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
channels
;
i
++
)
{
dst
[
i
]
=
static_cast
<
float
>
(
src
[
i
]);
}
}
...
...
@@ -100,7 +100,12 @@ inline QByteArray writeLayer(const int width,
}
for
(
int
ch
=
0
;
ch
<
channels
;
ch
++
)
{
dst
[
ch
]
=
applyCurveAsNeeded
<
conversionPolicy
>
(
dst
[
ch
]);
if
(
ch
==
CSTrait
::
alpha_pos
)
{
dst
[
ch
]
=
applyCurveAsNeeded
<
ConversionPolicy
::
KeepTheSame
>
(
dst
[
ch
]);
}
else
{
dst
[
ch
]
=
applyCurveAsNeeded
<
conversionPolicy
>
(
dst
[
ch
]);
}
}
if
(
swap
)
{
...
...
plugins/impex/jxl/JPEGXLImport.cpp
View file @
9177afd7
...
...
@@ -104,14 +104,21 @@ inline void imageOutCallback(void *that, size_t x, size_t y, size_t numPixels, c
const
double
*
lCoef
=
data
->
lCoef
.
constData
();
QVector
<
float
>
pixelValues
(
static_cast
<
int
>
(
cs
->
channelCount
()));
float
*
tmp
=
pixelValues
.
data
();
const
quint32
alphaPos
=
cs
->
alphaPos
();
for
(
size_t
i
=
0
;
i
<
numPixels
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
channels
;
i
++
)
{
tmp
[
i
]
=
0
;
tmp
[
i
]
=
1.
0
;
}
for
(
size_t
ch
=
0
;
ch
<
channels
;
ch
++
)
{
tmp
[
ch
]
=
value
<
policy
,
channelsType
>
(
src
,
ch
);
if
(
ch
==
alphaPos
)
{
tmp
[
ch
]
=
value
<
policy
,
channelsType
>
(
src
,
ch
);
}
else
{
tmp
[
ch
]
=
value
<
LinearizePolicy
::
KeepTheSame
,
channelsType
>
(
src
,
ch
);
}
}
if
(
swap
)
{
...
...
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