Coder Social home page Coder Social logo

Comments (10)

sezero avatar sezero commented on May 27, 2024 1

I'd even say the patch isfit for upstreaming. The steps don't look too hard: https://github.com/webmproject/libwebp/blob/main/CONTRIBUTING.md#sending-patches

Done. (Pulled my hair a lot when trying to upload but figured it out eventually.)

from sdl_image.

sezero avatar sezero commented on May 27, 2024

I may be wrong about the whole tree: sharpyuv is certainly affected though.

EDIT: Yes, looks like only sharpyuv is affected..

from sdl_image.

sezero avatar sezero commented on May 27, 2024

@madebr: Is the following correct?

diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake
index 7513ca8..20ae612 100644
--- a/cmake/cpu.cmake
+++ b/cmake/cpu.cmake
@@ -107,6 +107,7 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
   # Check which files we should include or not.
   list(GET WEBP_SIMD_FILE_EXTENSIONS ${I_SIMD} WEBP_SIMD_FILE_EXTENSION)
   file(GLOB SIMD_FILES "${CMAKE_CURRENT_LIST_DIR}/../"
+       "sharpyuv/*${WEBP_SIMD_FILE_EXTENSION}"
        "src/dsp/*${WEBP_SIMD_FILE_EXTENSION}")
   if(WEBP_HAVE_${WEBP_SIMD_FLAG})
     # Memorize the file and flags.

from sdl_image.

madebr avatar madebr commented on May 27, 2024

Adding sources won't do anything, as the linker can resolve all missing links right now.
Does the following patch fix your intel issue?

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,20 @@ if(WIN32)
   option(WEBP_UNICODE "Build Unicode executables." ON)
 endif()
 
+set(WEBP_HAVE_SSE2 0)
+set(WEBP_HAVE_SSE41 0)
+include(CheckCCompilerFlag)
+check_c_compiler_flag("-msse2" COMPILER_SUPPORTS_-msse2)
+if(COMPILER_SUPPORTS_-msse2)
+  set(WEBP_HAVE_SSE2 1)
+  add_compile_options(-msse2)
+  check_c_compiler_flag("-msse4.1" COMPILER_SUPPORTS_-msse4.1)
+  if(COMPILER_SUPPORTS_-msse4.1)
+    set(WEBP_HAVE_SSE41 1)
+    add_compile_options(-msse4.1)
+  endif()
+endif()
+
 if(WEBP_BUILD_WEBP_JS)
   set(WEBP_BUILD_ANIM_UTILS OFF)

from sdl_image.

sezero avatar sezero commented on May 27, 2024

No, that's not the issue. The part of the cmake'ry I referenced above does check for simd sources and adds the necessary simd compiler flags if available, but it does so only for the ones under src/dsp/. Adding sharpyuv/ glob there does fix the issue; however I am not sure whether or not it is correct in terms of cmake, i.e. I am not sure what the file(GLOB ....) does with "${CMAKE_CURRENT_LIST_DIR}/../": Should it instead be like the following??

diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake
index 7513ca8..c2fae13 100644
--- a/cmake/cpu.cmake
+++ b/cmake/cpu.cmake
@@ -106,8 +106,9 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE})
   endif()
   # Check which files we should include or not.
   list(GET WEBP_SIMD_FILE_EXTENSIONS ${I_SIMD} WEBP_SIMD_FILE_EXTENSION)
-  file(GLOB SIMD_FILES "${CMAKE_CURRENT_LIST_DIR}/../"
-       "src/dsp/*${WEBP_SIMD_FILE_EXTENSION}")
+  file(GLOB SIMD_FILES
+   "${CMAKE_CURRENT_LIST_DIR}/../sharpyuv/*${WEBP_SIMD_FILE_EXTENSION}"
+   "${CMAKE_CURRENT_LIST_DIR}/../src/dsp/*${WEBP_SIMD_FILE_EXTENSION}")
   if(WEBP_HAVE_${WEBP_SIMD_FLAG})
     # Memorize the file and flags.
     foreach(FILE ${SIMD_FILES})

from sdl_image.

madebr avatar madebr commented on May 27, 2024

Yes, your change is fine. When I compile with -DCMAKE_C_FLAGS="-m32 -march=i486", and add

#else
#error no sse2
#endif

to sharpyuv/sharpyuv_sse2.c, it fails to build.
With your changes, it builds.

from sdl_image.

sezero avatar sezero commented on May 27, 2024

With your changes, it builds.

Thanks. But, which patch is the correct one? Is it the one from #423 (comment) or the one from #423 (comment) ?

from sdl_image.

madebr avatar madebr commented on May 27, 2024

I tested both, and they both work.
The cpu.cmake script sets variables, that are used by the main CMakeLists.txt.
What matters is that the paths are relative to this main script.

That said, the 2nd approach is safer.
Alternatively, you can also do:

+  file(GLOB SIMD_FILES
+   "${PROJECT_SOURE_DIR}/sharpyuv/*${WEBP_SIMD_FILE_EXTENSION}"
+   "${PROJECT_SOURE_DIR}/src/dsp/*${WEBP_SIMD_FILE_EXTENSION}")

PROJECT_SOURCE_DIR is the folder of the most recent call to project.

from sdl_image.

sezero avatar sezero commented on May 27, 2024

OK, applied my second patch for now. Please feel free to revise / improve further.

from sdl_image.

madebr avatar madebr commented on May 27, 2024

I'd even say the patch isfit for upstreaming.
The steps don't look too hard: https://github.com/webmproject/libwebp/blob/main/CONTRIBUTING.md#sending-patches

from sdl_image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.