| 315 | } |
| 316 | |
| 317 | static int d3d12va_encode_issue(AVCodecContext *avctx, |
| 318 | FFHWBaseEncodePicture *base_pic) |
| 319 | { |
| 320 | FFHWBaseEncodeContext *base_ctx = avctx->priv_data; |
| 321 | D3D12VAEncodeContext *ctx = avctx->priv_data; |
| 322 | D3D12VAEncodePicture *pic = base_pic->priv; |
| 323 | AVD3D12VAFramesContext *frames_hwctx = base_ctx->input_frames->hwctx; |
| 324 | int err, i, j; |
| 325 | HRESULT hr; |
| 326 | char data[MAX_PARAM_BUFFER_SIZE]; |
| 327 | void *ptr; |
| 328 | size_t bit_len; |
| 329 | ID3D12CommandAllocator *command_allocator = NULL; |
| 330 | ID3D12VideoEncodeCommandList2 *cmd_list = ctx->command_list; |
| 331 | D3D12_RESOURCE_BARRIER barriers[32] = { 0 }; |
| 332 | D3D12_VIDEO_ENCODE_REFERENCE_FRAMES d3d12_refs = { 0 }; |
| 333 | int barriers_ref_index = 0; |
| 334 | D3D12_RESOURCE_BARRIER *barriers_ref = NULL; |
| 335 | |
| 336 | D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS seq_flags = D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_NONE; |
| 337 | |
| 338 | // Request intra refresh if enabled |
| 339 | if (ctx->intra_refresh.Mode != D3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE_NONE) { |
| 340 | seq_flags |= D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_REQUEST_INTRA_REFRESH; |
| 341 | } |
| 342 | |
| 343 | D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS input_args = { |
| 344 | .SequenceControlDesc = { |
| 345 | .Flags = seq_flags, |
| 346 | .IntraRefreshConfig = ctx->intra_refresh, |
| 347 | .RateControl = ctx->rc, |
| 348 | .PictureTargetResolution = ctx->resolution, |
| 349 | .SelectedLayoutMode = D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_FULL_FRAME, |
| 350 | .FrameSubregionsLayoutData = ctx->subregions_layout, |
| 351 | .CodecGopSequence = ctx->gop, |
| 352 | }, |
| 353 | .pInputFrame = pic->input_surface->texture, |
| 354 | .InputFrameSubresource = 0, |
| 355 | }; |
| 356 | |
| 357 | D3D12_VIDEO_ENCODER_ENCODEFRAME_OUTPUT_ARGUMENTS output_args = { 0 }; |
| 358 | |
| 359 | D3D12_VIDEO_ENCODER_RESOLVE_METADATA_INPUT_ARGUMENTS input_metadata = { |
| 360 | .EncoderCodec = ctx->codec->d3d12_codec, |
| 361 | .EncoderProfile = ctx->profile->d3d12_profile, |
| 362 | .EncoderInputFormat = frames_hwctx->format, |
| 363 | .EncodedPictureEffectiveResolution = ctx->resolution, |
| 364 | }; |
| 365 | |
| 366 | D3D12_VIDEO_ENCODER_RESOLVE_METADATA_OUTPUT_ARGUMENTS output_metadata = { 0 }; |
| 367 | |
| 368 | memset(data, 0, sizeof(data)); |
| 369 | |
| 370 | av_log(avctx, AV_LOG_DEBUG, "Issuing encode for pic %"PRId64"/%"PRId64" " |
| 371 | "as type %s.\n", base_pic->display_order, base_pic->encode_order, |
| 372 | ff_hw_base_encode_get_pictype_name(base_pic->type)); |
| 373 | if (base_pic->nb_refs[0] == 0 && base_pic->nb_refs[1] == 0) { |
| 374 | av_log(avctx, AV_LOG_DEBUG, "No reference pictures.\n"); |
nothing calls this directly
no test coverage detected