Repository navigation
Fix periodic intra frames and feature reset for chunk-based models - #169
Open
DucTu (DucTu2k4) wants to merge 1 commit into
Open
DucTu (DucTu2k4) wants to merge 1 commit into
DucTu (DucTu2k4) wants to merge 1 commit into
Conversation
DucTu (DucTu2k4)
force-pushed
the
fix-intra-period-chunk
branch
from
October 7, 2026 07:08
201ad8f to
2c4cf64
Compare
DucTu (DucTu2k4)
force-pushed
the
fix-intra-period-chunk
branch
from
October 7, 2026 07:10
2c4cf64 to
e3318b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
--model_structure hts(orhtl) and a periodic intra setting such as--force_intra_period 128,test_video.pyinserts only one periodic intra frameand then stops both intra insertion and feature-memory reset for the rest of the
sequence.
In
run_one_point_with_stream, an intra frame is inserted whenframe_idx % intra_period == 1, checked at the start of each chunk. Withg_frame_delay = 8the chunk starts are 1, 9, ..., 129, so frame 129 is hit.The intra frame consumes a single frame, so the following chunks start at
130, 138, ... and the condition is never true again. The reset condition
(frame_idx + g_frame_delay) % reset_interval == 1is affected in the same way.For a 750-frame sequence this gives intra frames at [0, 129] only, and the last
620 frames are coded without any intra frame or reset.
Fix
max(frame_idx - 1, 0) // intra_periodincreases, instead of testing
frame_idxdirectly.reset_interval.Behaviour is unchanged for the LD model (
g_frame_delay = 1) and for HT modelswithout periodic intra frames (
intra_period = -1); I checked this by simulatingthe loop for several frame counts, intra periods and reset intervals.
Note: since an intra frame shifts the chunk alignment by one frame, the distance
between intra frames is
intra_period + 1for most GOPs (0, 129, 258, 387, ...),and one GOP is shortened by
g_frame_delayeveryg_frame_delayGOPs so that theaverage period stays
intra_period. I am happy to change this if you prefer adifferent convention.
Results
HT-S, QP 40, 1920x1080, 750 frames, 8-bit YUV420,
--reset_interval 128,--skip_thres 0.15, RTX 3090.main,--force_intra_period 128--force_intra_period 128intra_period = -1