mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-04 05:44:53 +00:00
[ENHANCEMENT] Handle idr_pic_id in AVC slice header parsing #863
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Harshdhall01 on GitHub (Dec 25, 2025).
Description:
Found a TODO in the AVC slice header parsing that suggests incomplete handling of IDR picture IDs:
Location:
src/lib_ccx/avc_functions.c:998Current code:
Issue:
The IDR (Instantaneous Decoder Refresh) picture ID is:
dvprint)Potential improvements:
dec_ctx->avc_ctx->idr_pic_id)Questions for maintainers:
idr_pic_idbe stored in the AVC context?Research:
According to H.264 spec,
idr_pic_ididentifies IDR pictures and can range from 0-65535. It's used to identify different IDR pictures when multiple occur in sequence.Proposed solution:
idr_pic_idfield to the appropriate context structureBackground:
Working toward GSoC 2026 with CCExtractor. First PR (#1889) merged. Focusing on core video processing and subtitle extraction for the CCExtractor 1.00 release.
Would love to implement this if you can guide me on whether/how the ID should be used!
@cfsmp3 commented on GitHub (Jan 1, 2026):
Thanks for the thorough analysis! After reviewing the code, the TODO can simply be removed - no additional implementation is needed.
Why
idr_pic_iddoesn't need to be stored:Bitstream parsing: The value must be read to advance the bitstream position correctly. The H.264 slice header has a specific structure, and we need to parse past
idr_pic_idto reach subsequent fields likepic_order_cnt_lsb.Not needed for caption extraction: CCExtractor extracts closed captions from SEI NAL units. For timing and frame ordering, we use:
pic_order_cnt_lsb(when--usepicorderis set)Neither of these requires
idr_pic_id.Purpose in H.264 spec:
idr_pic_idis used by decoders for error recovery - to distinguish between consecutive IDR pictures when recovering from stream errors. This is a decoder concern, not relevant for caption extraction.The TODO was likely a "maybe we'll need this later" placeholder that never materialized. I've created PR #1947 to remove the TODO and add a clarifying comment explaining why the value is read but not stored.