gus 1 #1 January 10, 2003 I know we've got some techy bods around here so I thought I'd share this problem with you all and let you show off your intelligence - it's been hurting my head trying to figure it out! EDIT: There's a better explanation a few posts down. (1) I have a counter, which increments every 27 microseconds. (2) I'm receiving frames of data, one every 125 microseconds. (3) Each frame contains the value of the counter at the instant the frame was produced. OK then! If, for some reason, I miss some frames can I work out exactly how many I've missed by comparing the counter value of the current frame with the counter value of the last frame I received??? Ta! GusOutpatientsOnline.com Quote Share this post Link to post Share on other sites
pds 0 #2 January 10, 2003 in what context are these values generated? i am assuming video. and do you mean milliseconds? never heard of a microsecond. this would be a trivial calculation, but by hand could become tedious. are you running windows? if so, elaborate on your problem and i will write you a calculator. is a text log being generated? if so, we can automate this.namaste, motherfucker. Quote Share this post Link to post Share on other sites
gus 1 #3 January 10, 2003 I probably do mean milliseconds but it doesn't really matter, it's the 27:125 ratio that's important. Quotethis would be a trivial calculation I'm not so sure. Each value of the counter represents a chunk of time 27 milliseconds long and if you don't know where in that chunk your frame was created I think the answer to "how many frames have I missed" can be ambiguous. I'm trying to think of an example but it's a problem of the counter and the frames not being in synch. If the counter incremented every 25 milliseconds we'd be laughing... GusOutpatientsOnline.com Quote Share this post Link to post Share on other sites
wildblue 7 #4 January 10, 2003 microsecond One millionth (10^-6) of a second --it's like incest - you're substituting convenience for quality Quote Share this post Link to post Share on other sites
nacmacfeegle 0 #5 January 10, 2003 Hmm not video then, 25fps means each frame is 40 milliseconds long, or each field is 20 milliseconds long......whatchoo talkin' bout then?-------------------- He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine, receives light without darkening me. Thomas Jefferson Quote Share this post Link to post Share on other sites
wildblue 7 #6 January 10, 2003 Is there an application for this? or is this just a math problem? Because so far, I have current - last / 4.629 rounded - 1 = number missed However, because of the odd number (27/125) I'm sure there's a case, if you miss enough frames, that it won't hold true anymore.it's like incest - you're substituting convenience for quality Quote Share this post Link to post Share on other sites
pds 0 #7 January 10, 2003 Quotemicrosecond One millionth (10^-6) of a second -- amzing the holes we can have in our knowledge bases. I have been writing code for over 20 years and have only every found relevant milli and nano. wonder why?namaste, motherfucker. Quote Share this post Link to post Share on other sites
gus 1 #8 January 10, 2003 Ok, I have a good analogy: (1) A guy walks into a room with a clock on the wall, he sits down, pulls out a piece of paper, writes a 0 on it and starts to watch the clock. Every 27 seconds he tears up his bit of paper, adds 1 to the number he's just destroyed and writes it on a new bit of paper. (2) Some time later a second guy walks into the room and sits down. He looks at what's written on the 1st guy's bit of paper, writes it down on another bit of paper, puts it aside and starts watching the clock. Every 125 seconds he repeats this process (creating a pile of paper) - sometimes the 1st guy's counter has gone up by 4, sometimes by 5. (3) You're sat next to the 2nd guy but can't see the 1st guy, his bit of paper or the clock on the wall. If you took out a wedge of paper from the 2nd guy's pile, could you work out how many bits there were there by looking at the top and bottom pieces only? GusOutpatientsOnline.com Quote Share this post Link to post Share on other sites
n2skdvn 0 #9 January 10, 2003 you forgot pico!!!! milli, micro, nano, pico!!!if my calculations are correct SLINKY + ESCULATOR = EVERLASTING FUN my site Quote Share this post Link to post Share on other sites
pds 0 #10 January 10, 2003 QuoteIs there an application for this? or is this just a math problem? Because so far, I have current - last / 4.629 rounded - 1 = number missed However, because of the odd number (27/125) I'm sure there's a case, if you miss enough frames, that it won't hold true anymore. depends whether gus wants to keep a running log to respond to sync errors or simply wants an end report.namaste, motherfucker. Quote Share this post Link to post Share on other sites
CrazyIvan 0 #11 January 10, 2003 A-hem, who said that computer clocks (based on quartz crystals) are accurate?__________________________________________ Blue Skies and May the Force be with you. Quote Share this post Link to post Share on other sites
gus 1 #12 January 10, 2003 Quote Is there an application for this? or is this just a math problem? It's just a boring work thing (think packets/frames/networks) but it's really bugging me. Quote Because so far, I have current - last / 4.629 rounded - 1 = number missed That's where I'm at. Quote However, because of the odd number (27/125) I'm sure there's a case, if you miss enough frames, that it won't hold true anymore. This is exactly what I'm talking about. So is it possible or am I just wasting my time? [For "my time" please read "my employer's/customer's" time.] GusOutpatientsOnline.com Quote Share this post Link to post Share on other sites
wmw999 2,583 #13 January 10, 2003 Quote I have been writing code for over 20 years and have only every found relevant milli and nano. wonder why? Obviously you don't work on the shuttle software We use them (that would be microseconds) all the time, for modules that have critical timing requirements. In fact, when we compile, the disassembled output (included for analysis) includes the number of milliseconds for each instruction. The software is cyclic in nature, and overrunning a cycle is a big deal And if that isn't TMI, I don't know what is Wendy W.There is nothing more dangerous than breaking a basic safety rule and getting away with it. It removes fear of the consequences and builds false confidence. (tbrown) Quote Share this post Link to post Share on other sites
gus 1 #14 January 10, 2003 Quote A-hem, who said that computer clocks (based on quartz crystals) are accurate? Damn you and your crazy Jedei mind (), for the sake of my sanity let's assume the clock's ok. GusOutpatientsOnline.com Quote Share this post Link to post Share on other sites
wildblue 7 #15 January 10, 2003 Quote This is exactly what I'm talking about. So is it possible or am I just wasting my time? [For "my time" please read "my employer's/customer's" time.] So "close enough" and "probably right" won't work in this case? it's like incest - you're substituting convenience for quality Quote Share this post Link to post Share on other sites
gus 1 #16 January 10, 2003 Quote So "close enough" and "probably right" won't work in this case? Well they're normally good enough for me but when it all goes tits-up can I place the collective blame on dz.com? GusOutpatientsOnline.com Quote Share this post Link to post Share on other sites
CrazyIvan 0 #17 January 10, 2003 Quote Damn you and your crazy Jedei mind (), for the sake of my sanity let's assume the clock's ok. Gus Well yes, but you have to also consider the CACHING time (when the System writes data to the HD) and CPU speed, I used to do a lot of programming, and I encountered similar situations, so, good luck __________________________________________ Blue Skies and May the Force be with you. Quote Share this post Link to post Share on other sites
billvon 3,107 #18 January 10, 2003 > . . . can I work out exactly how many I've missed by > comparing the counter value of the current frame with the counter > value of the last frame I received??? Yes, up to a limit. You will see either a 4 or a 5 count between each frame, so until you get to 5 skipped frames you can figure it out with no problem. You might be able to go longer by using remainders to predict the state of the counter at the beginning of each frame, but timebase problems (and basic sampling problems) limit the accuracy of that approach, unless you assume both frames and counter clocks are synchronous to the same clock. Quote Share this post Link to post Share on other sites