the invention herein is an apparatus and method for coding information that is particularly well suited for , but not limited to , such devices as hand held video players . the disclosure herein first discusses an exemplary player . an exemplary handheld video player , the zvue !™ player sold by handheld entertainment of san francisco , calif ., in which the preferred embodiment of the invention , referred to as hhe ™ video encoding , may be practiced is first discussed . fig1 is a plan view of a handheld video player 10 according to a presently preferred embodiment of the invention . the player also includes various ports , such as a usb port 25 , an expansion port 26 ; and includes connections for line out 27 , earphones 28 , and power 29 . there are a number of player states . the player processes button push / release events , and some other hardware events . the player response to an event depends on its state . the nav -* keys control the selection of a menu item . on [ nav - ok ] transition is made to menu item selected . in general , [ menu ] takes the user to the previous menu . if the user is in a fat file hierarchy it takes the user to the previous directory . if the selected item is playable , such as an hhe video or a directory full of mp3 audio , then the [ play ] button plays it from the start . volume control range : − 73 . . . + 6 db volume control granularity : 1 db volume level display timeout : 5 seconds volume level display : horizontal bar at the bottom of the screen after power off / power on , the audio level is to previous the value unless it is off , in which case it is set to low volume . the brightness is set to brightest . pressing the audio level control button in any player state results in current level being displayed in the bottom of the screen . subsequent pressures on volume buttons change audio level by 1 db . after volume control buttons are untouched for two seconds , the volume level bar disappears . dim and bright move the player up and down through at least five brightness settings . no visual indicator is on screen except for actual screen brightness change . at the dimmest setting , the display is off . this is useful for conserving batteries when only audio is desired . in this case , software should do less video work . at display off , any brightness input is displayed . note : if display is off while audio is playing , the volume indicator appears on the screen when the volume rocker button is pressed for the sake of consistency , and user convenience . menu or navigation buttons that present a ui turn the screen on . the screen goes off again when in the normal playback mode . graphic thermometer sliders are superimposed on moving video to give feedback for volume and brightness , compressed bitmaps are included for ui elements , icons , and menu screens . the format for icons include a transparent color . a simple animation language may also be provided . for example , this could be an hhe format avi , an animated gif ( subject to ip check ), or a flash animation . there is a characteristic zvue ! startup sound . audible button feedback has two styles . click for commands executed . a thud sounds for buttons pressed out of context . the player responds to a connected usb port by displaying a usb connection icon and is unresponsive to buttons aside from power , which can be used to turn it on or off . upon insertion , called button [ card ] the player goes to the state “ media insertion ” and starts playing . the initial state for the player is “ off ”, that is everything is down . the only way to get from this state is by pressing the [ power ] button or by inserting a media card [ card ]. after a momentary two - second display of the zvue ! welcome graphic and distinctive zvue ! startup sound , the player returns to the next expected operation . on “ power pushed ” event , the zvue ! welcome screen is temporarily displayed . if media is present , this is followed by the media menu . else , this is followed by the player menu . the zvue ! welcome screen is temporarily displayed . on “ card inserted ” event , the player checks the card type . the system goes to firmware update approval if it is an update card ; it goes to application approval from the card if there is an application ; and it goes to media menu temporary if it is a media card , the media menu is displayed , offering a chance to navigate to other options . after a timeout of six seconds , the media starts playing unless other media menu controls were used . if buttons are pressed , the timeout changes to “ after 3 minutes , go off .” the user is asked to insert a card , or to choose an item from the menu . the menu is : screen savers ( disabled ) settings ( includes text color and style and settings associated with mp3 and jpeg playback ) resume ( if the player was powered off or paused part way through the same media that is still inserted , a resume option appears .) check the media type . in the case that a writable sd or mmc card is found to contain both hhe media and other formats , go to state “ media choice menu ”. media menu is a short animation ( may be empty ), followed by a menu background picture with menu items displayed . the first menu item is active . all menu items point to video chapters . after a period of inactivity , the menu animation restarts . the [ menu ] button from media menu starts player menu ( see above ). if the media contains more than one track , the first one is selected and this is visually apparent . pressing [ play ] starts that media playing . the [ rev ] and [ ff ] buttons change the selected feature . navigation buttons allow moving around the ui . when hhe avi media cards are present , the play function is started . this is the state in which the user spends the most time and to which the user is most attentive . goes to “ off .” if the media is longer than five minutes , the position it was playing at is stored . nav - ok , sound continues , but playing menu on screen . goes to state “ playinghhe - menu ” the nav - down button enables the ab repeat feature , and can be called the ab repeat button during playback . the following is the ab / repeat state table . these states are sub - states of playinghhe . playing shows the video normally . moves to the next track when done . pressing a / b repeat moves it to state playing - a at that position . playing - a when the video auto - repeats , it restarts at point a instead of the start . pressing a / b repeat moves it to state playing - ab at that position . playing - ab when the video auto - repeats , it restarts at point a instead of the start and go to point b instead of the end . it continues to repeat from point a to b until the a - b timeout is reached . pressing a / b repeat moves it to state playing - autorepeat . timeout — the a - b repeat feature goes to playing after 60 minutes of playing . this state is reached when the [ play ] key is pressed when in state playinghhe . [ play ] resumes from pause [ rev ] goes to the beginning of the chapter , does not resume from the pause . [ ff ] audio off , video playback is 2 × ( approx .) [ menu ] goes to the “ mediamenu ” [ nav - left ], previous video frame or keyframe or chapter , depending on implementation difficulty . remain in state playinghhe - pause . [ nav - right ], next video frame and remain in state playinghhe - pause . [ nav - up ], repeat or slow motion features enabled or disabled . [ nav - ok ], puts playing info on screen . changes the display to show a bar graph that indicates the time offset into the video track and the name of the track . remains in state playinghhe - pause . [ nav - down ] sets the ab repeat point in the video , and advances the ab repeat state exactly as it would in state playinghhe . [ play ] audio on , normal speed [ rev ] same as play [ ff ] audio off , video at six times normal speed . player does it by skipping b and , if necessary , p frames . this can result in the loss of continuity . remains in state playinghhe - ff . if [ ff ] is pressed again it toggles to twice ff . a jpg viewer is also provided for displaying digital photos . it is possible to combine content hhe downloads with other mp3 and jpeg content . only in that case is this navigation state necessary . it is basically a fat file system navigator . displays a list of things on the card . tiny icons are used in the left column to describe several types of object . icons are similar to the tiniest icons in windows ( see fig2 ). upon selected video [ nav - ok ] ( takes user to the media menu for that content .) upon selected jpeg [ nav - ok ] takes user to the slide show viewer starting with that picture . upon selected music [ nav - ok ] starts music playing at that file . navigates folders of mp3 files — see the discussion of state “ mp3 player .” software prepares two play lists . the audio playlist , and the photo playlist . if a play list file is on the card it may use that to determine the order of audio and video files . otherwise , both play lists are in breadth - first recursive order through the folders with the files sorted in the most natural order possible , displays the current slide . if possible it displays the whole slide , then zooms in slightly . operation of the four direction keys affects the photo position , panning the photo in the chosen direction until the edge is reached where it stops , making a thud sound . [ menu ] zooms out more . if totally zoomed out , it offers “ slide show playing ” options . [ nav - ok ] zooms in more . if totally zoomed in , it offers “ slide menu detail .” timeout : go to next slide in the sequence after adjustable time determined in settings . slideshow delay ( amount of time before slide advance ) rotate picture gamma adjust special effects crop here choose animation choose soundtrack when there are no mp3 &# 39 ; s the player behaves as above , except with no music . menu structure shows one directory of the fat file system . only folders with usable content are shown . the hhe compression / decompression (“ codec ”) multimedia format is a format for holding highly compressed digital video , audio , graphics , and navigation data . a file which conforms to the hhe format normally carries the extension “. hhe .” it is a complex file comprised of one or more different sub - files . the sub - file types which are supported by the hhe format are : config : the main configuration file for the media that specifies the media , the main navigation script file name , the decoding engine to use ( a custom decoding engine can reside on the media , the default one resides in internal memory ). avi : multiplexed compressed video / audio streams . bmp : menu subpictures that are ms windows sixteen - color compressed bitmaps . nav : navigation scripts for video chapters which specify the order in which chapters are played . mnu : menu files , that describe menu representation and functionality by specifying subpictures for menu items , pointers to chapters , etc . one or more of the sub - file types listed above may be present in a hhe file . the only requirement is that there must some auditory or visual content present ( an avi or bmp sub - file ). the format of each sub - file depends on its function . for detailed specifications of the file format , please refer to the discussion herein entitled “ hhe file format specification .” the hhe format supports full - motion video and can display up to 24 - bits of color per pixel on a full - color screen . hhe compresses video content at variable bit rates up to 100 : 1 , and it decompresses the same content at real - time speeds using minimal system resources on low - cost , low - power processors , such as the motorola dragonball ™ i . mxl ( manufactured by motorola , inc . of schaumburg , ill . ), which is used in the zvue ! video player . the hhe video compression technology is a proprietary algorithm that was developed specifically to produce superior compression performance yet maintain reasonable complexity in decompression . the compression scheme employs motion estimation followed by transform coding , as shown in the block diagram of fig3 . at a top level the hhe algorithm is similar to video compression standards developed over the past decade , but the specific techniques chosen ensure real - time decoder implementations on mobile devices . the hhe format supports audio compression at various quality levels from low bitrate mono through near cd quality stereo . the hhe format uses the popular mp3 audio compression standard as the default audio format . the hhe format also supports additional audio formats such as wma and aac . the security and integrity of compressed content is extremely high with the hhe format due to the encryption scheme and other features employed . multimedia encoded in the hhe format is protected from unauthorized copying using a highly secure encryption scheme . the encryption algorithm , based on the blowfish algorithm , is a symmetric private key algorithm using 128 - bit keys . blowfish is a symmetric block cipher that can be used as a drop - in replacement for des or idea . it takes a variable - length key , from 32 bits to 448 bits , making it ideal for both domestic and exportable use . blowfish was designed in 1993 by bruce schneier as a fast , free alternative to existing encryption algorithms . since then it has been analyzed considerably , and it is slowly gaining acceptance as a strong encryption algorithm . blowfish is unpatented and license - free , and is available free for all uses . the original blowfish paper was presented at the first fast software encryption workshop in cambridge , uk ( proceedings published by springer - verlag , lecture notes in computer science # 809 , 1994 ) and the april 1994 issue of dr . dobb &# 39 ; s journal . eight different keys have been generated using a particularly strong random number generator , scrambled , and stored at various offsets within the zvue ! internal memory . different keys are used to encrypt prerecorded content , downloaded content , and code updates . fig4 illustrates the process for content protection of prerecorded content . prerecorded content is stored on sd or mmc memory cards 31 . these memory cards contain a unique card key 32 which is stored in a protected area of the card . a player key 33 , key 0 , stored within the zvue ! internal memory is modified by the unique card key and data are encrypted with this new key prior to being stored in the memory card . data cannot be copied onto another memory card and played back without knowledge of player key 0 , the card key , and the encryption algorithm employed . fig5 illustrates content protection for downloadable content . downloaded content is encrypted with a separate player key , key 1 , modified by a unique player id . therefore downloaded content can only be decrypted and played back by one particular player . the client must upload the player id to the content server 100 ( 34 ; fig3 ) prior to purchasing 110 and downloading content 120 . after downloading the data are copied onto an sd or mmc memory card 130 . data cannot be copied onto another memory card and played back on a different player without knowledge of player key 1 , the new player id , and the encryption algorithm employed . the player has a real - time clock which can be set through the user interface . the real - time clock can be used to reject content which has a limited lifetime . for example , promotional content can be downloaded for free and played back for a limited time period ; when it has expired the promotional content no longer can be played unless the user purchases it . each decompressed video frame is assigned a unique id ( 0 , 1 , 2 , 3 , . . . ) each audio packet ( containing 1152 audio samples ) is also assigned a unique id ( 0 , 1 , 2 , 3 . . . ). the av sync code monitors the ids of the latest rendered video frame and audio packet . every time a video interrupt occurs , these ids are recalculated into real time stamps . the av sync code compares these time stamps and determine whether next video frame must be repeated ( shown twice ) or dropped ( skipped ). the audio stream is never adjusted . that means only video frames can be skipped or repeated to fit current audio position . specifically the procedure which takes place at each video interrupt is : video_time_stamp = just_rendered video_frame_id / video_frames_per_second ( value of video_frames_per_second comes from avi header ) audio time_stamp latest_audio_id / audio_packets_per second ( value of audio_packets per_second is normally 44100 / 1152 = 38 . 28125 ( samples_per_sec / samples_per packet )) difference = audio_time_stamp − video_time stamp if ( difference & gt ;+ one_frame_duration_time ) skip next video frame else if ( difference & lt ;− one_frame_duration_time ) repeat current video frame the file format for storing zvue ! media comes from the way the navigation system , the graphics system , and the decoding engines are designed . it is assumed that media containing video / audio streams is organized in chapters , associated with navigation scripts and can optionally carry a custom decoding engine . the media should be fat16 - formatted , and the content organized in files . all data are stored in the root folder , other folders are ignored if present . “ config ” main configuration file for the media that specifies the media type ( currently only two types are supported : zvue !- video and firmware ), the main navigation script file name , the decoding engine to use ( a custom one can go on the media , the default one resides in a flash ) “*. nav ” navigation scripts for video chapters “*. avi ” video / audio streams “*. mnu ” menu files , that describe menu representation and functionality by specifying subpictures for menu items , pointers to chapters , etc . “*. bmp ” menu subpictures that are ms windows 16 - color compressed bitmaps . colors { 0 , 0 , 0 } and { 255 , 255 , 255 } are reserved for transparent . file types that are not supported but can be added later : “*. mp3 ” audio only streams “*. jpg ”,“*. jpeg ” jpeg images ( for browsing digital photos from sd card , or to use as menu background etc .). this is a plain text ascii file in either windows ( cr / lf ) or unix ( cr ) format : a semicolon ‘;’ starts line comment commands are : & lt ; key & gt ;=& lt ; value & gt ;. spaces are allowed . if value contains spaces , it is enclosed in double quiets (“ ”) empty lines are ignored some keys may not be defined . the default semantics are applied in this case ( see table 1 below ). notifies the boot loader that this card stores video content . if application tag is present , the boot loader loads it to memory and runs there . if not , the boot loader loads application from the flash . notifies the boot loader that this card stores mp3 tracks . if application tag is present , the boot loader loads it to memory and runs there . if not , the boot loader loads application from the flash . the application runs as a standard mp3 player . notifies the boot loader that this card stores jpeg images . if application tag is present , the boot loader loads it to memory and runs there . if not , the boot loader loads application from the flash . the application runs in slide - show mode . notifies the boot loader that this card stores new media driver . the loader checks zveu . axf file from the card with encrypted checksum encryption_key and then burns it to the flash . it also checks the version against current and notifies user if it is older . the video player uses standard windows avi format for streaming the videos . the file should contain one video stream , coded with hhe video encoder ( fourcc = hhe0 ), and / or one audio stream , coded with any mp3 driver ( wformattag = 0x0055 ). when using b - frames , they should be put into separate avi chunks . typically , it requires some post processing because the vfw drivers usually are not capable of producing it . the audio bitstream format complies with iso cd 11172 - 3 document . navigation scripts specify the semantics of player buttons for the specific chapter , the avi stream and subpictures to use and the actions to perform . the navigation script is a test file , with navigation commands represented on separate lines . commands are case - sensitive . commands are : & lt ; key & gt ;=& lt ; value & gt ;. spaces are allowed . if value contains spaces , it should be enclosed in double quiets (“ ”) if it is the first chapter in a chain , previous should not be present . if it is the last chapter in a chain , next should not be present . menu file is a text file that specifies the menu appearance and functionality . commands should start at the beginning of each line , command arguments follow on the same line , any number of white space characters (‘ ’, ‘\ t ’) can be used as a separator . menu contains a background image ( stored in avi ), a number of static bitmaps over the background and a number of menu items associated with video chapters . command arguments are either filenames or numbers , filenames should be put in double quotes . all arguments are obligatory . specifies parent menu ( menu ) and number of item ( active_item ) that should be active when we come to this menu from current menu specifies an avi ( usually of one frame ) that contains menu background , the avi file is played on the screen , and the last frame of that avi is used as a background for menu . specifies a static bitmap displayed over the background image . x , y specify the bitmap offset from the top left corner ; transparency is a number from 0 to 255 that specifies the transparency ( 0 means transparent , 255 means solid ). specifies menu item . bitmap — 0 is displayed for a selected item , bitmap — 1 is displayed for deselected ones , x , y and transparency following a bitmap name specify its position and transparency . navig_script specifies the script to start when this menu item is executed , if “ ”, this means a submenu should be run , specified in menu argument . menu sets new menu for the script to run , or a submenu to run , if script name is not specified . if it is “ ”, current menu is used . active_item specifies number of active item in a new menu or submenu . the avi file is a container for any number of data streams of any kind . the main parts of avi file are : 1 . the main avi header . it always contains a stamp (“ riff ”) and overall file size ( for streaming ). it also describes general info on the file , such as a number of streams stored in it , streams data sizes , whether the file contains an index , offset at which data streams begin , etc . 2 . an optional index can be present in the avi file . it contains an entry for each data chunk ( see below ) describing its type and position in the file . the index is located at the very end of the file , after the data streams . 3 . each data stream format is described by its own stream header . video stream header is actually bitmapinfoheader structure ( width , height , bits per pixel , compression type ( hhe0 or hhe1 )). audio stream header is actually waveformatex structure ( audio format ( mp3 ), number of channels , samples per second ). 4 . after all the headers , data streams begin . data are organized in chunks . each chunk belongs to a stream and contains a header and actual data . the header contains the stream number this chunk belongs to ( usually 01 — video , 00 — audio ), stream type code (“ dc ”— compressed video , “ wb ”— compressed audio ), and chunk &# 39 ; s size in bytes . 01wb & lt ; chunk1 size & gt ;& lt ;- header . . . chunk 1 data . . . & lt ;- data 00dccchunk2 size & gt ; . . . chunk2 data . . . 01wb & lt ; chunk3 size & gt ; . . . chunk3 data . . . 00dc & lt ; chunk4 size & gt ; . . . chunk4 data to reduce the complexity of mpeg4 decoding the following four solutions have been introduced : disabling of intra prediction of ac coefficients intra prediction of ac coefficients is not made . the flag that indicates the need for ac prediction has been eliminated from the bitstream . disabling of motion compensation rounding control rounding control is disabled . constant additions are used during averaging : 0 for averaging of two values and 1 for averaging of four values . the rounding bit has been eliminated from the bitstream . combination of vlc decoding and dequantization in one step dequantization of the coefficient is made right after decoding of its variable length code . speed - up is possible due to exclusion of zero coefficients from dequantization process . simplification of inverse discrete cosine transformation with the use of significance map significance map is used to store the positions of last nonzero coefficients in each row / column of discrete cosine transformation block . significance map is filled during vlc decoding . knowing the number of last nonzero coefficient in row / column it is possible to simplify the inverse discrete cosine transformation for this particular row / column . two different versions of inverse discrete cosine transformation are provided : one — for rows / columns of 8 coefficients and one for rows / columns of 3 coefficients . note , that when all coefficients in row / column are zero coefficients , inverse transformation should not be made at all . to speed - up the color conversion routine , a conversion table is used . the table index is calculated as a function of three colors in yuv format : where y , u , and v are 8 - bit color components in yuv format ; and bits_y , bits_u , bits_v are the numbers of significant bits for each color : y , u , and v . the number of indexes is ( 1 & lt ;& lt ;( bits_y + bits_u + bits_v )). the conversion table cell represents color in rgb555 format that corresponds to color in yuv format . the size of the cell is two bytes ( high - order bit is unused ). therefore , the size of the table is the number of indexes * 2 , that is : the number of significant bits for y color component must be greater than number of significant bits for u and v components , because y color component contains more useful information for human visual perception . currently the following significant numbers are used : the color conversion table is organized in the manner that can help to avoid cache misses during conversion of image in yuv 4 : 2 : 0format . in yuv 4 : 2 : 0 format for each chrominance pixel there are four luminance pixels . a fact that index depends on y component less than on u and v components makes data cache misses infrequent . there can be other types of data chunks rather than video and audio . for example , if video color format is eight bits per pixel or less , then a special palette chunk can present . note that two video chunks never go one by one . there is always one audio chunk between them ( even of zero size ). each video chunk contains one compressed video frame exactly ( see below on this , regarding b - frames ). each audio chunk contains either two or three audio packets ( each packet is 1152 samples , when decompressed ). when compressing with b - frames , the invention breaks the rule that each video frame is stored in its own chunk . it stores several video frames in one chunk . the currently preferred embodiment of the invention inserts large amounts of empty ( zero length ) video chunks in the stream to isolate audio chunks . so the overall layout of data streams is as follows : & lt ; audio chunk & gt ; & lt ; big video chunk , containing 4 frames i - p - b - b & gt ; & lt ; audio chunk & gt ; & lt ; empty video chunk & gt ; & lt ; audio chunk & gt ; & lt ; empty video chunk & gt ; & lt ; audio chunk & gt ; & lt ; empty video chunk & gt ; . . . this actually wastes a lot of space because even an empty chunk contains a header and is contained in the index . this is a limitation of video for windows drivers . it is possible to eliminate this by applying a post - processing utility to an avi file that isolates each video frame in its own chunk and drops all the empty chunks . general remarks on operations with fractional values for fixed point arithmetic to represent data in fixed point operations , we use the following transformation : where nbitsfraction is the number of bits for fractional part , value 0 . 5 is used for rounding . 24 for signal samples ( representation 32 . 24 ), 24 or 15 for constant coefficients ( representation 32 . 24 or 32 . 15 ). where x float , y float are some variables ( c float is usually a constant ). x =( int ) ( x float *( 2 & gt ;& gt ; 24 )+ 0 . 5 ), c =( int ) ( c float *( 2 & gt ;& gt ; 24 )+ 0 . 5 ) y =( x * c )& gt ;& gt ; 24 . because we use 32 - bit integer operations , it is necessary to avoid overflow in calculation of product x * c . for this purpose , we represent data as a sum of high and low parts : to speed up the multiplication , we can remove small parts from this sum . in our implementation , we distinguish three different levels of precision , any of them can be chosen at compile time . the simplifications used for multiply operation in each mode are as follows : the simplified multiplication on constant coefficients in 32 . 24 representation can be implemented as to speed - up imdct calculation , the simplified multiplication by transform coefficients is used . the transform coefficients , with absolute values smaller than 1 , are represented in 32 . 15 format . for multiplication by this coefficients , formula ( 1 . 4 ) is used . for coefficients with absolute values greater than 1 , formula ( 1 . 6 ) is used . all transform coefficients have absolute value smaller than 1 , and represented in 32 . 15 format . for this case , formula ( 1 . 4 ) is used . note : in high precision mode , the more precise formula ( 1 . 2 ) is used for all idmct functions . to generate one output sound sample in 16 bit pcm format , it is necessary to calculate convolution of samples from delay line with window coefficients . for float data representation , the convolution loop appears as sum += windowtable [ i + 32 * j ]* line [( pos + j * 64 + i +( j & amp ; 1 )* 32 )& amp ; 1023 ]; ( 3 . 1 ) where windowtable [ 512 ] is array of window coefficients , pos is a current position in the delay line , i is a number of output samples in block of 32 samples . the speed up is achieved by calculation of output samples in following ways : where fix ( ) corresponds ( 1 . 1 ) with nbitsfraction = 24 , n = i + 32 * j , for each i = 0 . . . 31 index j = 0 . . . 15 , which provides consecutive access to array elements . because factors of a window with indexes j = 7 , 8 can have absolute value greater than 1 , the value q is obey to the rule : pn_windowtablest is a pointer to the scaled transposed window table , r = pos + i , and g = j * 64 +( j & amp ; 1 )* 32 . to provide true multiplication result , we use m = 6 for j = 7 , 8 , else m = 7 . in ( 3 . 1 ), some of the items with number j = 0 , 1 , 2 and j = 12 , 13 , 14 , 15 are eliminated from calculation due to their small impact to the result ( because of small window coefficients ). sixteen groups of window table items for each index i are normalized and have an exponent value , which is constant value inside group . then , the convolution loop is organized in sequence of the operators of the form the final summation is made with shifts , which depend on values of exponents . although the invention is described herein with reference to the preferred embodiment , one skilled in the art will readily appreciate that other applications may be substituted for those set forth herein without departing from the spirit and scope of the present invention . accordingly , the invention should only be limited by the claims included below .