32 Commits

Author SHA1 Message Date
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 7c7117e309 Remove per-texel error weights
Every use is replaced with a block-wide per-channel weighting.
This removes support for:

* -v and -va for effor function control
* -b for deblocking
* -a for alpha weighting (still supported for RDO)
2022-02-22 10:18:14 +00:00
pete 37ce984775 Remove redundant copy of the avg_var structure 2021-05-25 08:52:00 +01:00
pete 140428aca6 Use unsigned types in avg/var computations 2021-05-22 14:30:20 +01:00
pete 5543738c58 Reflow comments on 100 character lines 2021-05-19 09:39:26 +01:00
pete 0490f1d293 API change - pass swizzzle structs by reference. 2021-05-14 22:29:15 +01:00
pete 316804efa3 Cleanup API for compute_variance 2021-05-14 22:26:41 +01:00
pete 6a64ee4ebc Standardize on "component" not "channel" 2021-03-30 09:21:07 +01:00
pete b3b2ca885c Increase thread granule for var\avg SAT gen 2021-03-03 16:10:30 +00:00
Pete Harris fe730105a4 Make code OS/architecture invariant
This change makes the output of the codec invariant across operating systems (removed std::math dependency), and across CPU architectures (NEON vector code now matches the halving reduction patterns used by x86-64).
2021-03-01 13:20:05 +00:00
Kaarlo Räihä 2be7f81c67 Use bool for have_z (#226)
Easier to convert to other languages
2021-02-27 20:24:21 +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 3887246e91 Drop int3 and vtype3 template 2021-02-15 22:16:08 +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 657a065d94 Remove limit clamps on variance SAT.
This is an IQ bug introduced in 2.2 caused by an unneeded
clamp on the variance summed area table. The SAT is already
padded with the kernel radius, so the clamp isn't needed.
The input image initital transfer into the table _is_ still
clamped, as the input image isn't padded.
2021-02-10 20:21:56 +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
Peter Harris ab0c2ca0fb Fix clamps in compute_pixel_region_variance() 2020-12-17 21:22:00 +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 810e41925e Use new scalar initializer for template vectors 2020-11-09 00:18:37 +00:00
pete b301e0c78c Vectors are now .rgba, not .xyzw 2020-11-09 00:01:26 +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
Pete Harris 9fce19699c Merge increment
* Update test data reference CSV

* Formatting cleanups

* Make image data type flexible
- No new types supported yet, but it's a precursor to just supporting f32 as an interface type.
2020-09-04 22:59:08 +01:00
Peter Harris 51d5963ba8 Allow decompression-only builds 2020-07-19 17:02:22 +01:00
Pete Harris 5c87dbd9e4 Implement dynamic thread count support (#134)
Implement a new approach to threading the library compression function, removing the use of strict N-thread barriers to allow any number of threads (up to the max requested when the context was created, as the memory pool is still preallocated).

The new parallel manager allows:

* Single threaded init - the first thread to reach it runs it (optional)
* Parallel dynamic task assignment - worker threads keep requesting work until none remains.
* Completion synchronization - don't continue until all workers have exited the dynamic task assignment.
* Single threaded term - the first thread to reach it runs it (optional).
2020-07-15 09:18:19 +01:00
Peter Harris 4c3ee2bb6d Remove obsolete astc_codec_image 2020-07-08 21:02:01 +01:00
Peter Harris 29fc246eba Move avg/var data to the context 2020-07-08 20:29:39 +01:00
Peter Harris bee2ae38f6 Change core codec to only support user-created threads
Move thead creation out to CLI
2020-07-05 22:02:10 +01:00
Peter Harris 85aa545014 Remove -linsrgb option 2020-07-02 21:52:20 +01:00
Pete Harris 2b8fd08fc7 First phase of the front-end to codec API split (#125)
This phase introduces the first phase of the API split between the API front-end and the CODEC backed. However, some aspects of the final design are not yet supported:

This build only only supports automatic multi-threading; no user owned thread pools are supported.

Some memory allocations still tied to the compression pass, not the context, so reusing the context will have higher than planned CPU overhead due to the repeated memory allocation (although the impact is probably small unless compression small image).

The input image layout is still the legacy format and must be pre-padded by the caller for any pass using the area-based perceptual metrics.
2020-07-02 21:17:21 +01:00