Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QcmpCompressionLibrary
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
BioinformaticDataCompression
QcmpCompressionLibrary
Commits
d72d902f
Commit
d72d902f
authored
4 years ago
by
Vojtech Moravec
Browse files
Options
Downloads
Patches
Plain Diff
Renamed vector to quantization vector.
parent
1c2d46b0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/azgracompress/compression/ImageCompressor.java
+1
-1
1 addition, 1 deletion
src/main/java/azgracompress/compression/ImageCompressor.java
src/main/java/azgracompress/compression/VQImageCompressor.java
+9
-9
9 additions, 9 deletions
...ain/java/azgracompress/compression/VQImageCompressor.java
with
10 additions
and
10 deletions
src/main/java/azgracompress/compression/ImageCompressor.java
+
1
−
1
View file @
d72d902f
...
...
@@ -153,7 +153,7 @@ public class ImageCompressor extends CompressorDecompressorBase {
header
.
setImageSizeY
(
options
.
getInputDataInfo
().
getDimensions
().
getY
());
header
.
setImageSizeZ
(
getNumberOfPlanes
());
header
.
setVectorDimension
(
options
.
get
VectorDimension
());
header
.
setVectorDimension
(
options
.
get
QuantizationVector
());
return
header
;
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/azgracompress/compression/VQImageCompressor.java
+
9
−
9
View file @
d72d902f
...
...
@@ -31,7 +31,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
LBGVectorQuantizer
vqInitializer
=
new
LBGVectorQuantizer
(
planeVectors
,
getCodebookSize
(),
options
.
getWorkerCount
(),
options
.
get
VectorDimension
().
toV3i
());
options
.
get
QuantizationVector
().
toV3i
());
LBGResult
vqResult
=
vqInitializer
.
findOptimalCodebook
();
return
new
VectorQuantizer
(
vqResult
.
getCodebook
());
}
...
...
@@ -77,13 +77,13 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
if
(!
cacheManager
.
doesVQCacheExists
(
options
.
getInputDataInfo
().
getCacheFileName
(),
getCodebookSize
(),
options
.
get
VectorDimension
().
toV3i
()))
{
options
.
get
QuantizationVector
().
toV3i
()))
{
trainAndSaveCodebook
();
}
final
VQCodebook
codebook
=
cacheManager
.
loadVQCodebook
(
options
.
getInputDataInfo
().
getCacheFileName
(),
getCodebookSize
(),
options
.
get
VectorDimension
().
toV3i
());
options
.
get
QuantizationVector
().
toV3i
());
if
(
codebook
==
null
)
{
throw
new
ImageCompressionException
(
"Failed to read quantization vectors from cache."
);
...
...
@@ -130,7 +130,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
}
reportStatusToListeners
(
String
.
format
(
"Training vector quantizer from middle plane %d."
,
middlePlaneIndex
));
final
int
[][]
refPlaneVectors
=
middlePlane
.
toQuantizationVectors
(
options
.
get
VectorDimension
());
final
int
[][]
refPlaneVectors
=
middlePlane
.
toQuantizationVectors
(
options
.
get
QuantizationVector
());
quantizer
=
trainVectorQuantizerFromPlaneVectors
(
refPlaneVectors
);
huffman
=
createHuffmanCoder
(
huffmanSymbols
,
quantizer
.
getFrequencies
());
writeQuantizerToCompressStream
(
quantizer
,
compressStream
);
...
...
@@ -154,7 +154,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
throw
new
ImageCompressionException
(
"Unable to load plane data."
,
ex
);
}
final
int
[][]
planeVectors
=
plane
.
toQuantizationVectors
(
options
.
get
VectorDimension
());
final
int
[][]
planeVectors
=
plane
.
toQuantizationVectors
(
options
.
get
QuantizationVector
());
if
(!
hasGeneralQuantizer
)
{
reportStatusToListeners
(
String
.
format
(
"Training vector quantizer from plane %d."
,
planeIndex
));
...
...
@@ -188,11 +188,11 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
private
int
[][]
loadPlaneQuantizationVectors
(
final
IPlaneLoader
planeLoader
,
final
int
planeIndex
)
throws
IOException
{
ImageU16
refPlane
=
planeLoader
.
loadPlaneU16
(
planeIndex
);
return
refPlane
.
toQuantizationVectors
(
options
.
get
VectorDimension
());
return
refPlane
.
toQuantizationVectors
(
options
.
get
QuantizationVector
());
}
private
int
[][]
loadConfiguredPlanesData
()
throws
ImageCompressionException
{
final
int
vectorSize
=
options
.
get
VectorDimension
().
getX
()
*
options
.
get
VectorDimension
().
getY
();
final
int
vectorSize
=
options
.
get
QuantizationVector
().
getX
()
*
options
.
get
QuantizationVector
().
getY
();
final
InputData
inputDataInfo
=
options
.
getInputDataInfo
();
final
IPlaneLoader
planeLoader
;
try
{
...
...
@@ -217,7 +217,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
final
int
chunkCountPerPlane
=
Chunk2D
.
calculateRequiredChunkCount
(
inputDataInfo
.
getDimensions
().
toV2i
(),
options
.
get
VectorDimension
());
options
.
get
QuantizationVector
());
final
int
totalChunkCount
=
chunkCountPerPlane
*
planeIndices
.
length
;
trainData
=
new
int
[
totalChunkCount
][
vectorSize
];
...
...
@@ -253,7 +253,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
LBGVectorQuantizer
vqInitializer
=
new
LBGVectorQuantizer
(
trainingData
,
getCodebookSize
(),
options
.
getWorkerCount
(),
options
.
get
VectorDimension
().
toV3i
());
options
.
get
QuantizationVector
().
toV3i
());
reportStatusToListeners
(
"Starting LBG optimization."
);
vqInitializer
.
setStatusListener
(
this
::
reportStatusToListeners
);
LBGResult
lbgResult
=
vqInitializer
.
findOptimalCodebook
();
...
...
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