Precision Loss in Arithmetic Encoding of Binary Vectors for Reversible Data Hiding in 3D Meshes
29 次查看(过去 30 天)
显示 更早的评论
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.
采纳的回答
John D'Errico
2025-9-10,13:08
编辑:John D'Errico
2025-9-10,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 个)
Walter Roberson
2025-9-10,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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numbers and Precision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!