How clockDivisor works?

Hi,
Can anyone explain how clockDivisor works in HDiSim
Frankly speaking I cannot catch the idea :)

Simple sample below is to display "OK" on the screen after 1s.
timeBase is 60fps, clockDivisor is 120. When "OK" should appear
After 1s, after 2s, after 5s... And why

Thanks in advance

<head>
<timing clock="page" clockDivisor="120">
<cue begin="1s" select="id('ok')" dur="5s">
<set style:visibility="visible"/>
</cue>
</timing>
<styling/>
</head>
<body style:font="
file:///dvddisc/ADV_OBJ/font.ttf" >
<p id="ok" style:visibility="hidden"> OK </p>
</body>



Answer this question

How clockDivisor works?

  • eTape

    Dear Peter, thank you very much for fast answer.
    Yes, I understand that clockDivisor is used to lower the framerate.
    But in my sample timeBase="60fps" and clockDivisor="120".
    So framerate=60/120=0.5fps in other words redraw the screen every 2s not 120s.
    Is it correct
    So in my sample "OK" should appear after 2s, right
    In your sample small yellow box should be redrawn every 1/60=16.7ms when clockDivisor="1",
    and every 167ms for clockDivisor="10".
    If we change clockDivisor to 60 we have to see 5 steps of animation, right

  • Nigel Harper

    How are you testing that it is only after 5 seconds If you are going based off the title timeline, that won't be accurate since the animation is tied to the page clock, and it will take some time for the application to initialise and display the markup page.

  • Jon Stroh

    Hello Peter,
    Timeline is based on "page" so <timing> section should start after page is loaded.
    You can easily count up time in seconds using simple sample below:

    <timing clock="page">
    <defs>
    <set id="show" style:visibility="visible"/>
    </defs>
    <par begin="0s" dur="20s">
    <cue select="id('t1')" begin="1s" dur="10s" use="show" />
    <cue select="id('t2')" begin="2s" dur="10s" use="show" />
    <cue select="id('t3')" begin="3s" dur="10s" use="show" />
    <cue select="id('t4')" begin="4s" dur="10s" use="show" />
    <cue select="id('t5')" begin="5s" dur="10s" use="show" />
    <cue select="id('t6')" begin="6s" dur="10s" use="show" />
    <cue select="id('t7')" begin="7s" dur="10s" use="show" />
    </par>
    </timing>
    <styling>
    <style select="//span" id="invis" style:visibility="hidden"/>
    </styling>

    ...

    <p>Time: 0
    <span id="t1">1</span>
    <span id="t2">2</span>
    <span id="t3">3</span>
    <span id="t4">4</span>
    <span id="t5">5</span>
    <span id="t6">6</span>
    <span id="t7">7</span>
    </p>


  • tchen777

    Sorry; that was a temporary lapse in sanity on my part. You are correct that it re-draws every 120 frames (ie, 2 seconds) not every 120 seconds (doh!). I was so busy trying to explain clockDivisor that I didn't actually look at your example :-)

    Anyway, the real problem is that your content is invalid; try this and it will work:

    < xml version="1.0" >
    <
    root xml:lang="en" xmlns="http://www.dvdforum.org/2005/ihd" xmlns:style="http://www.dvdforum.org/2005/ihd#style" xmlns:state="http://www.dvdforum.org/2005/ihd#state">
    <head>
    <
    timing clock="page" clockDivisor="120">
    <
    par>
    <
    cue begin="1s" select="id('ok')" dur="5s">
    <
    set style:visibility="visible"/>
    </
    cue>
    </
    par>
    </
    timing>
    <
    styling/>
    </
    head>
    <
    body style:font="file:///dvddisc/ADV_OBJ/font.ttf" >
    <
    div>
    <
    p id="ok" style:visibility="hidden"> OK </p>
    </
    div>
    </
    body>
    </
    root>

    Do you have the schemas installed in Visual Studio (or the editor of your choice), and have you run the HD DVD Validator Both would tell you that you were missing the <par> and the <div>



  • IS dude

    Dear Peter, you are right absolutely about <par>. Yes, it was my fault.

    But anyway in my sample (with <par> :) I have “OK” appeared not after 2s but 5s…

    Is it a bug in HDiSim or something else


  • Santos_123

    clockDivisor is used to lower the framerate. All your animations are timed the same way, but the page is only layed out every clockDivisor frames. So in your example, the text "OK" is visible from t=1s to t=6s, but you only redraw the screen every 120s (2 minutes), so you never see what happens.

    Here's a quick example:

    Run the following:

    < xml version="1.0" >
    <
    root xml:lang="en" xmlns="http://www.dvdforum.org/2005/ihd" xmlns:style="http://www.dvdforum.org/2005/ihd#style" xmlns:state="http://www.dvdforum.org/2005/ihd#state"
    >
      <
    head
    >
        <
    timing clock="page" clockDivisor="1"
    >
          <
    par
    >
            <
    cue select="id('test')" dur="5s"
    >
              <
    animate style:x="0px;1920px"
    />
            </
    cue
    >
          </
    par
    >
        </
    timing
    >
      </
    head
    >
      <
    body
    >
        <
    div id="test" style:position="absolute" style:width="50px" style:height="50px" style:backgroundColor="yellow"
    />
      </
    body
    >
    </
    root>

    Now change clockDivisor to 10 and watch it again.



  • hotsauce

    The problem appears to be that clockDivisor always assumes 24fps, even if you have a 60fps presentatinon. If you need to use clockDivisor, you can set the tickBase="24fps" in your playlist and then use 24-fps based clockDivisor (eg, 48 instead of 60).

    Thanks for reporting this though; I will log it as a bug.



  • How clockDivisor works?