MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / vaapi_encode_init_roi

Function vaapi_encode_init_roi

libavcodec/vaapi_encode.c:2022–2054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2020}
2021
2022static av_cold int vaapi_encode_init_roi(AVCodecContext *avctx)
2023{
2024#if VA_CHECK_VERSION(1, 0, 0)
2025 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
2026 VAAPIEncodeContext *ctx = avctx->priv_data;
2027 VAStatus vas;
2028 VAConfigAttrib attr = { VAConfigAttribEncROI };
2029
2030 vas = vaGetConfigAttributes(ctx->hwctx->display,
2031 ctx->va_profile,
2032 ctx->va_entrypoint,
2033 &attr, 1);
2034 if (vas != VA_STATUS_SUCCESS) {
2035 av_log(avctx, AV_LOG_ERROR, "Failed to query ROI "
2036 "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
2037 return AVERROR_EXTERNAL;
2038 }
2039
2040 if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
2041 base_ctx->roi_allowed = 0;
2042 } else {
2043 VAConfigAttribValEncROI roi = {
2044 .value = attr.value,
2045 };
2046
2047 ctx->roi_max_regions = roi.bits.num_roi_regions;
2048 base_ctx->roi_allowed = ctx->roi_max_regions > 0 &&
2049 (ctx->va_rc_mode == VA_RC_CQP ||
2050 roi.bits.roi_rc_qp_delta_support);
2051 }
2052#endif
2053 return 0;
2054}
2055
2056static void vaapi_encode_free_output_buffer(AVRefStructOpaque opaque,
2057 void *obj)

Callers 1

ff_vaapi_encode_initFunction · 0.85

Calls 1

av_logFunction · 0.85

Tested by

no test coverage detected