intel / intel/media-driver

Encoder: HEVC: Low Power encoder generates broken stream if B frames' reference number is bigger than 3

Open
#1,390 11 comments 0 reactions 1 assignee Claimed by @bai-isaac View on GitHub
Encode HEVC
Dominant language
C
Stars
1.2k
Forks
383
Avg merge
8d 18h
Merged PRs (30d)
4

Description

## System information
- CPU information(`cat /proc/cpuinfo | grep "model name" | uniq`): Tiger Lake
- GPU information(`lspci -nn | grep -E 'VGA|isplay`): Gen12(Or all the platforms which support B and LDB)

## Issue behavior
### Describe the current behavior
For HEVC encoder, if we set the reference number of B frame > 3, the output coded stream is broke, as attached.
The VAConfigAttribEncMaxRefFrames return 3 for L0 and 3 for L1, this is correct for Low Delay B frame, which has the same L0 and L1 list. So in fact, there are only 3 reference frames for LDB kind frame.
But for normal B frame, the user does not know the HW limitation of the reference number, and still feed 3 forward frames as List0 and 1 or 2 backward frames as list1. So the total reference number is 3+1=4 or 3+2=5, which may exceeds the HW limitation and we get a broken coded result for this B frame.
The middleware or application does not know the max reference number it can provide to driver and always fully use the query result of VAConfigAttribEncMaxRefFrames to achieve the best compression.

The attached file:
[streams.zip](https://github.com/intel/media-driver/files/8546489/streams.zip)

When the limit total reference number to 3, the result is correct.
If the reference number is bigger than 3, the B frames are broken.

### Describe the expected behavior
The driver should add some protection to avoid the reference exceeds the HW limitation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.