Git Product home page Git Product logo

Comments (8)

eustas avatar eustas commented on April 28, 2024 2

Basic formulae is max(24, min(10, log2(size)+0.5)), if memory itself is not a problem.
If memory is a limited resource, then lgwin should be lowered a bit, but for higher qualities, hashers might take more memory than ring-buffer, so cutting lgwin won't give a big win.

from brotli.

MacGritsch avatar MacGritsch commented on April 28, 2024

Does this solution make sense?

params.lgwin = 22;

for (int i = 10; i < 22; i++)
{
    if (encodedSize <= (1 << i))
    {
        params.lgwin = i;

        break;
    }
}

from brotli.

jyrkialakuijala avatar jyrkialakuijala commented on April 28, 2024

lgwin can be up to 24 in brotli, but the maximum you want to use depends on the capabilities of the client running the decoder. For the mobile web use it might be wise to avoid the levels 23 and 24, and possibly smart to stay at 19.

from brotli.

MacGritsch avatar MacGritsch commented on April 28, 2024

lgwin of 24 bit means more than 50 MB of memory usage.

the question is still active: does my code make sense, and wouldnt it be a good idea to add this functionality functionality to the param-class?

from brotli.

eustas avatar eustas commented on April 28, 2024

This could easily be added to BrotliCompressBuffer method, but impossible for streaming versions (as the data size is unknown).

So, if we add the logic that reduces window size to BrotliCompressBuffer, will it work for you?

from brotli.

MacGritsch avatar MacGritsch commented on April 28, 2024

Why not add the size as an optional parameter to BrotliParams() constructor?

from brotli.

eustas avatar eustas commented on April 28, 2024

It would look a little bit confusing and redundant - lgwin and lgblock already specify the expected use-case. Probably it can be done with some helper function that adjusts BrotliParams given the expected input size...

from brotli.

sg77 avatar sg77 commented on April 28, 2024

Yes, that would be good.
At least some formula on the documentation. I'm interested in knowing how can I limit the amount of memory used while decoding by tunning the encoding parameters,

from brotli.

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.