Changeset 880
- Timestamp:
- 02/20/08 11:24:27 (16 years ago)
- Files:
-
- trunk/libffado/src/libieee1394/CycleTimerHelper.cpp (modified) (6 diffs)
- trunk/libffado/src/libieee1394/CycleTimerHelper.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libieee1394/CycleTimerHelper.cpp
r879 r880 28 28 #include "libutil/PosixThread.h" 29 29 30 #define DLL_BANDWIDTH (0.1)31 30 #define DLL_PI (3.141592653589793238) 32 31 #define DLL_SQRT2 (1.414213562373095049) 32 33 // the high-bandwidth coefficients are used 34 // to speed up inital tracking 35 #define DLL_BANDWIDTH_HIGH (0.1) 36 #define DLL_OMEGA_HIGH (2.0*DLL_PI*DLL_BANDWIDTH_HIGH) 37 #define DLL_COEFF_B_HIGH (DLL_SQRT2 * DLL_OMEGA_HIGH) 38 #define DLL_COEFF_C_HIGH (DLL_OMEGA_HIGH * DLL_OMEGA_HIGH) 39 40 // the low-bandwidth coefficients are used once we have a 41 // good estimate of the internal parameters 42 #define DLL_BANDWIDTH (0.01) 33 43 #define DLL_OMEGA (2.0*DLL_PI*DLL_BANDWIDTH) 34 44 #define DLL_COEFF_B (DLL_SQRT2 * DLL_OMEGA) 35 45 #define DLL_COEFF_C (DLL_OMEGA * DLL_OMEGA) 36 46 37 #define OFFSET_AVERAGE_COEFF 0.01 47 #define UPDATES_WITH_HIGH_BANDWIDTH 200 48 38 49 /* 39 50 #define ENTER_CRITICAL_SECTION { \ … … 67 78 , m_cycle_timer_prev ( 0 ) 68 79 , m_cycle_timer_ticks_prev ( 0 ) 80 , m_high_bw_updates ( UPDATES_WITH_HIGH_BANDWIDTH ) 69 81 , m_Thread ( NULL ) 70 82 , m_realtime ( false ) … … 88 100 , m_cycle_timer_prev ( 0 ) 89 101 , m_cycle_timer_ticks_prev ( 0 ) 102 , m_high_bw_updates ( UPDATES_WITH_HIGH_BANDWIDTH ) 90 103 , m_Thread ( NULL ) 91 104 , m_realtime ( rt ) … … 108 121 debugOutput( DEBUG_LEVEL_VERBOSE, "Start %p...\n", this); 109 122 #if IEEE1394SERVICE_USE_CYCLETIMER_DLL 123 m_high_bw_updates = UPDATES_WITH_HIGH_BANDWIDTH; 110 124 m_Thread = new Util::PosixThread(this, m_realtime, m_priority, 111 125 PTHREAD_CANCEL_DEFERRED); … … 264 278 m_current_time_ticks = m_next_time_ticks; 265 279 280 // decide what coefficients to use 281 double coeff_b, coeff_c; 282 if (m_high_bw_updates > 0) { 283 coeff_b = DLL_COEFF_B_HIGH; 284 coeff_c = DLL_COEFF_C_HIGH; 285 m_high_bw_updates--; 286 if (m_high_bw_updates == 0) { 287 debugOutput(DEBUG_LEVEL_VERBOSE, "Switching to low-bandwidth coefficients\n"); 288 } 289 } else { 290 coeff_b = DLL_COEFF_B; 291 coeff_c = DLL_COEFF_C; 292 } 293 266 294 // do the calculation in 'tick space' 267 int64_t tmp = (uint64_t)( DLL_COEFF_B* diff_ticks_corr);295 int64_t tmp = (uint64_t)(coeff_b * diff_ticks_corr); 268 296 if(m_dll_e2 > 0) { 269 297 tmp = addTicks(tmp, (uint64_t)m_dll_e2); … … 278 306 // it should be ok to not do this in tick space since it's value 279 307 // is approx equal to the rate, being 24.576 ticks/usec 280 m_dll_e2 += DLL_COEFF_C* diff_ticks_corr;308 m_dll_e2 += coeff_c * diff_ticks_corr; 281 309 282 310 // For jitter graphs 283 //debugOutputShort(DEBUG_LEVEL_NORMAL, "0123456789 %f %f %f %lld %lld %lld\n",284 //diff_ticks, diff_ticks_corr, m_dll_e2, cycle_timer_ticks, (int64_t)m_next_time_ticks, usecs_late);311 debugOutputShort(DEBUG_LEVEL_NORMAL, "0123456789 %f %f %f %lld %lld %lld\n", 312 diff_ticks, diff_ticks_corr, m_dll_e2, cycle_timer_ticks, (int64_t)m_next_time_ticks, usecs_late); 285 313 286 314 // update the y-axis values trunk/libffado/src/libieee1394/CycleTimerHelper.h
r879 r880 123 123 uint32_t m_cycle_timer_prev; 124 124 uint64_t m_cycle_timer_ticks_prev; 125 int m_high_bw_updates; 125 126 126 127 // cached vars used for computation