After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719699 - encoder: h264: improve bitrate calculation
encoder: h264: improve bitrate calculation
Status: RESOLVED FIXED
Product: gstreamer-vaapi
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gstreamer-vaapi maintainer(s)
gstreamer-vaapi maintainer(s)
Depends on:
Blocks: 719412
 
 
Reported: 2013-12-02 16:55 UTC by Gwenole Beauchesne
Modified: 2014-01-13 16:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Gwenole Beauchesne 2013-12-02 16:55:21 UTC
The set of vaapiencode_h264 options mention that a value of 0 (zero) for "bitrate" means that the target bitrate would be estimated. However, the GstVaapiEncoderH264 implementation does not seem to honour that.

For CQP rate control mode, the bitrate cannot be predicted. So, this is not an issue per se. For non CQP modes, it would be necessary to better estimate the defaults.

Better heuristics could be determined through appropriate testing, but here are some suggestions. If tuning for "size", reasonable defaults could be F = 0.1875 bits per pixel. Then, if "cabac" is set to FALSE, F *= 1.18 (or 1.10). If "dct8x8" is set to FALSE, F *= 1.10, etc.

Yes, this is arbitrary, based on some articles, but better suggestions are welcome. :)
Comment 1 Gwenole Beauchesne 2014-01-13 10:37:56 UTC
Reasonable heuristic, and considering that target_percentage is 70% of the supplied target bitrate, could be 48 bits per macroblock in "high-compression" mode (CABAC + DCT8x8), and increasing by 10% per each coding tool disabled.
Comment 2 Gwenole Beauchesne 2014-01-13 16:41:31 UTC
commit c7a2095b78f9b543b9e97b8556d1d67f2e23487b
Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Date:   Mon Jan 13 11:49:14 2014 +0100

    encoder: h264: improve automatic bitrate calculation.
    
    For non "Constant-QP" modes, we could provide more reasonable heuristics
    for the target bitrate. In general, 48 bits per macroblock with all the
    useful coding tools enable looks safe enough. Then, this rate is raised
    by +10% to +15% for each coding tool that is disabled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719699