diff mbox

[FFmpeg-devel,3/3] avcodec/nvdec: Increase frame pool size to help deinterlacing

Message ID 20181026155606.14754-4-philipl@overt.org
State Accepted
Headers show

Commit Message

Philip Langdale Oct. 26, 2018, 3:56 p.m. UTC
With the cuda yadif filter in use, the number of mapped decoder
frames could increase by two, as the filter holds on to additional
frames.

Signed-off-by: Philip Langdale <philipl@overt.org>
---
 libavcodec/nvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Timo Rothenpieler Nov. 1, 2018, 7:32 p.m. UTC | #1
On 26.10.2018 17:56, Philip Langdale wrote:
> With the cuda yadif filter in use, the number of mapped decoder
> frames could increase by two, as the filter holds on to additional
> frames.
> 
> Signed-off-by: Philip Langdale <philipl@overt.org>
> ---
>   libavcodec/nvdec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
> index 4dd6b1acf3..8e91c36084 100644
> --- a/libavcodec/nvdec.c
> +++ b/libavcodec/nvdec.c
> @@ -601,7 +601,7 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
>       frames_ctx->format            = AV_PIX_FMT_CUDA;
>       frames_ctx->width             = (avctx->coded_width + 1) & ~1;
>       frames_ctx->height            = (avctx->coded_height + 1) & ~1;
> -    frames_ctx->initial_pool_size = dpb_size;
> +    frames_ctx->initial_pool_size = dpb_size + 2;

A small comment here as to where that magic +2 is coming from and it's GTM.
diff mbox

Patch

diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 4dd6b1acf3..8e91c36084 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -601,7 +601,7 @@  int ff_nvdec_frame_params(AVCodecContext *avctx,
     frames_ctx->format            = AV_PIX_FMT_CUDA;
     frames_ctx->width             = (avctx->coded_width + 1) & ~1;
     frames_ctx->height            = (avctx->coded_height + 1) & ~1;
-    frames_ctx->initial_pool_size = dpb_size;
+    frames_ctx->initial_pool_size = dpb_size + 2;
 
     frames_ctx->free = nvdec_free_dummy;
     frames_ctx->pool = av_buffer_pool_init(0, nvdec_alloc_dummy);