diff options
author | David Staessens <dstaessens@google.com> | 2021-06-07 14:54:53 +0900 |
---|---|---|
committer | Chih-Yu Huang <akahuang@google.com> | 2021-10-20 12:07:10 +0900 |
commit | df5be4b969430c7d933b1bd9d01be3d4836a589d (patch) | |
tree | 4df62d16231d132c6134855074f6cc4f80898c6b /components/V4L2EncodeInterface.cpp | |
parent | bc5b861c8ef10aef8c3b7c48b350314d8d000b44 (diff) | |
download | v4l2_codec2-df5be4b969430c7d933b1bd9d01be3d4836a589d.tar.gz |
v4l2_codec2 encoder: Add support for configuring the bitrate mode.
This CL adds support for the C2_PARAMKEY_BITRATE_MODE parameter to the
v4l2 encoder. This parameter allows configuring the bitrate mode used
to encode a video.
The supported bitrate modes are:
- C2Config::BITRATE_VARIABLE
- C2Config::BITRATE_CONST
Note: Currently the C2 framework does not support configuring the peak
bitrate, which is used when the bitrate mode is set to VBR. Instead we
set the peak bitrate to a multiple of the target bitrate.
Note: Submit after support for V4L2_CID_MPEG_VIDEO_BITRATE_PEAK and
V4L2_CID_MPEG_VIDEO_BITRATE_MODE has been added to the virto encoder in
crrev.com/c/2944506.
BUG: 190336806
BUG: 181514834
Test: arc.VideoEncodeAccel.h264_192p_i420_vm
Change-Id: I95d8f9921c1ba475ea8c65760d3c18e5e2818d5e
Diffstat (limited to 'components/V4L2EncodeInterface.cpp')
-rw-r--r-- | components/V4L2EncodeInterface.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/components/V4L2EncodeInterface.cpp b/components/V4L2EncodeInterface.cpp index 7f0fb39..2bdf11b 100644 --- a/components/V4L2EncodeInterface.cpp +++ b/components/V4L2EncodeInterface.cpp @@ -310,6 +310,15 @@ void V4L2EncodeInterface::Initialize(const C2String& name) { .withSetter(Setter<decltype(*mBitrate)>::StrictValueWithNoDeps) .build()); + addParameter( + DefineParam(mBitrateMode, C2_PARAMKEY_BITRATE_MODE) + .withDefault(new C2StreamBitrateModeTuning::output(0u, C2Config::BITRATE_CONST)) + .withFields( + {C2F(mBitrateMode, value) + .oneOf({C2Config::BITRATE_CONST, C2Config::BITRATE_VARIABLE})}) + .withSetter(Setter<decltype(*mBitrateMode)>::StrictValueWithNoDeps) + .build()); + std::string outputMime; if (getCodecFromComponentName(name) == VideoCodec::H264) { outputMime = MEDIA_MIMETYPE_VIDEO_AVC; |