[h265d]: Skip decoding special encoder stream

Change-Id: I1c7aebce531452349fd5bbf20221906a81a163a7
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2023-04-17 16:45:53 +08:00
parent b45d8b16cb
commit e32018de55
4 changed files with 18 additions and 1 deletions

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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,

View File

@@ -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);