468,257 Members | 1,416 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

byte alignment

Hi
I have to read a binary image.
Info tell me that it is a binary image without encoding but with RLE.
Also i know it is 4 bytes align.

What it means ?? How can i read it ??
I red it is for portability whit different microprocessor. is it right ??

How can i perform my 4 bytes in rle decode function when i have to check
first byte (length byte) to understand what i have to do with other bytes
???

tks
Marco
Jul 22 '05 #1
4 2697
Marco, your msg is a little cryptic. Could you clarify a little? If
possible, zip and mail me your image file: sm******@gmail.com and tell
me EXACTLY what it is you want to do with this file.
Sashi

Jul 22 '05 #2
Marco wrote:
Hi
I have to read a binary image.
Info tell me that it is a binary image without encoding but with RLE.
Also i know it is 4 bytes align.

What it means ?? How can i read it ??
I red it is for portability whit different microprocessor. is it
right ??

How can i perform my 4 bytes in rle decode function when i have to
check first byte (length byte) to understand what i have to do with
other bytes ???


Hi,

Could you please reword? I have a hard time finding your C++ language
related question.

--
Attila aka WW
Jul 22 '05 #3
ok i tried to be more clear ( sorry english is not my language...;) )

I have a text file with image inside.
I have to read image.
I can read image data in a unsigned char buffer.

I know data image is not encoded, but it is compressed with Run-length
encode.
an information in file tell me that data image it is 4 byte alignment.
but i don't know what it means.

With oter image with same rle algorithm but with 1 byte alignment i have not
problem.
With this kind of data i do this...

value=*str++; // header byte
if (value<128)
{
n=value +1;
for (i=0;i<n;i++)
*dest++=*src++;
}
else
{
if (value>128)
{
n=257-value;
for (i=0;i<n;i++)
*dest=value;
*src++
}
else
// end of data
return;
}

cycle it does until i find 128 in header byte

Can anyone help me ????

Thank at all.
Marco
Jul 22 '05 #4
4 byte aligned would mean that a new record always
starts at a 4 byte boundary. Thus you should adjust your
algorithm to do the same.

The file would contain pads whenever a structure size does
not end at the four byte boundary.

Just look at the binary dump of a 4 byte aligned file to
identify the padding.

The following article might help:
http://www.eventhelix.com/RealtimeMa...ndOrdering.htm

Deepa
--
http://www.EventHelix.com/EventStudio
EventStudio 2.5 - Automate sequence diagram generation

Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Shashi | last post: by
11 posts views Thread by Taran | last post: by
1 post views Thread by v.venkatesh | last post: by
12 posts views Thread by Olaf Baeyens | last post: by
1 post views Thread by Gajendra | last post: by
20 posts views Thread by quantumred | last post: by
19 posts views Thread by glchin | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.