diff --git a/inc/rk_mpi_cmd.h b/inc/rk_mpi_cmd.h index 9cde5d46..391df8e5 100644 --- a/inc/rk_mpi_cmd.h +++ b/inc/rk_mpi_cmd.h @@ -105,6 +105,7 @@ typedef enum { MPP_DEC_SET_ENABLE_FAST_PLAY, /* enable idr output immediately */ MPP_DEC_SET_DISABLE_THREAD, /* MPP no thread mode and use external thread to decode */ MPP_DEC_SET_MAX_USE_BUFFER_SIZE, + MPP_DEC_SET_ENABLE_MVC, /* enable MVC decoding*/ MPP_DEC_CMD_QUERY = CMD_MODULE_CODEC | CMD_CTX_ID_DEC | CMD_DEC_QUERY, /* query decoder runtime information for decode stage */ diff --git a/mpp/base/mpp_dec_cfg.cpp b/mpp/base/mpp_dec_cfg.cpp index 551007ed..ae49a58a 100644 --- a/mpp/base/mpp_dec_cfg.cpp +++ b/mpp/base/mpp_dec_cfg.cpp @@ -123,6 +123,7 @@ public: ENTRY(base, enable_fast_play, U32, RK_U32, MPP_DEC_CFG_CHANGE_ENABLE_FAST_PLAY, base, enable_fast_play) \ ENTRY(base, enable_hdr_meta, U32, RK_U32, MPP_DEC_CFG_CHANGE_ENABLE_HDR_META, base, enable_hdr_meta) \ ENTRY(base, enable_thumbnail, U32, RK_U32, MPP_DEC_CFG_CHANGE_ENABLE_THUMBNAIL, base, enable_thumbnail) \ + ENTRY(base, enable_mvc, U32, RK_U32, MPP_DEC_CFG_CHANGE_ENABLE_MVC, base, enable_mvc) \ ENTRY(base, disable_thread, U32, RK_U32, MPP_DEC_CFG_CHANGE_DISABLE_THREAD, base, disable_thread) \ ENTRY(cb, pkt_rdy_cb, Ptr, MppExtCbFunc, MPP_DEC_CB_CFG_CHANGE_PKT_RDY, cb, pkt_rdy_cb) \ ENTRY(cb, pkt_rdy_ctx, Ptr, MppExtCbCtx, MPP_DEC_CB_CFG_CHANGE_PKT_RDY, cb, pkt_rdy_ctx) \ @@ -231,7 +232,7 @@ MppDecCfgService::MppDecCfgService() : * NOTE: The dec_node_len is not the real node count should be allocated * The max node count should be stream lengthg * 2 if each word is different. */ - ret = mpp_trie_init(&trie, 328, cfg_cnt); + ret = mpp_trie_init(&trie, 334, cfg_cnt); if (ret) { mpp_err_f("failed to init dec cfg set trie\n"); return ; diff --git a/mpp/codec/dec/h264/h264d_api.c b/mpp/codec/dec/h264/h264d_api.c index 8cec6f5a..454d949a 100644 --- a/mpp/codec/dec/h264/h264d_api.c +++ b/mpp/codec/dec/h264/h264d_api.c @@ -51,7 +51,6 @@ static MPP_RET init_input_ctx(H264dInputCtx_t *p_Inp, ParserCfg *init) INP_CHECK(ret, !p_Inp && !init); - mpp_env_get_u32("rkv_h264d_mvc_disable", &p_Inp->mvc_disable, 1); open_stream_file(p_Inp, "/sdcard"); if (rkv_h264d_parse_debug & H264D_DBG_WRITE_ES_EN) { p_Inp->spspps_size = HEAD_BUF_MAX_SIZE; diff --git a/mpp/codec/dec/h264/h264d_global.h b/mpp/codec/dec/h264/h264d_global.h index 984fa714..22f50e87 100644 --- a/mpp/codec/dec/h264/h264d_global.h +++ b/mpp/codec/dec/h264/h264d_global.h @@ -891,7 +891,6 @@ typedef struct h264d_input_ctx_t { RK_S64 in_pts; RK_S64 in_dts; RK_U8 has_get_eos; - RK_U32 mvc_disable; //!< output data RK_U8 task_valid; RK_U32 task_eos; diff --git a/mpp/codec/dec/h264/h264d_parse.c b/mpp/codec/dec/h264/h264d_parse.c index afe341d7..1b24a6e7 100644 --- a/mpp/codec/dec/h264/h264d_parse.c +++ b/mpp/codec/dec/h264/h264d_parse.c @@ -233,7 +233,7 @@ static MPP_RET parser_one_nalu(H264_SLICE_t *currSlice) H264D_DBG(H264D_DBG_PARSE_NALU, "nalu_type=SLICE."); FUN_CHECK(ret = process_slice(currSlice)); currSlice->p_Dec->nalu_ret = StartOfPicture; - if (currSlice->layer_id && currSlice->p_Inp->mvc_disable) + if (currSlice->layer_id && !currSlice->p_Dec->cfg->base.enable_mvc) currSlice->p_Dec->nalu_ret = MvcDisAble; break; case H264_NALU_TYPE_SPS: diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 2a092519..a4b1ab47 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -137,7 +137,8 @@ MPP_RET mpp_dec_proc_cfg(MppDecImpl *dec, MpiCmd cmd, void *param) case MPP_DEC_SET_OUTPUT_FORMAT : case MPP_DEC_SET_DISABLE_ERROR : case MPP_DEC_SET_ENABLE_DEINTERLACE : - case MPP_DEC_SET_ENABLE_FAST_PLAY : { + case MPP_DEC_SET_ENABLE_FAST_PLAY : + case MPP_DEC_SET_ENABLE_MVC : { ret = mpp_dec_set_cfg_by_cmd(&dec->cfg, cmd, param); mpp_dec_update_cfg(dec); dec->cfg.base.change = 0; @@ -523,6 +524,9 @@ MPP_RET mpp_dec_set_cfg(MppDecCfgSet *dst, MppDecCfgSet *src) if (change & MPP_DEC_CFG_CHANGE_ENABLE_THUMBNAIL) dst_base->enable_thumbnail = src_base->enable_thumbnail; + if (change & MPP_DEC_CFG_CHANGE_ENABLE_MVC) + dst_base->enable_mvc = src_base->enable_mvc; + if (change & MPP_DEC_CFG_CHANGE_DISABLE_THREAD) dst_base->disable_thread = src_base->disable_thread; @@ -1018,6 +1022,11 @@ MPP_RET mpp_dec_set_cfg_by_cmd(MppDecCfgSet *set, MpiCmd cmd, void *param) cfg->change |= MPP_DEC_CFG_CHANGE_ENABLE_FAST_PLAY; dec_dbg_func("disable idr immediately output %d\n", cfg->enable_fast_play); } break; + case MPP_DEC_SET_ENABLE_MVC : { + cfg->enable_mvc = (param) ? (*((RK_U32 *)param)) : (0); + cfg->change |= MPP_DEC_CFG_CHANGE_ENABLE_MVC; + dec_dbg_func("enable MVC decoder %d\n", cfg->enable_mvc); + } break; default : { mpp_err_f("unsupported cfg update cmd %x\n", cmd); ret = MPP_NOK; diff --git a/mpp/inc/mpp_dec_cfg.h b/mpp/inc/mpp_dec_cfg.h index c604f75a..9ff524f0 100644 --- a/mpp/inc/mpp_dec_cfg.h +++ b/mpp/inc/mpp_dec_cfg.h @@ -37,8 +37,10 @@ typedef enum MppDecCfgChange_e { MPP_DEC_CFG_CHANGE_ENABLE_FAST_PLAY = (1 << 16), MPP_DEC_CFG_CHANGE_ENABLE_HDR_META = (1 << 17), MPP_DEC_CFG_CHANGE_ENABLE_THUMBNAIL = (1 << 18), + MPP_DEC_CFG_CHANGE_ENABLE_MVC = (1 << 19), /* reserve high bit for global config */ MPP_DEC_CFG_CHANGE_DISABLE_THREAD = (1 << 28), + MPP_DEC_CFG_CHANGE_ALL = (0xFFFFFFFF), } MppDecCfgChange; @@ -67,6 +69,7 @@ typedef struct MppDecBaseCfg_t { RK_U32 enable_fast_play; RK_U32 enable_hdr_meta; RK_U32 enable_thumbnail; + RK_U32 enable_mvc; RK_U32 disable_thread; } MppDecBaseCfg; diff --git a/mpp/mpp.cpp b/mpp/mpp.cpp index 82c4baf2..31cd47d8 100644 --- a/mpp/mpp.cpp +++ b/mpp/mpp.cpp @@ -1154,7 +1154,8 @@ MPP_RET Mpp::control_dec(MpiCmd cmd, MppParam param) case MPP_DEC_SET_IMMEDIATE_OUT : case MPP_DEC_SET_DISABLE_ERROR : case MPP_DEC_SET_ENABLE_DEINTERLACE : - case MPP_DEC_SET_ENABLE_FAST_PLAY : { + case MPP_DEC_SET_ENABLE_FAST_PLAY : + case MPP_DEC_SET_ENABLE_MVC: { /* * These control may be set before mpp_init * When this case happen record the config and wait for decoder init