473,287 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

black word/white word encodings

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/
Nov 10 '08 #1
9 1640
On Sun, 9 Nov 2008 18:50:44 -0700, George <ge****@example.invalid>
wrote in comp.lang.c:
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.
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.

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

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.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Nov 10 '08 #2
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/
Nov 11 '08 #3
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.
Nov 11 '08 #4
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/
Nov 11 '08 #5
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.
Nov 12 '08 #6
On 11 Nov, 23:45, George <geo...@example.invalidwrote:
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

Nov 12 '08 #7
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/
Nov 13 '08 #8
On Wed, 12 Nov 2008 00:20:54 -0800 (PST), Nick Keighley wrote:
On 11 Nov, 23:45, George <geo...@example.invalidwrote:
>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/
Nov 13 '08 #9
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.
Nov 13 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stijn Goris | last post by:
Hi all, I want to make a coloured picture black and white when a user moves its mouse pointer over it. I just don't want to store a coloured an black and white (grayscaled) version on the...
12
by: Penna Elabi | last post by:
How do I create a style sheet with black background and white text?
7
by: JCL | last post by:
I have a winform and on this winform, I have a WebBrowser control. Users can browse the web through this form. Is there a way that I can make web pages show up as grey scale pages, with the color...
7
by: marfi95 | last post by:
I'm trying to implement some code in vb.net to allow the user to adjust the brightness or contrast on an image (through the use of a slider) that is already black & white in the bitmap. I have...
5
by: kaosyeti | last post by:
how can i get my report to print all in black when i have a control with conditional formatting to change the font color about 10% of the time it shows up. i've been trying to find a way to format...
1
by: Sandy | last post by:
Dear Pythonic People, I recently discovered SciTE (1.68) as a programming editor, and I find it just beautiful. Small, fast, elegant and beautiful. I particularly like syntax highlighting...
1
by: retheeshnewage | last post by:
I have a doubt in php.I wrote a php program to convert colour Images to balck & white.It is working fine with JPEG files and PNG files.When it comes to GIF files I am not getting the colour...
14
kadghar
by: kadghar | last post by:
Picture this: There are n guys, where n can be any number. This n guys are in a line so they can't see anyone behind them, but they can see everyone in front of them. The bad guys put a hat on...
3
by: Muddasir | last post by:
hi all i need to upload an image and if that image is coloured i need to convert it to black and white image ... till now i only uploaded images ... simple.. have no idea how to do this...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.