Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
005ce31f
Commit
005ce31f
authored
12 years ago
by
Merov Linden
Browse files
Options
Downloads
Patches
Plain Diff
SH-3047 : Fix lossless compression for small textures.
parent
5c11b6b2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llkdu/llimagej2ckdu.cpp
+11
-20
11 additions, 20 deletions
indra/llkdu/llimagej2ckdu.cpp
with
11 additions
and
20 deletions
indra/llkdu/llimagej2ckdu.cpp
+
11
−
20
View file @
005ce31f
...
@@ -619,36 +619,27 @@ BOOL LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, co
...
@@ -619,36 +619,27 @@ BOOL LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, co
// This code is where we specify the target number of bytes for each quality layer.
// This code is where we specify the target number of bytes for each quality layer.
// We're using a logarithmic spacing rule that fits with our way of fetching texture data.
// We're using a logarithmic spacing rule that fits with our way of fetching texture data.
// Note: For more info on this layers business, read kdu_codestream::flush() doc in kdu_compressed.h
// Note: For more info on this layers business, read kdu_codestream::flush() doc in kdu_compressed.h
U32
i
=
FIRST_PACKET_SIZE
;
layer_bytes
[
nb_layers
++
]
=
FIRST_PACKET_SIZE
;
U32
i
=
MIN_LAYER_SIZE
;
while
((
i
<
max_bytes
)
&&
(
nb_layers
<
(
MAX_NB_LAYERS
-
1
)))
while
((
i
<
max_bytes
)
&&
(
nb_layers
<
(
MAX_NB_LAYERS
-
1
)))
{
{
if
(
i
==
FIRST_PACKET_SIZE
*
4
)
layer_bytes
[
nb_layers
++
]
=
i
;
{
// That really just means that the first layer is FIRST_PACKET_SIZE and the second is MIN_LAYER_SIZE
i
=
MIN_LAYER_SIZE
;
}
layer_bytes
[
nb_layers
]
=
i
;
nb_layers
++
;
i
*=
4
;
i
*=
4
;
}
}
if
(
layer_bytes
[
nb_layers
-
1
]
<
max_bytes
)
{
// Set the last quality layer if necessary so to fit the preset compression ratio
// Use 0 for that last layer for reversible images so all remaining code blocks will be flushed
layer_bytes
[
nb_layers
++
]
=
(
reversible
?
0
:
max_bytes
);
}
if
(
reversible
)
if
(
reversible
)
{
{
codestream
.
access_siz
()
->
parse_string
(
"Creversible=yes"
);
codestream
.
access_siz
()
->
parse_string
(
"Creversible=yes"
);
// *TODO: we should use yuv in reversible mode and one res level since those images are small.
// *TODO: we should use yuv in reversible mode
// Don't turn this on now though as both create problems on decoding for the moment
// Don't turn this on now though as it creates problems on decoding for the moment
//codestream.access_siz()->parse_string("Clevels=1");
//codestream.access_siz()->parse_string("Cycc=no");
//codestream.access_siz()->parse_string("Cycc=no");
// In the reversible case, set the last entry of that table to 0 so that all generated bits will
// indeed be output by the time the last quality layer is encountered.
layer_bytes
[
nb_layers
]
=
0
;
}
else
{
// Truncate the last quality layer if necessary so to fit the set compression ratio
layer_bytes
[
nb_layers
]
=
max_bytes
;
}
}
nb_layers
++
;
std
::
string
layer_string
=
llformat
(
"Clayers=%d"
,
nb_layers
);
std
::
string
layer_string
=
llformat
(
"Clayers=%d"
,
nb_layers
);
codestream
.
access_siz
()
->
parse_string
(
layer_string
.
c_str
());
codestream
.
access_siz
()
->
parse_string
(
layer_string
.
c_str
());
...
...
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