Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Schwarzer <cnschwarzer@qq.com>
To: ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [AMD-AMF] What does these code in amfenc.c actually mean?
Date: Sun, 25 Dec 2022 00:27:13 +0800
Message-ID: <tencent_130145E79E04996DBDA390C40A654825E308@qq.com> (raw)

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-&gt;pVtbl-&gt;SetCrop(surface, 0, 0, frame-&gt;width, frame-&gt;height);

    frame_ref_storage_buffer = amf_create_buffer_with_frame_ref(frame, ctx-&gt;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-&gt;hwsurfaces_in_queue++;
    frame_ref_storage_buffer-&gt;pVtbl-&gt;Release(frame_ref_storage_buffer);
}



Line 707
buffer-&gt;pVtbl-&gt;Release(buffer);

if (data-&gt;pVtbl-&gt;HasProperty(data, L"av_frame_ref")) {
    AMFBuffer *frame_ref_storage_buffer;
    res = amf_get_property_buffer(data, L"av_frame_ref", &amp;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-&gt;hwsurfaces_in_queue--;
}

data-&gt;pVtbl-&gt;Release(data);








Schwarzer
cnschwarzer@qq.com



&nbsp;
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

                 reply	other threads:[~2022-12-24 16:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_130145E79E04996DBDA390C40A654825E308@qq.com \
    --to=cnschwarzer@qq.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git