THE COMPLETE TECHNICAL PAPER PROCEEDINGS FROM:
“BUT THE DEMO LOOKED GREAT” A TECHNICAL PRIMER ON SETTOP SOFTWARE DEVELOPEMENT
Stephen Johnson Coach Media
Abstract this knowledge, cable operators and other gatekeepers can ask the right questions and Creating effectively designed software— thereby create—or procure—better for any platform—is a complicated and time- applications to meet their ever-expanding consuming business. Creating software for needs. digital settops has encountered challenges unique to the cable industry: scarce MIDDLEWARE: FLEXIBILITY VS. applicable design precedence, a thankfully SPEED temporary mania of inflated expectations for “interactive television,” and a paucity of Middleware refers to a software basic technical knowledge about how application that runs programs—but also runs applications are created and deployed. While on top of an existing operating system (OS). the first two issues have largely faded, the Think of a web browser, e.g., Internet last continues to hamper effective application Explorer™ running “on top of” Windows™ deployment. Without a general and you get the idea. A middleware understanding of the issues involved in settop application uses code—or even just files of software design, cable operators will text or formatted data—written according to inevitably experience frustration and disap its own languages and syntax rather than that pointment with their deployments. of the OS. The diagram below illustrates This paper addresses five topics in how these various applications stack up: software design applicable to digital settops, SETTOP SOFTWARE STACK providing a brief technical background of DATA & GRAPHICS each issue followed by their individual effects on software performance—and ultimately MIDDLEWARE APPLICATION(S) viewer comprehension and acceptance. DATA & GRAPHICS While illustrated by real-world examples, MIDDLEWARE NATIVE this discussion does not focus on a particular APPLICATION(S) settop box manufacturer or set of features; OPERATING SYSTEM rather, the principles discussed here apply to all platforms. The topics cover the following: Schematic diagram of typical digital settop box • Middleware Usage software stack
• Memory Allocation Current Examples • Settop Performance
• Viewer Interface Details How and where is middleware used? The • TV Display Technology most prominent use today is probably the OpenCable™ Application Platform (OCAP), While not comprehensive, this list which uses middleware called the Java nevertheless covers a range of technical Virtual Machine™ (JVM). Java™ was issues collectively having a large impact on originally developed by Sun Microsystems as successful software deployment. Armed with an Internet-friendly programming language that could execute code using a JVM on any faster. Sometimes much faster. The reasons operating system. OCAP applications, for this are simple: fewer instructions to therefore, are written in Java and could translate and direct, customized code. Think potentially run on any settop operating of the stack diagram above; when a system; the JVM would handle all the middleware program runs its code it has to be underlying operating system routines. continually translated for the operating system. The difference is as dramatic as While OCAP remains the most prominent speaking English to an English speaker middleware example, the settop box versus speaking Italian to the same speaker development world has also seen the and attempting to translate it in real-time. introduction of middleware applications from While the translation will generally work, no companies like OpenTV, Liberate, and one can reasonably argue it will be as fast or Microsoft. With so many companies offering as clear. middleware solutions to settop development, why consider any competing strategy? While it’s certainly the most important Indeed, in addition to the promise of OCAP reason to avoid middleware development, middleware offers some very tempting lack of speed alone unfortunately doesn’t advantages. exhaust the disadvantages. Middleware is also very large. Since it translates The Best of All Worlds? instructions for many different operating systems—and needs to be resident in the Start with labor. Given the latent settop’s memory to execute commands at popularity of Internet-based programming a anything approaching reasonable speed—by relatively large pool of trained candidates has necessity it often requires generous amounts become available to code middleware of precious memory. Many middleware applications—at least of the browser-based applications simply cannot run on older or JVM variety. Since middleware digital boxes due to memory restrictions. programmers don’t write code directly to the operating system, developers are additionally In addition to its other difficulties, free to “script” quick applications and test middleware platforms also aren’t—alas—as them without enduring the rigor of compiling flexible as advertised. Even Sun’s touted and linking code. Think of an HTML Java, once marketed as “write once, run scripter doing a quick web page layout anywhere” has occasionally been derided as compared to a C++ programmer writing “write once, debug everywhere.” Even proprietary code and you can appreciate this discounting the jokes, Java developers often difference. find they have to adapt code for JVMs to their particular use. With deployment flexibility and an available labor pool on its side, what So use of middleware—a key decision disadvantages could there be to middleware point in settop software development—really development? Why suffer through hiring comes down to flexibility versus speed, with programmers to work in a very specific and a sizeable caveat on the former and little unforgiving development environment—on argument over the latter. code that can’t be used elsewhere? In a word: speed. Programs written without middleware overhead simply run MEMORY: BE LEAN, MEAN, AND PLAY Developers recognize these issues and WELL WITH OTHERS devise appropriate strategies to save memory space, but the resulting tradeoffs are far from Whether an application uses a middleware painless. Memory-related challenges platform or not (see previous section), it still confronting developers—along with loads into the settop’s memory when accompanying strategies and tradeoffs—are launched—not unlike how a program loads noted in the table below: on your PC. Compared to an average PC, however, settop memory is severely limited. Challenge Strategy Tradeoff(s) Large application • Store unused • Interactive The first issue confronting application size (including components performance memory usage, therefore, is simple: how supporting data) on server when much room do you need? Many developers vs. limited • Distinguish uploading memory between new data equivocate on this issue—and not without launch-ready good reason. The raw code size specified for and full an executable application may be misleading application for at least three (3) reasons: Large application • Store unused • Interactive graphics vs. components performance • The additional data the application limited memory on server when requires (e.g., program guide data) might • Compress uploading graphics new graphics be even larger than the code that • Use settop- • Graphic manipulates it; based degradation • Graphics and other large non-code graphics • Customized graphic components might not be included (for programmin good reason) in an application’s memory g footprint; and Multiple • Limit • Application • An application may be sharing memory applications number of Swapping space with several other applications— residing in simultaneous • Extensive about which it has no knowledge—and memory running Quality applications Assurance might be unstable at any size. • Certify (QA) deployed Why do developers need to address these applications issues? Program guide data, for example, can be enormous. One day of TV listing data To save memory many developers keep a uses up to 250 kilobytes of memory. Doing subset of application code, data, and/or the math it’s not hard to see why loading two graphics stored on a remote server and only weeks of guide data (14 x 250K, or 3.5 load it when required (e.g., on viewer megabytes) into settops with free memory request) to do so. While this strategy saves sizes of a few megabytes presents some space, the process of swapping in code and difficulties. Graphics are arguable worse: data might create some awkward one high-resolution (uncompressed) full performance delays when contacting a screen background requires almost a remote server. Delays become acutely painful megabyte of data. And lack of vigilance when loading graphics as viewers wait for an about several different applications interface to “arrive” and a screen is not yet (regardless of size) residing in memory has visually “complete.” very high costs: settop crashes (and reboots) correlate very well with this situation. A related memory-saving strategy a settop’s memory creates challenges of its effectively divides an application into parts, own. Furthermore, these challenges directly allowing a smaller version to launch (e.g., affect the cable operator since individual initially display on-screen) while the full developers may have no prior knowledge of version is stored remotely (e.g., on a server, other applications with which their programs as described above) and downloaded later. need to co-exist. While requiring some programming subtlety, this strategy mitigates performance delays As noted above, having a large number of by: 1) launching application faster; and 2) applications in memory often creates settop allowing other applications parts to be loaded crashes for a variety of technical reasons into memory while the initial launched beyond the scope of this paper. With this application runs. unpleasant fact in mind, cable operators need to address two challenges in this area: 1) Compressing graphics also saves space, keeping applications from running but tradeoffs beyond the obvious—potential simultaneously as much as possible; and/or visual degradation—should be considered. 2) testing multiple application combinations Depending on the compression schemes (e.g., before deployment. The first challenge places MPEG, JPEG, BMP, IMG) supported by the restrictions on application features and user settop operating system or middleware, interfaces while the second potentially graphics may require decompression time to imposes testing costs on the operator. be properly displayed—adding to performance delays. If compressed graphics Settop boxes will probably never have can be shown as-is the inherent low- enough memory for every deployed resolution NTSC display standard for application—or combination of applications. television often hides ugly artifacts—to a Even with the current tradeoffs operators point. The rapid deployment of High have deployed dozens of stable and robust Definition (HD) capable settops—and their interactive products. Intimate knowledge of demand for high-resolution imagery—will these issues often makes the difference likely eliminate this advantage very soon. between deployable and “demo” applications. The process of creating graphics directly from code available in the settop’s operating SETTOP PERFORMANCE: FASTER IS system (if available) offers the promise of GOOD, ROOMY IS BETTER avoiding speed and compression issues altogether. Already available from the OS, Many standards are available to gauge settop-generated graphics display very settop hardware performance. The previous quickly and require no compression. Creating section discussed memory management; this these graphics, however, requires hyper- section covers two other issues: processor specific programming skills and generous speed and permanent, or non-volatile, development time; working at the level of memory. individual screen pixels is not uncommon. Compared to similar hardware in PCs, Memory management issues unfortunately settop microprocessor speeds are aren’t limited to those relating to application frighteningly slow. Even accounting for size; keeping several applications— settop box economics, the numbers are regardless of their size(s)—simultaneously in startling: for example, the MicroSparc processor in a baseline Scientific Atlanta Settop hardware performance therefore 3000-series settop clocks in at 166 boils down to both suggestive and definitive Megahertz. In non-geekspeak that’s about numbers. Raw processor speed can be four to six times slower than an Intel or AMD overrated—but all the memory in the world microprocessor in a cheap PC. probably isn’t enough . Fortunately, raw processor speed pales in VIEWER INTERFACE: THE DEVIL IN importance to how well a settop is optimized THE DETAILS to use it—and how well developers make use of it. Current settops are generally optimized Even when a settop application runs to play digital video; relatively speaking, the quickly, uses memory efficiently, doesn’t tax processing power devoted to running the network or local storage, it still may not interactive applications doesn’t need to be look very good. Obviously this is often due nearly as fast as that for a PC. Settop to aesthetics, but this paper leaves that applications display graphics and data to hornet’s nest to the legion of TV graphic viewers and respond to interactive commands designers. Rather, the primary focus here is but have little need for the number crunching on the technical details of the viewer power PCs require for their word processing interface display. While this subject is nearly and spreadsheet tasks. inexhaustible, a survey of three (3) general areas—graphics, video, and on-screen text— The amount of available memory—both suffices as a primer. volatile (lost without power) and non-volatile (or NVRAM, maintained without power) in a Getting Graphic settop actually has a stronger impact on application speed and stability than its While graphics may be compressed in microprocessor clock speed. NVRAM several creative ways, their resolution is contains data that a developer doesn’t want ultimately dictated by the settop’s operating his application to lose if the settop loses system. Resolution is actually made up of power. Pay per View purchase (secured) data two separate parameters: size and color is an obvious example; settops have been depth. The supported sizes and color depths storing this data since the days of analog of some typical settop boxes are shown boxes. Applications also use NVRAM for below: parameters like viewer preferences (e.g., favorite channels) and code-critical data Settop Class/ Graphic Color Depth (e.g., patches and updates). Manufacturer Resolution Explorer 2000/ 320 x 240* at 72 16 bits Scientific Atlanta dpi NVRAM is also expensive and therefore Explorer 8000/ 640 x 480** 16 bits scarce. The aforementioned Scientific Scientific Atlanta DCT-2000/ 352 x 240 Up to 8 bits Atlanta box contains all of 2000 bytes of it. Motorola Developers who run out of room are forced DCT-5100/ 704 x 480 Up to 24 bits to store this important data on a server, via Motorola *640 x 480 supported, but not typically used due to memory sending it at regular intervals and correlating constraints** Typical use; up to 720 x 480 supported the data with individual settops. (Motorola) settop boxes presents a developer Video: Scale with Caution with some intriguing differences. Notice from the table above that resolutions and Settop applications have little control over color depth vary on both systems on almost a full-screen video playback resolution; the box-by-box basis. Developing for lower-end MPEG video compression standard (used in settops has attendant difficulties: low all digital settops) uses its own display resolution graphics must be recreated for the parameters. However, when video plays back same application on a higher-end box. at less-than-full-screen, e.g., in a quarter screen “window”, the settop application Graphic resolution is often dictated by the chooses the “scaled” video window size. largest image size accommodated, then scaling back if necessary. For example, the Since settops scale video by simply settops listed above use so-called “full” and removing pixels, video playback in windows “half” resolutions, meaning the fullest at non-fractional sizes can introduce visual resolution uses twice the horizontal and anomalies: “pixelated” objects and jagged vertical pixel count as the lowest. By some diagonal edges. In this case the relatively simple visualization one can see these labels low resolution of NTSC television doesn’t are somewhat misleading: a full resolution help and often hurts: degraded video images image (at the same color depth) actually still move at 30 frames/second and are more requires four times the memory capacity as a likely than graphics to be noticed by viewers. half resolution image (see below). What’s Your Type?
"Half" Resolution Explorer / 320 x 240 DCT / 352x 240 "Full" Resolution Like graphics and video, on-screen type Explorer / 640 x 480 must abide by resolutions largely set by the DCT / 704 x 480 settop operating system. Unlike these other visual criteria, however, type resolution is
determined by how it is rendered to the Comparison of “Half” and “Full” Graphic Resolutions screen rather than the number of pixels or color depth of its characters. Use of low resolution graphics is often an attractive tradeoff when memory space is a Most operating systems support both consideration. In this case graphics are vector-based and anti-aliased fonts; the expanded (“stretched”) at twice their difference can be seen in the images below: horizontal and vertical resolution to fill the screen. Fortunately the NTSC television display standard—which relies on flickering interlaced lines rather than pixels—often compensates for the low resolutions artifacts (or “stretch marks”). f
Vector-based Anti-aliased Bitmapped
Vector-based fonts rely on mathematical consequences—but the resulting applications formulas to print characters with smooth can look pretty ugly. Interfaces that flout edges, not unlike a standard laser printer. technical constraints exhibit overly bright Although these formulas take up very little colors, distorted images, and illegible or off- space (approximately 32 kilobytes per screen text and graphics. typeface; bold and italic versions not Two basic technical constraints on included) many settops exclude them because displays come straight from the arcane world developers don’t tend to use the same of television post-production: title safety and typeface—and including more than a few color limits. creates storage difficulties. Better Safe Than (Really) Sorry Anti-aliased fonts typically take up less ii space than vector-based fonts—and Commercial televisions do not show an surprisingly look better at some resolutions— entire video signal; rather, the TV monitor but have two non-trivial drawbacks: 1) they itself visually cuts off the outside edges. must be adjusted—sometimes pixel-by- Images and colors at the edge of the display pixel—at low resolutions to read properly; appear to “bleed off” the border of a TV. and 2) the “fuzzy” edges of their characters The reasons for this are complex, but this must be legible against every background on type of display has some advantages, e.g., which they’re rendered. allowing certain unsightly video artifacts like the vertical blanking interval, or VBI, (where If an application cannot use either vector- closed-captioning information is transmitted) based or anti-aliased fonts, settops typically to be hidden off-screen. provide several bitmapped fonts as a fallback. Characters from this font type have To complicate matters, TVs differ— very rough edges but some typefaces sometimes drastically—in the actual amount rendered in this fashion can be reasonably of signal they cut off; that is, two TVs may legible and acceptable for limited application display different amounts of the same signal. use. Televisions uses two cut-off display
conventions: title safe, meaning the area TV DISPLAY TECHNOLOGY: where no TV will ever cut off any portion of “ART IS NOTHING an image and action safe, meaning the area WITHOUT LIMITS”i where on-screen action (e.g., something
moving) must be contained. Action safe is Since settop applications focus primarily slightly larger than title safe since viewers on displaying images to viewers (and are not especially bothered by moving occasionally receiving feedback) developers objects occasionally disappearing at the need a thorough understanding of television edges of the screen; their eyes can visual technology. Ignorance of these compensate for the constraints doesn’t necessitate catastrophic movement. The image below shows how the Settop developers wrestling with color safety areas work on a standard 4:3 television should be aware that televisions—unlike display. standard computer monitors—are not calibrated to saturation values. A PC display typically uses colors in mixed values of red, Tonight green, and blue (or R/G/B); these are color saturation values, describing a linear scale of how much of each color is included to create Clear 55 a final value. (This technology largely mimics the process used for printing, which uses a mixture of four colors: Cyan, Magenta, Yellow, and Black, or CMYK.)