1

使用 Fabrice Bellard here提供的 bpg 编码器,我的 Debian 8链接上的以下说明,我已经完成了一些压缩测试并在我的浏览器(firefox chrome)上显示了结果,并提供了 .js(或者你可以使用这个网站) .

当我想显示一个重量大于(大约)800 KB(原始重量:2.6 MB,大小为 3600x2700)的 bpg 图像时,控制台中出现以下错误消息:

> Successfully compiled asm.js code (loaded from cache in 21ms) 

> pre-main prep time: 0 ms

> Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 33554432, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.
> uncaught exception: abort() at wa@https://webencoder.libbpg.org/js/bpgdec8.js:19:34
> B@https://webencoder.libbpg.org/js/bpgdec8.js:85:320
> z.b@https://webencoder.libbpg.org/js/bpgdec8.js:11:48
> Z@https://webencoder.libbpg.org/js/bpgdec8.js:53:333
> Vd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> fd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> sd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Mc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Sc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Tc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> _b@https://webencoder.libbpg.org/js/bpgdec8.js:66:1 Kb@https://webencoder.libbpg.org/js/bpgdec8.js:66:1
> Pc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Pd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Kd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> @https://webencoder.libbpg.org/js/bpgdec8.js line 15 > eval:1:84
> window.BPGDecoder.prototype.load/d.onload@https://webencoder.libbpg.org/js/bpgdec8.js:88:216 If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

> Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 33554432, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.

有谁知道这个错误来自哪里?

4

1 回答 1

1

README 文件中的第 7 节给出了问题的根源:

仅 8 位的解码器速度更快,消耗的内存更少(默认为 16 MB 而不是 32 MB,如果您想处理更大的图像,可以在 Makefile 中更改内存配置)。

=> 默认情况下,太大的图像以 JavaScript 文件无法显示的方式编码!

错误代码中解释了如何解决该问题(见上文):您必须在 Makefile 中编辑相应的行,然后重新编译项目。

于 2016-12-17T15:01:38.263 回答