summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhbiyik <boogiepop@gmx.com>2023-09-28 22:25:25 +0200
committersfan5 <sfan5@live.de>2023-09-29 12:10:59 +0200
commitc19115c8dad38ee94474f305c09714b24a85f746 (patch)
tree22e7d47eded5f8e58f4a3714cf3b5cfec2af7893
parentae230b1294d9b7982cc4032518c7112a37e11e78 (diff)
downloadmpv-c19115c8dad38ee94474f305c09714b24a85f746.tar.bz2
mpv-c19115c8dad38ee94474f305c09714b24a85f746.tar.xz
hwdec_drmprime: add nv16 support
NV16 is the half subsampled version of NV12 format. Decoders which support High 4:2:2 of h264 provide the frame in NV16 format to establish richer colorspace. Similar profiles are also available in HEVC and other popular codecs. This commit allows NV16 frames to be displayed over drmprime layers. Signed-off-by: hbiyik <boogiepop@gmx.com>
-rw-r--r--video/out/hwdec/dmabuf_interop_gl.c1
-rw-r--r--video/out/hwdec/hwdec_drmprime.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/video/out/hwdec/dmabuf_interop_gl.c b/video/out/hwdec/dmabuf_interop_gl.c
index bd33474289..e7fb1031a0 100644
--- a/video/out/hwdec/dmabuf_interop_gl.c
+++ b/video/out/hwdec/dmabuf_interop_gl.c
@@ -176,6 +176,7 @@ static bool vaapi_gl_map(struct ra_hwdec_mapper *mapper,
if (p_mapper->desc.layers[i].nb_planes > 1) {
switch (p_mapper->desc.layers[i].format) {
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV16:
format[0] = DRM_FORMAT_R8;
format[1] = DRM_FORMAT_GR88;
break;
diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c
index 5051207413..290f11c535 100644
--- a/video/out/hwdec/hwdec_drmprime.c
+++ b/video/out/hwdec/hwdec_drmprime.c
@@ -29,6 +29,7 @@
#include "libmpv/render_gl.h"
#include "options/m_config.h"
+#include "video/fmt-conversion.h"
#include "video/out/drm_common.h"
#include "video/out/gpu/hwdec.h"
#include "video/out/hwdec/dmabuf_interop.h"
@@ -117,6 +118,7 @@ static int init(struct ra_hwdec *hw)
int num_formats = 0;
MP_TARRAY_APPEND(p, p->formats, num_formats, IMGFMT_NV12);
MP_TARRAY_APPEND(p, p->formats, num_formats, IMGFMT_420P);
+ MP_TARRAY_APPEND(p, p->formats, num_formats, pixfmt2imgfmt(AV_PIX_FMT_NV16));
MP_TARRAY_APPEND(p, p->formats, num_formats, 0); // terminate it
p->hwctx.hw_imgfmt = IMGFMT_DRMPRIME;