I am receiving a stream of bits over the Ethernet
. I am collecting the bits in a byte[]
array in Java
(I am collecting them in a byte[] because I think its relevant).The stream is a digitized image where every 10 bits represent a pixel. There are 1280*1024
pixels. Every pixel is represented by 10 bits. Hence,1280*1024*10 = 13107200 bits = 1638400 bytes
is the image size.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Here is a method that can take a byte array and "split" it into groups of 10 bit. Each group is saved as an int.
here's the solution - but if the 10 bits represent actually 8 bits with some 'nonsense' in the other two bits its better to cut that like b=b>>2 - if your image is color then it sounds strange but use all 10 bits