[h264d]: Skip decoding special encoder stream

Change-Id: I9bdd32bc3b00b9a038d9429295b045a8b6bd97ef
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2023-04-14 17:16:38 +08:00
parent 1a8161c845
commit b45d8b16cb
4 changed files with 21 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
# vim: syntax=cmake
include_directories(.)
include_directories(../common)
# h264 decoder api
set(H264D_API
@@ -44,6 +45,6 @@ add_library(${CODEC_H264D} STATIC
${H264D_SRC}
)
target_link_libraries(${CODEC_H264D} mpp_base)
target_link_libraries(${CODEC_H264D} dec_common mpp_base)
set_target_properties(${CODEC_H264D} PROPERTIES FOLDER "mpp/codec")

View File

@@ -740,7 +740,6 @@ typedef struct h264_sei_t {
//-- for adding
} scalable_nesting;
RK_U32 user_data_DivX_flag;
// Placeholder; in future more supported types will contribute to more
//---- follow is used in other parts
RK_S32 mvc_scalable_nesting_flag;
@@ -1050,6 +1049,7 @@ typedef struct h264d_video_ctx_t {
RK_U32 dpb_fast_out;
RK_U32 dpb_first_fast_played;
RK_U32 last_ref_frame_num;
RK_U32 deny_flag;
} H264dVideoCtx_t;
typedef struct h264d_mem_t {

View File

@@ -226,6 +226,13 @@ static MPP_RET parser_one_nalu(H264_SLICE_t *currSlice)
MPP_RET ret = MPP_ERR_UNKNOW;
FUN_CHECK(ret = parser_nalu_header(currSlice));
if (currSlice->p_Vid->deny_flag &&
currSlice->p_Cur->nalu.nalu_type != H264_NALU_TYPE_SPS) {
currSlice->p_Dec->nalu_ret = NaluNotSupport;
return MPP_OK;
}
//!< nalu_parse
switch (currSlice->p_Cur->nalu.nalu_type) {
case H264_NALU_TYPE_SLICE:
@@ -240,6 +247,7 @@ static MPP_RET parser_one_nalu(H264_SLICE_t *currSlice)
H264D_DBG(H264D_DBG_PARSE_NALU, "nalu_type=SPS");
FUN_CHECK(ret = process_sps(currSlice));
currSlice->p_Dec->nalu_ret = NALU_SPS;
currSlice->p_Vid->deny_flag = 0;
break;
case H264_NALU_TYPE_PPS:
H264D_DBG(H264D_DBG_PARSE_NALU, "nalu_type=PPS");
@@ -923,6 +931,9 @@ MPP_RET parse_loop(H264_DecCtx_t *p_Dec)
} else if (p_Dec->nalu_ret == MvcDisAble) {
H264D_LOG("xxxxxxxx MVC disable");
goto __FAILED;
} else if (p_Dec->nalu_ret == NaluNotSupport) {
H264D_LOG("NALU not support, abort decoding");
goto __FAILED;
} else {
p_Dec->next_state = SliceSTATE_ReadNalu;
}

View File

@@ -23,6 +23,7 @@
#include "h264d_global.h"
#include "h264d_sps.h"
#include "h264d_sei.h"
#include "h2645d_sei.h"
static MPP_RET interpret_picture_timing_info(
BitReadCtx_t *p_bitctx,
@@ -249,6 +250,12 @@ MPP_RET process_sei(H264_SLICE_t *currSlice)
case H264_SEI_PIC_TIMING:
FUN_CHECK(interpret_picture_timing_info(&payload_bitctx, sei_msg, currSlice->p_Vid));
break;
case H264_SEI_USER_DATA_UNREGISTERED:
FUN_CHECK(check_encoder_sei_info(&payload_bitctx, sei_msg->payload_size, &currSlice->p_Vid->deny_flag));
if (currSlice->p_Vid->deny_flag)
H264D_DBG(H264D_DBG_SEI, "Bitstream is encoded by special encoder.");
break;
default:
H264D_DBG(H264D_DBG_SEI, "Skip parsing SEI type %d\n", sei_msg->type);
break;