[Question]: PreAnalysis Documentation Accuracy
I have some questions regarding the accuracy of certain statements in the AMF documentation.
Pre-Analysis
On page 5 of the "Pre-Analysis Component" document, it states:
In the current release, the PA feature is only supported when operating in PEAK_CONSTRAINED_VBR rate control mode. PA is automatically disabled in other rate control modes. PA cannot work with pre-encode assisted rate control (AMF_VIDEO_ENCODER_PREENCODE_ENABLE) and VBAQ (AMF_VIDEO_ENCODER_ENABLE_VBAQ) features. When PA is enabled, pre-encode assisted rate control and VBAQ settings are ignored.
- When using the CBR rate control it seems you are still able to activate
EnablePreAnalysis.
When setting it to true prior to encoder init, there seems to be no issue (no error thrown). When querying the encoder (get_amf_property) about the state of EnablePreAnalysis, it will return TRUE. The load on the GPU is also increased when enabled.
Is the response faulty? I did double check by setting it to both TRUE and FALSE, and the query comes back with what I had it set to. It would seem to be that it does in fact function while in CBR mode, despite the docs stating that it is PEAK_CONSTRAINED_VBR exclusive.
If the response is correct, the documentation needs to be corrected to reflect this.
AMF Video encoding seems deterministic, and I can encode 3+ identical files, so we can use this to tell if an option has changed.
I tested this via breakpoints in the debugger, as well as comparing that the output is different when comparing it TRUE vs FALSE.
- When Pre-Analysis is enabled, you can still use VBAQ
Essentially the same procedure as above. Ensuring both is set, no errors thrown, and querying its state results in the expected value (both TRUE).
Breakpoints in the debugger + queries both sugget both are enabled correctly.
When comparing PA + VBAQ true encoded file vs a PA + VBAQ false encoded files, it's clear that the files generated are different.
This seems to suggest to me that the encoder will accept both, and produce working output with both enabled. Assuming this is correct, it as well should be updated in the docs to reflect this.
Additional information has now surfaced. The issue seems to have come from a driver issue.
I was running 22.7.1 at the time of posting, and after downgrading the drivers to 22.5.1, pre-analysis is now actually working, and the behavior described above no longer happens.
That is to say:
- It still seems like Pre-Analysis will work on other rate controls, for instance CBR.
- Pre-Analysis now seems to work correctly, and does now in fact prevent VBAQ from being enabled.
This was on a Ryzen 5 4500U APU
The PreAnalysis Component will work in other Rate Control methods, as mentioned by MikhailAMD over in this thread:
PA (AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE) feature enables pre-analyze of the input video and allows user to enable some PA features listed in table 1. It also allows user to enables some other feature such as: AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP Or AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD = QVBR, HQVBR or HQCBR.
PA will add extra latency so it is recommended to enable only under these rate control methods: AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD = VBR or QVBR, HQVBR or HQCBR. PA can work with pre-encode assisted rate control (AMF_VIDEO_ENCODER_PREENCODE_ENABLE) and extended 2 pass motion search (AMF_VIDEO_ENCODER_HIGH_MOTION_QUALITY_BOOST_ENABLE).
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/318#issuecomment-1148055185
Documentation to convey this has not been updated as of yet.
Thank you for clarifying @rhutsAMD. I can now see why the (now old) documentation said what it did.