TiVo Community Forum Archive 1
READ ONLY ARCHIVES

Welcome to the TiVo Community Forum Archive
This archive covers threads on TiVo Community Forum that have not been posted to from the start until June 30, 2004.  Any thread that has a post made to it between 7/1/04 and 12/31/05, that had not been posted to, will be found in Archive 2.
This is a READ ONLY site.

  Search | ARCHIVE 2 | MAIN SITE

TiVo Community Forum Archive 1 : Powered by vBulletin version 2.2.8 TiVo Community Forum Archive 1 > Underground Playground > TiVo Underground
>>> cs22 file decoder <<<

Pages (3): [1] 2 3 Next »  
Forum Jump:
Search this Thread:
Last Thread   Next Thread
Author
Thread ---> Show Printable Version | Email this Page | Subscribe to this thread Post New Thread    Post A Reply
Mr. Belboz is offline Old Post 08-17-2000 06:05 PM
Click Here to See the Profile for Mr. Belboz Find more posts by Mr. Belboz Add Mr. Belboz to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Mr. Belboz
version 1.0.3

Registered: Dec 1999
Location: Cincinnati, OH
Posts: 185

Talking cs22 file decoder

I tossed this together "real quick". If someone wants to try to mess with the cs22 (screen images) on their TiVo. The below source will decompress the cs22 file into a second file you can then play with. I haven't looked at this raw file any yet, but thought I would post this for others.

Obviously you need to compile this on your PC. It "should" compile on most enviroments (Borland, Watcom, MSVC, DJGPP, gcc, etc).

You will also need to pull some sample cs22 files from your TiVo. You can get them with Zmodem through a terminal program and a bash prompt on your TiVo. You can also mount a TiVo drive with Dylan's boot disk to get them.

The format of the program is 'programname srcfile.cs22 destfile". A possible format to convert these cs22 files to and from is pcx since it uses packbytes format also.

Of the 4 cs22 files in my /tvbin directory there seem to be two packbyte sizes. 346120 and 172840. Not sure what resolution these images are. Be curious to hear what others with more time figure out.

You can get it at the below URL.
http://home.cinci.rr.com/mhill/cs22decode.c


------------------
Belboz
belboz@cinci.rr.com

POST #1 | Report this post to a moderator | IP: Logged

Old Post 08-17-2000 07:30 PM
Show Printable Version Edit/Delete Message Reply w/Quote
agt
Guest

Registered: Not Yet
Location:
Posts: N/A

Talking


FWIW, I threw some random (gzip'd) data at /dev/mpeg0a and noticed that the
garbage image seemed to move around to different areas of the screen as time went by. Perhaps part of the image data describes which areas of the screen should be masked off.

quote:
Originally posted by Mr. Belboz:
Of the 4 cs22 files in my /tvbin directory there seem to be two packbyte sizes. 346120 and 172840. Not sure what resolution these images are. Be curious to hear what others with more time figure out.
[/B]


POST #2 | Report this post to a moderator | IP: Logged

Mr. Belboz is offline Old Post 08-17-2000 07:41 PM
Click Here to See the Profile for Mr. Belboz Find more posts by Mr. Belboz Add Mr. Belboz to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Mr. Belboz
version 1.0.3

Registered: Dec 1999
Location: Cincinnati, OH
Posts: 185

Talking

quote:
Originally posted by agt:

FWIW, I threw some random (gzip'd) data at /dev/mpeg0a and noticed that the
garbage image seemed to move around to different areas of the screen as time went by. Perhaps part of the image data describes which areas of the screen should be masked off.




The CS22 chip does support multiple regions with seperate color tables for each region, overlays, etc.

I was guessing that the 172840 byte cs22 files were possibly 16bit images that are 352X240. That accounts for 168960 bytes and leaves 3880 bytes unaccounted for.

I was guessing that the 346120 byte cs22 files were possibly 16 bit images that are 352X480. That accounts for 337920 bytes and leaves 8200 bytes unaccounted for.



------------------
Belboz
belboz@cinci.rr.com

POST #3 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-17-2000 08:39 PM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

I haven't looked at the actual content of these files yet, but didn't someone say they have a header? Looks like "PackBytes%d/n" where %d is the uncompressed size. I just want to note that the C code Belboz posted doesn't take a header into account, which might explain the extra space you found.

Oops. I'm stupid. I missed the fgets line. Never mind.

Hmm.. 172840 = 4321 * 40... Not much use there.
Well, 360 * 240 * 2 = 172800.. 40 bytes off
And 360 * 480 * 2 = 345600.. 520 bytes off

Why did you choose 352?

------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda


[This message has been edited by Otto (edited August 17, 2000).]

POST #4 | Report this post to a moderator | IP: Logged

sorphin is offline Old Post 08-17-2000 09:09 PM
Click Here to See the Profile for sorphin Find more posts by sorphin Add sorphin to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
sorphin
Advanced Member

Registered: Jun 2000
Location: None Of Your Business
Posts: 7

Talking

if you notice that 1khz mp2 audio file, they use that for testing the sounds are prolly just variations of mpeg2 audio files.. (maybe)

quote:
Originally posted by agt:

FWIW, I threw some random (gzip'd) data at /dev/mpeg0a and noticed that the
garbage image seemed to move around to different areas of the screen as time went by. Perhaps part of the image data describes which areas of the screen should be masked off.






------------------
-ds
Member of the #TiVo Enhancement Project
(Not to be confused with the SourceForge Group)

POST #5 | Report this post to a moderator | IP: Logged

Mr. Belboz is offline Old Post 08-17-2000 11:00 PM
Click Here to See the Profile for Mr. Belboz Find more posts by Mr. Belboz Add Mr. Belboz to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Mr. Belboz
version 1.0.3

Registered: Dec 1999
Location: Cincinnati, OH
Posts: 185

Talking

quote:
Originally posted by Otto:
I haven't looked at the actual content of these files yet, but didn't someone say they have a header? Looks like "PackBytes%d/n" where %d is the uncompressed size. I just want to note that the C code Belboz posted doesn't take a header into account, which might explain the extra space you found.

Oops. I'm stupid. I missed the fgets line. Never mind.

Hmm.. 172840 = 4321 * 40... Not much use there.
Well, 360 * 240 * 2 = 172800.. 40 bytes off
And 360 * 480 * 2 = 345600.. 520 bytes off

Why did you choose 352?



Actually I got the 352 from documentation on the CS24 chip (figuring it is similiar to the cs22).

One thing I caught after posting it was that the 352 X 240 and 480 I saw were listed as supported Input Image sizes and not output sizes.

So your 360 might be closer to the mark.. I will look into the files more later.



------------------
Belboz
belboz@cinci.rr.com

POST #6 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-18-2000 01:09 AM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

Well, these are input images, right?

However, I now have support for the 360 theory. I ran your decoder on the InstallingSoftware.cs22 and got a large file out of it. Looking at the hex, I noticed that the first 520 (0x208) bytes are a bunch of junk. Assuming this is a raw file bitmap, type of thing, I'd say that's a palette of some type. When I display that on the screen with osdwriter, there nothing on the top line, as far as I can tell. The rest of the file looks consistent with a straight bitmap image. And the size matches 360x480.

Now if I could only find an image editor that understood this file type...

Addition: sending the resulting raw file to the various /dev/mpeg0* does nothing, except garble the screen a bit on mpeg0o. However, running osdwriter output.raw does display the same screen as running it on the *.cs22 file.

------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda


[This message has been edited by Otto (edited August 17, 2000).]

POST #7 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-18-2000 03:55 AM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

The image format of the raw file is 720 high by 240 wide, with a 520 byte header. I'm was able to open it in Paint Shop Pro 6.02 as a raw format file. I still haven't worked out that palette yet, however. It's in the header, I just don't know the format yet.

Bit of a weird image aspect ratio though. But that's definitely it. EDIT: No it's not. Paintshop pro assumes 24 bit color. I couldn't get it to work as 16 bit. That's why it was giving me weird aspect ratios.

------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda

[This message has been edited by Otto (edited August 18, 2000).]

POST #8 | Report this post to a moderator | IP: Logged

Old Post 08-18-2000 08:28 AM
Show Printable Version Edit/Delete Message Reply w/Quote
J-Man
Guest

Registered: Not Yet
Location:
Posts: N/A

Talking

I think it's 360 x 480 but with 2 bytes (16 bits) per pixel, though it seems for 65k colors you'd need more than 520 bytes of header to describe the palette... I'm honestly not sure how it works yet, but I also suspect there might be a byte-order issue here (Intel's LSB-MSB vs Motorola's MSB-LSB)... but either way, if we can somehow translate the header (and thus the palette), we should be able to duplicate it.

I tried renaming the uncompressed version to every single image type that Paint Shop and Photoshop recognize, with no success. I tried every conceivable setting for "raw" in both programs, and was able to view them but the colors were way off...

I have some other ideas - neither program seems willing to take an image containing a palette for any raw type - it has to be either grey-scale or RGB or CYM (or whatever)... but nothing with a palette. So I'm thinking about trying to add the image header from an 8 or 16 bpp bitmap, and see if I can get it to recognize it. Then I may be able to somehow merge the palette into the header as well. If we can crack that, we should be able to easily whip up a BMP --&gt; cs22 converter in C

I still don't know why I so badly want to get this to work - once I'm able to display my own images on the screen, I then will need to come up with a practical use... but I'm sure that won't take too long...

Also - I'm wondering if some of those bits are reserved for something like "transparency level". All image formats that I know of (except for .psd) cannot store varying levels of transparency - it's either transparent or opaque, no in-between. But keeping with TV standards, you need to be able to overlay an image over the video.

Consider this:

- TiVo can play only one MPEG type of image at a time, period. There is only one hardware decoder capable of displaying compressed images.

- TiVo can however mix raw video with the MPEG. Remember, you cannot mix compressed data without first decompressing both portions, mixing, then re-compressing them together - which the TiVo does not have enough processing power to do (same with audio).

Thus, all on-screen images that are mixed with video are raw (or RLE encoded, which is relatively simplistic in comparison to MPEG/JPEG). Hint: this is why the TiVo main menu will not overlay TV - it has its own animations in the back drop, probably in the form of an MPEG

What does all of this mean? I'm not sure, but my mind has been stuck on this all day. /dev/mpeg0v is for MPEG video. Go ahead and 'cat' something to it, you'll only see distortions in the video (proving my point above about mixing compressed data). The OSD is a separate rendering device (also why it records only the video, even if you're using the OSD to look at the description, for example).

To summarize, if we can figure out the color palette, the transparancy settings (how many bits are used for each - doesn't have to necessarily be 8:8 btw), the byte-ordering and so on, we should be able to project images, possibly as overlays and over only portions of the screen (perhaps ICQ messages, stock quotes, or whatever you can make a program on another PC send to the TiVo)...

PS - sorry for the long post - I've been up too long, and I tend to do 'brain dumps'

PPS - Thanks for the decoder, btw - it's been extremely helpful with this whole process

- J-Man aka Justin

[This message has been edited by J-Man (edited August 18, 2000).]

POST #9 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-18-2000 05:41 PM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

I've been thinking about this, and I agree with your conclusions that all the menus, guide, overlays, etc. Must be raw data. It just dumps them on top of the screen. At the same time, the overlays must support transparency and they don't need to support a lot of colors, really.

Then I started thinking about that 520 byte header. It doesn't really have to be a palette. That 520 bytes can be anything. With 16 bits of color, why not say that the image might be RGBA instead? 4 bits each, with the alpha channel providing 16 levels of transparency? This fits with what I've seen of the menus (note that the colors aren't great on some of the pictures in the titlebars of Tivolution Magazine. Also, the menus are partly transparent on the background as is the Live TV Guide on the TV image. The colors may be reversed, BGRA or something, but that's just details...

Just an assumption to work on that might be useful.


------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda

[This message has been edited by Otto (edited August 18, 2000).]

POST #10 | Report this post to a moderator | IP: Logged

bonehead is offline Old Post 08-18-2000 06:09 PM
Click Here to See the Profile for bonehead Find more posts by bonehead Add bonehead to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
bonehead
TiVo Forum Special Member

Registered: Apr 2000
Location: Des Moines, IA
Posts: 424

Talking

quote:
Originally posted by Otto:
The image format of the raw file is 720 high by 240 wide, with a 520 byte header.


That wouldn't make sense. If you flip it around and call it 720 wide by 240 high, then it might.

Two very common image sizes to use when working on NTSC video on a computer are 720x480 (NTSC, full frame, interlaced) and 352x240 (NTSC, deinterlaced frame). When I capture video, I capture at 352x480, then deinterlace that down to 352x240.

Since the display output of the Tivo is an NTSC television, I'd expect these images to conform to one of these common sizes (or at least be pretty darn close to it.)


POST #11 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-18-2000 08:07 PM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

If you read the rest of the post, you'll see I was mistaken.

The image format is a lot trickier than it looks. Paint Shop Pro sucks. I'm going to have to sit down and write something to decode this thing the right way. It looks like 360x480 interlaced. It's weird and it's making my head hurt. I've got some more theories I'll code up tonight and give it a shot. I may be able to write a raw2bmp (and therefore a cs22-&gt;bmp) convertor. I'll give it my best this weekend.

I think it's interlaced, but I'm uncertain. I'll figure that out when I figure out the size. The 520 bytes may or may not be a palette. Frankly, I don't know what the hell they are. Maybe they're commands to the mpeg decoder, maybe they're transparency chunks, I dunno.

Here's the deal with the wack image sizes. The reason I thought it was 240 wide is that that loaded the image properly in paint shop pro. However, it was using 3 bytes per pixel (24 bit) and doesn't understand 16 bit at all. So when it read 720 bytes, it got 240 pixels out of it. However, that was good enough to get a wacky bad color image that resembled the original. The lines at least synched up though, and you didn't get any diagnoal jaggies because 720 bytes is the length of the line. It should be 360 pixels wide though, or maybe 480. If the image is 16 bit (4-bit RGBA?), then it's 360 wide. It also could be 12-bit (4-bit RGB?), in which case it's 480 wide. Either way, the width of a raster line in this image is 720 bytes, period.


------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda

POST #12 | Report this post to a moderator | IP: Logged

Mr. Belboz is offline Old Post 08-18-2000 09:11 PM
Click Here to See the Profile for Mr. Belboz Find more posts by Mr. Belboz Add Mr. Belboz to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Mr. Belboz
version 1.0.3

Registered: Dec 1999
Location: Cincinnati, OH
Posts: 185

Talking

Ok the bigger packbyte files seem to be the following. This is unpacked obviously.

First 8 bytes unknown (header?). Could be offset, etc.

Next 512 bytes are RGB values for the 256 color palette. 2 Bytes per palette entry. Not sure on how the RGB values are mapped.

Image size is 720 X 480 with one byte per pixel so the final 345600 bytes make up the image.

I wrote a program to convert the above file to a Targa (TGA) file since it seems to be simple enough to use. Targa supports uncompressed images so it is a simple matter of tossing on a proper Targa header, toss out the palette, and then the image data.

The resulting TGA file looks great from an aspect ratio and pixel content. Just the palette is all messed up.

The smaller packbyte files have the 8 byte header as above and then 32 bytes which make up the RGB values for 16 colors (2 bytes per palette entry).

Haven't looked at the make up of the smaller packbytes files image. Not sure if it is a smaller size image, or 2 pixels per byte.

p.s. dont hunt me down if all of this is wrong.

------------------
Belboz
belboz@cinci.rr.com

[This message has been edited by Mr. Belboz (edited August 18, 2000).]

POST #13 | Report this post to a moderator | IP: Logged

Old Post 08-18-2000 09:17 PM
Show Printable Version Edit/Delete Message Reply w/Quote
agt
Guest

Registered: Not Yet
Location:
Posts: N/A

Talking


For a good time, "export DUMP_OSD=1 ; myworld" and then look in /var/tmp/osdDump.bin. Watch the file as you make menu selections, etc.

I'm heading out of town and can't play w/ this further.
Have fun folks, please post anything you find. Thanks.

POST #14 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-18-2000 10:08 PM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

quote:
Originally posted by Mr. Belboz:
I wrote a program to convert the above file to a Targa (TGA) file since it seems to be simple enough to use. Targa supports uncompressed images so it is a simple matter of tossing on a proper Targa header, toss out the palette, and then the image data.



Care to toss us that source code?


------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda

POST #15 | Report this post to a moderator | IP: Logged

Mr. Belboz is offline Old Post 08-18-2000 11:10 PM
Click Here to See the Profile for Mr. Belboz Find more posts by Mr. Belboz Add Mr. Belboz to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Mr. Belboz
version 1.0.3

Registered: Dec 1999
Location: Cincinnati, OH
Posts: 185

Talking

quote:
Originally posted by Otto:
Care to toss us that source code?





Ok. It aint much but here it is.
http://home.cinci.rr.com/mhill/maketga.c

It only works with the larger packbytes files right now. They already need to be uncompressed also with the previous decoder I uploaded. The code makes a few assumptions about the content so be warned.

For an example of the Install.cs22 converted by the above program (and converted to a gif by a third party program), check out. The palette is off, but you get the idea.

http://home.cinci.rr.com/mhill/install.gif

------------------
Belboz
belboz@cinci.rr.com



[This message has been edited by Mr. Belboz (edited August 20, 2000).]

POST #16 | Report this post to a moderator | IP: Logged

Old Post 08-18-2000 11:34 PM
Show Printable Version Edit/Delete Message Reply w/Quote
J-Man
Guest

Registered: Not Yet
Location:
Posts: N/A

Talking

RGBA - that sounds like a winner here. 4 bits per channel (RG and B), then 4 bits for transparency. I think that should yeild decent color results.

If that happens to be the case, I could probably whip up a program to convert a standard 24 bit RGB bitmap into a 12 bit RGB with a set transparency level or something to that affect - eg, take the 4 highest bits from each color channel, dropping the LSBs, and adding a common transparency level, settable from the command line ??

Source for the TGA converter would be most appreciated as well, as I'm sure it would prove helpful

POST #17 | Report this post to a moderator | IP: Logged

Mr. Belboz is offline Old Post 08-18-2000 11:47 PM
Click Here to See the Profile for Mr. Belboz Find more posts by Mr. Belboz Add Mr. Belboz to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Mr. Belboz
version 1.0.3

Registered: Dec 1999
Location: Cincinnati, OH
Posts: 185

Talking

quote:
Originally posted by J-Man:

Source for the TGA converter would be most appreciated as well, as I'm sure it would prove helpful



It is linked in the message above yours



------------------
Belboz
belboz@cinci.rr.com

POST #18 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-19-2000 12:21 AM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

Actually, I (rather impatiently) just wrote my own. It's essentially the same as Belboz's though. I found the TGA specs and they are rather simple, really. I had no idea.

I'm still having problems figuring out the color format. I've tried several ways.


------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda

POST #19 | Report this post to a moderator | IP: Logged

Otto is offline Old Post 08-19-2000 06:00 AM
Click Here to See the Profile for Otto Find more posts by Otto Add Otto to your buddy list Show Printable Version Edit/Delete Message Reply w/Quote
Otto

Registered: Mar 2000
Location:
Posts: 1031

Talking

Well, I'm convinced it's not RGB.

I went through every logical thing I could think of, and others that made no sense. I can't make heads or tails of the color format. I'm looking at CMYK and HSL now to see if its in one of these formats, but I am sure as heck that it's not RGB. I went to the trouble of looking at individual pixels, the color of which I knew, tracking them down in the file, seeing what colors they are, looking that up in the color map, converting to binary and visually comparing. They are more or less chaotic, in terms of differences on RGB. However, they have a vague CMYK feel to them, so I'm trying that now.


------------------
Otto, Supreme TiVoWarrior - Moderator - AVS Forum - Tivo Underground
"If once you start down the dark path, forever will it dominate your destiny. Consume you it will!" -- Yoda

POST #20 | Report this post to a moderator | IP: Logged

All times are GMT. The time now is 02:28 PM. Post New Thread    Post A Reply
Pages (3): [1] 2 3 Next »   Last Thread   Next Thread
>>> cs22 file decoder <<<

TiVo Community Forum Archive 1 : Powered by vBulletin version 2.2.8 TiVo Community Forum Archive 1 > Underground Playground > TiVo Underground
Search The Internet
 
Show Printable Version | Email this Page | Subscribe to this thread

Forum Jump:
 
Search this Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

< Contact Us - TiVo Community Forum Archive 1 >

Powered by: vBulletin Version 2.2.8
Copyright ©2000, 2001, Jelsoft Enterprises Limited.
(C)opyright - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not affiliated with TiVo Inc.
Page generated in 0.04648900 seconds (88.66% PHP - 11.34% MySQL) with 27 queries.


Spider History Index