Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > byte alignment

Reply
Thread Tools

byte alignment

 
 
Marco
Guest
Posts: n/a
 
      01-21-2005
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


 
Reply With Quote
 
 
 
 
Sashi
Guest
Posts: n/a
 
      01-21-2005
Marco, your msg is a little cryptic. Could you clarify a little? If
possible, zip and mail me your image file: http://www.velocityreviews.com/forums/(E-Mail Removed) and tell
me EXACTLY what it is you want to do with this file.
Sashi

 
Reply With Quote
 
 
 
 
Attila Feher
Guest
Posts: n/a
 
      01-21-2005
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


 
Reply With Quote
 
Marco
Guest
Posts: n/a
 
      01-21-2005
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<12
{
n=value +1;
for (i=0;i<n;i++)
*dest++=*src++;
}
else
{
if (value>12
{
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


 
Reply With Quote
 
EventHelix.com
Guest
Posts: n/a
 
      01-22-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Byte Alignment of Character to 2 byte v.venkatesh@gmail.com C Programming 1 07-06-2005 10:34 AM
Is it required to comply byte alignment within a function? gamja C Programming 14 05-15-2005 09:46 AM
Byte Alignment Shashi C Programming 4 11-10-2003 09:24 PM
JNI with 1 byte alignment crashes JVM Dave Rathnow Java 2 11-07-2003 08:14 AM
Byte alignment in union Ares Lagae C++ 21 09-01-2003 03:49 PM



Advertisments