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

Function ff_vaapi_encode_init

libavcodec/vaapi_encode.c:2157–2343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2155}
2156
2157av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
2158{
2159 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
2160 VAAPIEncodeContext *ctx = avctx->priv_data;
2161 AVVAAPIFramesContext *recon_hwctx = NULL;
2162 VAStatus vas;
2163 int err;
2164
2165 err = ff_hw_base_encode_init(avctx, base_ctx);
2166 if (err < 0)
2167 goto fail;
2168
2169 ctx->va_config = VA_INVALID_ID;
2170 ctx->va_context = VA_INVALID_ID;
2171
2172 base_ctx->op = &vaapi_op;
2173
2174 ctx->hwctx = base_ctx->device->hwctx;
2175
2176 err = vaapi_encode_profile_entrypoint(avctx);
2177 if (err < 0)
2178 goto fail;
2179
2180 err = vaapi_encode_surface_alignment(avctx);
2181 if (err < 0)
2182 goto fail;
2183
2184 if (ctx->codec->get_encoder_caps) {
2185 err = ctx->codec->get_encoder_caps(avctx);
2186 if (err < 0)
2187 goto fail;
2188 } else {
2189 // Assume 16x16 blocks.
2190 base_ctx->surface_width = FFALIGN(avctx->width, 16);
2191 base_ctx->surface_height = FFALIGN(avctx->height, 16);
2192 if (ctx->codec->flags & FF_HW_FLAG_SLICE_CONTROL) {
2193 base_ctx->slice_block_width = 16;
2194 base_ctx->slice_block_height = 16;
2195 }
2196 }
2197
2198 err = vaapi_encode_init_rate_control(avctx);
2199 if (err < 0)
2200 goto fail;
2201
2202 err = vaapi_encode_init_gop_structure(avctx);
2203 if (err < 0)
2204 goto fail;
2205
2206 err = vaapi_encode_init_slice_structure(avctx);
2207 if (err < 0)
2208 goto fail;
2209
2210 err = vaapi_encode_init_packed_headers(avctx);
2211 if (err < 0)
2212 goto fail;
2213
2214 err = vaapi_encode_init_roi(avctx);

Callers 7

vaapi_encode_av1_initFunction · 0.85
vaapi_encode_vp9_initFunction · 0.85
vaapi_encode_vp8_initFunction · 0.85
vaapi_encode_mpeg2_initFunction · 0.85
vaapi_encode_h265_initFunction · 0.85
vaapi_encode_h264_initFunction · 0.85
vaapi_encode_mjpeg_initFunction · 0.85

Tested by

no test coverage detected