| amnakhan786 (10) | |||
|
Hi, i have this piece of code which is decoding function for rice algorithm. which i pass as input is a binary file, which is encoded. working of encoder: the range of input in encoding fn is 0-255, and the encoder creates a combination of unary and binary, for example if i have 42, it is encoded as (010)011111- for the part in bracket it is 42 mod 8 written in binary, part except bracket is int(42/8) written in unary.the in bitfile the value 010011111 is written. now when i decode the file, i read bit by bit from the file, and the following fn is used which i didnt coded but got online: here k=3, which is the number of bits for remainder.
As i understand the unary part is decoded, but i dont see where the binary part is decoded. i dont understand how this piece of code works with input from the file. I have written for each of the decoding steps, the value for tmp and byte in the code i thought, but they are not right bc i am getting correct decoded values when i run the code, so i am not understanding some part of it. plz can anyone help me understand this code. | |||
|
|
|||