Git Product home page Git Product logo

Comments (6)

richgel999 avatar richgel999 commented on May 18, 2024 1

Hi - The current design has some state in the basisu_transcoder object. There's m_lowlevel_decoder (the m_pFile_data/m_file_data_size members are dead code and I'll remove them on the next checkin). There's also m_block_endpoint_preds[], which is only temporarily used while transcoding.

m_lowlevel_decoder doesn't became valid until you call start_transcoding(), which signals your intention to start decoding texture slices. So you can use a single global instance of basisu_transcoder to query for basic file information (like get_file_info() etc.), and that would be thread safe in the current design. But once you call start_transcoding(), the local state becomes valid, and is used during transcoding.

So you can't have a single global object and call start_transcoding() on it from multiple threads. If you have multiple .basis files that you want to transcode simultaneously, you'll need multiple basisu_transcoder's.

Right now, you can't call transcode_image_level() from multiple threads on the same object, because m_block_endpoint_preds[] (which is used during transcoding) is per-object state. I will fix this this week. The intention is that you can transcode multiple images or mipmaps from the same .basis file on multiple threads.

Does this make sense?

-Rich

from basis_universal.

Saticmotion avatar Saticmotion commented on May 18, 2024

Thanks Rich, this is exactly what I wanted to know!

from basis_universal.

richgel999 avatar richgel999 commented on May 18, 2024

Thanks, I'll update this issue once it's possible to transcode multiple slices of a single .basis file from multiple threads.

from basis_universal.

richgel999 avatar richgel999 commented on May 18, 2024

I'm adding an optional pointer to a transcoding state struct to all the transcoding API's. For video, this state struct needs to stay persistent as it holds the last frame's indices. I'll have this checked in hopefully tomorrow or Sat.

from basis_universal.

richgel999 avatar richgel999 commented on May 18, 2024

I have checked in an optional state struct that you can use during transcoding for threading purposes.

from basis_universal.

Saticmotion avatar Saticmotion commented on May 18, 2024

Great stuff, thanks!

from basis_universal.

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.