[vlc-devel] [PATCH] avcodec: allow the va to request extra pictures for decoding

Rémi Denis-Courmont remi at remlab.net
Mon Nov 28 15:31:14 CET 2016


On November 28, 2016 4:13:58 PM GMT+02:00, Steve Lhomme <robux4 at gmail.com> wrote:
>On Mon, Nov 28, 2016 at 3:09 PM, Rémi Denis-Courmont <remi at remlab.net>
>wrote:
>> On November 28, 2016 3:08:48 PM GMT+02:00, Steve Lhomme
><robux4 at videolabs.io> wrote:
>>>Since direct3d11 requires more frames to extract to with some HEVC
>>>sources.
>>>
>>>--
>>>replaces https://patches.videolan.org/patch/15141/ by setting the
>>>contraint
>>>closer to where it's needed.
>>>---
>>> modules/codec/avcodec/va.c    | 14 ++++++++++++++
>>> modules/codec/avcodec/va.h    |  7 +++++++
>>> modules/codec/avcodec/video.c |  3 +++
>>> 3 files changed, 24 insertions(+)
>>>
>>>diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
>>>index 091c35a..b2c0e53 100644
>>>--- a/modules/codec/avcodec/va.c
>>>+++ b/modules/codec/avcodec/va.c
>>>@@ -88,6 +88,20 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat
>>>hwfmt, enum PixelFormat swfmt)
>>>     }
>>> }
>>>
>>>+int vlc_va_GetExtraPictures(enum PixelFormat hwfmt)
>>>+{
>>>+    switch (hwfmt)
>>>+    {
>>>+#if LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
>>>+        case AV_PIX_FMT_D3D11VA_VLD:
>>>+            return 2;
>>>+#endif
>>>+        default:
>>>+            break;
>>>+    }
>>>+    return 0;
>>>+}
>>>+
>>> static int vlc_va_Start(void *func, va_list ap)
>>> {
>>>     vlc_va_t *va = va_arg(ap, vlc_va_t *);
>>>diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
>>>index 4f7df66..e863bd7 100644
>>>--- a/modules/codec/avcodec/va.h
>>>+++ b/modules/codec/avcodec/va.h
>>>@@ -55,6 +55,13 @@ struct vlc_va_t {
>>>vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum
>PixelFormat
>>>swfmt);
>>>
>>> /**
>>>+ * Determine the number of extra pictures the hardware decoder will
>>>need.
>>>+ * @param hwfmt the hardware acceleration pixel format
>>>+ * @return the number of extra buffers to allocate for the decoder.
>>>+ */
>>>+int vlc_va_GetExtraPictures(enum PixelFormat hwfmt);
>>>+
>>>+/**
>>>  * Creates an accelerated video decoding back-end for libavcodec.
>>>  * @param obj parent VLC object
>>>  * @param fmt VLC format of the content to decode
>>>diff --git a/modules/codec/avcodec/video.c
>>>b/modules/codec/avcodec/video.c
>>>index 07db5ae..421e24c 100644
>>>--- a/modules/codec/avcodec/video.c
>>>+++ b/modules/codec/avcodec/video.c
>>>@@ -153,6 +153,9 @@ static int lavc_GetVideoFormat(decoder_t *dec,
>>>video_format_t *restrict fmt,
>>>         return -1; /* invalid display size */
>>>     }
>>>
>>>+    if (pix_fmt != sw_pix_fmt)
>>>+        dec->i_extra_picture_buffers +=
>>>vlc_va_GetExtraPictures(pix_fmt);
>>>+
>>>     fmt->i_width = width;
>>>     fmt->i_height = height;
>>>     fmt->i_visible_width = ctx->width;
>>>--
>>>2.10.1.windows.1
>>>
>>>_______________________________________________
>>>vlc-devel mailing list
>>>To unsubscribe or modify your subscription options:
>>>https://mailman.videolan.org/listinfo/vlc-devel
>>
>> This looks completely out of place. I don't see any reason why it
>would need to be hard-coded *there*, nor any reason why it should be
>there.
>
>The reason why has been explained in other threads. The decoder
>Extract() from the decoder to other pictures from the decoder pool.
>Just the dbp size is not enough.
>
>The reason to do it there is because it needs to be done before the
>vout is created (obviously) and since the va is not created before the
>vout is created, it can only be in the generic va code.
>
>> --
>> Rémi Denis-Courmont
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

I don't see any plausible explanation anywhere and the reasoning from that looks flawed to me as well.

So nack.
-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list