On 4/9/2020 10:25 PM, Fu, Linjie wrote: >> From: ffmpeg-devel <ffmpeg-devel-boun...@ffmpeg.org> On Behalf Of >> James Almer >> Sent: Friday, April 10, 2020 02:27 >> To: ffmpeg-devel@ffmpeg.org >> Subject: [FFmpeg-devel] [PATCH v2] avcodec/nvenc: adapt to the new >> internal encode API >> >> Signed-off-by: James Almer <jamr...@gmail.com> >> --- >> Version with the flush() callback left in place. But it will need the >> changes i originally added to avcodec_flush_buffers() and then removed >> for the latest iteration of this set, in some form or another. >> >> libavcodec/nvenc.c | 78 ++++++++++++++++++----------------------- >> libavcodec/nvenc.h | 9 ++--- >> libavcodec/nvenc_h264.c | 6 ---- >> libavcodec/nvenc_hevc.c | 4 --- >> 4 files changed, 36 insertions(+), 61 deletions(-) >> >> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c >> index 9a96bf2bba..700a9a7a97 100644 >> --- a/libavcodec/nvenc.c >> +++ b/libavcodec/nvenc.c >> @@ -30,6 +30,7 @@ >> #include "libavutil/avassert.h" >> #include "libavutil/mem.h" >> #include "libavutil/pixdesc.h" >> +#include "encode.h" >> #include "internal.h" >> >> >> - if (output_ready(avctx, ctx->encoder_flushing)) { >> + if (!frame->buf[0]) { >> + res = ff_encode_get_frame(avctx, frame); >> + if (res < 0 && res != AVERROR_EOF) >> + return res; >> + } >> + >> + res = nvenc_send_frame(avctx, frame); >> + if (res < 0) { >> + if (res != AVERROR(EAGAIN)) >> + return res; >> + } else >> + av_frame_unref(frame); > > Would it be better to use av_frame_move_ref inside nvenc_upload_frame() > in nvenc_send_frame() instead of add frame reference again? > > Didn't verify in nvenc, but such modification leads to some performance > improvements > for vaapi.
The frame is used after the call to nvenc_upload_frame(), so not possible without bigger changes. > > - Linjie > _______________________________________________ > 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". > _______________________________________________ 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".