rkmpp: update to 451ae59

This commit is contained in:
Jonas Karlman 2019-09-08 18:16:12 +00:00
parent 276b989054
commit 2a5b368872
7 changed files with 6 additions and 340 deletions

View File

@ -2,8 +2,8 @@
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="rkmpp"
PKG_VERSION="66b140eed828391994c04b8c53b1c1864c386576"
PKG_SHA256="ff1d31aa5cae7a694aee9711d2be4c8f73cc50734734c2131fc822223c29ad7e"
PKG_VERSION="451ae59386bbb8093a25defdca7a95f588c28706"
PKG_SHA256="b2f6478783caa8ffb9698b4207bae3a684fe861ba09cd371414fe26d41a3433e"
PKG_ARCH="arm aarch64"
PKG_LICENSE="APL"
PKG_SITE="https://github.com/rockchip-linux/mpp"

View File

@ -1,4 +1,4 @@
From 9e8b370b826e662879fcec9193956ec59a7db331 Mon Sep 17 00:00:00 2001
From ef687eaf87efff3efcb1897ca02be97e09bf292e Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 24 Jun 2018 11:07:44 +0200
Subject: [PATCH] disable unit tests by default

View File

@ -1,4 +1,4 @@
From 087282d7d3fb5b5216acf7d10864ab2a42dd8473 Mon Sep 17 00:00:00 2001
From 8f9bd9b08f67beded2a8498754e59deb5e4eeae1 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Thu, 1 Mar 2018 22:31:47 +0100
Subject: [PATCH] [m2vd]: use ctx pts
@ -8,10 +8,10 @@ Subject: [PATCH] [m2vd]: use ctx pts
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c
index 6a720d56..24372f85 100755
index 903712c6..ce97cd9b 100755
--- a/mpp/codec/dec/m2v/m2vd_parser.c
+++ b/mpp/codec/dec/m2v/m2vd_parser.c
@@ -1151,7 +1151,7 @@ static MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx)
@@ -1172,7 +1172,7 @@ static MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx)
mpp_frame_set_hor_stride(ctx->frame_cur->f, ctx->display_width);
mpp_frame_set_ver_stride(ctx->frame_cur->f, ctx->display_height);
mpp_frame_set_errinfo(ctx->frame_cur->f, 0);

View File

@ -1,26 +0,0 @@
From 57a996a3c2ebf8991216c9084b476254e205c28c Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Fri, 7 Sep 2018 19:53:10 +0200
Subject: [PATCH] [h264d]: fix mpp_buf_slot_get_prop crash
---
mpp/codec/dec/h264/h264d_init.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mpp/codec/dec/h264/h264d_init.c b/mpp/codec/dec/h264/h264d_init.c
index cd17776c..acad2ea7 100644
--- a/mpp/codec/dec/h264/h264d_init.c
+++ b/mpp/codec/dec/h264/h264d_init.c
@@ -1401,7 +1401,11 @@ static RK_U32 check_ref_dbp_err(H264_DecCtx_t *p_Dec, H264_RefPicInfo_t *pref, R
for (i = 0; i < MAX_REF_SIZE; i++) {
if (pref[i].valid) {
MppFrame mframe = NULL;
- RK_U32 slot_idx = p_Dec->dpb_info[pref[i].dpb_idx].slot_index;
+ RK_S32 slot_idx = p_Dec->dpb_info[pref[i].dpb_idx].slot_index;
+ if (slot_idx < 0) {
+ dpb_error_flag |= 1;
+ break;
+ }
mpp_buf_slot_get_prop(p_Dec->frame_slots, slot_idx, SLOT_FRAME_PTR, &mframe);
if (mframe) {
if (i < active_refs) {

View File

@ -1,104 +0,0 @@
From 30476f13ad6fee7392993e848f2b89519521df39 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sat, 15 Sep 2018 11:24:28 +0200
Subject: [PATCH] [m2vd]: export aspect ratio information
---
inc/mpp_frame.h | 10 ++++++++++
mpp/base/inc/mpp_frame_impl.h | 2 ++
mpp/base/mpp_frame.cpp | 1 +
mpp/codec/dec/m2v/m2vd_parser.c | 22 ++++++++++++++++++++++
4 files changed, 35 insertions(+)
diff --git a/inc/mpp_frame.h b/inc/mpp_frame.h
index 39763f37..fd1358d3 100644
--- a/inc/mpp_frame.h
+++ b/inc/mpp_frame.h
@@ -189,6 +189,14 @@ typedef enum {
MPP_FMT_BUTT = MPP_FMT_COMPLEX_BUTT,
} MppFrameFormat;
+/**
+ * Rational number (pair of numerator and denominator).
+ */
+typedef struct MppFrameRational {
+ RK_S32 num; ///< Numerator
+ RK_S32 den; ///< Denominator
+} MppFrameRational;
+
typedef enum {
MPP_FRAME_ERR_UNKNOW = 0x0001,
MPP_FRAME_ERR_UNSUPPORT = 0x0002,
@@ -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);
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);
/*
* HDR parameter
diff --git a/mpp/base/inc/mpp_frame_impl.h b/mpp/base/inc/mpp_frame_impl.h
index 2b512fcb..30898a1a 100644
--- a/mpp/base/inc/mpp_frame_impl.h
+++ b/mpp/base/inc/mpp_frame_impl.h
@@ -88,6 +88,8 @@ struct MppFrameImpl_t {
MppFrameFormat fmt;
+ MppFrameRational sar;
+
/*
* buffer information
* NOTE: buf_size only access internally
diff --git a/mpp/base/mpp_frame.cpp b/mpp/base/mpp_frame.cpp
index 1452604a..b94d1622 100644
--- a/mpp/base/mpp_frame.cpp
+++ b/mpp/base/mpp_frame.cpp
@@ -199,5 +199,6 @@ MPP_FRAME_ACCESSORS(MppFrameColorTransferCharacteristic, color_trc)
MPP_FRAME_ACCESSORS(MppFrameColorSpace, colorspace)
MPP_FRAME_ACCESSORS(MppFrameChromaLocation, chroma_location)
MPP_FRAME_ACCESSORS(MppFrameFormat, fmt)
+MPP_FRAME_ACCESSORS(MppFrameRational, sar)
MPP_FRAME_ACCESSORS(size_t, buf_size)
MPP_FRAME_ACCESSORS(RK_U32, errinfo)
diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c
index 619e4fb2..561c4acf 100755
--- a/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] = {
1
};
+static const MppFrameRational mpeg2_aspect[16] = {
+ {0,1},
+ {1,1},
+ {4,3},
+ {16,9},
+ {221,100},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+ {0,1},
+};
+
static inline RK_S32 m2vd_get_readbits(BitReadCtx_t *bx)
{
return bx->used_bits;
@@ -1164,6 +1183,9 @@ static MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx)
}
mpp_frame_set_mode(ctx->frame_cur->f, frametype);
+ if (ctx->seq_head.aspect_ratio_information >= 0 && ctx->seq_head.aspect_ratio_information < 16)
+ mpp_frame_set_sar(ctx->frame_cur->f, mpeg2_aspect[ctx->seq_head.aspect_ratio_information]);
+
mpp_buf_slot_get_unused(ctx->frame_slots, &ctx->frame_cur->slot_index);
mpp_buf_slot_set_prop(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_FRAME, ctx->frame_cur->f);
mpp_buf_slot_set_flag(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_CODEC_USE);

View File

@ -1,52 +0,0 @@
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);

View File

@ -1,152 +0,0 @@
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);