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

Function ff_d3d12va_encode_close

libavcodec/d3d12va_encode.c:1865–1911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1863}
1864
1865int ff_d3d12va_encode_close(AVCodecContext *avctx)
1866{
1867 int num_allocator = 0;
1868 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
1869 D3D12VAEncodeContext *ctx = avctx->priv_data;
1870 FFHWBaseEncodePicture *pic, *next;
1871 CommandAllocator allocator;
1872
1873 if (!base_ctx->frame)
1874 return 0;
1875
1876 for (pic = base_ctx->pic_start; pic; pic = next) {
1877 next = pic->next;
1878 d3d12va_encode_free(avctx, pic);
1879 }
1880
1881 d3d12va_encode_free_rc_params(avctx);
1882
1883 av_buffer_pool_uninit(&ctx->output_buffer_pool);
1884
1885 D3D12_OBJECT_RELEASE(ctx->command_list);
1886 D3D12_OBJECT_RELEASE(ctx->command_queue);
1887
1888 if (ctx->allocator_queue) {
1889 while (av_fifo_read(ctx->allocator_queue, &allocator, 1) >= 0) {
1890 num_allocator++;
1891 D3D12_OBJECT_RELEASE(allocator.command_allocator);
1892 }
1893
1894 av_log(avctx, AV_LOG_VERBOSE, "Total number of command allocators reused: %d\n", num_allocator);
1895 }
1896
1897 av_fifo_freep2(&ctx->allocator_queue);
1898
1899 D3D12_OBJECT_RELEASE(ctx->sync_ctx.fence);
1900 if (ctx->sync_ctx.event)
1901 CloseHandle(ctx->sync_ctx.event);
1902
1903 D3D12_OBJECT_RELEASE(ctx->encoder_heap);
1904 D3D12_OBJECT_RELEASE(ctx->encoder);
1905 D3D12_OBJECT_RELEASE(ctx->video_device3);
1906 D3D12_OBJECT_RELEASE(ctx->device3);
1907
1908 ff_hw_base_encode_close(base_ctx);
1909
1910 return 0;
1911}

Callers 3

d3d12va_encode_av1_closeFunction · 0.85

Calls 7

d3d12va_encode_freeFunction · 0.85
av_buffer_pool_uninitFunction · 0.85
av_fifo_readFunction · 0.85
av_logFunction · 0.85
av_fifo_freep2Function · 0.85
ff_hw_base_encode_closeFunction · 0.85

Tested by

no test coverage detected