• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

How does the upscaling work for the Apple TV Tuner Card?

noglin

Member
I'm making a demo (demoscene) for my beloved 5200. It is not the fastest machine and there is no 320x240 mode, so one must upscale in software which steals quite a bit of cycles.

The Apple TV Tuner Card is 320x240 and it up-scales to 640x480 (in hardware, I'm quite sure). Perhaps there is someone hardcore here that has some insights how that works?

A while ago, I tried to systematically write to all locations in VRAM (1MB, I could not reach the very first 32 bytes if I recall correctly but the rest I could write) while I had the Apple Video Application running, I had kind of hoped I would miraclously see that I could overwrite the video signal and get free 2x scaling :D but no, I did not get that.

Very curious if anyone has some insights on how the Apple TV Tuner Card gets its data to the screen upscaled.
 

François

Well-known member
It may well completely bypass the VRAM, and directly output the upscaled signal in the analog space… (no insight, just speculating)
 

Fizzbinn

Well-known member
Some info on this general topic in the LC/Quadra 630 Developer note:

e.g, Page 17:
"The display memory contains three separate frame buffers. The first frame buffer holds the graphics data—the display that is generated by the computer. The other two frame buffers hold video data from the video input module. The video data frame buffers are used alternately: while one is supplying data to be sent to the video monitor, the other is receiving the next frame of video input."
 

noglin

Member
treellama! wow thanks this is *amazing* :D


#define videoBuffer0 0x0
#define videoBuffer1 0x40
#define windowActive 0x20
#define pixelDouble 0x2

#define VALKYRIEVideoInControlRegister (*((volatile byte*)0x50f2a020))
...
VALKYRIEVideoInControlRegister= videoBuffer0|windowActive|pixelDouble;

I will play with this!

How did Bungie figure this out?? Was the valkyrie chip documented somewhere?

I had previously checked linux drivers but it didn't do much more than just get a framebuffer from it (https://git.kernel.org/pub/scm/linu...ee/drivers/video/fbdev/valkyriefb.c?h=v6.2.10)
 
Last edited:

noglin

Member
LaPorta, excellent!! So there we have it. This also explains the various limitations on depths and resolutions while using Apple Video (with 1MB vram constraint there must be enough space for the video-in to write to 320x240). If one watches in 640x480 then valkyrie does the upscaling of the video buffer. Very cool!
 

treellama

Well-known member
I'd look forward to your demo, but I only have a 630, not a 5200. So you'll have to upload a video of it!
 

joevt

Well-known member
Power Mac 8500 video input (composite or S-Video) doesn't have a pixel doubler. It did capture 640x480 though. It DMA'd the pixels directly to the framebuffer (for play through) or RAM (for video capture). It could display or capture smaller sizes, probably by skipping pixels and lines, perhaps with some convolving?

Power Mac 8500 video output (composite or S-Video) has 256x192 and 320x240 modes. Smallest RGB output is 512x384.

It would take some work to create an arbitrary resolution such as 320x240 for RGB output. After setting up the registers to produce that resolution, you would need a special scaler to put that onto a display.
 

noglin

Member
It is pretty cool. I got it to work nicely on the 5200 :D page flipping and 2x upscaling.

treellama, I'll definitely make a video capture of the demo (eta August), and maybe one day I'll target 68k for a demo.

joevt, that is interesting does it feel slower when using the video? (even if it is powerful enough, I would imagine the transfer would take some of its data bandwidth)

For the demo, I think the 7200 (and portables like PB5300) could be problematic, as neither has upscale, but are still quite slow machines. But there is always 8bpp mode and dithering.
 

noglin

Member
zefrenchtoon, I read that actually as well yesterday (but in 5200 dev notes). It is however nowhere near the level of detail needed to write an implementation.

I presume that Bungie might have had help directly from Apple. Otherwise it is really kudos to them figuring out that valkyrie's control register is at 0x50f2a020, and that there is a window mode that one can set it to (value 0x20) and it only shows the selected video buffer if one writes a specific color index value to the main buffer. The Apple Video Player for example does not write 0x20 to this register (I haven't checked, maybe some other application used the window mode? does QuickTime maybe allow to view 320x240 fullscreen and uses window mode?)

It is also possible they reverse-engineered this, but I think I doubt that they would spend that kind of effort given that it only was applicable to a few models.

I wonder what other (if any?) capabilities the valkyrie IC has.
 

zefrenchtoon

Well-known member
zefrenchtoon, I read that actually as well yesterday (but in 5200 dev notes). It is however nowhere near the level of detail needed to write an implementation.

I presume that Bungie might have had help directly from Apple. Otherwise it is really kudos to them figuring out that valkyrie's control register is at 0x50f2a020, and that there is a window mode that one can set it to (value 0x20) and it only shows the selected video buffer if one writes a specific color index value to the main buffer. The Apple Video Player for example does not write 0x20 to this register (I haven't checked, maybe some other application used the window mode? does QuickTime maybe allow to view 320x240 fullscreen and uses window mode?)

It is also possible they reverse-engineered this, but I think I doubt that they would spend that kind of effort given that it only was applicable to a few models.

I wonder what other (if any?) capabilities the valkyrie IC has.
Curiously, in the LC 630 Dev Notes, there is a note which is not present in the 50X0 Dev Notes:
Note
The display memory controller in the Valkyrie IC is similar to the
DAFB IC used in the Macintosh Quadra 700 and 900 computers
and to the display portion of the MEMCjr IC used in the
Macintosh Quadra 605 computer.
 

zefrenchtoon

Well-known member
I knew that I had seen a pdf file about internals of Valkyrie chips … found it here ! but this is for an evolution of Valkyrie, not the original one.
Maybe @Arbee has the pdf of the original Valkyrie :rolleyes:
 

joevt

Well-known member
joevt, that is interesting does it feel slower when using the video? (even if it is powerful enough, I would imagine the transfer would take some of its data bandwidth)
I've never noticed a slow down but haven't done any benchmarks. The CPU is not involved in the transfer. The transfer is handled by a DBDMA engine. The video-in DBDMA program is in RAM, at least 16 bytes per scan line.
The VRAM is like PCI but is 50MHz instead of 33MHz.
best case for RAM and VRAM bandwidth = 50 MHz * 64 bits = 3200 Mb/s = 400 MB/s.
video bandwidth = (640 + 16) x 480 x 30 Hz x 32 bpp = 302 Mb/s = 38 MB/s.
So maybe the video bandwidth takes only 10% of RAM bandwidth? There's some overhead that I'm not accounting for.

I presume that Bungie might have had help directly from Apple. Otherwise it is really kudos to them figuring out that valkyrie's control register is at 0x50f2a020, and that there is a window mode that one can set it to (value 0x20) and it only shows the selected video buffer if one writes a specific color index value to the main buffer.
I remember seeing video input on an older Power Mac or Centris or something. It would draw video pixels only on pixels of a certain color. I believe the color could be the text color in certain display modes which means you can see the video through the text of menus?
For the Power Mac 8500, The DBDMA program can include a clipping stream which is basically a bitmap of pixels that are allowed to be modified. This bitmap is created from the visRgn of the graphics port you want to draw into.
 

NJRoadfan

Well-known member
Drawing video only on pixels of a certain color sounds an awful lot like an overlay video mode. Early TV tuner cards for PCs would do this in tandem with the VGA/VESA feature connector since the ISA bus was too slow to transmit full motion video to a video card's frame buffer. The overlay color would be a video "hole" that allowed the output from the TV tuner card to show thru.
 

joevt

Well-known member
From QuickTimeComponents.h (vdig = video digitizer):
Code:
/* vdig types */
enum {
  vdTypeBasic                   = 0,    /* basic, no clipping */
  vdTypeAlpha                   = 1,    /* supports clipping with alpha channel */
  vdTypeMask                    = 2,    /* supports clipping with mask plane */
  vdTypeKey                     = 3     /* supports clipping with key color(s) */
};

Old Macs would use key color. Power Mac 8500 supports mask plane.
 

noglin

Member
zefrenchtoon: wow, very nice document, thanks!! Wish we had such documents for all chips :D

I'm wondering about the other low-end PPC models, like 6100/7100/8100 (with "AMIC" chip) that seemingly also could come with AV? or have a video card bought. Did the AMIC chip handle upscaling? (would certainly help me!).

I suppose same for 7200/8200 (with "Iridium" chip), all these 5 models were probably all too weak to handle video-in fullscreen without hardware upscaling. So my hope is that maybe someone has some insights on "AMIC" and "Iridium"?
 

Arbee

Well-known member
The AV card for the NuBus x100 machines is the Quadra 660/840AV video circuitry plus a PPC to '040 bus translator. Kinda amusing, but it worked.
 
Last edited:
Top