diff options
author | David Staessens <dstaessens@google.com> | 2021-05-12 05:56:13 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-05-12 05:56:13 +0000 |
commit | a0d66ba27efe58cb79c701be1e56adcfc93e662c (patch) | |
tree | e5992120469c1542ac41ce3f7f4e101baaad6efc | |
parent | 1a5a53b20f1b8bbc2b6e503e34296edf65a40a36 (diff) | |
parent | eca6155b4da333cebc9f57acc3af8a5259d9ee0e (diff) | |
download | v4l2_codec2-a0d66ba27efe58cb79c701be1e56adcfc93e662c.tar.gz |
v4l2_codec2: Remove minimum H.264 profile workaround in V4L2 encoder. am: eca6155b4d
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/v4l2_codec2/+/14511930
Change-Id: Idadc01e05b698f23b29759f82ac9c78fa89f8d76
-rw-r--r-- | components/V4L2EncodeInterface.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/components/V4L2EncodeInterface.cpp b/components/V4L2EncodeInterface.cpp index 48e5fe3..f0abd29 100644 --- a/components/V4L2EncodeInterface.cpp +++ b/components/V4L2EncodeInterface.cpp @@ -43,9 +43,6 @@ constexpr uint32_t kDefaultBitrate = 64000; // TODO: increase this in the future for supporting higher level/resolution encoding. constexpr uint32_t kMaxBitrate = 50000000; -// The frame size of 1080p video. -constexpr uint32_t kFrameSize1080P = 1920 * 1080; - C2Config::profile_t videoCodecProfileToC2Profile(media::VideoCodecProfile profile) { switch (profile) { case media::VideoCodecProfile::H264PROFILE_BASELINE: @@ -116,23 +113,16 @@ C2R V4L2EncodeInterface::H264ProfileLevelSetter( const C2P<C2StreamBitrateInfo::output>& bitrate) { static C2Config::level_t lowestConfigLevel = C2Config::LEVEL_UNUSED; - // Use at least PROFILE_AVC_MAIN as default for 1080p input video and up. - // TODO (b/114332827): Find root cause of bad quality of Baseline encoding. - C2Config::profile_t defaultMinProfile = C2Config::PROFILE_AVC_BASELINE; - if (videoSize.v.width * videoSize.v.height >= kFrameSize1080P) { - defaultMinProfile = C2Config::PROFILE_AVC_MAIN; - } - // Adopt default minimal profile instead if the requested profile is not supported, or lower // than the default minimal one. - if (!info.F(info.v.profile).supportsAtAll(info.v.profile) || - info.v.profile < defaultMinProfile) { - if (info.F(info.v.profile).supportsAtAll(defaultMinProfile)) { - ALOGV("Set profile to default (%u) instead.", defaultMinProfile); - info.set().profile = defaultMinProfile; + constexpr C2Config::profile_t minProfile = C2Config::PROFILE_AVC_BASELINE; + if (!info.F(info.v.profile).supportsAtAll(info.v.profile) || info.v.profile < minProfile) { + if (info.F(info.v.profile).supportsAtAll(minProfile)) { + ALOGV("Set profile to default (%u) instead.", minProfile); + info.set().profile = minProfile; } else { ALOGE("Unable to set either requested profile (%u) or default profile (%u).", - info.v.profile, defaultMinProfile); + info.v.profile, minProfile); return C2R(C2SettingResultBuilder::BadValue(info.F(info.v.profile))); } } |