Files
test2/source/blender/blenlib/intern/compression.cc
Aras Pranckevicius 3d9155eb0a PointCache: improve performance and compression, always compress
Point Caches (used by particle system, cloth, boids etc.) are now
always compressed, uzing zstd coupled with lossless data filtering.

- This is both smaller cache files _and_ faster than the old
  "Heavy" compression mode,
- And smaller data files and same or slightly faster speed than
  using no compression at all,
- There was not much difference between compression levels once
  data filtering got added, so option to pick them was removed.
- So there's no downside to just always using the compression,
  which makes for a simpler UI.
- RNA change: removes PointCache.compression property.

More details and cache size / performance numbers in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/144356
2025-08-13 16:38:46 +02:00

45 lines
967 B
C++

/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup bli
*/
#include "BLI_compression.hh"
namespace blender {
void filter_transpose_delta(const uint8_t *src, uint8_t *dst, size_t items_num, size_t item_size)
{
for (size_t ib = 0; ib < item_size; ib++) {
uint8_t prev = 0;
const uint8_t *src_ptr = src + ib;
size_t it = 0;
for (; it < items_num; it++) {
uint8_t v = *src_ptr;
*dst = v - prev;
prev = v;
src_ptr += item_size;
dst += 1;
}
}
}
void unfilter_transpose_delta(const uint8_t *src, uint8_t *dst, size_t items_num, size_t item_size)
{
for (size_t ib = 0; ib < item_size; ib++) {
uint8_t prev = 0;
uint8_t *dst_ptr = dst + ib;
for (size_t it = 0; it < items_num; it++) {
uint8_t v = *src + prev;
prev = v;
*dst_ptr = v;
src += 1;
dst_ptr += item_size;
}
}
}
} // namespace blender