[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 <leo.ding@rock-chips.com>
This commit is contained in:
Ding Wei
2018-04-23 09:54:29 +08:00
committed by Herman Chen
parent 2f5bd0bffb
commit 7716b36af8
8 changed files with 6 additions and 61 deletions

View File

@@ -89,7 +89,7 @@ typedef enum {
MPP_DEC_SET_FRAME_INFO, /* vpu api legacy control for buffer slot dimension init */ 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_EXT_BUF_GROUP, /* IMPORTANT: set external buffer group to mpp decoder */
MPP_DEC_SET_INFO_CHANGE_READY, 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_SPLIT_MODE, /* Need to setup before init */
MPP_DEC_SET_PARSER_FAST_MODE, /* Need to setup before init */ MPP_DEC_SET_PARSER_FAST_MODE, /* Need to setup before init */
MPP_DEC_GET_STREAM_COUNT, MPP_DEC_GET_STREAM_COUNT,
@@ -97,7 +97,6 @@ typedef enum {
MPP_DEC_SET_VC1_EXTRA_DATA, MPP_DEC_SET_VC1_EXTRA_DATA,
MPP_DEC_SET_OUTPUT_FORMAT, 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_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_DEC_CMD_END,
MPP_ENC_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_ENC, MPP_ENC_CMD_BASE = CMD_MODULE_CODEC | CMD_CTX_ID_ENC,

View File

@@ -163,19 +163,11 @@ MPP_RET h263d_flush(void *dec)
MPP_RET h263d_control(void *dec, RK_S32 cmd_type, void *param) MPP_RET h263d_control(void *dec, RK_S32 cmd_type, void *param)
{ {
H263dCtx *p;
if (NULL == dec) { if (NULL == dec) {
mpp_err_f("found NULL intput\n"); mpp_err_f("found NULL intput\n");
return MPP_ERR_NULL_PTR; return MPP_ERR_NULL_PTR;
} }
(void)cmd_type;
p = (H263dCtx *)dec;
switch (cmd_type) {
case MPP_DEC_SET_INTERNAL_PTS_ENABLE : {
mpp_h263_parser_set_pts_mode(p->parser, 0);
} break;
}
(void)param; (void)param;
return MPP_OK; return MPP_OK;
} }

View File

@@ -223,7 +223,6 @@ MPP_RET mpp_h263_parser_init(H263dParser *ctx, MppBufSlots frame_slots)
mpp_buf_slot_setup(frame_slots, 4); mpp_buf_slot_setup(frame_slots, 4);
p->frame_slots = frame_slots; p->frame_slots = frame_slots;
p->use_internal_pts = 0;
p->pos_frm_start = -1; p->pos_frm_start = -1;
p->pos_frm_end = -1; p->pos_frm_end = -1;
p->bit_ctx = bit_ctx; 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->width = p->hdr_curr.width;
p->height = p->hdr_curr.height; p->height = p->hdr_curr.height;
p->pts = mpp_packet_get_pts(pkt);
if (!p->use_internal_pts)
p->pts = mpp_packet_get_pts(pkt);
__BITREAD_ERR: __BITREAD_ERR:
h263d_dbg_status("found i_frame %d frame_type %d ret %d\n", h263d_dbg_status("found i_frame %d frame_type %d ret %d\n",
p->found_i_vop, p->hdr_curr.pict_type, ret); 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; 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;
}

View File

@@ -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_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_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_update_dpb(H263dParser ctx);
MPP_RET mpp_h263_parser_set_pts_mode(H263dParser ctx, RK_U32 use_internal_pts);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -163,19 +163,11 @@ static MPP_RET mpg4d_flush(void *dec)
static MPP_RET mpg4d_control(void *dec, RK_S32 cmd_type, void *param) static MPP_RET mpg4d_control(void *dec, RK_S32 cmd_type, void *param)
{ {
Mpg4dCtx *p;
if (NULL == dec) { if (NULL == dec) {
mpp_err_f("found NULL intput\n"); mpp_err_f("found NULL intput\n");
return MPP_ERR_NULL_PTR; return MPP_ERR_NULL_PTR;
} }
(void)cmd_type;
p = (Mpg4dCtx *)dec;
switch (cmd_type) {
case MPP_DEC_SET_INTERNAL_PTS_ENABLE : {
mpp_mpg4_parser_set_pts_mode(p->parser, 0);
} break;
}
(void)param; (void)param;
return MPP_OK; return MPP_OK;
} }

View File

@@ -158,7 +158,6 @@ typedef struct Mpg4Hdr_t {
typedef struct { typedef struct {
// global paramter // global paramter
MppBufSlots frame_slots; MppBufSlots frame_slots;
RK_U32 use_internal_pts;
RK_U32 found_vol; RK_U32 found_vol;
RK_U32 found_vop; RK_U32 found_vop;
RK_U32 found_i_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->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); SKIP_BITS(gb, 1);
READ_BITS(gb, 1, &val); 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); mpp_buf_slot_setup(frame_slots, 8);
p->frame_slots = frame_slots; p->frame_slots = frame_slots;
p->use_internal_pts = 0;
p->state = -1; p->state = -1;
p->vop_header_found = 0; p->vop_header_found = 0;
p->bit_ctx = bit_ctx; 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; 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); 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; 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;
}

View File

@@ -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_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_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_update_dpb(Mpg4dParser ctx);
MPP_RET mpp_mpg4_parser_set_pts_mode(Mpg4dParser ctx, RK_U32 use_internal_pts);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -751,13 +751,6 @@ MPP_RET Mpp::control_dec(MpiCmd cmd, MppParam param)
ret = mpp_buf_slot_ready(mDec->frame_slots); ret = mpp_buf_slot_ready(mDec->frame_slots);
mThreadCodec->signal(); mThreadCodec->signal();
} break; } 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: { case MPP_DEC_SET_PARSER_SPLIT_MODE: {
RK_U32 flag = *((RK_U32 *)param); RK_U32 flag = *((RK_U32 *)param);
mParserNeedSplit = flag; mParserNeedSplit = flag;