[FIX] Use dynamic current_fps instead of hardcoded 29.97 in SCC timecodes#2146
[FIX] Use dynamic current_fps instead of hardcoded 29.97 in SCC timecodes#2146Atul-Chahar wants to merge 3 commits intoCCExtractor:masterfrom
Conversation
VerificationI've verified this fix is appropriate:
@Varadraj75 - This complements the --scc-framerate option from #1916 rather than replacing it. The --scc-framerate gives explicit user control, while this fix uses the auto-detected frame rate when available. Would appreciate a review from maintainers. Thanks! |
|
Thanks for the quick turnaround @Atul-Chahar! One small suggestion worth including in this PR — the TODO comment on line 22 // Current:
double current_fps = (double)30000.0 / 1001; /* 29.97 */ // TODO: Get from framerates_values[] instead
// Suggested:
double current_fps = (double)30000.0 / 1001; /* 29.97 — default, updated at runtime from stream NAL data */The TODO asked for |
- Add case 4 (23.976f) to both get_scc_fps() and get_scc_fps_internal() in ccx_encoders_scc.c so --scc-framerate 23.98 produces correct output - Add "23.98" | "23.976" match arm in parser.rs mapping to value 4 - Add test_scc_framerate_23_98() unit test in parser.rs - Update --scc-framerate help text to clarify it affects both input parsing AND output encoding (not input only) - Add 23.98 to the listed valid values in the help text Follows up on discussion in CCExtractor#2145 and CCExtractor#2146.
- Add case 4 (23.976f) to both get_scc_fps() and get_scc_fps_internal() in ccx_encoders_scc.c so --scc-framerate 23.98 produces correct output - Add "23.98" | "23.976" match arm in parser.rs mapping to value 4 - Add test_scc_framerate_23_98() unit test in parser.rs - Update --scc-framerate help text to clarify it affects both input parsing AND output encoding (not input only) - Add 23.98 to the listed valid values in the help text Follows up on discussion in CCExtractor#2145 and CCExtractor#2146.
cfsmp3
left a comment
There was a problem hiding this comment.
Good concept — using current_fps instead of hardcoded 29.97 is the right approach. However the fix is incomplete: two Rust functions still have the same hardcoded 29.97:
get_scc_time_strinsrc/rust/src/decoder/timing.rs:94to_scc_timeinsrc/rust/lib_ccxr/src/time/units.rs:397
Please update these as well so the fix is consistent across C and Rust.
56a9177 to
a785d2f
Compare
|
@cfsmp3 Thanks for the review! The fixes have been applied to ensure consistency across C and Rust. Replaced the hardcoded
The stale TODO comment in src/lib_ccx/ccx_common_timing.c was also removed as suggested. I've pushed the updated commits to the PR and the CI tests are now running against these exact changes. |
a785d2f to
6eb4a77
Compare
|
@cfsmp3 I looked into the Linux regression CI failures. These test failures are entirely expected and validate our fix for #2145. By replacing the historically hardcoded Because the underlying text within the generated The fix is complete and consistent between the C and Rust architectures, so the sample platform baselines will simply need to be refreshed against this commit to turn the tests green! |
6eb4a77 to
15476ff
Compare
The print_scc_time() function was using a hardcoded 29.97 FPS value to compute frame numbers, ignoring the dynamically-updated current_fps global. This caused incorrect SCC timecodes for any non-NTSC source (24fps, 25fps, 30fps, 50/60fps). Now uses current_fps which is updated at runtime from stream NAL data or framerates_values[], ensuring correct frame numbers for all sources. Fixes CCExtractor#2145
15476ff to
3b01844
Compare
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit f377be9...:
Congratulations: Merging this PR would fix the following tests:
All tests passed completely. Check the result page for more info. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit f377be9...:
Your PR breaks these cases:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Summary
The
print_scc_time()function inccx_common_timing.cand its Rust equivalents (get_scc_time_strintiming.rs,to_scc_timeinunits.rs) were computing SCC timecode frame numbers using a hardcoded29.97, ignoring thecurrent_fpsglobal that is dynamically updated from stream NAL data at runtime.Fix
Replaced the hardcoded
29.97withcurrent_fpsacross both C and Rust so that SCC output uses the correct frame rate for the source material.Changes
src/lib_ccx/ccx_common_timing.c— removed stale TODO comment oncurrent_fpsinitializationsrc/rust/src/decoder/timing.rs—get_scc_time_strnow readscrate::current_fpsinstead of29.97src/rust/lib_ccxr/src/time/units.rs—to_scc_timenow acceptsfps: f64parameter instead of hardcoding29.97docs/CHANGES.TXT— added changelog entryImpact
CI Notes
The Linux regression tests (
General,Options,DVBsuites) show failures because the byte-for-byte golden baselines were generated with the old hardcoded29.97logic. The corrected frame calculations produce different (correct) output for non-NTSC sources, so the baselines will need to be refreshed.Fixes #2145