From 7716b36af8137a1de7523c70d59e77c263484fda Mon Sep 17 00:00:00 2001 From: Ding Wei Date: Mon, 23 Apr 2018 09:54:29 +0800 Subject: [PATCH] [mpeg4][h263]: remove internal pts mode tips: the timestamp in slice header is not useful, except for calculate increment of dispaly frame. so, it cannot use to dispaly, and remove it. Change-Id: I748d553d40c4736e2f5ef98d8a8519fcc5e533e0 Signed-off-by: Ding Wei --- inc/rk_mpi_cmd.h | 3 +-- mpp/codec/dec/h263/h263d_api.c | 10 +--------- mpp/codec/dec/h263/h263d_parser.c | 13 ++----------- mpp/codec/dec/h263/h263d_parser.h | 1 - mpp/codec/dec/mpg4/mpg4d_api.c | 10 +--------- mpp/codec/dec/mpg4/mpg4d_parser.c | 22 +--------------------- mpp/codec/dec/mpg4/mpg4d_parser.h | 1 - mpp/mpp.cpp | 7 ------- 8 files changed, 6 insertions(+), 61 deletions(-) diff --git a/inc/rk_mpi_cmd.h b/inc/rk_mpi_cmd.h index 89f53f77..7ec58e2c 100644 --- a/inc/rk_mpi_cmd.h +++ b/inc/rk_mpi_cmd.h @@ -89,7 +89,7 @@ typedef enum { MPP_DEC_SET_FRAME_INFO, /* vpu api legacy control for buffer slot dimension init */ MPP_DEC_SET_EXT_BUF_GROUP, /* IMPORTANT: set external buffer group to mpp decoder */ MPP_DEC_SET_INFO_CHANGE_READY, - MPP_DEC_SET_INTERNAL_PTS_ENABLE, + MPP_DEC_SET_PRESENT_TIME_ORDER, /* use input time order for output */ MPP_DEC_SET_PARSER_SPLIT_MODE, /* Need to setup before init */ MPP_DEC_SET_PARSER_FAST_MODE, /* Need to setup before init */ MPP_DEC_GET_STREAM_COUNT, @@ -97,7 +97,6 @@ typedef enum { MPP_DEC_SET_VC1_EXTRA_DATA, MPP_DEC_SET_OUTPUT_FORMAT, MPP_DEC_SET_DISABLE_ERROR, /* When set it will disable sw/hw error (H.264 / H.265) */ - MPP_DEC_SET_PRESENT_TIME_ORDER, /* use input time order for output */ MPP_DEC_CMD_END, MPP_ENC_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_ENC, diff --git a/mpp/codec/dec/h263/h263d_api.c b/mpp/codec/dec/h263/h263d_api.c index b69f3c42..11661a43 100644 --- a/mpp/codec/dec/h263/h263d_api.c +++ b/mpp/codec/dec/h263/h263d_api.c @@ -163,19 +163,11 @@ MPP_RET h263d_flush(void *dec) MPP_RET h263d_control(void *dec, RK_S32 cmd_type, void *param) { - H263dCtx *p; - if (NULL == dec) { mpp_err_f("found NULL intput\n"); return MPP_ERR_NULL_PTR; } - - p = (H263dCtx *)dec; - switch (cmd_type) { - case MPP_DEC_SET_INTERNAL_PTS_ENABLE : { - mpp_h263_parser_set_pts_mode(p->parser, 0); - } break; - } + (void)cmd_type; (void)param; return MPP_OK; } diff --git a/mpp/codec/dec/h263/h263d_parser.c b/mpp/codec/dec/h263/h263d_parser.c index e36b6fa2..00f44cff 100644 --- a/mpp/codec/dec/h263/h263d_parser.c +++ b/mpp/codec/dec/h263/h263d_parser.c @@ -223,7 +223,6 @@ MPP_RET mpp_h263_parser_init(H263dParser *ctx, MppBufSlots frame_slots) mpp_buf_slot_setup(frame_slots, 4); p->frame_slots = frame_slots; - p->use_internal_pts = 0; p->pos_frm_start = -1; p->pos_frm_end = -1; p->bit_ctx = bit_ctx; @@ -429,10 +428,7 @@ MPP_RET mpp_h263_parser_decode(H263dParser ctx, MppPacket pkt) p->width = p->hdr_curr.width; p->height = p->hdr_curr.height; - - if (!p->use_internal_pts) - p->pts = mpp_packet_get_pts(pkt); - + p->pts = mpp_packet_get_pts(pkt); __BITREAD_ERR: h263d_dbg_status("found i_frame %d frame_type %d ret %d\n", p->found_i_vop, p->hdr_curr.pict_type, ret); @@ -570,10 +566,5 @@ MPP_RET mpp_h263_parser_update_dpb(H263dParser ctx) return MPP_OK; } -MPP_RET mpp_h263_parser_set_pts_mode(H263dParser ctx, RK_U32 use_internal_pts) -{ - H263dParserImpl *p = (H263dParserImpl *)ctx; - p->use_internal_pts = use_internal_pts; - return MPP_OK; -} + diff --git a/mpp/codec/dec/h263/h263d_parser.h b/mpp/codec/dec/h263/h263d_parser.h index 2e29da3a..823dfce8 100644 --- a/mpp/codec/dec/h263/h263d_parser.h +++ b/mpp/codec/dec/h263/h263d_parser.h @@ -45,7 +45,6 @@ MPP_RET mpp_h263_parser_setup_syntax(H263dParser ctx, MppSyntax *syntax); MPP_RET mpp_h263_parser_setup_hal_output(H263dParser ctx, RK_S32 *output); MPP_RET mpp_h263_parser_setup_refer(H263dParser ctx, RK_S32 *refer, RK_S32 max_ref); MPP_RET mpp_h263_parser_update_dpb(H263dParser ctx); -MPP_RET mpp_h263_parser_set_pts_mode(H263dParser ctx, RK_U32 use_internal_pts); #ifdef __cplusplus } diff --git a/mpp/codec/dec/mpg4/mpg4d_api.c b/mpp/codec/dec/mpg4/mpg4d_api.c index 8c1147dd..b75a4cf3 100644 --- a/mpp/codec/dec/mpg4/mpg4d_api.c +++ b/mpp/codec/dec/mpg4/mpg4d_api.c @@ -163,19 +163,11 @@ static MPP_RET mpg4d_flush(void *dec) static MPP_RET mpg4d_control(void *dec, RK_S32 cmd_type, void *param) { - Mpg4dCtx *p; - if (NULL == dec) { mpp_err_f("found NULL intput\n"); return MPP_ERR_NULL_PTR; } - - p = (Mpg4dCtx *)dec; - switch (cmd_type) { - case MPP_DEC_SET_INTERNAL_PTS_ENABLE : { - mpp_mpg4_parser_set_pts_mode(p->parser, 0); - } break; - } + (void)cmd_type; (void)param; return MPP_OK; } diff --git a/mpp/codec/dec/mpg4/mpg4d_parser.c b/mpp/codec/dec/mpg4/mpg4d_parser.c index ddf0d94e..0e63fa84 100644 --- a/mpp/codec/dec/mpg4/mpg4d_parser.c +++ b/mpp/codec/dec/mpg4/mpg4d_parser.c @@ -158,7 +158,6 @@ typedef struct Mpg4Hdr_t { typedef struct { // global paramter MppBufSlots frame_slots; - RK_U32 use_internal_pts; RK_U32 found_vol; RK_U32 found_vop; RK_U32 found_i_vop; @@ -835,12 +834,6 @@ static MPP_RET mpeg4_parse_vop_header(Mpg4dParserImpl *p, BitReadCtx_t *gb) mp4Hdr->time_bp = mp4Hdr->time_pp - (RK_S32)(mp4Hdr->last_non_b_time - mp4Hdr->time); } - mp4Hdr->pts = (RK_S64)mp4Hdr->time; - - if (p->use_internal_pts) { - p->pts = mp4Hdr->time; - } - SKIP_BITS(gb, 1); READ_BITS(gb, 1, &val); @@ -1072,7 +1065,6 @@ MPP_RET mpp_mpg4_parser_init(Mpg4dParser *ctx, MppBufSlots frame_slots) mpp_buf_slot_setup(frame_slots, 8); p->frame_slots = frame_slots; - p->use_internal_pts = 0; p->state = -1; p->vop_header_found = 0; p->bit_ctx = bit_ctx; @@ -1354,8 +1346,7 @@ MPP_RET mpp_mpg4_parser_decode(Mpg4dParser ctx, MppPacket pkt) p->height = p->hdr_curr.vol.height; } - if (!p->use_internal_pts) - p->pts = mpp_packet_get_pts(pkt); + p->pts = mpp_packet_get_pts(pkt); ret = (p->found_vol && p->found_vop) ? (MPP_OK) : (MPP_NOK); @@ -1546,16 +1537,5 @@ MPP_RET mpp_mpg4_parser_update_dpb(Mpg4dParser ctx) return MPP_OK; } -MPP_RET mpp_mpg4_parser_set_pts_mode(Mpg4dParser ctx, RK_U32 use_internal_pts) -{ - Mpg4dParserImpl *p = (Mpg4dParserImpl *)ctx; - mpg4d_dbg_func("in\n"); - - p->use_internal_pts = use_internal_pts; - - mpg4d_dbg_func("out\n"); - - return MPP_OK; -} diff --git a/mpp/codec/dec/mpg4/mpg4d_parser.h b/mpp/codec/dec/mpg4/mpg4d_parser.h index 5a5f3f98..a85117bb 100644 --- a/mpp/codec/dec/mpg4/mpg4d_parser.h +++ b/mpp/codec/dec/mpg4/mpg4d_parser.h @@ -45,7 +45,6 @@ MPP_RET mpp_mpg4_parser_setup_syntax(Mpg4dParser ctx, MppSyntax *syntax); MPP_RET mpp_mpg4_parser_setup_hal_output(Mpg4dParser ctx, RK_S32 *output); MPP_RET mpp_mpg4_parser_setup_refer(Mpg4dParser ctx, RK_S32 *refer, RK_S32 max_ref); MPP_RET mpp_mpg4_parser_update_dpb(Mpg4dParser ctx); -MPP_RET mpp_mpg4_parser_set_pts_mode(Mpg4dParser ctx, RK_U32 use_internal_pts); #ifdef __cplusplus } diff --git a/mpp/mpp.cpp b/mpp/mpp.cpp index a08367e7..96c1553b 100755 --- a/mpp/mpp.cpp +++ b/mpp/mpp.cpp @@ -751,13 +751,6 @@ MPP_RET Mpp::control_dec(MpiCmd cmd, MppParam param) ret = mpp_buf_slot_ready(mDec->frame_slots); mThreadCodec->signal(); } break; - case MPP_DEC_SET_INTERNAL_PTS_ENABLE: { - if (mCoding == MPP_VIDEO_CodingMPEG2 || mCoding == MPP_VIDEO_CodingMPEG4) { - ret = mpp_dec_control(mDec, cmd, param); - } else { - mpp_err("coding %x does not support use internal pts control\n", mCoding); - } - } break; case MPP_DEC_SET_PARSER_SPLIT_MODE: { RK_U32 flag = *((RK_U32 *)param); mParserNeedSplit = flag;