Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
84448d0a
Commit
84448d0a
authored
Oct 1, 2022
by
Alexander Rose
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://github.com/molstar/molstar
parents
24681840
31ced249
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/mol-io/common/binary-cif/array-encoder.ts
+17
-10
17 additions, 10 deletions
src/mol-io/common/binary-cif/array-encoder.ts
with
18 additions
and
10 deletions
CHANGELOG.md
+
1
−
0
View file @
84448d0a
...
...
@@ -6,6 +6,7 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased]
-
Optimize BinaryCIF integer packing encoder
-
Fix Dual depth peeling when post-processing is off or when rendering direct-volumes
-
Add
`cameraClipping.minNear`
parameter
...
...
This diff is collapsed.
Click to expand it.
src/mol-io/common/binary-cif/array-encoder.ts
+
17
−
10
View file @
84448d0a
...
...
@@ -264,28 +264,35 @@ export namespace ArrayEncoding {
return
false
;
}
function
packingSize
(
data
:
Int32Array
,
upperLimit
:
number
)
{
function
packingSizeUnsigned
(
data
:
Int32Array
,
upperLimit
:
number
)
{
let
size
=
0
;
for
(
let
i
=
0
,
n
=
data
.
length
;
i
<
n
;
i
++
)
{
size
+=
(
data
[
i
]
/
upperLimit
)
|
0
;
}
size
+=
data
.
length
;
return
size
;
}
function
packingSizeSigned
(
data
:
Int32Array
,
upperLimit
:
number
)
{
const
lowerLimit
=
-
upperLimit
-
1
;
let
size
=
0
;
for
(
let
i
=
0
,
n
=
data
.
length
;
i
<
n
;
i
++
)
{
const
value
=
data
[
i
];
if
(
value
===
0
)
{
size
+=
1
;
}
else
if
(
value
>
0
)
{
size
+=
Math
.
ceil
(
value
/
upperLimit
);
if
(
value
%
upperLimit
===
0
)
size
+=
1
;
if
(
value
>=
0
)
{
size
+=
(
value
/
upperLimit
)
|
0
;
}
else
{
size
+=
Math
.
ceil
(
value
/
lowerLimit
);
if
(
value
%
lowerLimit
===
0
)
size
+=
1
;
size
+=
(
value
/
lowerLimit
)
|
0
;
}
}
size
+=
data
.
length
;
return
size
;
}
function
determinePacking
(
data
:
Int32Array
):
{
isSigned
:
boolean
,
size
:
number
,
bytesPerElement
:
number
}
{
const
signed
=
isSigned
(
data
);
const
size8
=
signed
?
packingSize
(
data
,
0x7F
)
:
packingSize
(
data
,
0xFF
);
const
size16
=
signed
?
packingSize
(
data
,
0x7FFF
)
:
packingSize
(
data
,
0xFFFF
);
const
size8
=
signed
?
packingSize
Signed
(
data
,
0x7F
)
:
packingSize
Unsigned
(
data
,
0xFF
);
const
size16
=
signed
?
packingSize
Signed
(
data
,
0x7FFF
)
:
packingSize
Unsigned
(
data
,
0xFFFF
);
if
(
data
.
length
*
4
<
size16
*
2
)
{
// 4 byte packing is the most effective
...
...
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