Message ID | 20240901000314.379276-2-dev@lynne.ee |
---|---|
State | New |
Headers | show |
Series | None | expand |
Lynne: >Subject: [FFmpeg-devel] [PATCH 03/10] hw_base_encode: allocate DPB image >upfront > >Vulkan requires this, as it needs to initialize state upfront. >--- > libavcodec/d3d12va_encode.c | 6 ------ > libavcodec/hw_base_encode.c | 6 ++++++ > libavcodec/vaapi_encode.c | 5 ----- > 3 files changed, 6 insertions(+), 11 deletions(-) > >diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c index >d437750598..68fb9927a8 100644 >--- a/libavcodec/d3d12va_encode.c >+++ b/libavcodec/d3d12va_encode.c >@@ -264,12 +264,6 @@ static int d3d12va_encode_issue(AVCodecContext >*avctx, > > av_log(avctx, AV_LOG_DEBUG, "Input surface is %p.\n", pic->input_surface- >>texture); > >- err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic- >>recon_image, 0); >- if (err < 0) { >- err = AVERROR(ENOMEM); >- goto fail; >- } >- > pic->recon_surface = (AVD3D12VAFrame *)base_pic->recon_image->data[0]; > av_log(avctx, AV_LOG_DEBUG, "Recon surface is %p.\n", > pic->recon_surface->texture); diff --git a/libavcodec/hw_base_encode.c >b/libavcodec/hw_base_encode.c index 35dac6e596..8411cc7582 100644 >--- a/libavcodec/hw_base_encode.c >+++ b/libavcodec/hw_base_encode.c >@@ -446,6 +446,12 @@ static int >hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex > goto fail; > } > >+ err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, 0); >+ if (err < 0) { >+ err = AVERROR(ENOMEM); >+ goto fail; >+ } >+ > pic->priv = av_mallocz(ctx->op->priv_size); > if (!pic->priv) { > err = AVERROR(ENOMEM); Pls rebase this patch to current master or just push the refactor patch V3. >diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index >b72e9035cb..0058e1e772 100644 >--- a/libavcodec/vaapi_encode.c >+++ b/libavcodec/vaapi_encode.c >@@ -313,11 +313,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx, > > av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); > >- err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic- >>recon_image, 0); >- if (err < 0) { >- err = AVERROR(ENOMEM); >- goto fail; >- } > pic->recon_surface = (VASurfaceID)(uintptr_t)base_pic->recon_image- >>data[3]; > av_log(avctx, AV_LOG_DEBUG, "Recon surface is %#x.\n", pic->recon_surface); > >-- >2.45.2.753.g447d99e1c3b >_______________________________________________ >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".
On 04/09/2024 16:36, Tong Wu wrote: > Lynne: >> Subject: [FFmpeg-devel] [PATCH 03/10] hw_base_encode: allocate DPB image >> upfront >> >> Vulkan requires this, as it needs to initialize state upfront. >> --- >> libavcodec/d3d12va_encode.c | 6 ------ >> libavcodec/hw_base_encode.c | 6 ++++++ >> libavcodec/vaapi_encode.c | 5 ----- >> 3 files changed, 6 insertions(+), 11 deletions(-) >> >> diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c index >> d437750598..68fb9927a8 100644 >> --- a/libavcodec/d3d12va_encode.c >> +++ b/libavcodec/d3d12va_encode.c >> @@ -264,12 +264,6 @@ static int d3d12va_encode_issue(AVCodecContext >> *avctx, >> >> av_log(avctx, AV_LOG_DEBUG, "Input surface is %p.\n", pic->input_surface- >>> texture); >> >> - err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic- >>> recon_image, 0); >> - if (err < 0) { >> - err = AVERROR(ENOMEM); >> - goto fail; >> - } >> - >> pic->recon_surface = (AVD3D12VAFrame *)base_pic->recon_image->data[0]; >> av_log(avctx, AV_LOG_DEBUG, "Recon surface is %p.\n", >> pic->recon_surface->texture); diff --git a/libavcodec/hw_base_encode.c >> b/libavcodec/hw_base_encode.c index 35dac6e596..8411cc7582 100644 >> --- a/libavcodec/hw_base_encode.c >> +++ b/libavcodec/hw_base_encode.c >> @@ -446,6 +446,12 @@ static int >> hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex >> goto fail; >> } >> >> + err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, 0); >> + if (err < 0) { >> + err = AVERROR(ENOMEM); >> + goto fail; >> + } >> + >> pic->priv = av_mallocz(ctx->op->priv_size); >> if (!pic->priv) { >> err = AVERROR(ENOMEM); > > Pls rebase this patch to current master or just push the refactor patch V3. Err, it requires the refactor patch. I posted an updated version of the refactor patch as part 1 of this series. You can also just pull from my branch which contains all patches in this patchset. https://github.com/cyanreg/FFmpeg/tree/vulkan
Lynne: >To: Tong Wu <wutong1208@outlook.com>; FFmpeg development discussions and >patches <ffmpeg-devel@ffmpeg.org> >Cc: Lynne <dev@lynne.ee> >Subject: Re: [FFmpeg-devel] [PATCH 03/10] hw_base_encode: allocate DPB image >upfront > >On 04/09/2024 16:36, Tong Wu wrote: >> Lynne: >>> Subject: [FFmpeg-devel] [PATCH 03/10] hw_base_encode: allocate DPB >>> image upfront >>> >>> Vulkan requires this, as it needs to initialize state upfront. >>> --- >>> libavcodec/d3d12va_encode.c | 6 ------ libavcodec/hw_base_encode.c | >>> 6 ++++++ >>> libavcodec/vaapi_encode.c | 5 ----- >>> 3 files changed, 6 insertions(+), 11 deletions(-) >>> >>> diff --git a/libavcodec/d3d12va_encode.c >>> b/libavcodec/d3d12va_encode.c index >>> d437750598..68fb9927a8 100644 >>> --- a/libavcodec/d3d12va_encode.c >>> +++ b/libavcodec/d3d12va_encode.c >>> @@ -264,12 +264,6 @@ static int d3d12va_encode_issue(AVCodecContext >>> *avctx, >>> >>> av_log(avctx, AV_LOG_DEBUG, "Input surface is %p.\n", >>> pic->input_surface- >>>> texture); >>> >>> - err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic- >>>> recon_image, 0); >>> - if (err < 0) { >>> - err = AVERROR(ENOMEM); >>> - goto fail; >>> - } >>> - >>> pic->recon_surface = (AVD3D12VAFrame *)base_pic->recon_image- >>data[0]; >>> av_log(avctx, AV_LOG_DEBUG, "Recon surface is %p.\n", >>> pic->recon_surface->texture); diff --git >>> a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c index >>> 35dac6e596..8411cc7582 100644 >>> --- a/libavcodec/hw_base_encode.c >>> +++ b/libavcodec/hw_base_encode.c >>> @@ -446,6 +446,12 @@ static int >>> hw_base_encode_send_frame(AVCodecContext *avctx, >FFHWBaseEncodeContex >>> goto fail; >>> } >>> >>> + err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, >0); >>> + if (err < 0) { >>> + err = AVERROR(ENOMEM); >>> + goto fail; >>> + } >>> + >>> pic->priv = av_mallocz(ctx->op->priv_size); >>> if (!pic->priv) { >>> err = AVERROR(ENOMEM); >> >> Pls rebase this patch to current master or just push the refactor patch V3. > >Err, it requires the refactor patch. I posted an updated version of the refactor >patch as part 1 of this series. >You can also just pull from my branch which contains all patches in this patchset. >https://github.com/cyanreg/FFmpeg/tree/vulkan Part 1 seems lost in Patchwork somehow. I compared the refactor patch in your repo it looks like just the same one as V3 I posted before. If that's the case feel free to push that one if you feel necessary. Thanks.
diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c index d437750598..68fb9927a8 100644 --- a/libavcodec/d3d12va_encode.c +++ b/libavcodec/d3d12va_encode.c @@ -264,12 +264,6 @@ static int d3d12va_encode_issue(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Input surface is %p.\n", pic->input_surface->texture); - err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic->recon_image, 0); - if (err < 0) { - err = AVERROR(ENOMEM); - goto fail; - } - pic->recon_surface = (AVD3D12VAFrame *)base_pic->recon_image->data[0]; av_log(avctx, AV_LOG_DEBUG, "Recon surface is %p.\n", pic->recon_surface->texture); diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c index 35dac6e596..8411cc7582 100644 --- a/libavcodec/hw_base_encode.c +++ b/libavcodec/hw_base_encode.c @@ -446,6 +446,12 @@ static int hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex goto fail; } + err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, 0); + if (err < 0) { + err = AVERROR(ENOMEM); + goto fail; + } + pic->priv = av_mallocz(ctx->op->priv_size); if (!pic->priv) { err = AVERROR(ENOMEM); diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index b72e9035cb..0058e1e772 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -313,11 +313,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); - err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic->recon_image, 0); - if (err < 0) { - err = AVERROR(ENOMEM); - goto fail; - } pic->recon_surface = (VASurfaceID)(uintptr_t)base_pic->recon_image->data[3]; av_log(avctx, AV_LOG_DEBUG, "Recon surface is %#x.\n", pic->recon_surface);