472,958 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

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 2894
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shashi | last post by:
Can somebody explain how the byte alignment for structures work, taking the following example and considering: byte of 1 Byte word of 2 Bytes dword of 4 Bytes typedef struct { byte a; word...
14
by: gamja | last post by:
Hi all. This is my first post on this group. Nice to meet you, cool guys~! I'm on system programming on various embedded systems and understand very well the byte alignment issues. When I write...
11
by: Taran | last post by:
Hi all, I was wondering how does address alignment to x byte boundary is done. For example, if I say "adjust the requested size to be on a 4-byte boundary" or for that matter 8 byte boundary....
1
by: v.venkatesh | last post by:
Hi, For one of our design, we had introduced a local array of structures which contains the following fields : typedef struct { W_CHAR ussdService; W_CHAR ussdCommand; BOOL isTrue; }...
12
by: Olaf Baeyens | last post by:
I am porting some of my buffer class code for C++ to C#. This C++ class allocates a block of memory using m_pBuffer=new BYTE; But since the class is also used for pointers for funtions that uses...
1
by: Gajendra | last post by:
How does the byte packing and the byte alignment work in VC++ compiler? What is the effect of #pragma pack(n) on the alignment and byte packing for example while using the structur struc double...
20
by: quantumred | last post by:
I found the following code floating around somewhere and I'd like to get some comments. unsigned char a1= { 5,10,15,20}; unsigned char a2= { 25,30,35,40}; *(unsigned int *)a1=*(unsigned int...
5
by: moni | last post by:
Hey, My buffer contains a short int, some char, and a structure in form of a byte array. Read the string as: TextBox4.Text = System.Text.Encoding.ASCII.GetString(buffer1, 0, 31); Read...
19
by: glchin | last post by:
Does a compiler guarantee that the variable w below is placed on an eight-byte aligned address? void myFunction( long iFreq ) { const double w = two_pi * iFreq; ... ... }
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.