diff options
Diffstat (limited to 'modules/webp')
-rw-r--r-- | modules/webp/SCsub | 9 | ||||
-rw-r--r-- | modules/webp/image_loader_webp.cpp | 18 | ||||
-rw-r--r-- | modules/webp/image_loader_webp.h | 3 |
3 files changed, 11 insertions, 19 deletions
diff --git a/modules/webp/SCsub b/modules/webp/SCsub index d215f19cef..666628bb44 100644 --- a/modules/webp/SCsub +++ b/modules/webp/SCsub @@ -29,13 +29,11 @@ if env['builtin_libwebp']: "dsp/cost.c", "dsp/cost_mips32.c", "dsp/cost_mips_dsp_r2.c", + "dsp/cost_neon.c", "dsp/cost_sse2.c", "dsp/cpu.c", "dsp/dec.c", "dsp/dec_clip_tables.c", - "dsp/ssim.c", - "dsp/ssim_sse2.c", - "dsp/yuv_neon.c", "dsp/dec_mips32.c", "dsp/dec_mips_dsp_r2.c", "dsp/dec_msa.c", @@ -72,6 +70,8 @@ if env['builtin_libwebp']: "dsp/rescaler_msa.c", "dsp/rescaler_neon.c", "dsp/rescaler_sse2.c", + "dsp/ssim.c", + "dsp/ssim_sse2.c", "dsp/upsampling.c", "dsp/upsampling_mips_dsp_r2.c", "dsp/upsampling_msa.c", @@ -81,6 +81,7 @@ if env['builtin_libwebp']: "dsp/yuv.c", "dsp/yuv_mips32.c", "dsp/yuv_mips_dsp_r2.c", + "dsp/yuv_neon.c", "dsp/yuv_sse2.c", "dsp/yuv_sse41.c", "enc/alpha_enc.c", @@ -125,7 +126,7 @@ if env['builtin_libwebp']: ] thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources] - env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"]) + env_webp.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"]) env_thirdparty = env_webp.Clone() env_thirdparty.disable_warnings() diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 928a0dcbd3..d1bfa20842 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -71,7 +71,7 @@ static PoolVector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_q w[3] = 'P'; copymem(&w[4], dst_buff, dst_size); free(dst_buff); - w = PoolVector<uint8_t>::Write(); + w.release(); return dst; } @@ -84,8 +84,7 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) { ERR_FAIL_COND_V(r[0] != 'W' || r[1] != 'E' || r[2] != 'B' || r[3] != 'P', Ref<Image>()); WebPBitstreamFeatures features; if (WebPGetFeatures(&r[4], size, &features) != VP8_STATUS_OK) { - ERR_EXPLAIN("Error unpacking WEBP image:"); - ERR_FAIL_V(Ref<Image>()); + ERR_FAIL_V_MSG(Ref<Image>(), "Error unpacking WEBP image."); } /* @@ -107,10 +106,9 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) { errdec = WebPDecodeRGBInto(&r[4], size, dst_w.ptr(), datasize, 3 * features.width) == NULL; } - //ERR_EXPLAIN("Error decoding webp! - "+p_file); - ERR_FAIL_COND_V(errdec, Ref<Image>()); + ERR_FAIL_COND_V_MSG(errdec, Ref<Image>(), "Failed decoding WebP image."); - dst_w = PoolVector<uint8_t>::Write(); + dst_w.release(); Ref<Image> img = memnew(Image(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image)); return img; @@ -122,7 +120,6 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p WebPBitstreamFeatures features; if (WebPGetFeatures(p_buffer, p_buffer_len, &features) != VP8_STATUS_OK) { - // ERR_EXPLAIN("Error decoding WEBP image"); ERR_FAIL_V(ERR_FILE_CORRUPT); } @@ -137,10 +134,9 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p } else { errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w.ptr(), datasize, 3 * features.width) == NULL; } - dst_w = PoolVector<uint8_t>::Write(); + dst_w.release(); - //ERR_EXPLAIN("Error decoding webp!"); - ERR_FAIL_COND_V(errdec, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V_MSG(errdec, ERR_FILE_CORRUPT, "Failed decoding WebP image."); p_image->create(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image); @@ -171,8 +167,6 @@ Error ImageLoaderWEBP::load_image(Ref<Image> p_image, FileAccess *f, bool p_forc Error err = webp_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); - w = PoolVector<uint8_t>::Write(); - return err; } diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h index 0c4e54df09..5a5c038017 100644 --- a/modules/webp/image_loader_webp.h +++ b/modules/webp/image_loader_webp.h @@ -33,9 +33,6 @@ #include "core/io/image_loader.h" -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ class ImageLoaderWEBP : public ImageFormatLoader { public: |