mirror of
https://github.com/godotengine/godot.git
synced 2024-11-12 23:24:26 +00:00
qoa.h: Sync with upstream
This commit is contained in:
parent
4c4e673344
commit
4e85456f4c
2
thirdparty/README.md
vendored
2
thirdparty/README.md
vendored
@ -694,7 +694,7 @@ Collection of single-file libraries used in Godot components.
|
||||
* License: MIT
|
||||
- `qoa.h`
|
||||
* Upstream: https://github.com/phoboslab/qoa
|
||||
* Version: git (e0c69447d4d3945c3c92ac1751e4cdc9803a8303, 2024)
|
||||
* Version: git (a2d927f8ce78a85e903676a33e0f956e53b89f7d, 2024)
|
||||
* Modifications: Added a few modifiers to comply with C++ nature.
|
||||
* License: MIT
|
||||
- `r128.{c,h}`
|
||||
|
4
thirdparty/misc/patches/qoa-min-fix.patch
vendored
4
thirdparty/misc/patches/qoa-min-fix.patch
vendored
@ -1,5 +1,5 @@
|
||||
diff --git a/qoa.h b/qoa.h
|
||||
index cfed266bef..23612bb0bf 100644
|
||||
index f0f44214d8..9fa5465f08 100644
|
||||
--- a/qoa.h
|
||||
+++ b/qoa.h
|
||||
@@ -140,14 +140,14 @@ typedef struct {
|
||||
@ -42,7 +42,7 @@ index cfed266bef..23612bb0bf 100644
|
||||
|
||||
for (unsigned int c = 0; c < qoa->channels; c++) {
|
||||
/* Set the initial LMS weights to {0, 0, -1, 2}. This helps with the
|
||||
@@ -655,7 +655,7 @@ short *qoa_decode(const unsigned char *bytes, int size, qoa_desc *qoa) {
|
||||
@@ -657,7 +657,7 @@ short *qoa_decode(const unsigned char *bytes, int size, qoa_desc *qoa) {
|
||||
|
||||
/* Calculate the required size of the sample buffer and allocate */
|
||||
int total_samples = qoa->samples * qoa->channels;
|
||||
|
4
thirdparty/misc/qoa.h
vendored
4
thirdparty/misc/qoa.h
vendored
@ -626,12 +626,14 @@ unsigned int qoa_decode_frame(const unsigned char *bytes, unsigned int size, qoa
|
||||
qoa_uint64_t slice = qoa_read_u64(bytes, &p);
|
||||
|
||||
int scalefactor = (slice >> 60) & 0xf;
|
||||
slice <<= 4;
|
||||
|
||||
int slice_start = sample_index * channels + c;
|
||||
int slice_end = qoa_clamp(sample_index + QOA_SLICE_LEN, 0, samples) * channels + c;
|
||||
|
||||
for (int si = slice_start; si < slice_end; si += channels) {
|
||||
int predicted = qoa_lms_predict(&qoa->lms[c]);
|
||||
int quantized = (slice >> 57) & 0x7;
|
||||
int quantized = (slice >> 61) & 0x7;
|
||||
int dequantized = qoa_dequant_tab[scalefactor][quantized];
|
||||
int reconstructed = qoa_clamp_s16(predicted + dequantized);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user