Parameter Curves

 
Microsoft DirectShow 9.0

Parameter Curves

Media parameters are able to follow a curve over time. Each curve is described by a mathematical formula and two end-points. Each end-point is defined by a reference time and the value of the curve at that time. The formula is used to calculate intermediate values between the points, and determines the shape of the curve. The possible curves are:

  • Jump
  • Linear
  • Square
  • Inverse square
  • Sine

"Jump" means jump directly to the end value. The other curves are shown in the following diagram.

Parameter Curves

Mathematically, the curves work as follows. Suppose that a curve begins at time t0 with a value of v0, and ends at time t1 with a value of v1. The two points that define the curve are (t0,v0) and (t1,v1).

  • Let Δt be the total duration of the curve, t1t0.
  • Let Δv be the interval between the starting and ending values, v1v0.
  • At any time t such that t0 <= t <= t1, let &Delta;t' = tt0.

Parameter Calculation

The value of the parameter at time t is:

v = f( &Delta;t' / &Delta;t ) * &Delta;v + v0

where f(x) is a function determined by the curve type: 

  • Linear: y = x
  • Square: y = x2
  • Inverse square: y = sqrt(x)
  • Sine: y = [ sin(&pi;x – &pi;/2) + 1 ] / 2

Observe that &Delta;t' < &Delta;t, so the term &Delta;t'/&Delta;t ranges from 0 to 1. Therefore, f(x) also ranges from 0 to 1, and v always falls between v0 and v1. This is true whether v0 < v1 or vice versa. In other words, the curve is bounded by the rectangle (t0,v0,t1,v1).

For the sine curve, the value of (&pi;x – &pi;/2) ranges from –&pi;/2 to &pi;/2, which means that sin(&pi;x – &pi;/2) ranges from –1 to 1. The result is then normalized so that f(x) falls into the range (0–1).

See Also