Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VAAPI AV1 Encode] Encoder doesn't check VAConfigAttribEncMaxRefFrames #278

Open
sivileri opened this issue Oct 4, 2023 · 4 comments
Open

Comments

@sivileri
Copy link
Contributor

sivileri commented Oct 4, 2023

On official ffmpeg (with the upstreamed AV1 encode patch), the encoder seems to be generating bitstreams using always 2 reference frames set to LAST/GOLDEN for P, even when VAConfigAttribEncMaxRefFrames.L0 reports a lower limit (e.g max 1 L0 reference frame).

@feiwan1 Is this something that could be checked so only the LAST reference is used for P when VAConfigAttribEncMaxRefFrames.L0 = 1 ? This affects the vaon12 VA driver which has encode AV1 support over different hardware abstracted through D3D12 reporting different support for VAConfigAttribEncMaxRefFrames.

Thanks!

@sivileri
Copy link
Contributor Author

sivileri commented Oct 5, 2023

Actually, looks like this also affects other codecs like H264/HEVC encoding with VAAPI, could we add such check for those as well?

@feiwan1
Copy link
Contributor

feiwan1 commented Oct 8, 2023

OK, I will add the max ref frames check. BTW, 2 refs for P frame is only avaliable for AV1. Other codecs still use one ref for P frame.

@sivileri
Copy link
Contributor Author

sivileri commented Oct 8, 2023

Thanks @feiwan1 ! For B frames in AV1, vaon12 is also reporting the L1 limit in the upper 16 bits of VAConfigAttribEncMaxRefFrames, right now looks like encoding B uses 2 references, could also the max references check be staged in the B case in case in the future there are more references used in B frame, so they're always under the L1 limit of VAConfigAttribEncMaxRefFrames too ?

@feiwan1
Copy link
Contributor

feiwan1 commented Oct 9, 2023

Thanks @feiwan1 ! For B frames in AV1, vaon12 is also reporting the L1 limit in the upper 16 bits of VAConfigAttribEncMaxRefFrames, right now looks like encoding B uses 2 references, could also the max references check be staged in the B case in case in the future there are more references used in B frame, so they're always under the L1 limit of VAConfigAttribEncMaxRefFrames too ?

Sure, both L0 and L1 should be checked.

BtbN pushed a commit to FFmpeg/FFmpeg that referenced this issue Dec 22, 2024
Some drivers are more strict about the size of the reference lists given
(i.e. VAOn12 [1]). The next_prev list is used to handle multiple "L0"
references in AV1 encode. Restrict the size of next_prev based on the
value of ref_l0 when the GOP structure is initialized.

[1] intel/cartwheel-ffmpeg#278

v2: fix indentation issues
richardpl pushed a commit to librempeg/librempeg that referenced this issue Dec 23, 2024
Some drivers are more strict about the size of the reference lists given
(i.e. VAOn12 [1]). The next_prev list is used to handle multiple "L0"
references in AV1 encode. Restrict the size of next_prev based on the
value of ref_l0 when the GOP structure is initialized.

[1] intel/cartwheel-ffmpeg#278

v2: fix indentation issues
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

No branches or pull requests

2 participants