sync documentation with current master

This commit is contained in:
Fischlurch 2011-03-31 18:46:31 +02:00
commit f89d33e95e
18 changed files with 129 additions and 65 deletions

View file

@ -347,10 +347,12 @@ def defineBuildTargets(env, artifacts):
artifacts['corelib'] = core
artifacts['support'] = lLib
artifacts['lumiera'] = ( env.Program('lumiera', ['src/lumiera/main.cpp'], LIBS=core, install=True)
+ env.ConfigData(env.path.srcConf+'setup.ini', targetDir='$ORIGIN')
artifacts['config'] = ( env.ConfigData(env.path.srcConf+'setup.ini', targetDir='$ORIGIN')
+ env.ConfigData(env.path.srcConf+'dummy_lumiera.ini')
)
artifacts['lumiera'] = ( env.Program('lumiera', ['src/lumiera/main.cpp'], LIBS=core, install=True)
+ artifacts['config']
)
# building Lumiera Plugins
artifacts['plugins'] = [] # currently none

View file

@ -511,12 +511,12 @@ TimelineRuler::calculate_major_spacing() const
15l * GAVL_TIME_SCALE,
30l * GAVL_TIME_SCALE,
60l * GAVL_TIME_SCALE,
2l * 60l * GAVL_TIME_SCALE,
5l * 60l * GAVL_TIME_SCALE,
10l * 60l * GAVL_TIME_SCALE,
15l * 60l * GAVL_TIME_SCALE,
30l * 60l * GAVL_TIME_SCALE,
60l * 60l * GAVL_TIME_SCALE
2ll * 60ll * GAVL_TIME_SCALE,
5ll * 60ll * GAVL_TIME_SCALE,
10ll * 60ll * GAVL_TIME_SCALE,
15ll * 60ll * GAVL_TIME_SCALE,
30ll * 60ll * GAVL_TIME_SCALE,
60ll * 60ll * GAVL_TIME_SCALE
};
for(i = 0; i < sizeof(major_spacings) / sizeof(gavl_time_t); i++)

View file

@ -96,7 +96,7 @@ lumiera_frame_duration (FrameRate const& fps)
namespace { // implementation helper
inline long
inline long long
calculate_quantisation (gavl_time_t time, gavl_time_t origin, gavl_time_t grid)
{
time -= origin;
@ -105,9 +105,11 @@ namespace { // implementation helper
}
long
int64_t
lumiera_quantise_frames (gavl_time_t time, gavl_time_t origin, gavl_time_t grid)
{
ENSURE (sizeof(int64_t) <= sizeof(long long));
return calculate_quantisation (time, origin, grid);
}

View file

@ -103,7 +103,7 @@ lumiera_tmpbuf_print_time (gavl_time_t time);
* @return number of the grid interval containing the given time.
* @warning the resulting value is limited to (Time::Min, Time::MAX)
*/
long
int64_t
lumiera_quantise_frames (gavl_time_t time, gavl_time_t origin, gavl_time_t grid);
/**

View file

@ -72,6 +72,7 @@
#include <boost/lexical_cast.hpp>
#include <tr1/functional>
#include <string>
#include <cstdio>
#include <cmath>
using std::string;
@ -126,7 +127,7 @@ namespace time {
{
size_t space = std::snprintf (printbuffer_, bufsiz, formatSpec_, val);
REQUIRE (space < bufsiz, "Digxel value exceeded available buffer size. "
"For showing %s, %lu+1 chars instead of just %lu+1 would be required."
"For showing %s, %zu+1 chars instead of just %zu+1 would be required."
, cStr(lexical_cast<string>(val)), space, len); ///////////TICKET #197
}
ENSURE (!empty());

View file

@ -256,6 +256,9 @@ namespace time {
/// direct assignment prohibited
Time& operator= (Time const);
/// suppress possible direct conversions
Time(int);
public:
static const Time MAX ;
static const Time MIN ;
@ -269,6 +272,7 @@ namespace time {
: TimeValue(calcResult)
{ }
explicit
Time (FSecs const& fractionalSeconds);
Time ( long millis
@ -314,6 +318,11 @@ namespace time {
: Offset(Offset(timeSpec).abs())
{ }
explicit
Duration (FSecs const& timeSpan_in_secs)
: Offset(Offset(Time(timeSpan_in_secs)).abs())
{ }
Duration (TimeSpan const& interval);
Duration (ulong count, FrameRate const& fps);

View file

@ -59,7 +59,16 @@ namespace util {
/** helper to treat int or long division uniformly */
template<typename I>
struct IDiv;
struct IDiv
{
I quot;
I rem;
IDiv (I num, I den)
: quot(num/den)
, rem(num - quot*den)
{ }
};
template<>
struct IDiv<int>
@ -79,6 +88,15 @@ namespace util {
{ }
};
template<>
struct IDiv<long long>
: lldiv_t
{
IDiv<long long> (long long num, long long den)
: lldiv_t(lldiv (num,den))
{ }
};
/** floor function for integer arithmetics.
* Unlike the built-in integer division, this function

View file

@ -154,7 +154,7 @@ namespace meta {
PGrid
TimeGrid::build (Symbol gridID, FrameRate frames_per_second)
{
return build (gridID,frames_per_second, Time(0));
return build (gridID,frames_per_second, Time(0,0));
}

View file

@ -100,7 +100,7 @@ out: TestSubMO1\(ID= [0-9]{3}\)
out: TestSubMO2\(ID= [0-9]{3}\)
out: TestSubMO21\(ID= [0-9]{3}\)
out: specialAPI()
out: pID\(\w{8,16}\)
out: pID\(\w{6,16}\)
END

View file

@ -59,6 +59,7 @@ artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['lib','co
+ [ testCollection(env, dir) for dir in moduledirs if not dir in specials]
+ createPlugins(env, 'plugin')
+ env.File(glob('*.tests')) # depending on the test definition files for test.sh
+ artifacts['config']
)

View file

@ -85,7 +85,7 @@ namespace test {
GridBuilder spec = asset::Meta::create (myGrID);
CHECK ( spec.fps_ == 1);
CHECK ( spec.origin_ == Time(0));
CHECK ( spec.origin_ == TimeValue(0));
CHECK (!spec.predecessor_);
spec.fps_ = testFps;
@ -118,8 +118,8 @@ namespace test {
CHECK (!util::isnil (simplePALGrid->ident.name)); // note: name-ID filled in automatically
cout << "simple PAL Grid: " << simplePALGrid->ident << endl;
CHECK (Time(2) == simplePALGrid->timeOf(50));
CHECK (Time(2) == simplePALGrid->timeOf(FSecs(2)));
CHECK (Time(0,2) == simplePALGrid->timeOf(50));
CHECK (Time(0,2) == simplePALGrid->timeOf(FSecs(2)));
}
};

View file

@ -42,7 +42,13 @@ namespace test{
const uint MAX_FRAMES = 25*500;
const uint DIRT_GRAIN = 50;
const FSecs F25(1,25); // duration of one PAL frame
const FSecs F25(1,25); // duration of one PAL frame
inline Time
secs (int seconds)
{
return Time(FSecs(seconds));
}
}
@ -84,7 +90,7 @@ namespace test{
uint frames = (rand() % MAX_FRAMES);
FSecs dirt = (F25 / (rand() % DIRT_GRAIN));
Time rawTime = dirt + frames*F25;
Time rawTime (dirt + frames*F25);
CHECK (Time( frames *F25) <= rawTime);
CHECK (Time((frames+1)*F25) > rawTime);
@ -152,51 +158,51 @@ namespace test{
{
// origin at lower end of the time range
FixedFrameQuantiser case1 (1, Time::MIN);
CHECK (Time(0) == case1.gridAlign(Time::MIN ));
CHECK (Time(0) == case1.gridAlign(Time::MIN +TimeValue(1) ));
CHECK (Time(1) == case1.gridAlign(Time::MIN +Time(1) ));
CHECK (Time::MAX -Time(1) > case1.gridAlign( Time(-1) ));
CHECK (Time::MAX -Time(1) <= case1.gridAlign( Time (0) ));
CHECK (Time::MAX > case1.gridAlign( Time (0) ));
CHECK (Time::MAX == case1.gridAlign( Time(+1) ));
CHECK (Time::MAX == case1.gridAlign( Time(+2) ));
CHECK (secs(0) == case1.gridAlign(Time::MIN ));
CHECK (secs(0) == case1.gridAlign(Time::MIN +TimeValue(1) ));
CHECK (secs(1) == case1.gridAlign(Time::MIN +secs(1) ));
CHECK (Time::MAX -secs(1) > case1.gridAlign( secs(-1) ));
CHECK (Time::MAX -secs(1) <= case1.gridAlign( secs (0) ));
CHECK (Time::MAX > case1.gridAlign( secs (0) ));
CHECK (Time::MAX == case1.gridAlign( secs(+1) ));
CHECK (Time::MAX == case1.gridAlign( secs(+2) ));
// origin at upper end of the time range
FixedFrameQuantiser case2 (1, Time::MAX);
CHECK (Time( 0) == case2.gridAlign(Time::MAX ));
CHECK (Time(-1) == case2.gridAlign(Time::MAX -TimeValue(1) )); // note: next lower frame
CHECK (Time(-1) == case2.gridAlign(Time::MAX -Time(1) )); // i.e. the same as a whole frame down
CHECK (Time::MIN +Time(1) < case2.gridAlign( Time(+2) ));
CHECK (Time::MIN +Time(1) >= case2.gridAlign( Time(+1) ));
CHECK (Time::MIN < case2.gridAlign( Time(+1) ));
CHECK (Time::MIN == case2.gridAlign( Time( 0) )); // note: because of downward truncating,
CHECK (Time::MIN == case2.gridAlign( Time(-1) )); // resulting values will already exceed
CHECK (Time::MIN == case2.gridAlign( Time(-2) )); // allowed range and thus will be clipped
CHECK (secs( 0) == case2.gridAlign(Time::MAX ));
CHECK (secs(-1) == case2.gridAlign(Time::MAX -TimeValue(1) )); // note: next lower frame
CHECK (secs(-1) == case2.gridAlign(Time::MAX -secs(1) )); // i.e. the same as a whole frame down
CHECK (Time::MIN +secs(1) < case2.gridAlign( secs(+2) ));
CHECK (Time::MIN +secs(1) >= case2.gridAlign( secs(+1) ));
CHECK (Time::MIN < case2.gridAlign( secs(+1) ));
CHECK (Time::MIN == case2.gridAlign( secs( 0) )); // note: because of downward truncating,
CHECK (Time::MIN == case2.gridAlign( secs(-1) )); // resulting values will already exceed
CHECK (Time::MIN == case2.gridAlign( secs(-2) )); // allowed range and thus will be clipped
// maximum frame size is half the time range
Duration hugeFrame(Offset(Time::MAX));
FixedFrameQuantiser case3 (hugeFrame);
CHECK (Time::MIN == case3.gridAlign(Time::MIN ));
CHECK (Time::MIN == case3.gridAlign(Time::MIN +TimeValue(1) ));
CHECK (Time::MIN == case3.gridAlign( Time(-1) ));
CHECK (Time(0) == case3.gridAlign( Time( 0) ));
CHECK (Time(0) == case3.gridAlign( Time(+1) ));
CHECK (Time(0) == case3.gridAlign(Time::MAX -TimeValue(1) ));
CHECK (Time::MIN == case3.gridAlign( secs(-1) ));
CHECK (TimeValue(0) == case3.gridAlign( secs( 0) ));
CHECK (TimeValue(0) == case3.gridAlign( secs(+1) ));
CHECK (TimeValue(0) == case3.gridAlign(Time::MAX -TimeValue(1) ));
CHECK (Time::MAX == case3.gridAlign(Time::MAX ));
// now displacing this grid by +1sec....
FixedFrameQuantiser case4 (hugeFrame, Time(1));
FixedFrameQuantiser case4 (hugeFrame, secs(1));
CHECK (Time::MIN == case4.gridAlign(Time::MIN ));
CHECK (Time::MIN == case4.gridAlign(Time::MIN +TimeValue(1) )); // clipped...
CHECK (Time::MIN == case4.gridAlign(Time::MIN +Time(1) )); // but now exact (unclipped)
CHECK (Time::MIN == case4.gridAlign( Time(-1) ));
CHECK (Time::MIN == case4.gridAlign( Time( 0) ));
CHECK (Time(0) == case4.gridAlign( Time(+1) )); //.....now exactly the frame number zero
CHECK (Time(0) == case4.gridAlign(Time::MAX -TimeValue(1) ));
CHECK (Time(0) == case4.gridAlign(Time::MAX )); //.......still truncated down to frame #0
CHECK (Time::MIN == case4.gridAlign(Time::MIN +secs(1) )); // but now exact (unclipped)
CHECK (Time::MIN == case4.gridAlign( secs(-1) ));
CHECK (Time::MIN == case4.gridAlign( secs( 0) ));
CHECK (TimeValue(0) == case4.gridAlign( secs(+1) )); //.....now exactly the frame number zero
CHECK (TimeValue(0) == case4.gridAlign(Time::MAX -TimeValue(1) ));
CHECK (TimeValue(0) == case4.gridAlign(Time::MAX )); //.......still truncated down to frame #0
// larger frames aren't possible
Duration not_really_larger(Time(10000) + hugeFrame);
Duration not_really_larger(secs(10000) + hugeFrame);
CHECK (hugeFrame == not_really_larger);
// frame sizes below the time micro grid get trapped

View file

@ -148,7 +148,7 @@ namespace test{
// Extended SMPTE: extension of the axis beyond origin towards negative values
smpte.hours -= 6;
CHECK ("- 0:21:59:24"== string(smpte)); // representation is symmetrical to origin
CHECK (tx - Time(6*60*60) == smpte.getTime()); // Continuous time axis
CHECK (tx - Time(0,0,0,6) == smpte.getTime()); // Continuous time axis
CHECK (-1 == smpte.sgn); // Note: for these negative (extended) SMPTE...
CHECK (smpte.mins > 0); // ...the representation is really flipped around zero
@ -161,13 +161,13 @@ namespace test{
++smpte; // but the orientation of the increment on the *whole* TC values is unaltered
CHECK ("- 0:21:59:24"== string(smpte)); // so this actually *advanced* time by one frame
CHECK (tx == smpte.getTime());
CHECK (tx < Time(0));
CHECK (tx < TimeValue(0));
smpte.mins -= 2*60; // now lets flip the representation again...
CHECK (" 1:38:00:01"== string(smpte));
CHECK (+1 == smpte.sgn);
CHECK (smpte.getTime() > 0);
CHECK (tx + Time(2*60*60) == smpte.getTime());
CHECK (tx + Time(0,0,0,2) == smpte.getTime());
smpte.secs -= 2*60*60; // and again...
CHECK (tx == smpte.getTime());
CHECK ("- 0:21:59:24"== string(smpte));

View file

@ -75,8 +75,8 @@ namespace test{
virtual void
run (Arg arg)
{
Time ref (random_or_get(arg));
CHECK (Time(0) < ref);
Time ref (0,random_or_get(arg),0,0);
CHECK (TimeValue(0) < ref);
checkSimpleUsage (ref);
check_theFullStory (ref);

View file

@ -167,8 +167,8 @@ namespace test{
CHECK (o1 == o2);
CHECK (o1 == org);
// integer interpreted as second
Time t1(1);
// time in seconds
Time t1(FSecs(1));
CHECK (t1 == TimeValue(GAVL_TIME_SCALE));
// create from fractional seconds
@ -190,7 +190,7 @@ namespace test{
CHECK (th+th == t1);
CHECK (t1-th == th);
CHECK (((t1-th)*=2) == t1);
CHECK (th-th == Time(0));
CHECK (th-th == TimeValue(0));
// that was indeed a temporary and didn't affect the originals
CHECK (t1 == TimeValue(GAVL_TIME_SCALE));
@ -252,14 +252,14 @@ namespace test{
CHECK (distance == backwards.abs());
Duration len1(Time(23,4,5,6));
CHECK (len1 == Time(FSecs(23,1000)) + Time(4 + 5*60 + 6*3600));
CHECK (len1 == Time(FSecs(23,1000)) + Time(0, 4 + 5*60 + 6*3600));
Duration len2(Time(-10)); // negative specs...
CHECK (len2 == Time(10));//
CHECK (len2 > zero); // will be taken absolute
Duration len2(Time(FSecs(-10))); // negative specs...
CHECK (len2 == Time(FSecs(10)));//
CHECK (len2 > zero); // will be taken absolute
Duration unit(50, FrameRate::PAL);
CHECK (Time(2) == unit); // duration of 50 frames at 25fps is... (guess what)
CHECK (Time(0,2,0,0) == unit); // duration of 50 frames at 25fps is... (guess what)
CHECK (FrameRate::PAL.duration() == Time(FSecs(1,25)));
CHECK (FrameRate::NTSC.duration() == Time(FSecs(1001,30000)));
@ -296,7 +296,7 @@ namespace test{
CHECK (theLength == Offset(org,five).abs());
Time endpoint = interval.end();
TimeSpan successor (endpoint, Duration(Time(2)));
TimeSpan successor (endpoint, Duration(Time(0,2,0,0)));
CHECK (Offset(interval,endpoint) == Offset(org,five).abs());
CHECK (Offset(endpoint,successor.end()) == Duration(successor));

View file

@ -90,6 +90,7 @@ namespace test {
/**********************************************************************
* @test Evaluate a custom built integer floor function.
* Also known as Knuth's floor division.
* This function is crucial for Lumiera's rule of quantisation
* of time values into frame intervals. This rule requires time
* points to be rounded towards the next lower frame border always,
@ -111,6 +112,12 @@ namespace test {
{
verifyBehaviour ();
verifyIntegerTypes<int>();
verifyIntegerTypes<long>();
verifyIntegerTypes<short>();
verifyIntegerTypes<int64_t>();
verifyIntegerTypes<long long int>();
if (!isnil (arg))
runPerformanceTest();
}
@ -147,6 +154,22 @@ namespace test {
}
template<typename I>
void
verifyIntegerTypes ()
{
I n,d,expectedRes;
for (int i=-12; i <= 12; ++i)
{
n = i;
d = 4;
expectedRes = floordiv (i,4);
CHECK (floordiv(n,d) == expectedRes);
}
}
/** @test timing measurements to compare implementation details.
* This test uses a sequence of random integers, where the values

View file

@ -1,4 +1,5 @@
LOGSUPPRESS='^\(\*\*[0-9]*\*\* \)\?[0-9]\{10,\}[:!] \(TRACE\|INFO\|NOTICE\|WARNING\|ERR\|TODO\|PLANNED\|FIXME\|DEPRECATED\|UNIMPLEMENTED\|RESOURCE_ANNOUNCE\|RESOURCE_ENTER\|RESOURCE_STATE\|RESOURCE_LEAVE\):'
LIMIT_VG_CPU=55
LIMIT_VG_TIME=60
LIMIT_CPU=120
LIMIT_VG_CPU=115
LIMIT_VG_TIME=120

View file

@ -134,6 +134,7 @@ fi
#valgrind false positives in 'vgsuppression'. Care must be taken that this file is simple and does
#valgrind not generate true positives.
#valgrind
echo "NOTE: CPU time limit: $LIMIT_CPU sec"
ulimit -S -t ${LIMIT_CPU:-5} -v ${LIMIT_VSZ:-524288}
valgrind=""
LIMIT_TIME_REAL="$LIMIT_TIME"