diff --git a/mpp/codec/dec/h265/CMakeLists.txt b/mpp/codec/dec/h265/CMakeLists.txt index 894636ef..08544fc2 100644 --- a/mpp/codec/dec/h265/CMakeLists.txt +++ b/mpp/codec/dec/h265/CMakeLists.txt @@ -1,4 +1,6 @@ # vim: syntax=cmake +include_directories(../common) + set(H265D_PARSER_HDR h265d_defs.h h265d_parser.h @@ -19,4 +21,4 @@ add_library(${CODEC_H265D} STATIC ) set_target_properties(${CODEC_H265D} PROPERTIES FOLDER "mpp/codec") -target_link_libraries(${CODEC_H265D} mpp_base) +target_link_libraries(${CODEC_H265D} dec_common mpp_base) diff --git a/mpp/codec/dec/h265/h265d_parser.c b/mpp/codec/dec/h265/h265d_parser.c index d29fe829..c32674f3 100644 --- a/mpp/codec/dec/h265/h265d_parser.c +++ b/mpp/codec/dec/h265/h265d_parser.c @@ -1297,6 +1297,11 @@ static RK_S32 parser_nal_unit(HEVCContext *s, const RK_U8 *nal, int length) s->nuh_layer_id = ret; h265d_dbg(H265D_DBG_GLOBAL, "s->nal_unit_type = %d,len = %d \n", s->nal_unit_type, length); + if (s->deny_flag && (s->nal_unit_type != NAL_VPS && s->nal_unit_type != NAL_SPS)) { + ret = MPP_ERR_STREAM; + goto fail; + } + switch (s->nal_unit_type) { case NAL_VPS: ret = mpp_hevc_decode_nal_vps(s); @@ -1311,6 +1316,8 @@ static RK_S32 parser_nal_unit(HEVCContext *s, const RK_U8 *nal, int length) mpp_err("mpp_hevc_decode_nal_sps error ret = %d", ret); goto fail; } + + s->deny_flag = 0; break; case NAL_PPS: if (s->pre_pps_data == NULL) { diff --git a/mpp/codec/dec/h265/h265d_parser.h b/mpp/codec/dec/h265/h265d_parser.h index 21ebd33c..700327c5 100644 --- a/mpp/codec/dec/h265/h265d_parser.h +++ b/mpp/codec/dec/h265/h265d_parser.h @@ -625,6 +625,8 @@ typedef struct HEVCContext { /* hdr info */ RK_U32 is_hdr; RK_U32 hdr_dynamic; + + RK_U32 deny_flag; } HEVCContext; RK_S32 mpp_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps, diff --git a/mpp/codec/dec/h265/h265d_sei.c b/mpp/codec/dec/h265/h265d_sei.c index f52eef5c..09e2f8b0 100644 --- a/mpp/codec/dec/h265/h265d_sei.c +++ b/mpp/codec/dec/h265/h265d_sei.c @@ -29,6 +29,7 @@ #include "h265d_parser.h" #include "rk_hdr_meta_com.h" +#include "h2645d_sei.h" static RK_S32 decode_nal_sei_decoded_picture_hash(BitReadCtx_t *gb) @@ -418,6 +419,11 @@ MPP_RET mpp_hevc_decode_nal_sei(HEVCContext *s) h265d_dbg(H265D_DBG_SEI, "Skipped PREFIX SEI %d\n", payload_type); } else if (payload_type == 4) { ret = user_data_registered_itu_t_t35(s, &payload_bitctx, payload_size); + } else if (payload_type == 5) { + ret = check_encoder_sei_info(&payload_bitctx, payload_size, &s->deny_flag); + + if (s->deny_flag) + h265d_dbg(H265D_DBG_SEI, "Bitstream is encoded by special encoder."); } else if (payload_type == 129) { ret = active_parameter_sets(s, &payload_bitctx); h265d_dbg(H265D_DBG_SEI, "Skipped PREFIX SEI %d\n", payload_type);