How do I create a function to process each millisecond? - page 3

 
Dmitry Fedoseev:

24 frames per second is enough if you didn't read TV books when you were a kid)))

Actually analogue CRT televisions used interlaced scanning, but only because in those days they could not make full frames in a given bandwidth, producing even, then odd, and flicker was not visible due to tube afterglow. Not only did I read books, but as a student I used to do quite a bit of hackwork when repairing TVs).

 
Alexey Volchanskiy:

Actually analogue CRT televisions had interlaced scanning, but only because in those years they could not make full frames in a given bandwidth, they made even lines first, then odd, and due to tube afterglow flicker was not visible. Not only did I read books, but as a student I also did quite a bit of shoddy work repairing TVs ))

I don't know how many frames there should be. I haven't read any such books. But the main thing is that I've done it now and it works fine. Of course, I haven't got it all figured out yet, but I've already got something to hang on to.
 
Nikolay Demko:

The ChartRedraw function has a cost of 40 milliseconds, so there is no point in updating the timer after 16.

40 milliseconds corresponds to 25 frames per second, which is equal to human perception speed.

Well no, Nikolai, of course it's less than that. On my computer it is a bit less than 2 milliseconds with COLOR_FORMAT_ARGB_NORMALIZE , and less than a millisecond with COLOR_FORMAT_XRGB_NOALPHA

As you can see from the attached sample script(TestSpeedCanv.ex5) the frame delay of 30 milliseconds (32 fps) is absolutely enough for your eyes. By the way, all video is shot at this speed. A higher frame rate is used when slow motion playback is required.

Files:
 
Реter Konow:

The maximum frequency of the timer function is 15-16 mc.

Yes, it is. (Only not the frequency, but the period. Maximum frequency = 64 Hz)

Just to add a clarification:

The period step for the timer = 15.625 milliseconds.

I.e. with EventSetMillisecondTimer(1) command and with EventSetMillisecondTimer(10) command the real period will be 15.625 ms.

with the EventSetMillisecondTimer(21) command and with the EventSetMillisecondTimer(30) command the actual period will be 31.25 ms.

With the EventSetMillisecondTimer(95) command and the EventSetMillisecondTimer(105) command, the actual period will be 109.375 ms.

etc.

Files:
 
Alexey Volchanskiy:

Actually analogue CRT televisions had interlaced scanning, but only because in those years they could not make full frames in a given bandwidth, they made even lines first, then odd, and due to tube afterglow flicker was not visible. Not only did I read books, but as a student I also did quite a bit of shoddy work repairing TVs ))

Yeah, 625 lines and all that. The first homemade games (not computer games - assembled on individual chips) used 312 lines usually. Played when I was a kid: hockey, tennis...
 
Alexey Volchanskiy:

Actually analogue CRT televisions had interlaced scanning, but only because in those years they could not make full frames in a given bandwidth, they made even lines first, then odd, and due to tube afterglow flicker was not visible. I not only read books, but as a student I used to do pretty good shifts when repairing TVs).

So? Weren't you taught that in video, 24 frames per second is enough for a natural uniform motion effect? And the flicker problem is a monitor (TV) problem.

 
Dmitry Fedoseev:

So? Weren't you taught there that in video, 24 frames per second is enough to provide a natural uniform motion effect? And the flicker problem is a monitor (TV) problem.

now even phones have video at 50 fps)

shoot the same thing, fast movement, at 24 fps and 50 fps and compare

ps. and charlie chaplin shot 15 fps which is more than enough)

 
Alexey Volchanskiy:

Actually analogue CRT televisions had interlaced scanning, but only because in those years they could not make full frames in a given bandwidth, they made even lines first, then odd, and due to tube afterglow flicker was not visible. Not only did I read books, but as a student I also did quite a bit of shoddy work repairing TVs ))

Yes, but those half-frames were different, not from the same frame.
And because of that the movements were smoother than 25 fps on the computer.

 
Taras Slobodyanik:

even phones now have video at 50 fps)

shoot the same thing, fast movement, at 24 fps and 50 fps and compare.

ps. and charlie chaplin shot 15 fps - more than enough)

It's amazing the depth of knowledge! ...and the subtlety of perception! Usually everyone sees jerks and unnatural movement in Charlie Chaplin films.

 
Nikolai Semko:

Yes, it is. (Only not the frequency, but the period. Maximum frequency = 64 Hz)

Just to add a clarification:

The period step for the timer = 15.625 milliseconds.

I.e. with EventSetMillisecondTimer(1) command and with EventSetMillisecondTimer(10) command the real period will be 15.625 ms.

with the EventSetMillisecondTimer(21) command and with the EventSetMillisecondTimer(30) command the actual period will be 31.25 ms.

With the EventSetMillisecondTimer(95) command and the EventSetMillisecondTimer(105) command, the actual period will be 109.375 ms.

etc.

Thanks for the correction, Nikolai.

I haven't measured such exact periods, but I noticed that there are skips of some periods. The frequency is not ideal. Especially in the range of small period values (16-25 ms). So, if I set it to 16 ms, the pause will quite often be 32 milliseconds.

There is a kind of a failure in the frequency of periods. It's a kind of electronic arrhythmia.


So, I'm thinking, what if I set a period of 40 ms (which is enough for human perception) and the timer skips some periods? Then we wouldn't get 24 frames per second, but 18-24. Depending on how many periods the timer will skip. I think the best option would be a timer period of 25ms. Which is what I originally set myself.

Reason: