Skip to content

Commit

Permalink
Fix keyframe counter update for dropped frames.
Browse files Browse the repository at this point in the history
The counters are always updated in update_rc_counters(),
for encoded or dropped frames. So the additional update
in postencode_update_drop_frame() is not needed.

Remove the update in postencode_update_drop_frame(). And
this then requires an update in RateControlRTC::ComputeQP(),
to keep external and internal RC the same.

Change-Id: I2f1f67f8aa6586603801d5d65889445e2000d720
  • Loading branch information
marco99zz committed Jul 18, 2024
1 parent b90f901 commit 8bc0414
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions av1/encoder/ratectrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2431,10 +2431,6 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) {
void av1_rc_postencode_update_drop_frame(AV1_COMP *cpi) {
// Update buffer level with zero size, update frame counters, and return.
update_buffer_level(cpi, 0);
if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1) {
cpi->rc.frames_since_key++;
cpi->rc.frames_to_key--;
}
cpi->rc.rc_2_frame = 0;
cpi->rc.rc_1_frame = 0;
cpi->rc.prev_avg_frame_bandwidth = cpi->rc.avg_frame_bandwidth;
Expand Down
2 changes: 2 additions & 0 deletions av1/ratectrl_rtc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ FrameDropDecision AV1RateControlRTC::ComputeQP(
av1_rc_drop_frame(cpi_)) {
cpi_->is_dropped_frame = true;
av1_rc_postencode_update_drop_frame(cpi_);
if (cpi_->svc.spatial_layer_id == cpi_->svc.number_spatial_layers - 1)
cpi_->rc.frames_since_key++;
cpi_->frame_index_set.show_frame_count++;
cpi_->common.current_frame.frame_number++;
return FrameDropDecision::kDrop;
Expand Down

0 comments on commit 8bc0414

Please sign in to comment.