elwrclandClaude Opus 5 f68161c313 hasvk: Add open-loop CBR and VBR rate control for gen7.
Only constant QP was offered.  Add the two bitrate modes, with the quantizer
derived once per picture from the requested bitrate and frame rate.

There is no closed loop and there cannot be one here: a picture's size is
known only after the GPU encodes it, and vkCmdEncodeVideoKHR merely records
commands.  The VA-API encoder for this hardware runs its bit rate control
after each frame completes, which that API's synchronisation allows and this
one does not, and gen7 has no macroblock-level rate control the hardware
drives on its own -- the VA-API driver leaves those MFX_AVC_IMG_STATE fields
zero on this generation.  Vulkan defines rate control as best effort, and
this is the effort.

The quantizer comes from a measured curve rather than a guess: sweeping QP 14
to 50 over a 176x144 clip gives 361 bits per macroblock at QP 26 for an I
picture and 166 for a P one, halving every 12.5 steps of the quantizer for I
and every 10.3 for P.  Measured against the target across a 15x range of
bitrates, I pictures land between 0.82x and 1.30x, P pictures between 0.59x
and 1.56x -- the spread on P is content dependent and nothing open loop can
narrow it.  A target below about 90 bits per macroblock cannot be met at all,
since that is where the curve flattens.

dEQP-VK.video.encode.h264 goes from 84 to 92 of 120 with no failures.  The
remaining 28 are quantization maps, which gen7 has no hardware path for, and
B frames.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-21 08:21:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00
2026-06-06 13:25:15 +03:00

The software may implement third party technologies (e.g. third party
libraries) that are not licensed to you by AMD and for which you may need
to obtain licenses from other parties.  Unless explicitly stated otherwise,
these third party technologies are not licensed hereunder.  Such third
party technologies include, but are not limited, to H.264, MPEG-2, MPEG-4,
AVC, and VC-1.  

For MPEG-2 Intermediate Products: ANY USE OF THIS PRODUCT IN ANY MANNER OTHER
THAN PERSONAL USE THAT COMPLIES WITH THE MPEG-2 STANDARD IS EXPRESSLY
PROHIBITED WITHOUT A LICENSE UNDER APPLICABLE PATENTS IN THE MPEG-2 PATENT
PORTFOLIO, WHICH LICENSES IS AVAILABLE FROM MPEG LA, LLC, 6312 S. Fiddlers
Green Circle, Suite 400E, Greenwood Village, Colorado 80111 U.S.A.

WARRANTY DISCLAIMER: THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND.  AMD DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, THAT THE SOFTWARE WILL RUN
UNINTERRUPTED OR ERROR-FREE OR WARRANTIES ARISING FROM CUSTOM OF TRADE OR
COURSE OF USAGE.  THE ENTIRE RISK ASSOCIATED WITH THE USE OF THE SOFTWARE IS
ASSUMED BY YOU.  Some jurisdictions do not allow the exclusion of implied
warranties, so the above exclusion may not apply to You.

LIMITATION OF LIABILITY AND INDEMNIFICATION:  AMD AND ITS LICENSORS WILL NOT,
UNDER ANY CIRCUMSTANCES BE LIABLE FOR ANY PUNITIVE, DIRECT, INCIDENTAL,
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM USE OF THE SOFTWARE OR
THIS AGREEMENT EVEN IF AMD AND ITS LICENSORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.  In no event shall AMD's total liability to You
for all damages, losses, and causes of action (whether in contract, tort
(including negligence) or otherwise) exceed the amount of $100 USD.  You agree
to defend, indemnify and hold harmless AMD and its licensors, and any of their
directors, officers, employees, affiliates or agents from and against any and
all loss, damage, liability and other expenses (including reasonable
attorneys' fees), resulting from Your use of the Software or violation of the
terms and conditions of this Agreement.

U.S. GOVERNMENT RESTRICTED RIGHTS: The Software is provided with "RESTRICTED
RIGHTS." Use, duplication, or disclosure by the Government is subject to the
restrictions as set forth in FAR 52.227-14 and DFAR252.227-7013, et seq., or
its successor.  Use of the Software by the Government constitutes
acknowledgement of AMD's proprietary rights in them.

EXPORT RESTRICTIONS: The Software may be subject to export restrictions as
stated in the Software License Agreement.
S
Description
No description provided
Readme
119 MiB
0 Stars 2 Watchers 0 Forks
Languages
C 75.5%
C++ 17.6%
Python 2.6%
Rust 1.9%
Assembly 1.3%
Other 0.8%