#LyX 1.1 created this file. For more info see http://www.lyx.org/
\lyxformat 218
\textclass IEEEtran
\begin_preamble
\pagestyle{empty}
\end_preamble
\language english
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize letterpaper
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 2
\papersides 1
\paperpagestyle default

\layout Standard
\pextra_type 3 \pextra_widthp 100


\series bold 
\size largest 
DIGITAL TIME CODE SYSTEM
\layout Standard
\align center 
Matthew R.
 Flax
\newline 
School of Electrical Engineering & Telecommunications, University of NSW
\newline 
flatmax@ieee.org
\newline 
Jesse S.
 Jin
\newline 
School of Computer Science & Engineering, University of NSW
\newline 
Department of Computer Science, University of Sydney
\newline 
jesse@cs.usyd.edu.au
\layout Standard

\SpecialChar ~

\layout Standard

\SpecialChar ~

\layout Standard

\SpecialChar ~

\layout Standard
\line_top 
proceedings - cybersonica 2002, pages 61-64
\layout Standard

http://www.cybersonica.org/
\layout Title
\pagebreak_top 
DIGITAL TIME CODE SYSTEM
\layout Author

Matthew R.
 Flax
\newline 
School of Electrical Engineering & Telecommunications, University of NSW
\newline 
flatmax@ieee.org
\newline 
Jesse S.
 Jin
\newline 
School of Computer Science & Engineering, University of NSW
\newline 
Department of Computer Science, University of Sydney
\newline 
jesse@cs.usyd.edu.au
\layout Abstract

A time code system is described which allows linear and non-linear alteration
 for multimedia systems and streams.
 The time code system is adaptable to any time code protocol.
 The time code system is computationally inexpensive.
\layout LaTeX


\backslash 
thispagestyle{empty}
\layout Section

Introduction
\layout Standard

Time code is temporal control of multimedia systems and streams.
 Examples of systems which are controlled by time code are ATA packet interface
 (ATAPI) devices 
\begin_inset LatexCommand \cite{key-2}

\end_inset 

 such as CDROM drives, music instrument digital interface (MIDI) devices
 
\begin_inset LatexCommand \cite{key-4}

\end_inset 

 such as hardware MIDI sequencers and much video SMPTE 
\begin_inset LatexCommand \cite{key-5}

\end_inset 

 based hardware.
 Streams and systems alike are controlled by many specific time code protocols
 such as SMPTE, midi time code (MTC), ATAPI MSF address and so on.
\layout Standard

The specific aim of this article is to outline a time code abstract data
 type which is suitable for human computer interaction and bears low computation
al complexity.
 By the same token such a time code must be associated with a window of
 media samples or frames.
 The time code interfaces a window of media to a large stream of media windows,
 which may overlap.
 The data type which is abstracted is typically a natural number, termed
 an unsigned integer.
\layout Standard

The abstract data type is applicable to ANY time code protocol.
 It is not a protocol.
 It is an abstraction of a natural number to a user specified protocol.
 Each time code reference is allocated a media data buffer.
 Time and data are closely coupled.
 These two attributes are unique to this time code abstract data type.
\layout Subsection

HCI
\layout Standard

Alteration of time code allows the user to position oneself non-linearly
 in a multimedia device or stream.
 The only element which limits the user to accurate and direct location
 in a stream should be channel bandwidth, where the user may specify a location
 in time, however bandwidth congestion in the media transport limit the
 direct location.
 Linear and non-linear interface to time code should be possible.
 Linear interface typically compromises accuracy in location for ease of
 location.
 Non-linear interface allows accuracy however compromises ease of location.
\layout Standard

An example of a linear time code locator is the location slider.
 Using this type of device it is easy to locate oneself non-linearly in
 a stream, however location is limited to the slider accuracy, which is
 typically quantised.
 As an example of quantisation, assume a horizontal slider is used to locate
 an audio stream which is of compact disk (CD) quality and is of one hour
 in length.
 Also assume the slider spans one thousand pixels and hence has one thousand
 possible locations.
 CD quality audio has 44100 frames per second.
 An hours worth of audio contains around 
\begin_inset Formula \( 159x10^{6} \)
\end_inset 

 frames.
 Each slider location quanta is 
\begin_inset Formula \( 159x10^{3} \)
\end_inset 

 frames of audio, that is 3.6 seconds of audio.
 In this example media location accuracy is compromised by quantisation
 to within 3.6 seconds of the desired location.
\layout Standard

An example of non-linear time code location is digit based alteration.
 An example of such a location alteration method is the setting method used
 by digital watches based on digit interface.
 To locate oneself in time one has to step through time digit by digit.
 It takes more effort to locate oneself in time, however accuracy is not
 compromised.
\layout Subsection

Computational Complexity
\layout Standard

Integer manipulation is the cheapest data type for computer processors to
 manipulate.
 In order to retain cheap computational complexity, all operations on time
 code are implemented in integer operations of addition, subtraction, multiplica
tion, division and modulus.
 By the same token it is desired that digit based abstraction of the integer
 operates with the same minimal computational complexity.
 For this reason it is possible to implement such an abstraction system
 using object inheritance.
\layout Section

Time code abstraction
\layout Standard

Label the base integer a 
\shape italic 
counter
\shape default 
, this is its job, to count.
 It is the base most object.
\layout Standard

Assume that time code is broken into many 
\shape italic 
field
\shape default 
s.
 As an example world time is broken into many many fields, to name a few
 from largest time to least {millennium, centuries, decades, years, months,
 weeks, days, hours, minutes, seconds, milliseconds}.
 Each field must retain its count and inherits the counter object to accomplish
 this.
\layout Standard

A master is required to manage the co-ordination of each of the fields of
 the time code with respect to the underlying base counter.
 At each point in time the individual fields must accurately represent (count
 up to) the same total which is counted by the 
\shape italic 
master counter
\shape default 
 element.
 The master counter element maintains the master count by inheriting the
 base counter object.
\layout Standard

A window or array of frames is also based on a master counter.
 The user might want to alter the window size in a linear or non-linear
 way.
 So each media window or array of frames must be controlled by a master
 counter, labelled a 
\shape italic 
master counter array
\shape default 
.
 A master counter is inherited for array or window size manipulation.
\layout Standard

Finally 
\shape italic 
time code
\shape default 
 is encapsulated by a beginning and a finish.
 These are the absolute limits of the media stream beyond which no media
 is defined or exists.
 Within the physical limits one may set a start and end location between
 which a window steps.
 A current time code location continuously steps with the window.
 Such a structure seems complex, however entails the requirements of a manageabl
e and flexibly alterable time code system.
 This system is depicted in Figure 
\begin_inset LatexCommand \ref{timecodestructure}

\end_inset 

.
\layout Standard

\begin_float fig 
\layout Standard
\align center 

\begin_inset Figure size 246 70
file figs/timeCodePic.eps
flags 9

\end_inset 


\layout Caption

Time code structure.
 Physical media limits are specified by the 'Beginning' and 'Finish'.
 A desired media segment is specified by the 'Start' and 'End'.
 The current location of the media window is specified by the 'Current'
 counter.
\begin_inset LatexCommand \label{timecodestructure}

\end_inset 


\end_float 
\layout Standard

Figure 
\begin_inset LatexCommand \ref{objectInheritence}

\end_inset 

 depicts the specified inheritance hierarchy.
\layout Standard

\begin_float fig 
\layout Standard
\align center 

\begin_inset Figure size 173 132
file figs/timeCode.eps
flags 9

\end_inset 


\layout Caption

Time code object inheritance hierarchy.
\begin_inset LatexCommand \label{objectInheritence}

\end_inset 


\end_float 
\layout Standard

Internal to each object in the time code hierarchy are elements which are
 required for time code system operation.
 Figure 
\begin_inset LatexCommand \ref{timecodeinternals}

\end_inset 

 depicts the hierarchy and its internal elements.
 Data types specified are in the C programming language notation and are
 as follows :
\layout Description

int An integer number limited by word size.
\layout Description

uint An unsigned integer which is greater or equal to zero.
\layout Description

uchar An unsigned eight bit number which is greater then or equal to zero.
\layout Description

TYPE\SpecialChar ~
* \SpecialChar ~
\SpecialChar ~
A memory pointer to an array of TYPE.
\layout Description

TYPE\SpecialChar ~
** \SpecialChar ~
\SpecialChar ~
\SpecialChar ~
\SpecialChar ~
An array of memory pointers to arrays of TYPE.
\layout Standard


\shape italic 
Counter
\shape default 
, the base of the hierarchy (located at the bottom of the Figure).
 The counter counts between a minimum and maximum value.
 If any operations force the count above or below the max/min, then carry
 is indicated.
 This is essentially a self contained arithmetic logic unit ALU.
 Inherent in this is a looping mechanism, where if the maximum is exceeded,
 then a modulus operator loops to the remainder above the minimum.
 The same applies for the case when the minimum is under-ceded.
\layout Standard


\shape italic 
Field
\shape default 
, a leaf node in the hierarchy (located middle left in the Figure).
 The field is a counter with a digit display.
 The counter maximum determines the number of digits required by the field,
 called the digit count.
 Each digit is alterable in a field, either incremented or decremented.
 When a digit is altered, the inherited counter adjusts accordingly such
 that the counter represents the number indicated by the digits.
 The counter is also alterable, in which case the digits adjust to represent
 the counter value.
 As the number of digits depends on the maximum value, digits are dynamically
 created and pointed to in computer memory space.
\layout Standard


\shape italic 
Master Counter
\shape default 
, a limb in the hierarchy (located middle right in the Figure).
 The master counter maintains the master count.
 It synchronises the individual fields with the master count.
 When the master count is altered, then relevant fields are altered to add
 in total at all times to the master count.
 Again vice versa applies, when a field is altered, the master count is
 constantly the sum of all the fields.
 A master count may be split into arbitrary numbers of fields.
 Each field is dynamically created and pointed to in memory space.
 At this point in the hierarchy, the tasks of linear and non-linear representati
on are accomplished.
 Linearly the base counter object is adjustable.
 Non-linearly individual digits in individual fields are adjustable.
\layout Standard


\shape italic 
Master Counter Array
\shape default 
, a leaf node in the hierarchy (located top left in the Figure).
 This object controls the size of the window (a dynamically allocated array)
 of media frames.
 A master counter allows alteration of the size of the media window or frame
 count.
 Frame size is specified in terms of word count.
 The data type of the array is adjustable.
\layout Standard


\shape italic 
Time Code
\shape default 
, a leaf node in the hierarchy (located top right).
 This object encapsulates time code which is consistently within the physical
 limits of the underlying media stream or system.
 Start and end points, as well as window size are flexibly alterable.
 Such a time code 
\begin_inset Formula \( (t) \)
\end_inset 

 is made of a beginning 
\begin_inset Formula \( (b) \)
\end_inset 

, a start 
\begin_inset Formula \( (s) \)
\end_inset 

, a current 
\begin_inset Formula \( (c) \)
\end_inset 

, an end 
\begin_inset Formula \( (e) \)
\end_inset 

, a finish 
\begin_inset Formula \( (f) \)
\end_inset 

 and a window 
\begin_inset Formula \( (w) \)
\end_inset 

.
 At all times 
\begin_inset Formula \( b\leq s\leq e\leq f \)
\end_inset 

 .
 This allows the start and end to shift but not overlap.
 The current location obeys 
\begin_inset Formula \( s\leq c<e \)
\end_inset 

.
 The window should have the following properties 
\begin_inset Formula \( w\leq (e-s) \)
\end_inset 

.
 This defines a multimedia time code.
\begin_float fig 
\layout Standard
\align center 

\begin_inset Figure size 209 195
file figs/timeCodeInternal.eps
flags 9

\end_inset 


\layout Caption

Time Code hierarchy internal elements
\begin_inset LatexCommand \label{timecodeinternals}

\end_inset 


\end_float 
\layout Section

Experiment
\layout Standard

An implementation of the time code hierarchy is available 
\begin_inset LatexCommand \cite{key-6}

\end_inset 

.
 This is used in experiment to give examples of each element in operation.
\layout Standard

Counter, in this example three initial counters 
\begin_inset Formula \( \{c,\, d,\, e\} \)
\end_inset 

 are set up where 
\begin_inset Formula \( \left\{ \begin{array}{cc}
c=212; & 0\leq c<300\\
d=13; & 0\leq d<300\\
e=0; & 0\leq e<100
\end{array}\right\}  \)
\end_inset 

.
 The following is computed 
\begin_inset Formula \( e=e+(c+d) \)
\end_inset 

 this yields the result
\begin_inset Formula \[
e=25;\, \, carry=2\]

\end_inset 

an interpretation of this result is that the addition 
\begin_inset Formula \( (c+d) \)
\end_inset 

 yields 225, when added to 
\begin_inset Formula \( e \)
\end_inset 

 yields 225, which wraps twice above the maximum value of 
\begin_inset Formula \( e \)
\end_inset 

.
 The result is the modulus 
\begin_inset Formula \( e=25 \)
\end_inset 

 and two carries.
\layout Standard

Field, in this example a field 
\begin_inset Formula \( (f) \)
\end_inset 

 is set up such that 
\begin_inset Formula \( f=1;\, \, 0\leq f<21 \)
\end_inset 

.
 As the field maximum is set to twenty one, two digits are required to represent
 this field.
 Three operations are carried out on this field and each of the results
 are represented in Figure 
\begin_inset LatexCommand \ref{fieldex}

\end_inset 

.
 The initial value of the field is one.
 Operation 'b]' increments the unit digit twice, hence adding two to the
 underlying counter.
 The value of the field is now 
\begin_inset Formula \( f=3 \)
\end_inset 

.
 Operation 'c]' increments the tens digit.
 The value of the field is now 
\begin_inset Formula \( f=13 \)
\end_inset 

.
 Operation 'c]' increments the tens digit again.
 In this case the counter carries once as its value is 
\begin_inset Formula \( f=23 \)
\end_inset 

, as the maximum is exceeded the field and counter now equals two, 
\begin_inset Formula \( f=2;\, \, carry=1 \)
\end_inset 

.
\layout Standard

\begin_float fig 
\layout Standard
\align center 
a]\SpecialChar ~

\begin_inset Figure size 49 35
file figs/field1.eps
flags 11

\end_inset 

\SpecialChar ~
\SpecialChar ~
b]\SpecialChar ~

\begin_inset Figure size 49 35
file figs/field2.eps
flags 11

\end_inset 


\layout Standard
\align center 
c]\SpecialChar ~

\begin_inset Figure size 49 35
file figs/field3.eps
flags 11

\end_inset 

\SpecialChar ~
\SpecialChar ~
d]\SpecialChar ~

\begin_inset Figure size 49 35
file figs/field4.eps
flags 11

\end_inset 


\layout Caption

Field example.
 a] Initial value, b] unit digit increment twice, c] tens digit increment,
 d] tens digit increment
\begin_inset LatexCommand \label{fieldex}

\end_inset 


\end_float 
\layout Standard

Master Counter, we create a master counter 
\begin_inset Formula \( (c) \)
\end_inset 

 with three fields, hours 
\begin_inset Formula \( (h) \)
\end_inset 

, minutes 
\begin_inset Formula \( (m) \)
\end_inset 

 and seconds 
\begin_inset Formula \( (s) \)
\end_inset 

 in this case we require the following conditions to apply
\begin_inset Formula \[
\begin{array}{cc}
h=0; & 0\leq h<24\\
m=0; & 0\leq m<60\\
s=0; & 0\leq s<60
\end{array}\]

\end_inset 

We also choose a minimum of two minutes and a maximum of twenty three hours,
 fifty nine minutes and fifty nine seconds is assumed.
 Hence in seconds, 
\begin_inset Formula \( 120\leq c<86400 \)
\end_inset 

 and initially 
\begin_inset Formula \( c=120 \)
\end_inset 

.
 A single operation is carried out on the master counter.
 Figure 
\begin_inset LatexCommand \ref{mastercounterex}

\end_inset 

 depicts these operations.
 Initially 
\begin_inset Formula \( c \)
\end_inset 

 is set to two minutes (one hundred and twenty seconds) as that is the minimum
 possible value.
 Operation 'b]' decrements the seconds unit digit by one.
 As the minimum value is under-ceded, the master counter wraps to the highest
 value, namely twenty three hours, fifty nine minutes and fifty nine seconds.
 The carry is set to negative one indicating under-ceding the minimum once.
\layout Standard

\begin_float fig 
\layout Standard
\align center 
a]\SpecialChar ~

\begin_inset Figure size 171 31
file figs/mastercounter1.eps
flags 11

\end_inset 


\layout Standard
\align center 
b]\SpecialChar ~

\begin_inset Figure size 171 31
file figs/mastercounter2.eps
flags 11

\end_inset 


\layout Caption

Master counter example.
 a] Initial value, b] Seconds unit digit decrement.
\begin_inset LatexCommand \label{mastercounterex}

\end_inset 


\end_float 
\layout Section

Conclusion
\layout Standard

Linear time code representation allows mathematical manipulation.
 Simple media location is also accomplished, however accuracy is compromised.
 Non-linear time code representation allows accurate media frame location.
 Such a high level description of the media stream location (field by field,
 digit by digit) is good for interaction.
\layout Standard

This article and the software referenced is unique in its ability to control
 any time code protocol.
 Media data is closely coupled to the time reference and this is an advantage
 for systems which require media data shifting and location.
\layout Bibliography
\bibitem {key-2}

Small Form Factor Committee Specification of ATA Packet Interface for CD-ROMs.
 SFF-8020i
\layout Bibliography
\bibitem {key-4}

Complete MIDI 1.0 Detailed Specification, MIDI Manufacturers Association
\layout Bibliography
\bibitem {key-5}

Society of Motion Picture and Television Engineers (SMPTE) time code
\layout Bibliography
\bibitem {key-6}

Time code implementation available from : http://mffmtimecode.sourceforge.net/
\the_end
