Sweep data explanation
It took me quite a while to understand the explanation of the sweep data from the HP Journal articles, so I will try to explain it in a little clearer terms here.
The swing buffer separation applies for black as well as CMY sweeps. I have only deciphered the ordering for the black data, however.
What's a sweep?
Let's first start off by describing how the nozzles on the printhead are arranged.
For the black nozzles, there are 300 total nozzles. They are numbered from 1 to 300. There are two columns of nozzles - odd and even. The odd colum consists of 150 nozzles separated by 1/300 of an inch. The even column is similar, but it is shifted down 1/600 of an inch from the odd column. Thus, we can get 300 dpi by printing with one column and 600 dpi by printing "between the lines" with the other column.
For the color nozzles, each color (CMY - cyan, magenta, yellow) has 64 nozzles. They are split into two columns of 32 nozzles each. The odd column has nozzles separated by 1/150 of an inch, and the even column has the same set of nozzles, but shifted 1/300 of an inch down. This allows us to get 300 dpi color. (This may differ slightly on printers other than the 820Cse)
When the printer prints a graphical image, it must convert the image data into a form that it can understand. The first task is to separate the image into swaths. Let us assume that we have a black-and-white bitmap that is X pixels wide and Y pixels tall that we want to send to the printer. We must cut this into several swaths, each of a certain height. For example, we might choose to cut it into swaths that are 300 pixels high (1/2 an inch). This produces a series of bitmaps that are X by 300 pixels in dimension.
With this swath data, we can now produce a series of sweeps. A sweep is simply a set of data that tells the printhead how to move across the page and what data to print. For each swath, there may be only one sweep, or there may be multiple sweeps.
Formatting the sweep data
The sweep data is formatted in a very specific way so that the printer can understand it. The first thing that we need to do is convert the bitmap data into the correct form. The form that is required looks like this:
Each of the 8 bit values are packed into a byte in big-endian order.
To give a more concrete example, assume we have a sweep that is 64 pixels wide and 8 pixels tall. Here is what our data organization will look like:
Our next task is to separate this data into swing buffers. Since the odd and even nozzles on the printhead are physically separated, we must extract the appropriate rows of pixels to give to the printer. Two swing buffers are created for each column of bytes. The first is the odd swing buffer, and the second is the even swing buffer. These correspond to which pins will be printing the data. Thus, the odd swing buffer for the first column in the above example would look like this: (Note added: from inspection of the pbm2ppa and pnm2mma code, this seems to be the even swing buffer, not the odd one (?))
And the even swing buffer looks like this: (Note added: this seems to be the odd swing buffer (?))
Ordering the swing buffers
Now we have odd and even swing buffers for each of the columns in the print sweep. The next thing for us to do is order these swing buffers and send them to the printer.
From experimentation, I have determined the ordering for the black data on the 820Cse.
From experimentation, it seems that the values of the first and last 12 columns of data MUST be all 0's. Otherwise, strange results occur, including the repetition of a single swing buffer across the whole sweep.
Here is a quick reference for the ordering of the swing buffer data, assuming X columns of data.
For different printers and color printing, the number of columns to send before we start interleaving seems to vary.