Original date:2014-08-31 08:55:39 Edited by: petelomax Subject: Re: Compressed Linetables

Looking good.

FYI, since I am using 32-bit Phix, it needed the following tweaks:

in generate_lut():

--/**/lut = sq_floor(sq_div(sq_mul(s,limit),sum(s)))    --/*    -- Phix 
    lut = floor(s * limit / sum(s))                     --*/    -- OpenEu 

in badd():

atom j 

in bdif():

atom j, result 

After that, it was fine.

I had whipped up two small routines:

function offsets_to_bytes_generated(sequence offsets, integer totalsize) 
integer last = 0 
    for i=1 to length(offsets) do 
        if offsets[i]>=0 then 
            if last>0 then 
                offsets[last] = offsets[i]-offsets[last] 
            end if 
            last = i 
        end if 
    end for 
    if last then 
        offsets[last] = totalsize-offsets[last] 
    end if 
    return offsets 
end function 
function bytes_generated_to_offsets(sequence bytes_generated) 
integer base = 0, tmp 
    for i=1 to length(bytes_generated) do 
        if bytes_generated[i]>0 then 
            tmp = base 
            base += bytes_generated[i] 
            bytes_generated[i] = tmp 
        end if 
    end for 
    return bytes_generated 
end function 

so in compress_linetable() I removed "calculate delta for offsets", and in decompress_linetable() I replaced y += x table &= y with table &= x. That gave me perfect results, without the extra entry:

820 entries -> 3546 bits 
4.32439 bits per entry 
I will have to study this stuff some more, and can see it taking a while to sink in properly.

Edit: forgot to mention, I used 2222 as a "fake" totalsize.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu