black word/white word encodings

Discussion in 'C Programming' started by George, Nov 10, 2008.

  1. George

    George Guest

    C with 2 sprained hands.

    I would nlike to emulate the t4 encoding scheme using the following

    graphic:

    * * *
    * * *

    ***** o O o o
    hello isn't working; let's ace the 'ello'.





    *****
    *****
    *****
    *****
    *****
    *****
    *****
    *****
    ************
    ************
    ************
    ***** ***
    ***** ***
    ***** ***
    ***** ***
    ***** ***
    ***** ***

    Given that I can suck this in using a twenty by twenty char array, what

    would be a sufficient black word/white word encoding scheme.
    --
    George

    The action we take and the decisions we make in this decade will have
    consequences far into this century. If America shows weakness and
    uncertainty, the world will drift toward tragedy. That will not happen on
    my watch.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
     
    George, Nov 10, 2008
    #1
    1. Advertising

  2. George

    George Guest

    On Sun, 09 Nov 2008 20:55:41 -0600, Jack Klein wrote:

    >> Given that I can suck this in using a twenty by twenty char array, what
    >>
    >> would be a sufficient black word/white word encoding scheme.

    >
    > I don't understand your question. Still, there's some code on my
    > website that you might find useful, from my chapter of the book "C
    > Unleashed". There's a source file there that contains a black and
    > white character set using 16 unsigned shorts for each character.


    Is the width of an unsigned short fixed.

    >
    > See http://jk-technology.com/C_Unleashed/code_list.html


    I think I have the identical materials on the disc that comes with the
    book. Of course the disc doesn't have the errata, but I don't think there
    were any significant ones with this material.

    >
    > There are also links there to source and header files for making
    > binary files from text files, using the character set. And for T4
    > encoding and decoding.


    This is as far as I get tonight:

    Using the encoding formats on pp. 766-770, let's see what happens to our h,
    which is a 20 x 20 that contains:




    *****
    *****
    *****
    *****
    *****
    *****
    *****
    *****
    ************
    ************
    ************
    ***** ***
    ***** ***
    ***** ***
    ***** ***
    ***** ***
    ***** ***


    The first line consists of spaces and maybe a cr and a line feed. Any such
    characters are simply not asterisks, ie, they are white. The first line is
    empty and therefore contains 20 whites. Following the development, they
    would contain 0xFF. We can represent this as 20W.

    When we hit the top of the h, we have 3W, 5B, 12W.
    Halfway down we have 3W, 12B, 5W.
    Then 3W, 5B,4W,3B,5W

    Ultimately, we have rows of 20W.

    In the development, the blamk lines are translated as
    1,728WM, 0WT, EOL

    I think the analog is:
    20 WT, EOL

    and:

    0001000 000000000001

    I don't see how these words would differ except where that 1 bit is.
    Aren't they both padded out with zeroes?


    --
    George

    It's going to be the year of the sharp elbow and the quick tongue.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
     
    George, Nov 11, 2008
    #2
    1. Advertising

  3. George

    James Kuyper Guest

    George wrote:
    ....
    > Is the width of an unsigned short fixed.


    For any given implementation, the width is a fixed value, of at least 16
    bits. It can be different on different implementations.
     
    James Kuyper, Nov 11, 2008
    #3
  4. George

    George Guest

    On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:

    > George wrote:
    > ...
    >> Is the width of an unsigned short fixed.

    >
    > For any given implementation, the width is a fixed value, of at least 16
    > bits. It can be different on different implementations.


    And the words for 1000 and 1 would be the same size and have the same
    number of zeroes and ones?

    Is the length of all these code words the same? If yes, does that mean
    they get padded out with zeroes to the left?

    Example:

    Run length white code word black code word

    2 0111 011

    Are these not identical except for the third bit, counting from the right.

    If there are 16 bits to a word, does not tte former have 13 zeroes while
    the latter has 14. If yes, this contradicts claims about EOL on page 771.

    --
    George

    Every nation in every region now has a decision to make. Either you are
    with us, or you are with the terrorists.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
     
    George, Nov 11, 2008
    #4
  5. George

    James Kuyper Guest

    George wrote:
    > On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
    >
    >> George wrote:

    [A lot of stuff I didn't understand, but one question that seemed quite
    clear:]
    >>> Is the width of an unsigned short fixed.

    >> For any given implementation, the width is a fixed value, of at least 16
    >> bits. It can be different on different implementations.


    Your question was about 'unsigned short', and so was my answer. Your
    further questions either reflect a severe lack of elementary knowledge
    about binary representations, or a failure to clearly communicate the
    fact that you're actually referring to something other than unsigned
    short. I'm favoring the second explanation, and if I'm right I won't be
    able to answer your question until you make it clearer.

    However, on the off chance that your questions are actually about the
    binary representation used in unsigned short, I will answer them in that
    context.

    > And the words for 1000 and 1 would be the same size and have the same
    > number of zeroes and ones?


    unsigned short objects representing 1000 and 1 will take up the same
    exact amount of memory.

    A unsigned short object representing 1 will have one value bit set to 1,
    and the rest of the value bits set to 0; padding bits, if any, might be
    set to either 0 or 1.

    A unsigned short object representing 1000 will have six value bits set
    to 1, and the rest of the value bits set to 0; padding bits, if any,
    might be set to either 0 or 1.

    > Is the length of all these code words the same? If yes, does that mean
    > they get padded out with zeroes to the left?


    All unsigned short objects have the same size. All of the value bits
    that don't need to be set to determine the value of the object must be
    cleared (0). There could be padding bits, that are not value bits,
    though this is rather uncommon; if they are present, they can be either
    0 or 1.
     
    James Kuyper, Nov 12, 2008
    #5
  6. On 11 Nov, 23:45, George <> wrote:
    > On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
    > > George wrote:


    > >> Is the width of an unsigned short fixed.

    >
    > > For any given implementation, the width is a fixed value, of at least 16
    > > bits. It can be different on different implementations.

    >
    > And the words for 1000 and 1 would be the same size and have the same
    > number of zeroes and ones?
    >
    > Is the length of all these code words the same?  If yes, does that mean
    > they get padded out with zeroes to the left?
    >
    > Example:
    >
    > Run length  white code word black code word
    >
    >    2          0111               011
    >
    > Are these not identical except for the third bit, counting from the right..
    >
    > If there are 16 bits to a word, does not tte former have 13 zeroes while
    > the latter has 14.  If yes, this contradicts claims about EOL on page 771.


    your questions need to become much clearer. For instance

    "And the words for 1000 and 1 would be the same size and have the same
    number of zeroes and ones?"

    what is a "word". What base is 1000 and 1 in? What representation
    are you using? Are they strings? Do you mean "the same number of
    bits"?


    --
    Nick Keighley
     
    Nick Keighley, Nov 12, 2008
    #6
  7. George

    George Guest

    On Wed, 12 Nov 2008 02:19:34 GMT, James Kuyper wrote:

    > George wrote:
    >> On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
    >>
    >>> George wrote:

    > [A lot of stuff I didn't understand, but one question that seemed quite
    > clear:]
    >>>> Is the width of an unsigned short fixed.
    >>> For any given implementation, the width is a fixed value, of at least 16
    >>> bits. It can be different on different implementations.

    >
    > Your question was about 'unsigned short', and so was my answer. Your
    > further questions either reflect a severe lack of elementary knowledge
    > about binary representations, or a failure to clearly communicate the
    > fact that you're actually referring to something other than unsigned
    > short. I'm favoring the second explanation, and if I'm right I won't be
    > able to answer your question until you make it clearer.


    I've seen this material discussed in mathematics, where we never really get
    down to the zeroes and ones.

    >
    > However, on the off chance that your questions are actually about the
    > binary representation used in unsigned short, I will answer them in that
    > context.
    >
    >> And the words for 1000 and 1 would be the same size and have the same
    >> number of zeroes and ones?

    >
    > unsigned short objects representing 1000 and 1 will take up the same
    > exact amount of memory.
    >
    > A unsigned short object representing 1 will have one value bit set to 1,
    > and the rest of the value bits set to 0; padding bits, if any, might be
    > set to either 0 or 1.
    >
    > A unsigned short object representing 1000 will have six value bits set
    > to 1, and the rest of the value bits set to 0; padding bits, if any,
    > might be set to either 0 or 1.


    The text here is critical, from pp 767-771 of unleashed.

    The code words are variable length and strung together one after another
    without regard for higher-level boundaries.

    Ultimately lines are padded out on the eol word to make--they pad them out
    to the left with zeroes--octets, which are unsigned shorts.


    >
    >> Is the length of all these code words the same? If yes, does that mean
    >> they get padded out with zeroes to the left?

    >
    > All unsigned short objects have the same size. All of the value bits
    > that don't need to be set to determine the value of the object must be
    > cleared (0). There could be padding bits, that are not value bits,
    > though this is rather uncommon; if they are present, they can be either
    > 0 or 1.


    Padding with ones?


    --
    George

    When I take action, I'm not going to fire a $2 million missile at a $10
    empty tent and hit a camel in the butt. It's going to be decisive.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
     
    George, Nov 13, 2008
    #7
  8. George

    George Guest

    On Wed, 12 Nov 2008 00:20:54 -0800 (PST), Nick Keighley wrote:

    > On 11 Nov, 23:45, George <> wrote:
    >> On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
    >>> George wrote:


    >> Is the length of all these code words the same?  If yes, does that mean
    >> they get padded out with zeroes to the left?
    >>
    >> Example:
    >>
    >> Run length  white code word black code word
    >>
    >>    2          0111               011
    >>
    >> Are these not identical except for the third bit, counting from the right.
    >>
    >> If there are 16 bits to a word, does not tte former have 13 zeroes while
    >> the latter has 14.  If yes, this contradicts claims about EOL on page 771.

    >
    > your questions need to become much clearer. For instance
    >
    > "And the words for 1000 and 1 would be the same size and have the same
    > number of zeroes and ones?"
    >
    > what is a "word". What base is 1000 and 1 in? What representation
    > are you using? Are they strings? Do you mean "the same number of
    > bits"?


    Clarity isn't my strong suit now. This is new material for me.

    By words I mean "code words" of the T.4 protocol. There are 64 terminating
    white code words, a like number of black terminating code words, for a
    total of 128 terminating code words. Since 1728/64 = 27, there are 27 white
    make-up code words and a like number of black, for a total of 54 make-up
    code words.

    The final code word is the eol word, which has eleven leading zroes, unlike
    any other code word. The eol you can pad out, but no other.

    For our code to reproduce "h," we have:

    %- characters are simply not asterisks, ie, they are white. The first line
    is
    %- empty and therefore contains 20 whites. Following the development, they
    %- would contain 0xFF. We can represent this as 20W.
    %-
    %- When we hit the top of the h, we have 3W, 5B, 12W.
    %- Halfway down we have 3W, 12B, 5W.
    %- Then 3W, 5B,4W,3B,5W
    %-
    %- Ultimately, we have rows of 20W.
    %-
    %- In the development, the blamk lines are translated as
    %- 1,728WM, 0WT, EOL
    %-
    %- I think the analog is:
    %- 20 WT, EOL

    This is 0001000 000000000001

    3W, 5B, 12 W , eol is
    1000 0011 001000 000000000001

    3W, 5B,4W,3B,5W, eol is

    1000 0011 1011 011 1100 000000000001

    20 WT eol is again:
    0001000 000000000001

    What would be a good tool to use to string these together without a
    prohibibitively long line or cr's or lf's?

    --
    George

    To those of you who received honours, awards and distinctions, I say well
    done. And to the C students, I say you, too, can be president of the United
    States.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
     
    George, Nov 13, 2008
    #8
  9. George

    CBFalconer Guest

    George wrote:
    >

    .... snip ...
    >
    > --
    > To those of you who received honours, awards and distinctions,
    > I say well done. And to the C students, I say you, too, can be
    > president of the United States. -- George W. Bush


    Well, this gives me a chance to trot out my latest sig:

    Sometimes, when I look at my children, I say to myself:
    "Lillian, you should have remained a virgin." -- Lillian Carter
    I had a rose named after me, and I was very flattered. But I was
    not pleased to read the description in the catalog:
    "No good in bed, but fine against a wall.' -- Eleanor Roosevelt


    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.
     
    CBFalconer, Nov 13, 2008
    #9
  10. George

    George Guest

    On Wed, 12 Nov 2008 21:45:46 -0500, CBFalconer wrote:

    > George wrote:
    >>

    > ... snip ...
    >>
    >> --
    >> To those of you who received honours, awards and distinctions,
    >> I say well done. And to the C students, I say you, too, can be
    >> president of the United States. -- George W. Bush

    >
    > Well, this gives me a chance to trot out my latest sig:
    >
    > Sometimes, when I look at my children, I say to myself:
    > "Lillian, you should have remained a virgin." -- Lillian Carter


    Lillian is what the South wants to be: better people. Jimmy's stubborn
    refusal to not give in to the Bush family ethics makes him unpopular with
    most people. Not so with me. The carpenter union card I keep in my pocket
    is from local 1 in Chicago. He's unpopular with me for the reasom that
    most other folks like him.

    His "habitat for humanity," in my book, were better "lawyers for humanity,"
    or "data miners for numanity," or "coffee for humanity," butplease not
    something that depresses wages for the workers in the vineyards.

    §%- By words I mean "code words" of the T.4 protocol. There are 64
    terminating
    %- white code words, a like number of black terminating code words, for a
    %- total of 128 terminating code words. Since 1728/64 = 27, there are 27
    white
    %- make-up code words and a like number of black, for a total of 54 make-up
    %- code words.
    %-
    %- The final code word is the eol word, which has eleven leading zroes,
    unlike
    %- any other code word. The eol you can pad out, but no other.
    %-
    %- For our code to reproduce "h," we have:
    %-
    %- %- characters are simply not asterisks, ie, they are white. The first
    line
    %- is
    %- %- empty and therefore contains 20 whites. Following the development,
    they
    %- %- would contain 0xFF. We can represent this as 20W.
    %- %-
    %- %- When we hit the top of the h, we have 3W, 5B, 12W.
    %- %- Halfway down we have 3W, 12B, 5W.
    %- %- Then 3W, 5B,4W,3B,5W
    %- %-
    %- %- Ultimately, we have rows of 20W.
    %- %-
    %- %- In the development, the blamk lines are translated as
    %- %- 1,728WM, 0WT, EOL
    %- %-
    %- %- I think the analog is:
    %- %- 20 WT, EOL
    %-
    %- This is 0001000 000000000001
    %-
    %- 3W, 5B, 12 W , eol is
    %- 1000 0011 001000 000000000001
    %-
    %- 3W, 5B,4W,3B,5W, eol is
    %-
    %- 1000 0011 1011 011 1100 000000000001
    %-
    %- 20 WT eol is again:
    %- 0001000 00000000000


    §
    Typing with 2 sprained hands and no vicadin

    I've decided that I like pain better than being flabby and undone, so I
    have forsaken the hydrocodone/apap, and will type until my hands stop
    complaining to me. A smallish amount of marijuana sits on the book I
    received today, _The Fortran 2003 Handbook_, and a largeish amount of beer
    contributes to the heat in my kitchen.


    *****
    *****
    *****
    *****
    *****
    *****
    *****
    *****
    ************
    ************
    ************
    ***** ***
    ***** ***
    ***** ***
    ***** ***
    ***** ***
    ***** ***

    The target is to have one blank space on top and one below. This line is:
    0001000 000000000001
    §

    I think we can economize on such lines but that would be another day.
    Today we have:
    123456781234567812345678
    0001000000000000001

    I think Jack wants to say CHAR_BITS, where he now says octets. I don't
    mean that to say octets isn't "right." There's a lot of C between pp.
    765-771, and *not equating* charbits to eight would have been the bigger of
    the weevils.

    §
    > I had a rose named after me, and I was very flattered. But I was
    > not pleased to read the description in the catalog:
    > "No good in bed, but fine against a wall.' -- Eleanor Roosevelt


    If it were 1938 and the first lady were talking to me about what is fine
    against a wall, I'd say she were a sexy bitch.

    --
    George

    We've climbed the mighty mountain. I see the valley below, and it's a
    valley of peace.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
     
    George, Nov 16, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sandy
    Replies:
    1
    Views:
    324
    Sandy
    May 3, 2006
  2. Uli Kunkel
    Replies:
    11
    Views:
    21,790
    John B. Matthews
    Feb 20, 2009
  3. semaphore
    Replies:
    0
    Views:
    703
    semaphore
    Feb 26, 2009
  4. Axel Etzold
    Replies:
    0
    Views:
    118
    Axel Etzold
    Sep 2, 2008
  5. Stijn Goris

    create black-white picture on the fly

    Stijn Goris, Dec 16, 2003, in forum: Javascript
    Replies:
    3
    Views:
    139
    Stijn Goris
    Dec 16, 2003
Loading...

Share This Page