Precision Loss in Arithmetic Encoding of Binary Vectors for Reversible Data Hiding in 3D Meshes
29 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Harpreet
el 10 de Sept. de 2025 a las 7:50
I’m currently working on a reversible data hiding scheme and using arithmetic encoding to compress auxiliary data. The data is a binary vector of approximately 7000 bits. The encoder outputs a fractional value between 0 and 1, which I store and later use for decoding.
However, during decompression, the reconstructed binary vector does not match the original, indicating a loss of precision—likely due to MATLAB’s handling of floating-point numbers. I’ve tried increasing numeric precision using vpa and symbolic variables, but the mismatch persists.
1 comentario
Respuesta aceptada
John D'Errico
el 10 de Sept. de 2025 a las 13:08
Editada: John D'Errico
el 10 de Sept. de 2025 a las 13:12
You are telling us that you effectively have a binary number with 7000 binary bits. You convert it to a decimal number, and then convert it back to binary. And you are surpised you have lost some low order bits in the process? A double will surely fail here. You say you used vpa, but you don't need to do so. str2sym will suffice.
B0 = char(randi([0 1],[1,7000]) + '0');
B0((-100:0) + end) % the lowest order bits
Dsym = str2sym(['0b',B0])
B1 = dec2bin(Dsym);
isequal(B0,B1)
As you can see, the original bit string and the reconstruction are identical. Be careful of using vpa, because it specifies the number of digits. Maybe that was your problem. I don't know what you did, since you were too vague for us to know.
1 comentario
Más respuestas (1)
Walter Roberson
el 10 de Sept. de 2025 a las 19:04
I speculate that you are converting 64 bits at a time to binary, constructing a 64 bit integer from that, dividing it by 2^64.
If so then you run into the problem that double precision numbers can only represent 53 bits.
Ver también
Categorías
Más información sobre Numbers and Precision en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!