diff options
author | Peter Schlaile <peter@schlaile.de> | 2007-10-21 19:42:08 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2007-10-21 19:42:08 +0400 |
commit | a0390e5cc340febece6e2a7e61085033d79742e2 (patch) | |
tree | 5d0e89c54603641f394b95b0e76ee917d15a727d /source/blender/quicktime | |
parent | bacfc9eb91f10871a2ba9c3b35e48c3895dffac3 (diff) |
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
Diffstat (limited to 'source/blender/quicktime')
-rw-r--r-- | source/blender/quicktime/apple/quicktime_export.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 7d6d3f32f14..d6c4d33a82f 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -566,20 +566,21 @@ static void check_renderbutton_framerate(void) { (qtdata->gTemporalSettings.frameRate == 1571553 || qtdata->gTemporalSettings.frameRate == 1964113 || qtdata->gTemporalSettings.frameRate == 3928227)) {;} else - qtdata->gTemporalSettings.frameRate = G.scene->r.frs_sec << 16; + qtdata->gTemporalSettings.frameRate = + (G.scene->r.frs_sec << 16) / G.scene->r.frs_sec_base ; err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings); CheckError( err, "SCSetInfo error" ); if(qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps - qtdata->kVideoTimeScale = 2398; - qtdata->duration = 100; + qtdata->kVideoTimeScale = 2400; + qtdata->duration = 1001; } else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps - qtdata->kVideoTimeScale = 2997; - qtdata->duration = 100; + qtdata->kVideoTimeScale = 3000; + qtdata->duration = 1001; } else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps - qtdata->kVideoTimeScale = 5994; - qtdata->duration = 100; + qtdata->kVideoTimeScale = 6000; + qtdata->duration = 1001; } else { qtdata->kVideoTimeScale = (qtdata->gTemporalSettings.frameRate >> 16) * 100; qtdata->duration = 100; @@ -641,25 +642,37 @@ int get_qtcodec_settings(void) // framerate jugglin' if(qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps - qtdata->kVideoTimeScale = 2398; - qtdata->duration = 100; + qtdata->kVideoTimeScale = 24000; + qtdata->duration = 1001; G.scene->r.frs_sec = 24; + G.scene->r.frs_sec_base = 1.001; } else if (qtdata->gTemporalSettings.frameRate == 1964113) { // 29.97 fps - qtdata->kVideoTimeScale = 2997; - qtdata->duration = 100; + qtdata->kVideoTimeScale = 3000; + qtdata->duration = 1001; G.scene->r.frs_sec = 30; + G.scene->r.frs_sec_base = 1.001; } else if (qtdata->gTemporalSettings.frameRate == 3928227) { // 59.94 fps - qtdata->kVideoTimeScale = 5994; - qtdata->duration = 100; + qtdata->kVideoTimeScale = 6000; + qtdata->duration = 1001; G.scene->r.frs_sec = 60; + G.scene->r.frs_sec_base = 1.001; } else { + double fps = qtdata->gTemporalSettings.frameRate; + qtdata->kVideoTimeScale = 600; qtdata->duration = qtdata->kVideoTimeScale / (qtdata->gTemporalSettings.frameRate / 65536); - G.scene->r.frs_sec = (qtdata->gTemporalSettings.frameRate / 65536); + if ((qtdata->gTemporalSettings.frameRate & 0xffff) == 0) { + G.scene->r.frs_sec = fps / 65536; + G.scene->r.frs_sec_base = 1; + } else { + /* we do our very best... */ + G.scene->r.frs_sec = (fps * 10000 / 65536); + G.scene->r.frs_sec_base = 10000; + } } return 1; |