Search:

Type: Posts; User: hamster_nz

Page 1 of 13 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    346

    Here's my equivalent: int32_t...

    Here's my equivalent:



    int32_t a=0,b=0,c=0;
    if(x > bytes_per_pixel) {
    a = img->scanline[y]->data[x-bytes_per_pixel];
    }
    if(y >...
  2. Replies
    5
    Views
    128

    Maybe you might want to add a couple of...

    Maybe you might want to add a couple of functions, making you 'main()' function look something like this:



    int main ()
    {
    int p[5]={15,30,28,19,61};


    printArray("Before shift", p,...
  3. Replies
    8
    Views
    346

    expected = 000003F7, actual = CF2F0849 ?

    expected = 000003F7, actual = CF2F0849

    ?
  4. The printf/scanf format strings.

    The printf/scanf format strings.
  5. You are seeing 3 because overflows are not...

    You are seeing 3 because overflows are not errors.

    Think of it like being 'clock' arithmetic, where 11:00 plus 3 hours equals 2:00.

    For 8-bit unsigned numbers 0 follows after 255.
  6. You have a typo. It is uint8_t not unit8_t.

    You have a typo. It is uint8_t not unit8_t.
  7. Replies
    3
    Views
    239

    Just by eyeballing them I can tell that they are...

    Just by eyeballing them I can tell that they are good. They start at "all zeros" and end at "all ones".

    But will supply a table when I finish work (in about 9 hours or so).
  8. Thread: adler32

    by hamster_nz
    Replies
    2
    Views
    254

    For a given block of data, prior_key is ...

    For a given block of data, prior_key is 0x00000001 for the first time the function is called, and from then on whatever was returned by this function the last time it was called.
  9. Replies
    4
    Views
    220

    The usual way to scale an n-bit value into a...

    The usual way to scale an n-bit value into a 2n-bit value is to multiply by 2^n+1.

    e.g. from a 4-bit value to an 8-bit value is to multiply by 17.

    Coding it is usually a shift-and-add:



    ...
  10. Replies
    125
    Views
    5,685

    Here's 37 lines that does those 200 lines...

    Here's 37 lines that does those 200 lines correctly. Note how everything is handled identically.



    static const int32_t lut_code[19] = { 0, 1, 2, 3, 4, 5, 6, 7, 8,...
  11. Replies
    125
    Views
    5,685

    You still need to adjust the rest of your code...

    You still need to adjust the rest of your code accordingly too.

    This change means that you will only need to add entries to your table in one place in your code, rather than handling those 16 and...
  12. Replies
    125
    Views
    5,685

    I think you might end up with cleaner code if you...

    I think you might end up with cleaner code if you realized that



    ZLIB_IMPLIED implied_type_data =
    {
    /* get extra bits */
    {
    0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,...
  13. Replies
    125
    Views
    5,685

    Looking at your output, the first table seems...

    Looking at your output, the first table seems perfect.

    The second one has literals that should not occur. 386? 404? 382?



    code_symbols[ 0]: _tt = false, src = 138, lit = 283, use = ...
  14. Replies
    20
    Views
    764

    It is very hard to track down if you mave a...

    It is very hard to track down if you mave a memory leak in your code if it doesn't free all resources before exiting.

    Also, usually tidying up before exiting can involve such things as writing...
  15. Replies
    20
    Views
    764

    I strongly disagree with this advice....

    I strongly disagree with this advice. "Maintaining a lost of allocated memory blocks" is exactly what malloc(), free(), realloc() and so on do on the inside, and usually do it in a far more nuanced...
  16. Replies
    125
    Views
    5,685

    As requested Note that "x:y" is value x, with...

    As requested

    Note that "x:y" is value x, with repeat count y.

    Image is properly decoded.



    Last block = true
    Compressed (dynamic dictionary)
  17. Replies
    125
    Views
    5,685

    If you can supply me a test '.gz' data file you...

    If you can supply me a test '.gz' data file you are using, I can send back what the correct codeword tables should be for that file.
  18. Replies
    125
    Views
    5,685

    Here's the whole algorithm at a very high level:...

    Here's the whole algorithm at a very high level:

    1. Read in the three 5-bit values, hlit, hdist and hclen. Note that these need to have 257, 1 and 4 added to the 5-bit binary values that are read....
  19. Replies
    125
    Views
    5,685

    I did try taking a look at your code, but without...

    I did try taking a look at your code, but without comments to let me know what each step was doing I was unable to follow what was being attempted.
  20. It is a pretty common pattern that people use....

    It is a pretty common pattern that people use. Not because it is particularly nice, but just because it fits on one line.
  21. '?' is the ternary operator. It is clamping x...

    '?' is the ternary operator.

    It is clamping x to between 0.0 an 0.35

    Translated:

    If x > 0.35 then
    Use 0.35

    Else If x < 0.0 then
  22. Replies
    125
    Views
    5,685

    What you said there makes little sense to me. I...

    What you said there makes little sense to me. I think you need to carefully consider the structure of the file and re-evaluate how you are processing it.

    Map out what the possible inputs are (the...
  23. Replies
    6
    Views
    320

    What are the ASCII codes for 'a' and 'A'? And...

    What are the ASCII codes for 'a' and 'A'?

    And when you plug those values into the expression?
  24. Replies
    125
    Views
    5,685

    Oh, and this may potentially give different...

    Oh, and this may potentially give different results on big endian or little endian platforms:



    ulong A;
    uchar *a = (uchar*)&A;
  25. Replies
    125
    Views
    5,685

    Are you sure that you have allowed for the edge...

    Are you sure that you have allowed for the edge case where the filter attempts to address that that are to the left of, or above the visible image?

    e.g. output_image[y][x] = output_image[y-1][x] +...
Results 1 to 25 of 306
Page 1 of 13 1 2 3 4