I'm using h264_amf in my project, and want to use D3D11 pixel format to encode video in D3D11Texture2D to elinimate copy between GPU and CPU. I found the performance is very poor, comparing to obs-project which also use AMF as an encoder. After comparing and debugging through codes, I found these code strange and seems does nothing useful to encoding job:
In branch 5.1.2 amfenc.c Line 659 if (hw_surface) { AMFBuffer *frame_ref_storage_buffer; // input HW surfaces can be vertically aligned by 16; tell AMF the real size surface->pVtbl->SetCrop(surface, 0, 0, frame->width, frame->height); frame_ref_storage_buffer = amf_create_buffer_with_frame_ref(frame, ctx->context); AMF_RETURN_IF_FALSE(ctx, frame_ref_storage_buffer != NULL, AVERROR(ENOMEM), "create_buffer_with_frame_ref() returned NULL\n"); res = amf_set_property_buffer(surface, L"av_frame_ref", frame_ref_storage_buffer); AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "SetProperty failed for \"av_frame_ref\" with error %d\n", res); ctx->hwsurfaces_in_queue++; frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer); } Line 707 buffer->pVtbl->Release(buffer); if (data->pVtbl->HasProperty(data, L"av_frame_ref")) { AMFBuffer *frame_ref_storage_buffer; res = amf_get_property_buffer(data, L"av_frame_ref", &frame_ref_storage_buffer); AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_UNKNOWN, "GetProperty failed for \"av_frame_ref\" with error %d\n", res); amf_release_buffer_with_frame_ref(frame_ref_storage_buffer); ctx->hwsurfaces_in_queue--; } data->pVtbl->Release(data); Schwarzer cnschwar...@qq.com _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".