fast_thumbhash 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +58 -0
- data/ext/fast_thumbhash/fast_thumbhash.c +5 -5
- data/lib/fast_thumbhash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e30e34927a692280eac28e7a1237d9964ad6899a29ab7268a321df8ea2b9d979
|
4
|
+
data.tar.gz: 39cd14b05a0d0a598ea3f48646c169935cbe17e17a4a2000450833347e4465b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee54e878ad7002544e568618281784baf2a565aa3f3ea44b0f0918c81b13ea56b849e12ea5c3a7baa7d36b5e94229b015bf256c0c4c23492789e0182bfc6457a
|
7
|
+
data.tar.gz: 9bd9096c25bf0a64999f6a484becae2e075018f3e9bc4a215dd94c4156e4c0319b7ad61ae7ff4d99d9c54cf5551c5e68b08d1d3f7000a1d1977f56816c043cac
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
<!--datocms-autoinclude-header start-->
|
2
|
+
|
3
|
+
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60"></a>
|
4
|
+
|
5
|
+
👉 [Visit the DatoCMS homepage](https://www.datocms.com) or see [What is DatoCMS?](#what-is-datocms)
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
<!--datocms-autoinclude-header end-->
|
10
|
+
|
1
11
|
# FastThumbhash
|
2
12
|
|
3
13
|
[](https://github.com/datocms/fast_thumbhash/actions/workflows/main.yml)
|
@@ -124,3 +134,51 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
124
134
|
## Code of Conduct
|
125
135
|
|
126
136
|
Everyone interacting in the FastThumbhash project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/datocms/fast_thumbhash/blob/master/CODE_OF_CONDUCT.md).
|
137
|
+
|
138
|
+
<!--datocms-autoinclude-footer start-->
|
139
|
+
|
140
|
+
---
|
141
|
+
|
142
|
+
# What is DatoCMS?
|
143
|
+
|
144
|
+
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60" alt="DatoCMS - The Headless CMS for the Modern Web"></a>
|
145
|
+
|
146
|
+
[DatoCMS](https://www.datocms.com/) is the REST & GraphQL Headless CMS for the modern web.
|
147
|
+
|
148
|
+
Trusted by over 25,000 enterprise businesses, agencies, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ❤️ our [developers](https://www.datocms.com/team/best-cms-for-developers), [content editors](https://www.datocms.com/team/content-creators) and [marketers](https://www.datocms.com/team/cms-digital-marketing)!
|
149
|
+
|
150
|
+
**Why DatoCMS?**
|
151
|
+
|
152
|
+
- **API-First Architecture**: Built for both REST and GraphQL, enabling flexible content delivery
|
153
|
+
- **Just Enough Features**: We believe in keeping things simple, and giving you [the right feature-set tools](https://www.datocms.com/features) to get the job done
|
154
|
+
- **Developer Experience**: First-class TypeScript support with powerful developer tools
|
155
|
+
|
156
|
+
**Getting Started:**
|
157
|
+
|
158
|
+
- ⚡️ [Create Free Account](https://dashboard.datocms.com/signup) - Get started with DatoCMS in minutes
|
159
|
+
- 🔖 [Documentation](https://www.datocms.com/docs) - Comprehensive guides and API references
|
160
|
+
- ⚙️ [Community Support](https://community.datocms.com/) - Get help from our team and community
|
161
|
+
- 🆕 [Changelog](https://www.datocms.com/product-updates) - Latest features and improvements
|
162
|
+
|
163
|
+
**Official Libraries:**
|
164
|
+
|
165
|
+
- [**Content Delivery Client**](https://github.com/datocms/cda-client) - TypeScript GraphQL client for content fetching
|
166
|
+
- [**REST API Clients**](https://github.com/datocms/js-rest-api-clients) - Node.js/Browser clients for content management
|
167
|
+
- [**CLI Tools**](https://github.com/datocms/cli) - Command-line utilities for schema migrations (includes [Contentful](https://github.com/datocms/cli/tree/main/packages/cli-plugin-contentful) and [WordPress](https://github.com/datocms/cli/tree/main/packages/cli-plugin-wordpress) importers)
|
168
|
+
|
169
|
+
**Official Framework Integrations**
|
170
|
+
|
171
|
+
Helpers to manage SEO, images, video and Structured Text coming from your DatoCMS projects:
|
172
|
+
|
173
|
+
- [**React Components**](https://github.com/datocms/react-datocms)
|
174
|
+
- [**Vue Components**](https://github.com/datocms/vue-datocms)
|
175
|
+
- [**Svelte Components**](https://github.com/datocms/datocms-svelte)
|
176
|
+
- [**Astro Components**](https://github.com/datocms/astro-datocms)
|
177
|
+
|
178
|
+
**Additional Resources:**
|
179
|
+
|
180
|
+
- [**Plugin Examples**](https://github.com/datocms/plugins) - Example plugins we've made that extend the editor/admin dashboard
|
181
|
+
- [**Starter Projects**](https://www.datocms.com/marketplace/starters) - Example website implementations for popular frameworks
|
182
|
+
- [**All Public Repositories**](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
|
183
|
+
|
184
|
+
<!--datocms-autoinclude-footer end-->
|
@@ -140,8 +140,8 @@ uint8_t rgba_to_thumbhash(uint8_t w, uint8_t h, uint8_t *rgba, uint8_t *thumbhas
|
|
140
140
|
|
141
141
|
// Write the constants
|
142
142
|
bool is_landscape = w > h;
|
143
|
-
|
144
|
-
|
143
|
+
uint32_t header24 = (uint32_t)roundf(63.0 * el.dc) | ((uint32_t)roundf(31.5 + 31.5 * ep.dc) << 6) | ((uint32_t)roundf(31.5 + 31.5 * eq.dc) << 12) | ((uint32_t)roundf(31.0 * el.scale) << 18) | (has_alpha << 23);
|
144
|
+
uint32_t header16 = (is_landscape ? ly : lx) | ((uint16_t)roundf(63.0 * ep.scale) << 3) | ((uint16_t)roundf(63.0 * eq.scale) << 9) | (is_landscape << 15);
|
145
145
|
|
146
146
|
thumbhash[0] = (uint8_t)(header24 & 0xff);
|
147
147
|
thumbhash[1] = (uint8_t)((header24 >> 8) & 0xff);
|
@@ -353,8 +353,8 @@ void thumbhash_to_rgba(
|
|
353
353
|
uint8_t *rgba)
|
354
354
|
{
|
355
355
|
// Read the constants
|
356
|
-
|
357
|
-
|
356
|
+
uint32_t header24 = hash[0] | (hash[1] << 8) | (hash[2] << 16);
|
357
|
+
uint32_t header16 = hash[3] | (hash[4] << 8);
|
358
358
|
double l_dc = (double)(header24 & 63) / 63;
|
359
359
|
double p_dc = (double)((header24 >> 6) & 63) / 31.5 - 1;
|
360
360
|
double q_dc = (double)((header24 >> 12) & 63) / 31.5 - 1;
|
@@ -381,7 +381,7 @@ void thumbhash_to_rgba(
|
|
381
381
|
// Decode using the DCT into RGB
|
382
382
|
double fx[7];
|
383
383
|
double fy[7];
|
384
|
-
|
384
|
+
uint32_t i = 0;
|
385
385
|
|
386
386
|
for (uint8_t ry = 0; ry < h; ry++)
|
387
387
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_thumbhash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|