For Programmers: Free Programming Magazines  


Home > Archive > Compression > September 2004 > Coding question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Coding question
Ernst Berg

2004-09-19, 3:55 pm

I have a coding question:

I have an algorithm were I have coded for two events.
The first event may have zero or more bits.
The second will have one or more bits.
It is necessary to delimit each event.

I have coded this way:

For the first event I use zeros and for the second I use ones
terminated by a zero.
" 1011110000001000000011111000010 "
A first event will not follow a first event but, a second event may
follow a second event.


My Question is: Is there a better coding? Can I avoid the need for a
termination bit in the second event and still be able to have "back to
back" delimited second events?

Ernst
David A. Scott

2004-09-20, 3:55 am

Ernst_Berg@sbcglobal.net (Ernst Berg) wrote in
news:be9ae35b.0409191116.8156c33@posting.google.com:

>
> I have a coding question:
>
> I have an algorithm were I have coded for two events.
> The first event may have zero or more bits.
> The second will have one or more bits.
> It is necessary to delimit each event.
>
>


It not clear enough how do you distingish between
to second events and a second event followed by a first
event of zero bits followed by a second event. Your
statements don't make logical sense to me.


David A. Scott
--
My Crypto code
http://bijective.dogma.net/crypto/scott19u.zip
http://www.jim.com/jamesd/Kong/scott19u.zip old version
My Compression code http://bijective.dogma.net/
**TO EMAIL ME drop the roman "five" **
Disclaimer:I am in no way responsible for any of the statements
made in the above text. For all I know I might be drugged.
As a famous person once said "any cryptograhic
system is only as strong as its weakest link"

Guenther von Knakspott

2004-09-20, 3:55 am

Ernst_Berg@sbcglobal.net (Ernst Berg) wrote in message news:<be9ae35b.0409191116.8156c33@posting.google.com>...
> I have a coding question:
>
> I have an algorithm were I have coded for two events.
> The first event may have zero or more bits.
> The second will have one or more bits.
> It is necessary to delimit each event.
>
> I have coded this way:
>
> For the first event I use zeros and for the second I use ones
> terminated by a zero.
> " 1011110000001000000011111000010 "
> A first event will not follow a first event but, a second event may
> follow a second event.
>
>
> My Question is: Is there a better coding? Can I avoid the need for a
> termination bit in the second event and still be able to have "back to
> back" delimited second events?


What do you mean by "better"? I think, Berg, your approach to the
problem might be slightly flawed. You could also consider the
situation like this. You have 2 types of event and events have a
bitlength. If the bitlengths are constrained you could think of it as
having 2*max_bitlength different events. If you then also have a
frequency distribution for the events, you then may build a huffman
code to get an optimal code. Now, there are too many "If"s here,and I
might be missinterpreting you, because the information you provide is
much too scant

regards.
Ernst Berg

2004-09-20, 8:55 pm

"David A. Scott" <daVvid_a_scott@email.com> wrote in message news:< Xns9569DCA309733H110W296LC45WIN3030R@130
.133.1.4>...
> Ernst_Berg@sbcglobal.net (Ernst Berg) wrote in
> news:be9ae35b.0409191116.8156c33@posting.google.com:
>
>
> It not clear enough how do you distingish between
> to second events and a second event followed by a first
> event of zero bits followed by a second event. Your
> statements don't make logical sense to me.
>
>
> David A. Scott



Right.

I must leave for work but I will return to express my question in a
better way tonight.

Ernst
Ernst Berg

2004-09-24, 8:55 am

guenther.vonKnakspott@gmx.de (Guenther von Knakspott) wrote in message news:<9e54a9f7.0409192227.7dc1a4a4@posting.google.com>...
> Ernst_Berg@sbcglobal.net (Ernst Berg) wrote in message news:<be9ae35b.0409191116.8156c33@posting.google.com>...
>
> What do you mean by "better"? I think, Berg, your approach to the
> problem might be slightly flawed. You could also consider the
> situation like this. You have 2 types of event and events have a
> bitlength. If the bitlengths are constrained you could think of it as
> having 2*max_bitlength different events. If you then also have a
> frequency distribution for the events, you then may build a huffman
> code to get an optimal code. Now, there are too many "If"s here,and I
> might be missinterpreting you, because the information you provide is
> much too scant
>
> regards.



I have not tried this approach but I like the enumeration ideal.
I adopted a unary code but the seperate functions still interest me.
I will look into this.

Thank you.

Ernst
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com