mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
rkmpp: update to 66b140e
This commit is contained in:
parent
1279115624
commit
8daa6cd4a2
@ -0,0 +1,103 @@
|
|||||||
|
From 1a02e726f50ae2ce007854ee473a9f69617e2947 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jonas Karlman <jonas@kwiboo.se>
|
||||||
|
Date: Sat, 22 Jun 2019 16:08:25 +0000
|
||||||
|
Subject: [PATCH] rkmppdec: set mastering display and content light side data
|
||||||
|
|
||||||
|
---
|
||||||
|
libavcodec/rkmppdec.c | 62 +++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 62 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
|
||||||
|
index 48016bc681..74938443df 100644
|
||||||
|
--- a/libavcodec/rkmppdec.c
|
||||||
|
+++ b/libavcodec/rkmppdec.c
|
||||||
|
@@ -35,6 +35,7 @@
|
||||||
|
#include "libavutil/frame.h"
|
||||||
|
#include "libavutil/hwcontext.h"
|
||||||
|
#include "libavutil/hwcontext_drm.h"
|
||||||
|
+#include "libavutil/mastering_display_metadata.h"
|
||||||
|
#include "libavutil/imgutils.h"
|
||||||
|
#include "libavutil/log.h"
|
||||||
|
|
||||||
|
@@ -319,6 +320,59 @@ static void rkmpp_release_frame(void *opaque, uint8_t *data)
|
||||||
|
av_free(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void rkmpp_hevc_mastering_display(AVFrame *frame, MppFrameMasteringDisplayMetadata mastering_display)
|
||||||
|
+{
|
||||||
|
+ // HEVC uses a g,b,r ordering, which we convert to a more natural r,g,b
|
||||||
|
+ AVMasteringDisplayMetadata *metadata;
|
||||||
|
+ const int mapping[3] = {2, 0, 1};
|
||||||
|
+ const int chroma_den = 50000;
|
||||||
|
+ const int luma_den = 10000;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
|
||||||
|
+ if (sd)
|
||||||
|
+ metadata = (AVMasteringDisplayMetadata *)sd->data;
|
||||||
|
+ else
|
||||||
|
+ metadata = av_mastering_display_metadata_create_side_data(frame);
|
||||||
|
+ if (!metadata)
|
||||||
|
+ return AVERROR(ENOMEM);
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < 3; i++) {
|
||||||
|
+ const int j = mapping[i];
|
||||||
|
+ metadata->display_primaries[i][0].num = mastering_display.display_primaries[j][0];
|
||||||
|
+ metadata->display_primaries[i][0].den = chroma_den;
|
||||||
|
+ metadata->display_primaries[i][1].num = mastering_display.display_primaries[j][1];
|
||||||
|
+ metadata->display_primaries[i][1].den = chroma_den;
|
||||||
|
+ }
|
||||||
|
+ metadata->white_point[0].num = mastering_display.white_point[0];
|
||||||
|
+ metadata->white_point[0].den = chroma_den;
|
||||||
|
+ metadata->white_point[1].num = mastering_display.white_point[1];
|
||||||
|
+ metadata->white_point[1].den = chroma_den;
|
||||||
|
+
|
||||||
|
+ metadata->max_luminance.num = mastering_display.max_luminance;
|
||||||
|
+ metadata->max_luminance.den = luma_den;
|
||||||
|
+ metadata->min_luminance.num = mastering_display.min_luminance;
|
||||||
|
+ metadata->min_luminance.den = luma_den;
|
||||||
|
+ metadata->has_luminance = 1;
|
||||||
|
+ metadata->has_primaries = 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void rkmpp_hevc_content_light(AVFrame *frame, MppFrameContentLightMetadata content_light)
|
||||||
|
+{
|
||||||
|
+ AVContentLightMetadata *metadata;
|
||||||
|
+
|
||||||
|
+ AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
|
||||||
|
+ if (sd)
|
||||||
|
+ metadata = (AVContentLightMetadata *)sd->data;
|
||||||
|
+ else
|
||||||
|
+ metadata = av_content_light_metadata_create_side_data(frame);
|
||||||
|
+ if (!metadata)
|
||||||
|
+ return AVERROR(ENOMEM);
|
||||||
|
+
|
||||||
|
+ metadata->MaxCLL = content_light.MaxCLL;
|
||||||
|
+ metadata->MaxFALL = content_light.MaxFALL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
{
|
||||||
|
RKMPPDecodeContext *rk_context = avctx->priv_data;
|
||||||
|
@@ -352,6 +406,11 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
avctx->width = mpp_frame_get_width(mppframe);
|
||||||
|
avctx->height = mpp_frame_get_height(mppframe);
|
||||||
|
|
||||||
|
+ avctx->color_range = mpp_frame_get_color_range(mppframe);
|
||||||
|
+ avctx->color_primaries = mpp_frame_get_color_primaries(mppframe);
|
||||||
|
+ avctx->color_trc = mpp_frame_get_color_trc(mppframe);
|
||||||
|
+ avctx->colorspace = mpp_frame_get_colorspace(mppframe);
|
||||||
|
+
|
||||||
|
decoder->mpi->control(decoder->ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL);
|
||||||
|
|
||||||
|
av_buffer_unref(&decoder->frames_ref);
|
||||||
|
@@ -410,6 +469,9 @@ static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||||
|
MppFrameRational dar = mpp_frame_get_sar(mppframe);
|
||||||
|
frame->sample_aspect_ratio = av_div_q((AVRational) { dar.num, dar.den },
|
||||||
|
(AVRational) { frame->width, frame->height });
|
||||||
|
+ } else if (avctx->codec_id == AV_CODEC_ID_HEVC && frame->color_trc > AVCOL_TRC_UNSPECIFIED) {
|
||||||
|
+ rkmpp_hevc_mastering_display(frame, mpp_frame_get_mastering_display(mppframe));
|
||||||
|
+ rkmpp_hevc_content_light(frame, mpp_frame_get_content_light(mppframe));
|
||||||
|
}
|
||||||
|
|
||||||
|
mode = mpp_frame_get_mode(mppframe);
|
@ -2,8 +2,8 @@
|
|||||||
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
||||||
|
|
||||||
PKG_NAME="rkmpp"
|
PKG_NAME="rkmpp"
|
||||||
PKG_VERSION="056e17df923ced58fa0c0b9e0f6ef14cbc640c8d"
|
PKG_VERSION="66b140eed828391994c04b8c53b1c1864c386576"
|
||||||
PKG_SHA256="6ff910455d86ffd00bf8d388f37b6d18bbf5907fbe095048466a8cdfdc2b4db4"
|
PKG_SHA256="ff1d31aa5cae7a694aee9711d2be4c8f73cc50734734c2131fc822223c29ad7e"
|
||||||
PKG_ARCH="arm aarch64"
|
PKG_ARCH="arm aarch64"
|
||||||
PKG_LICENSE="APL"
|
PKG_LICENSE="APL"
|
||||||
PKG_SITE="https://github.com/rockchip-linux/mpp"
|
PKG_SITE="https://github.com/rockchip-linux/mpp"
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
From 3b9802254aeed9a0708d6c0c6b64c6b94ede3fa5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
|
|
||||||
Date: Mon, 29 May 2017 14:08:43 +0200
|
|
||||||
Subject: [PATCH] fix 32-bit mmap issue on 64-bit kernels
|
|
||||||
|
|
||||||
Running 32-bit userland on a 64-bit kernel resulted in the error:
|
|
||||||
|
|
||||||
mpp_drm: mmap failed: Invalid argument
|
|
||||||
|
|
||||||
Both the pagesize_mask and the mmap call truncated the offset
|
|
||||||
value to 32 bit. This patch fixes both issues.
|
|
||||||
|
|
||||||
For details see https://github.com/rockchip-linux/kernel/issues/17
|
|
||||||
---
|
|
||||||
osal/allocator/allocator_drm.c | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/osal/allocator/allocator_drm.c b/osal/allocator/allocator_drm.c
|
|
||||||
index b1dc277f..c2572716 100644
|
|
||||||
--- a/osal/allocator/allocator_drm.c
|
|
||||||
+++ b/osal/allocator/allocator_drm.c
|
|
||||||
@@ -15,6 +15,8 @@
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MODULE_TAG "mpp_drm"
|
|
||||||
+/* Enable 64-bit mmap also when compiling for 32 bit */
|
|
||||||
+#define _FILE_OFFSET_BITS 64
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
@ -1,20 +1,20 @@
|
|||||||
From e8b390f2a92a9a5668ed8f00255b75d21f9ce60a Mon Sep 17 00:00:00 2001
|
From 30476f13ad6fee7392993e848f2b89519521df39 Mon Sep 17 00:00:00 2001
|
||||||
From: Jonas Karlman <jonas@kwiboo.se>
|
From: Jonas Karlman <jonas@kwiboo.se>
|
||||||
Date: Sat, 15 Sep 2018 11:24:28 +0200
|
Date: Sat, 15 Sep 2018 11:24:28 +0200
|
||||||
Subject: [PATCH] [m2vd]: export aspect ratio information
|
Subject: [PATCH] [m2vd]: export aspect ratio information
|
||||||
|
|
||||||
---
|
---
|
||||||
inc/mpp_frame.h | 10 ++++++++++
|
inc/mpp_frame.h | 10 ++++++++++
|
||||||
mpp/base/inc/mpp_frame_impl.h | 1 +
|
mpp/base/inc/mpp_frame_impl.h | 2 ++
|
||||||
mpp/base/mpp_frame.cpp | 1 +
|
mpp/base/mpp_frame.cpp | 1 +
|
||||||
mpp/codec/dec/m2v/m2vd_parser.c | 22 ++++++++++++++++++++++
|
mpp/codec/dec/m2v/m2vd_parser.c | 22 ++++++++++++++++++++++
|
||||||
4 files changed, 34 insertions(+)
|
4 files changed, 35 insertions(+)
|
||||||
|
|
||||||
diff --git a/inc/mpp_frame.h b/inc/mpp_frame.h
|
diff --git a/inc/mpp_frame.h b/inc/mpp_frame.h
|
||||||
index 6c1b7f1d..87513a09 100644
|
index 39763f37..fd1358d3 100644
|
||||||
--- a/inc/mpp_frame.h
|
--- a/inc/mpp_frame.h
|
||||||
+++ b/inc/mpp_frame.h
|
+++ b/inc/mpp_frame.h
|
||||||
@@ -190,6 +190,14 @@ typedef enum {
|
@@ -189,6 +189,14 @@ typedef enum {
|
||||||
MPP_FMT_BUTT = MPP_FMT_COMPLEX_BUTT,
|
MPP_FMT_BUTT = MPP_FMT_COMPLEX_BUTT,
|
||||||
} MppFrameFormat;
|
} MppFrameFormat;
|
||||||
|
|
||||||
@ -29,32 +29,33 @@ index 6c1b7f1d..87513a09 100644
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
MPP_FRAME_ERR_UNKNOW = 0x0001,
|
MPP_FRAME_ERR_UNKNOW = 0x0001,
|
||||||
MPP_FRAME_ERR_UNSUPPORT = 0x0002,
|
MPP_FRAME_ERR_UNSUPPORT = 0x0002,
|
||||||
@@ -263,6 +271,8 @@ void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chr
|
@@ -266,6 +274,8 @@ MppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame);
|
||||||
|
void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location);
|
||||||
MppFrameFormat mpp_frame_get_fmt(MppFrame frame);
|
MppFrameFormat mpp_frame_get_fmt(MppFrame frame);
|
||||||
void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
|
void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
|
||||||
|
|
||||||
+MppFrameRational mpp_frame_get_sar(const MppFrame frame);
|
+MppFrameRational mpp_frame_get_sar(const MppFrame frame);
|
||||||
+void mpp_frame_set_sar(MppFrame frame, MppFrameRational sar);
|
+void mpp_frame_set_sar(MppFrame frame, MppFrameRational sar);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HDR parameter
|
* HDR parameter
|
||||||
diff --git a/mpp/base/inc/mpp_frame_impl.h b/mpp/base/inc/mpp_frame_impl.h
|
diff --git a/mpp/base/inc/mpp_frame_impl.h b/mpp/base/inc/mpp_frame_impl.h
|
||||||
index 44edc184..1f13d553 100644
|
index 2b512fcb..30898a1a 100644
|
||||||
--- a/mpp/base/inc/mpp_frame_impl.h
|
--- a/mpp/base/inc/mpp_frame_impl.h
|
||||||
+++ b/mpp/base/inc/mpp_frame_impl.h
|
+++ b/mpp/base/inc/mpp_frame_impl.h
|
||||||
@@ -87,6 +87,7 @@ struct MppFrameImpl_t {
|
@@ -88,6 +88,8 @@ struct MppFrameImpl_t {
|
||||||
MppFrameChromaLocation chroma_location;
|
|
||||||
|
|
||||||
MppFrameFormat fmt;
|
MppFrameFormat fmt;
|
||||||
|
|
||||||
+ MppFrameRational sar;
|
+ MppFrameRational sar;
|
||||||
|
+
|
||||||
/*
|
/*
|
||||||
* buffer information
|
* buffer information
|
||||||
* NOTE: buf_size only access internally
|
* NOTE: buf_size only access internally
|
||||||
diff --git a/mpp/base/mpp_frame.cpp b/mpp/base/mpp_frame.cpp
|
diff --git a/mpp/base/mpp_frame.cpp b/mpp/base/mpp_frame.cpp
|
||||||
index cc83b6b3..984efa62 100644
|
index 1452604a..b94d1622 100644
|
||||||
--- a/mpp/base/mpp_frame.cpp
|
--- a/mpp/base/mpp_frame.cpp
|
||||||
+++ b/mpp/base/mpp_frame.cpp
|
+++ b/mpp/base/mpp_frame.cpp
|
||||||
@@ -184,5 +184,6 @@ MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc)
|
@@ -199,5 +199,6 @@ MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc)
|
||||||
MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace)
|
MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace)
|
||||||
MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location)
|
MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location)
|
||||||
MPP_FRAME_ACCESSORS(MppFrameFormat, fmt)
|
MPP_FRAME_ACCESSORS(MppFrameFormat, fmt)
|
||||||
@ -62,7 +63,7 @@ index cc83b6b3..984efa62 100644
|
|||||||
MPP_FRAME_ACCESSORS(size_t, buf_size)
|
MPP_FRAME_ACCESSORS(size_t, buf_size)
|
||||||
MPP_FRAME_ACCESSORS(RK_U32, errinfo)
|
MPP_FRAME_ACCESSORS(RK_U32, errinfo)
|
||||||
diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c
|
diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c
|
||||||
index 24372f85..e44e35fb 100755
|
index 619e4fb2..561c4acf 100755
|
||||||
--- a/mpp/codec/dec/m2v/m2vd_parser.c
|
--- a/mpp/codec/dec/m2v/m2vd_parser.c
|
||||||
+++ b/mpp/codec/dec/m2v/m2vd_parser.c
|
+++ b/mpp/codec/dec/m2v/m2vd_parser.c
|
||||||
@@ -82,6 +82,25 @@ static int frame_period_Table[16] = {
|
@@ -82,6 +82,25 @@ static int frame_period_Table[16] = {
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
From f85d62a7d99f3da1d86ac57f94fa58c885ee5476 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jonas Karlman <jonas@kwiboo.se>
|
||||||
|
Date: Sat, 22 Jun 2019 13:42:08 +0000
|
||||||
|
Subject: [PATCH] [h265d]: fix color range and colorspace metadata
|
||||||
|
|
||||||
|
---
|
||||||
|
inc/mpp_frame.h | 2 ++
|
||||||
|
mpp/codec/dec/h265/h265d_codec.h | 2 ++
|
||||||
|
mpp/codec/dec/h265/h265d_refs.c | 2 ++
|
||||||
|
3 files changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/inc/mpp_frame.h b/inc/mpp_frame.h
|
||||||
|
index fd1358d3..33a6e644 100644
|
||||||
|
--- a/inc/mpp_frame.h
|
||||||
|
+++ b/inc/mpp_frame.h
|
||||||
|
@@ -68,6 +68,8 @@ typedef enum {
|
||||||
|
MPP_FRAME_PRI_FILM = 8, ///< colour filters using Illuminant C
|
||||||
|
MPP_FRAME_PRI_BT2020 = 9, ///< ITU-R BT2020
|
||||||
|
MPP_FRAME_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
||||||
|
+ MPP_FRAME_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
|
||||||
|
+ MPP_FRAME_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
|
||||||
|
MPP_FRAME_PRI_NB, ///< Not part of ABI
|
||||||
|
} MppFrameColorPrimaries;
|
||||||
|
|
||||||
|
diff --git a/mpp/codec/dec/h265/h265d_codec.h b/mpp/codec/dec/h265/h265d_codec.h
|
||||||
|
index 49804f7c..3fdddbfc 100644
|
||||||
|
--- a/mpp/codec/dec/h265/h265d_codec.h
|
||||||
|
+++ b/mpp/codec/dec/h265/h265d_codec.h
|
||||||
|
@@ -39,6 +39,8 @@ enum MppColorSpace {
|
||||||
|
MPPCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
|
||||||
|
MPPCOL_SPC_SMPTE240M = 7,
|
||||||
|
MPPCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
||||||
|
+ MPPCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
|
||||||
|
+ MPPCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
|
||||||
|
MPPCOL_SPC_NB , ///< Not part of ABI
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/mpp/codec/dec/h265/h265d_refs.c b/mpp/codec/dec/h265/h265d_refs.c
|
||||||
|
index 504a90c4..80905d98 100644
|
||||||
|
--- a/mpp/codec/dec/h265/h265d_refs.c
|
||||||
|
+++ b/mpp/codec/dec/h265/h265d_refs.c
|
||||||
|
@@ -91,8 +91,10 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
|
||||||
|
mpp_frame_set_errinfo(frame->frame, 0);
|
||||||
|
mpp_frame_set_pts(frame->frame, s->pts);
|
||||||
|
mpp_frame_set_poc(frame->frame, s->poc);
|
||||||
|
+ mpp_frame_set_color_range(frame->frame, s->h265dctx->color_range);
|
||||||
|
mpp_frame_set_color_primaries(frame->frame, s->sps->vui.colour_primaries);
|
||||||
|
mpp_frame_set_color_trc(frame->frame, s->sps->vui.transfer_characteristic);
|
||||||
|
+ mpp_frame_set_colorspace(frame->frame, s->h265dctx->colorspace);
|
||||||
|
h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height);
|
||||||
|
ret = mpp_buf_slot_get_unused(s->slots, &frame->slot_index);
|
||||||
|
mpp_assert(ret == MPP_OK);
|
@ -0,0 +1,152 @@
|
|||||||
|
From 30ac9fb8b0568f549229e3f8b907b49ef2ce29fe Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jonas Karlman <jonas@kwiboo.se>
|
||||||
|
Date: Sat, 22 Jun 2019 13:44:05 +0000
|
||||||
|
Subject: [PATCH] [h265d]: export mastering display and content light metadata
|
||||||
|
|
||||||
|
---
|
||||||
|
inc/mpp_frame.h | 16 ++++++++++++++++
|
||||||
|
mpp/base/inc/mpp_frame_impl.h | 2 ++
|
||||||
|
mpp/base/mpp_frame.cpp | 2 ++
|
||||||
|
mpp/codec/dec/h265/h265d_parser.h | 3 +++
|
||||||
|
mpp/codec/dec/h265/h265d_refs.c | 2 ++
|
||||||
|
mpp/codec/dec/h265/h265d_sei.c | 21 +++++++++++++++++++++
|
||||||
|
6 files changed, 46 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/inc/mpp_frame.h b/inc/mpp_frame.h
|
||||||
|
index 33a6e644..a2a4cf81 100644
|
||||||
|
--- a/inc/mpp_frame.h
|
||||||
|
+++ b/inc/mpp_frame.h
|
||||||
|
@@ -199,6 +199,18 @@ typedef struct MppFrameRational {
|
||||||
|
RK_S32 den; ///< Denominator
|
||||||
|
} MppFrameRational;
|
||||||
|
|
||||||
|
+typedef struct MppFrameMasteringDisplayMetadata {
|
||||||
|
+ RK_U16 display_primaries[3][2];
|
||||||
|
+ RK_U16 white_point[2];
|
||||||
|
+ RK_U32 max_luminance;
|
||||||
|
+ RK_U32 min_luminance;
|
||||||
|
+} MppFrameMasteringDisplayMetadata;
|
||||||
|
+
|
||||||
|
+typedef struct MppFrameContentLightMetadata {
|
||||||
|
+ RK_U16 MaxCLL;
|
||||||
|
+ RK_U16 MaxFALL;
|
||||||
|
+} MppFrameContentLightMetadata;
|
||||||
|
+
|
||||||
|
typedef enum {
|
||||||
|
MPP_FRAME_ERR_UNKNOW = 0x0001,
|
||||||
|
MPP_FRAME_ERR_UNSUPPORT = 0x0002,
|
||||||
|
@@ -278,6 +290,10 @@ MppFrameFormat mpp_frame_get_fmt(MppFrame frame);
|
||||||
|
void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
|
||||||
|
MppFrameRational mpp_frame_get_sar(const MppFrame frame);
|
||||||
|
void mpp_frame_set_sar(MppFrame frame, MppFrameRational sar);
|
||||||
|
+MppFrameMasteringDisplayMetadata mpp_frame_get_mastering_display(const MppFrame frame);
|
||||||
|
+void mpp_frame_set_mastering_display(MppFrame frame, MppFrameMasteringDisplayMetadata mastering_display);
|
||||||
|
+MppFrameContentLightMetadata mpp_frame_get_content_light(const MppFrame frame);
|
||||||
|
+void mpp_frame_set_content_light(MppFrame frame, MppFrameContentLightMetadata content_light);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HDR parameter
|
||||||
|
diff --git a/mpp/base/inc/mpp_frame_impl.h b/mpp/base/inc/mpp_frame_impl.h
|
||||||
|
index 30898a1a..a5433888 100644
|
||||||
|
--- a/mpp/base/inc/mpp_frame_impl.h
|
||||||
|
+++ b/mpp/base/inc/mpp_frame_impl.h
|
||||||
|
@@ -89,6 +89,8 @@ struct MppFrameImpl_t {
|
||||||
|
MppFrameFormat fmt;
|
||||||
|
|
||||||
|
MppFrameRational sar;
|
||||||
|
+ MppFrameMasteringDisplayMetadata mastering_display;
|
||||||
|
+ MppFrameContentLightMetadata content_light;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* buffer information
|
||||||
|
diff --git a/mpp/base/mpp_frame.cpp b/mpp/base/mpp_frame.cpp
|
||||||
|
index b94d1622..d58786c9 100644
|
||||||
|
--- a/mpp/base/mpp_frame.cpp
|
||||||
|
+++ b/mpp/base/mpp_frame.cpp
|
||||||
|
@@ -200,5 +200,7 @@ MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace)
|
||||||
|
MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location)
|
||||||
|
MPP_FRAME_ACCESSORS(MppFrameFormat, fmt)
|
||||||
|
MPP_FRAME_ACCESSORS(MppFrameRational, sar)
|
||||||
|
+MPP_FRAME_ACCESSORS(MppFrameMasteringDisplayMetadata, mastering_display)
|
||||||
|
+MPP_FRAME_ACCESSORS(MppFrameContentLightMetadata, content_light)
|
||||||
|
MPP_FRAME_ACCESSORS(size_t, buf_size)
|
||||||
|
MPP_FRAME_ACCESSORS(RK_U32, errinfo)
|
||||||
|
diff --git a/mpp/codec/dec/h265/h265d_parser.h b/mpp/codec/dec/h265/h265d_parser.h
|
||||||
|
index bf42eb97..3b1264fa 100644
|
||||||
|
--- a/mpp/codec/dec/h265/h265d_parser.h
|
||||||
|
+++ b/mpp/codec/dec/h265/h265d_parser.h
|
||||||
|
@@ -678,6 +678,9 @@ typedef struct HEVCContext {
|
||||||
|
RK_U32 got_frame;
|
||||||
|
RK_U32 extra_has_frame;
|
||||||
|
|
||||||
|
+ MppFrameMasteringDisplayMetadata mastering_display;
|
||||||
|
+ MppFrameContentLightMetadata content_light;
|
||||||
|
+
|
||||||
|
MppBufSlots slots;
|
||||||
|
|
||||||
|
MppBufSlots packet_slots;
|
||||||
|
diff --git a/mpp/codec/dec/h265/h265d_refs.c b/mpp/codec/dec/h265/h265d_refs.c
|
||||||
|
index 80905d98..8d5092a5 100644
|
||||||
|
--- a/mpp/codec/dec/h265/h265d_refs.c
|
||||||
|
+++ b/mpp/codec/dec/h265/h265d_refs.c
|
||||||
|
@@ -95,6 +95,8 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
|
||||||
|
mpp_frame_set_color_primaries(frame->frame, s->sps->vui.colour_primaries);
|
||||||
|
mpp_frame_set_color_trc(frame->frame, s->sps->vui.transfer_characteristic);
|
||||||
|
mpp_frame_set_colorspace(frame->frame, s->h265dctx->colorspace);
|
||||||
|
+ mpp_frame_set_mastering_display(frame->frame, s->mastering_display);
|
||||||
|
+ mpp_frame_set_content_light(frame->frame, s->content_light);
|
||||||
|
h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height);
|
||||||
|
ret = mpp_buf_slot_get_unused(s->slots, &frame->slot_index);
|
||||||
|
mpp_assert(ret == MPP_OK);
|
||||||
|
diff --git a/mpp/codec/dec/h265/h265d_sei.c b/mpp/codec/dec/h265/h265d_sei.c
|
||||||
|
index 4706b922..86beb428 100644
|
||||||
|
--- a/mpp/codec/dec/h265/h265d_sei.c
|
||||||
|
+++ b/mpp/codec/dec/h265/h265d_sei.c
|
||||||
|
@@ -154,12 +154,18 @@ static RK_S32 mastering_display_colour_volume(HEVCContext *s)
|
||||||
|
BitReadCtx_t *gb = &s->HEVClc->gb;
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
READ_BITS(gb, 16, &value);
|
||||||
|
+ s->mastering_display.display_primaries[i][0] = value;
|
||||||
|
READ_BITS(gb, 16, &value);
|
||||||
|
+ s->mastering_display.display_primaries[i][1] = value;
|
||||||
|
}
|
||||||
|
READ_BITS(gb, 16, &value);
|
||||||
|
+ s->mastering_display.white_point[0] = value;
|
||||||
|
READ_BITS(gb, 16, &value);
|
||||||
|
+ s->mastering_display.white_point[1] = value;
|
||||||
|
mpp_read_longbits(gb, 32, &lum);
|
||||||
|
+ s->mastering_display.max_luminance = lum;
|
||||||
|
mpp_read_longbits(gb, 32, &lum);
|
||||||
|
+ s->mastering_display.min_luminance = lum;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
@@ -167,6 +173,17 @@ __BITREAD_ERR:
|
||||||
|
return MPP_ERR_STREAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static RK_S32 content_light_info(HEVCContext *s)
|
||||||
|
+{
|
||||||
|
+ RK_U32 value = 0;
|
||||||
|
+ BitReadCtx_t *gb = &s->HEVClc->gb;
|
||||||
|
+ mpp_read_longbits(gb, 16, &value);
|
||||||
|
+ s->content_light.MaxCLL = value;
|
||||||
|
+ mpp_read_longbits(gb, 16, &value);
|
||||||
|
+ s->content_light.MaxFALL = value;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static RK_S32 colour_remapping_info(HEVCContext *s)
|
||||||
|
{
|
||||||
|
RK_U32 i = 0, j = 0;
|
||||||
|
@@ -344,6 +361,10 @@ static RK_S32 decode_nal_sei_message(HEVCContext *s)
|
||||||
|
h265d_dbg(H265D_DBG_SEI, "mastering_display_colour_volume in\n");
|
||||||
|
mastering_display_colour_volume(s);
|
||||||
|
return 1;
|
||||||
|
+ } else if (payload_type == 144) {
|
||||||
|
+ h265d_dbg(H265D_DBG_SEI, "content_light_info in\n");
|
||||||
|
+ content_light_info(s);
|
||||||
|
+ return 1;
|
||||||
|
} else if (payload_type == 143) {
|
||||||
|
h265d_dbg(H265D_DBG_SEI, "colour_remapping_info in\n");
|
||||||
|
colour_remapping_info(s);
|
Loading…
x
Reference in New Issue
Block a user