diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 04:57:17 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 04:57:17 +0000 |
commit | ecc69427e18d26c0f67ef445c77a2371add936a2 (patch) | |
tree | ddb0188ea033d83133dc17d9657b661f5fc8cc1a /common | |
parent | 7842728b2ec4efd52a9bd33c2acb8a6f083b1479 (diff) | |
parent | 61e0951e671386282452309d31eadabcec003704 (diff) | |
download | v4l2_codec2-aml_ips_341611000.tar.gz |
Snap for 10453563 from 61e0951e671386282452309d31eadabcec003704 to mainline-ipsec-releaseaml_ips_341611000aml_ips_341510000aml_ips_340914280aml_ips_340914200aml_ips_340914000
Change-Id: I26d83ecbc81090377378a98b8e2ed6e4f8eb9e67
Diffstat (limited to 'common')
-rw-r--r-- | common/V4L2ComponentCommon.cpp | 5 | ||||
-rw-r--r-- | common/V4L2Device.cpp | 35 | ||||
-rw-r--r-- | common/VideoTypes.cpp | 2 | ||||
-rw-r--r-- | common/include/v4l2_codec2/common/V4L2ComponentCommon.h | 2 | ||||
-rw-r--r-- | common/include/v4l2_codec2/common/VideoTypes.h | 3 |
5 files changed, 45 insertions, 2 deletions
diff --git a/common/V4L2ComponentCommon.cpp b/common/V4L2ComponentCommon.cpp index 518b489..f67a516 100644 --- a/common/V4L2ComponentCommon.cpp +++ b/common/V4L2ComponentCommon.cpp @@ -18,15 +18,18 @@ const std::string V4L2ComponentName::kVP9Encoder = "c2.v4l2.vp9.encoder"; const std::string V4L2ComponentName::kH264Decoder = "c2.v4l2.avc.decoder"; const std::string V4L2ComponentName::kVP8Decoder = "c2.v4l2.vp8.decoder"; const std::string V4L2ComponentName::kVP9Decoder = "c2.v4l2.vp9.decoder"; +const std::string V4L2ComponentName::kHEVCDecoder = "c2.v4l2.hevc.decoder"; const std::string V4L2ComponentName::kH264SecureDecoder = "c2.v4l2.avc.decoder.secure"; const std::string V4L2ComponentName::kVP8SecureDecoder = "c2.v4l2.vp8.decoder.secure"; const std::string V4L2ComponentName::kVP9SecureDecoder = "c2.v4l2.vp9.decoder.secure"; +const std::string V4L2ComponentName::kHEVCSecureDecoder = "c2.v4l2.hevc.decoder.secure"; // static bool V4L2ComponentName::isValid(const char* name) { return name == kH264Encoder || name == kVP8Encoder || name == kVP9Encoder || name == kH264Decoder || name == kVP8Decoder || name == kVP9Decoder || - name == kH264SecureDecoder || name == kVP8SecureDecoder || name == kVP9SecureDecoder; + name == kHEVCDecoder || name == kH264SecureDecoder || name == kVP8SecureDecoder || + name == kVP9SecureDecoder || name == kHEVCSecureDecoder; } // static diff --git a/common/V4L2Device.cpp b/common/V4L2Device.cpp index 68a9dca..4e44fed 100644 --- a/common/V4L2Device.cpp +++ b/common/V4L2Device.cpp @@ -50,6 +50,11 @@ #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') #endif +// HEVC parsed slices +#ifndef V4L2_PIX_FMT_HEVC_SLICE +#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') +#endif + namespace android { struct v4l2_format buildV4L2Format(const enum v4l2_buf_type type, uint32_t fourcc, @@ -1237,6 +1242,13 @@ uint32_t V4L2Device::C2ProfileToV4L2PixFmt(C2Config::profile_t profile, bool sli } else { return V4L2_PIX_FMT_VP9; } + } else if (profile >= C2Config::PROFILE_HEVC_MAIN && + profile <= C2Config::PROFILE_HEVC_3D_MAIN) { + if (sliceBased) { + return V4L2_PIX_FMT_HEVC_SLICE; + } else { + return V4L2_PIX_FMT_HEVC; + } } else { ALOGE("Unknown profile: %s", profileToString(profile)); return 0; @@ -1283,6 +1295,16 @@ C2Config::profile_t V4L2Device::v4L2ProfileToC2Profile(VideoCodec codec, uint32_ return C2Config::PROFILE_VP9_3; } break; + case VideoCodec::HEVC: + switch (profile) { + case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN: + return C2Config::PROFILE_HEVC_MAIN; + case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE: + return C2Config::PROFILE_HEVC_MAIN_STILL; + case V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10: + return C2Config::PROFILE_HEVC_MAIN_10; + } + break; default: ALOGE("Unknown codec: %u", codec); } @@ -1305,6 +1327,9 @@ std::vector<C2Config::profile_t> V4L2Device::v4L2PixFmtToC2Profiles(uint32_t pix case VideoCodec::VP9: queryId = V4L2_CID_MPEG_VIDEO_VP9_PROFILE; break; + case VideoCodec::HEVC: + queryId = V4L2_CID_MPEG_VIDEO_HEVC_PROFILE; + break; default: return false; } @@ -1355,6 +1380,16 @@ std::vector<C2Config::profile_t> V4L2Device::v4L2PixFmtToC2Profiles(uint32_t pix profiles = {C2Config::PROFILE_VP9_0}; } break; + case V4L2_PIX_FMT_HEVC: + case V4L2_PIX_FMT_HEVC_SLICE: + if (!getSupportedProfiles(VideoCodec::HEVC, &profiles)) { + ALOGW("Driver doesn't support QUERY HEVC profiles, " + "use default values, Main"); + profiles = { + C2Config::PROFILE_HEVC_MAIN, + }; + } + break; default: ALOGE("Unhandled pixelformat %s", fourccToString(pixFmt).c_str()); return {}; diff --git a/common/VideoTypes.cpp b/common/VideoTypes.cpp index c123ad1..18ebfc9 100644 --- a/common/VideoTypes.cpp +++ b/common/VideoTypes.cpp @@ -19,6 +19,8 @@ const char* VideoCodecToString(VideoCodec codec) { return "VP8"; case VideoCodec::VP9: return "VP9"; + case VideoCodec::HEVC: + return "HEVC"; } } diff --git a/common/include/v4l2_codec2/common/V4L2ComponentCommon.h b/common/include/v4l2_codec2/common/V4L2ComponentCommon.h index b8cf031..a5fbdaf 100644 --- a/common/include/v4l2_codec2/common/V4L2ComponentCommon.h +++ b/common/include/v4l2_codec2/common/V4L2ComponentCommon.h @@ -18,9 +18,11 @@ struct V4L2ComponentName { static const std::string kH264Decoder; static const std::string kVP8Decoder; static const std::string kVP9Decoder; + static const std::string kHEVCDecoder; static const std::string kH264SecureDecoder; static const std::string kVP8SecureDecoder; static const std::string kVP9SecureDecoder; + static const std::string kHEVCSecureDecoder; // Return true if |name| is a valid component name. static bool isValid(const char* name); diff --git a/common/include/v4l2_codec2/common/VideoTypes.h b/common/include/v4l2_codec2/common/VideoTypes.h index 076f096..54786e8 100644 --- a/common/include/v4l2_codec2/common/VideoTypes.h +++ b/common/include/v4l2_codec2/common/VideoTypes.h @@ -18,10 +18,11 @@ enum class VideoCodec { H264, VP8, VP9, + HEVC, }; constexpr std::initializer_list<VideoCodec> kAllCodecs = {VideoCodec::H264, VideoCodec::VP8, - VideoCodec::VP9}; + VideoCodec::VP9, VideoCodec::HEVC}; const char* VideoCodecToString(VideoCodec codec); const char* profileToString(C2Config::profile_t profile); |