Enable HEVC RFI on Tegra

This commit is contained in:
Cameron Gutman 2022-10-14 23:41:09 -05:00
parent 704ce4ff0c
commit a860bd8dd5

View file

@ -47,6 +47,22 @@
#define FAILED_DECODES_RESET_THRESHOLD 20 #define FAILED_DECODES_RESET_THRESHOLD 20
static const struct {
const char* codec;
int capabilities;
} k_NonHwaccelCodecInfo[] = {
{"h264_mmal", 0},
{"h264_rkmpp", 0},
{"h264_nvv4l2", 0},
{"h264_nvmpi", 0},
{"h264_v4l2m2m", 0},
{"hevc_rkmpp", 0},
{"hevc_nvv4l2", CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC},
{"hevc_nvmpi", 0},
{"hevc_v4l2m2m", 0},
};
bool FFmpegVideoDecoder::isHardwareAccelerated() bool FFmpegVideoDecoder::isHardwareAccelerated()
{ {
return m_HwDecodeCfg != nullptr || return m_HwDecodeCfg != nullptr ||
@ -90,6 +106,21 @@ int FFmpegVideoDecoder::getDecoderCapabilities()
slices); slices);
capabilities |= CAPABILITY_SLICES_PER_FRAME(slices); capabilities |= CAPABILITY_SLICES_PER_FRAME(slices);
} }
else if (m_HwDecodeCfg == nullptr) {
// We have a non-hwaccel hardware decoder. This will always
// be using SDLRenderer so we will pick decoder capabilities
// based on the decoder name.
for (int i = 0; i < SDL_arraysize(k_NonHwaccelCodecInfo); i++) {
if (strcmp(m_VideoDecoderCtx->codec->name, k_NonHwaccelCodecInfo[i].codec) == 0) {
capabilities = k_NonHwaccelCodecInfo[i].capabilities;
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Found capabilities for non-hwaccel decoder: %s -> %d",
m_VideoDecoderCtx->codec->name,
capabilities);
break;
}
}
}
} }
// We use our own decoder thread with the "pull" model. This cannot // We use our own decoder thread with the "pull" model. This cannot