Skip to content

Comments

Fix MVC per-view DPB management: add same_views mask#24

Open
intrepidsilence wants to merge 1 commit intotvlabs:masterfrom
intrepidsilence:fix/mvc-per-view-dpb
Open

Fix MVC per-view DPB management: add same_views mask#24
intrepidsilence wants to merge 1 commit intotvlabs:masterfrom
intrepidsilence:fix/mvc-per-view-dpb

Conversation

@intrepidsilence
Copy link

Summary

Two DPB management checks in edge264_headers.c count pending frames from both MVC views against per-view SPS limits. This causes incorrect frame bumping and output ordering in MVC streams.

The Two Bugs (Same Root Cause)

1. DPB fullness check (line ~1225)

// Before: counts both views against per-view limit
while (popcount(reference_frames | to_get & ~output) > max_dec_frame_buffering && max_bump--)

// After: counts only current view
while (popcount((reference_frames | to_get & ~output) & same_views) > max_dec_frame_buffering && max_bump--)

With both views contributing ~8 frames against a per-view limit of 4, the loop bumps too many frames, driving max_bump negative. The max_bump < 0 path then directly inserts frames into the FIFO output queue, bypassing bump_frame()'s POC-ordered output. This corrupts the base view's display order.

2. Reorder threshold check (line ~1231)

// Before: counts both views against per-view limit
} else if (popcount(to_get & ~output) > max_num_reorder_frames) {

// After: counts only current view
} else if (popcount(to_get & ~output & same_views) > max_num_reorder_frames) {

Counting both views' pending frames triggers premature bumping from the current view's queue. Since edge264_get_frame() pairs base and dependent views by FIFO queue position, this desynchronizes the two queues, pairing frames from different temporal moments.

Symptoms

  • Bug 1: Base view (left eye) frame stutter during playback — frames appear out of display order
  • Bug 2: Dependent view (right eye) exhibits ±1 frame temporal oscillation in a repeating 6-frame cycle matching the IBBBP GOP substructure

Quantitative analysis of a commercial MVC stream showed ~63% of dependent view frames were temporally displaced by ±1 frame (±42ms at 24fps).

Verification

  • Tested on commercial 3D Blu-ray MVC streams (130,000+ frame pairs, High Profile, CABAC, max_num_reorder_frames=4)
  • Before fix: periodic right-eye motion spikes (1.4x mean, up to 2.2x) and left-eye POC ordering corruption
  • After fix: both views smooth, correct stereo output across entire stream
  • 85/85 JVT conformance streams continue to pass

Note

The same_views bitmask is already used correctly in the max_bump calculation at line 1222 and in bump_frame() itself. These two lines were the only places missing it.

In MVC streams, the DPB fullness check (line 1225) and reorder
threshold check (line 1231) count pending frames from both views
against per-view SPS limits (max_dec_frame_buffering and
max_num_reorder_frames). This causes two problems:

1. DPB fullness (line 1225): With both views contributing ~8 frames
   against a per-view limit of 4, the while loop bumps too many frames,
   driving max_bump negative. The max_bump < 0 path (line 1228) then
   directly inserts frames into the FIFO output queue, bypassing
   bump_frame()'s POC-ordered output. This corrupts the base view's
   display order.

2. Reorder threshold (line 1231): Counting both views' pending frames
   triggers premature bumping of frames from the current view's output
   queue. Since edge264_get_frame() pairs base and dependent views by
   FIFO queue position, this desynchronizes the two queues, causing
   the dependent view to be paired with the wrong temporal frame.

Fix both by masking with same_views before counting, so each view's
frames are checked independently against its own limits. The
same_views bitmask is already computed earlier in the function.

Symptoms: base view frame stutter (bug 1) and dependent view +/-1
frame temporal oscillation in a periodic pattern matching the GOP
substructure (bug 2). Verified on commercial 3D Blu-ray MVC streams
with max_num_reorder_frames=4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant