通过消除无意义的位来压缩数据的方法
我正在处理时间序列数据。
在每个示例时序,我都会得到一个样本,并且该值的大小不是全字节。
例如,如果样本是7位数据,则仅在字节上使用7位。
第一个示例= 0B 0100 1000, 第二个样本= 0B 0110 0010 等等……
最初 0100 1000 0110 0010
,但我想获得 10 0100 0110 0010
如何将此压缩方法应用于编码和解码?
使用这种方法有任何官方的压缩理论吗?
I am dealing with time-series data.
At each sample timing, i get a sample and the size of this value is not full-byte.
for example, if sample is data of 7 bits, it uses only 7 bits on a byte.
first sample = 0b 0100 1000,
second sample = 0b 0110 0010
and so on…
originally,
0100 1000 0110 0010
but i want to get
10 0100 0110 0010
how can i apply this compressing method to both encode and decode??
is there any official compressing theory using this method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用位操作一次将七个位写入您在两个变量中维护的位缓冲区的缓冲区,并在积累它们时写出字节。最后,您仍然需要写出完整的字节,因此最后一个字节可能有一些未使用的位。解码使用相同的方法一次从比特流读取七个位。
编码(在C中):
解码(掩盖您如何知道如何制作样本[]):
Use bit operations to write seven bits at a time to a buffer of bits you maintain in two variables, writing out bytes as you accumulate them. In the end, you will still need to write out full bytes, so the last byte may have some unused bits. Decoding reads seven bits at a time from the bitstream, using the same approach.
Encode (in C):
Decode (glossing over how you know how big to make sample[]):