55 Commits

Author SHA1 Message Date
屑屑屑 c2ec9354d3 p10 astcDec support dma
Signed-off-by: 屑屑屑 <jiangwenda5@h-partners.com>
2026-04-11 12:14:02 +08:00
屑屑屑 172e2144aa p7 fix img.dim_stride and 34patch 35patch
Signed-off-by: 屑屑屑 <jiangwenda5@h-partners.com>
2026-04-10 19:02:55 +08:00
屑屑屑 ccbbf05d00 d2a8f46 p1
Signed-off-by: 屑屑屑 <jiangwenda5@h-partners.com>
2026-04-09 22:02:51 +08:00
屑屑屑 41dd3fd422 astc-encoder-5.3.0
Signed-off-by: 屑屑屑 <jiangwenda5@h-partners.com>
2026-04-09 20:33:02 +08:00
colinhl 7194dc16b5 fix
Signed-off-by: colinhl <helin48@huawei.com>
2025-01-09 11:36:54 +08:00
colinhl 0deb76905b support dma
Signed-off-by: colinhl <helin48@huawei.com>
2025-01-08 22:03:43 +08:00
ql 17c0115f3c ASTC-encoder update to 4.7.0
Signed-off-by: zhaonan287 <zhaonan34@huawei.com>
2024-05-16 10:11:13 +08:00
f00849353 d2a8f464ea add stride; add calculate ssd
Signed-off-by: f00849353 <fanghuameng@huawei.com>
2023-11-16 15:00:28 +08:00
Pete Harris 0b59667b34 Use C++-style casts everywhere 2022-04-26 22:29:24 +01:00
Pete Harris 113f310e15 Use vector grayscale detection 2022-04-26 20:18:07 +01:00
Pete Harris ac62e58064 Remove obsolete comment 2022-04-09 19:45:57 +01:00
Pete Harris 8c307c00f6 Add fast load variant for U8 LDR images 2022-04-09 19:22:54 +01:00
Pete Harris 492de18a91 Allow single channel NaNs in void-extent blocks
The spec allows single color channels to decode to NaN in
void-extent blocks. Prior to this fix the 3.x compressor
would force the entire texel to NaN if component 0 was NaN.
2022-02-24 07:26:00 +00:00
pete 551824340c Fix error block output color handling 2022-02-23 15:10:59 +00:00
Pete Harris 0887ec5446 Remove ewb.block_error_weighted_rgba_sum 2022-02-22 10:18:14 +00:00
pete ee5b34a1f1 Cleanup - remove some ;; instances 2021-08-01 19:43:27 +01:00
pete bbcc472cbc Remove TODOs that have been checked 2021-06-21 21:29:10 +01:00
pete e6993d496d Fix /W4 warnings on VS2019 2021-06-17 15:55:20 +01:00
pete f61f607744 Fix /W2 warnings on VS2019 2021-06-17 14:46:10 +01:00
pete da885c132a Rename imageblock to image_block 2021-05-31 23:45:13 +01:00
pete 7640047bc5 Make more use of unsigned ints 2021-05-22 13:49:22 +01:00
pete a995c07d13 Cleanup platform_isa_detection 2021-05-16 20:17:34 +01:00
pete cbd2fd3896 Cleanup API for astcenc_image.cpp 2021-05-15 23:23:17 +01:00
pete 0490f1d293 API change - pass swizzzle structs by reference. 2021-05-14 22:29:15 +01:00
pete b20f35eb14 Style cleanups 2021-04-30 20:54:30 +01:00
pete 4f6c39243d Use function pointer pipeline for data loading 2021-04-30 10:46:49 +01:00
pete 1fef906a42 Inline computation of derivatives 2021-04-30 09:45:03 +01:00
pete fc26dc326f Simplify error block / end point handling 2021-04-12 23:28:21 +01:00
pete 7802b33ffa Cleanup write_imageblock 2021-03-03 00:19:17 +00:00
pete 619e66a854 Inline block initialization for decompression 2021-03-02 23:37:21 +00:00
Pete Harris 23af1ae5e3 Use vector versions of working pixel conversions (#230)
Replace conversions between storage types (unorm16, LNS16),
decode types(float16), and codec types (float), with vectorized
versions of the same algorithms.
2021-03-02 16:59:55 +00:00
pete 786dd0d05c clangcl.exe - Make constants floats 2021-02-27 21:17:45 +00:00
pete 90d1735428 Standardize on blk for image block variables 2021-02-20 11:31:17 +00:00
Pete Harris 6fc0531e78 Implement vec4 support for float16 conversions (#214)
This PR implements the ability to convert floats stored in vfloat4 vectors to fp16 bit patterns stored in vint4 vectors. Scalar versions are also provided as overloaded functions of the same name, for sake of convenience.

The code has been refactored to take advantage of the vectorization opportunities this gives, in particular using NEON (Arm) and F16C (x86-64) ISA support for float<>fp16 conversion. The F16C support is tied to the AVX2 enable config option, it is not a separate enable. In cases where the soft-float code is not needed, code size reduces by ~5KB.
2021-02-16 23:29:56 +00:00
pete 1639c88f49 Use vfloat4 to back float3 types, allowing SIMD 2021-02-14 00:48:08 +00:00
pete 8653628b94 Use local frexp 2021-02-13 23:00:10 +00:00
pete 3490b1a6da Image address calcs only need min() not clamp() 2021-02-12 21:44:29 +00:00
pete 02902d8699 Make init_orig_from_work static 2021-02-12 21:40:53 +00:00
pete 10d094fc98 Add accessor for fetching block texels 2021-02-12 21:09:29 +00:00
Pete Harris affbeea396 Migrate to vfloat4 everywhere (#212)
Prior to this PR we had two vec4 implementations for floats, the legacy "float4" and the newer "vfloat4". The newer vfloat4 is a superset of the capabilities of the float4, and using it everywhere would give other opportunities to optimize by e.g. using the conditional select functionality rather than scalarizing chunks of vector code.

This patch is just the basic migration - where possible I've translated the original code without additional refactoring. Further optimizations to make better use of the vfloat4 functionality will come later. Overall this patch has no impact on IQ or performance, but does give a slight reduction in code size.
2021-02-11 09:15:26 +00:00
pete 5cf81ff5f5 Use explicit int-to-float casts to guide optimization 2021-01-20 22:48:26 +00:00
Pete Harris 1d48924a6e Use min/max/clamp templates where possible (#200)
Replace manual min/max/clamp code with template functions. It's more literate as a style, makes it easier to spot vectorizability opportunities, and actually improves code size slightly.
2021-01-11 22:30:24 +00:00
Pete Harris 39f0260928 Implement optimizations for compute_error_squared_rgb/a() (#198)
This implementation alters the algorithm and vectorizes these two functions.

The algorithm change will have a minor image quality impact; it now uses a faster approximation for selecting which component to assign to a second plane when choosing a partition. There is an insignificant IQ hit on -medium (under < 0.01dB), as we rarely use two planes anyway, and a slightly larger one on -thorough (under < -0.05dB). The significant (>10%) performance gain on -thorough is worth the quality loss (i.e. users are more likely to use -thorough if it's faster, and the overall IQ gain vs medium is still net positive).
2021-01-11 22:10:03 +00:00
pete bbf17f056d Inline update_imageblock_flags in data load loop 2020-12-30 22:16:44 +00:00
Pete Harris 0576f42652 First pass at new API for 2D slice image (#182)
This implementation changes the core codec API for images so they they are no longer 3D arrays (which require a pointer tree to get allocated and created). Instead images are passed as an array of 2D image slices, building up 3D images in layers. Each slice consists of tightly packed 4 channel data with no padding between rows.

The common case usage of ASTC is 2D images, so in the common case the slice array consists of just a single slice, while leaving support for 3D as an option in the API when it's needed. In addition passing raw data slices loaded from other libraries is now possible, as there is no longer need for the pointer preamble. This can remove additional memory allocation and copy overheads

Slight performance improvement for -fastest is expected - but will be < 1%. The main improvement here is just improved ease of integration with data from other sources, and the ability to avoid two memory allocations for the same data.

Note that this change is ONLY the API change; the command line wrapper is still creating copies of the data from stb_image and tiny_exr, which isn't really needed. This will get fixed in a later PR.
2020-11-26 10:39:17 +00:00
pete b56ca46b72 Remove padding from input images 2020-11-13 21:25:09 +00:00
pete 0a68cfe616 Only swizzle on demand 2020-11-13 14:02:25 +00:00
pete b301e0c78c Vectors are now .rgba, not .xyzw 2020-11-09 00:01:26 +00:00
Pete Harris d47fdaed0c Remove the scratch copy of the original data. (#171)
The current code makes a copy of the original data (imageblock.orig_data), transferring into working buffers (imageblock.data_[rgba]) for each encoding trial. The working buffer is overwritten by each trial, so we have to repopulate the working buffer after each trial which is a significant (10-15%) overhead for the fast searches. In reality the output of the decompression is never really used - we only need to compute RMS error for the trial (which can be done inline) and throw the output away.

This patch removes the orig_data copy of the data, and uses only the data_[rgba] fields. Data encoding transforms at the start/end of the block are done in-place, and the data is no longer overwritten during each trial. Some parts of the code needed to be adapted to the fact that the "working" encoding of the data is not the original encoding.

PSNR is identical for LDR images, but has minor changes for HDR images. This is because we now compute derivatives on a converted form of the modified data, so we have an additional conversion round-trip which can add some rounding. On our test set this actually slightly improves PSNR, but I suspect this is just luck.
2020-10-30 13:51:12 +00:00
pete 6fb67cebd9 Implement support for F32 as core API channel type
Code to use this for HDR images is also implemented for the CLI
wrapper, but currently the HDR functionality in the wrapper is
still routed though FP16. Local testing indicates that this works
as expected.
2020-10-07 23:27:04 +01:00