[h264d] remove problem which sps and pps is packeted in omx h264d_prepare.

[h264d] add h264d_flsh in h264d_prepare.

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@597 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
DingWei
2016-03-28 10:01:06 +00:00
parent af111d36a1
commit 93382fdca3
4 changed files with 31 additions and 28 deletions

View File

@@ -653,10 +653,14 @@ MPP_RET h264d_prepare(void *decoder, MppPacket pkt, HalDecTask *task)
p_Inp->in_dts = mpp_packet_get_dts(pkt); p_Inp->in_dts = mpp_packet_get_dts(pkt);
if (mpp_packet_get_eos(pkt)) { if (mpp_packet_get_eos(pkt)) {
if (p_Inp->in_length < 4) {
h264d_flush(decoder);
}
p_Inp->in_buf = NULL; p_Inp->in_buf = NULL;
p_Inp->in_length = 0; p_Inp->in_length = 0;
p_Inp->pkt_eos = 1; p_Inp->pkt_eos = 1;
p_Inp->has_get_eos = 1; p_Inp->has_get_eos = 1;
} else { } else {
p_Inp->in_buf = (RK_U8 *)mpp_packet_get_pos(pkt); p_Inp->in_buf = (RK_U8 *)mpp_packet_get_pos(pkt);
p_Inp->in_length = mpp_packet_get_length(pkt); p_Inp->in_length = mpp_packet_get_length(pkt);
@@ -673,13 +677,12 @@ MPP_RET h264d_prepare(void *decoder, MppPacket pkt, HalDecTask *task)
} }
H264D_DBG(H264D_DBG_INPUT, "[pkt_in_timeUs] is_avcC=%d, in_pts=%lld, pkt_eos=%d, len=%d, g_framecnt=%d \n", H264D_DBG(H264D_DBG_INPUT, "[pkt_in_timeUs] is_avcC=%d, in_pts=%lld, pkt_eos=%d, len=%d, g_framecnt=%d \n",
p_Inp->is_nalff, p_Inp->in_pts, p_Inp->pkt_eos, p_Inp->in_length, p_Dec->p_Vid->g_framecnt); p_Inp->is_nalff, p_Inp->in_pts, p_Inp->pkt_eos, p_Inp->in_length, p_Dec->p_Vid->g_framecnt);
if (p_Inp->is_nalff) { if (p_Inp->is_nalff) {
(ret = parse_prepare_extra_data(p_Inp, p_Dec->p_Cur)); (ret = parse_prepare_extra_data(p_Inp, p_Dec->p_Cur));
task->valid = p_Inp->task_valid; //!< prepare valid flag task->valid = p_Inp->task_valid; //!< prepare valid flag
} else { } else {
do { do {
(ret = parse_prepare(p_Inp, p_Dec->p_Cur)); (ret = parse_prepare_fast(p_Inp, p_Dec->p_Cur));
task->valid = p_Inp->task_valid; //!< prepare valid flag task->valid = p_Inp->task_valid; //!< prepare valid flag
} while (mpp_packet_get_length(pkt) && !task->valid); } while (mpp_packet_get_length(pkt) && !task->valid);
} }

View File

@@ -33,6 +33,7 @@
#include "h264d_sei.h" #include "h264d_sei.h"
#include "h264d_init.h" #include "h264d_init.h"
#include "h264d_fill.h" #include "h264d_fill.h"
#include "h264d_log.h"
#define HEAD_MAX_SIZE 12800 #define HEAD_MAX_SIZE 12800
@@ -332,7 +333,6 @@ static MPP_RET store_cur_nalu(H264dCurStream_t *p_strm, H264dDxvaCtx_t *dxva_ctx
RK_U32 add_size = 0; RK_U32 add_size = 0;
//!< fill head buffer //!< fill head buffer
//mpp_log("store_cur_nalu function In \n");
if ( (p_strm->nalu_type == NALU_TYPE_SLICE) if ( (p_strm->nalu_type == NALU_TYPE_SLICE)
|| (p_strm->nalu_type == NALU_TYPE_IDR) || (p_strm->nalu_type == NALU_TYPE_IDR)
|| (p_strm->nalu_type == NALU_TYPE_SPS) || (p_strm->nalu_type == NALU_TYPE_SPS)
@@ -365,6 +365,8 @@ static MPP_RET store_cur_nalu(H264dCurStream_t *p_strm, H264dDxvaCtx_t *dxva_ctx
memcpy(p_des + sizeof(g_start_precode), p_strm->nalu_buf, p_strm->nalu_len); memcpy(p_des + sizeof(g_start_precode), p_strm->nalu_buf, p_strm->nalu_len);
dxva_ctx->strm_offset += p_strm->nalu_len + sizeof(g_start_precode); dxva_ctx->strm_offset += p_strm->nalu_len + sizeof(g_start_precode);
} }
return ret = MPP_OK; return ret = MPP_OK;
__FAILED: __FAILED:
return ret; return ret;
@@ -573,7 +575,6 @@ MPP_RET parse_prepare_fast(H264dInputCtx_t *p_Inp, H264dCurCtx_t *p_Cur)
p_Dec->p_Inp->task_valid = 1; p_Dec->p_Inp->task_valid = 1;
p_Dec->p_Inp->task_eos = 1; p_Dec->p_Inp->task_eos = 1;
LogInfo(p_Inp->p_Dec->logctx.parr[RUN_PARSE], "----- end of stream ----"); LogInfo(p_Inp->p_Dec->logctx.parr[RUN_PARSE], "----- end of stream ----");
//mpp_log("----- eos: end of stream ----\n");
goto __RETURN; goto __RETURN;
} }
//!< check input //!< check input
@@ -592,11 +593,6 @@ MPP_RET parse_prepare_fast(H264dInputCtx_t *p_Inp, H264dCurCtx_t *p_Cur)
p_strm->nalu_buf[p_strm->nalu_len++] = *p_strm->curdata; p_strm->nalu_buf[p_strm->nalu_len++] = *p_strm->curdata;
if (p_strm->nalu_len == 1) { if (p_strm->nalu_len == 1) {
p_strm->nalu_type = p_strm->nalu_buf[0] & 0x1F; p_strm->nalu_type = p_strm->nalu_buf[0] & 0x1F;
//nalu_header_bytes += 1;
//if ((p_strm->nalu_type == NALU_TYPE_PREFIX)
// || (p_strm->nalu_type == NALU_TYPE_SLC_EXT)) {
// nalu_header_bytes += 3;
//}
if (p_strm->nalu_type == NALU_TYPE_SLICE if (p_strm->nalu_type == NALU_TYPE_SLICE
|| p_strm->nalu_type == NALU_TYPE_IDR || p_strm->nalu_type == NALU_TYPE_SLC_EXT) { || p_strm->nalu_type == NALU_TYPE_IDR || p_strm->nalu_type == NALU_TYPE_SLC_EXT) {
@@ -633,11 +629,14 @@ MPP_RET parse_prepare_fast(H264dInputCtx_t *p_Inp, H264dCurCtx_t *p_Cur)
p_Inp->in_length = pkt_impl->length; p_Inp->in_length = pkt_impl->length;
//!< check input //!< check input
if (!p_Inp->in_length) { if (!p_Inp->in_length) {
if (!p_Cur->p_Inp->task_valid) {
p_Dec->nalu_ret = EndOfNalu;
FUN_CHECK(ret = store_cur_nalu(&p_Dec->p_Cur->strm, p_Dec->dxva_ctx));
} else {
p_Dec->nalu_ret = HaveNoStream;
}
p_strm->nalu_offset = 0; p_strm->nalu_offset = 0;
p_Dec->nalu_ret = HaveNoStream;
p_strm->endcode_found = 1; p_strm->endcode_found = 1;
p_Dec->nalu_ret = EndOfNalu;
reset_nalu(p_strm); reset_nalu(p_strm);
p_strm->startcode_found = 0; p_strm->startcode_found = 0;

View File

@@ -30,23 +30,23 @@
#define H264D_DBG_ASSERT (0x00000002) #define H264D_DBG_ASSERT (0x00000002)
#define H264D_DBG_WARNNING (0x00000004) #define H264D_DBG_WARNNING (0x00000004)
#define H264D_DBG_LOG (0x00000008) #define H264D_DBG_LOG (0x00000008)
#define H264D_DBG_ERR_DUMP (0x00000010)
//!< parse marco
#define H264D_DBG_INPUT (0x00000020) //!< input packet
#define H264D_DBG_PPS_SPS (0x00000040)
#define H264D_DBG_LOOP_STATE (0x00000080)
#define H264D_DBG_PARSE_NALU (0x00000100) #define H264D_DBG_INPUT (0x00000010) //!< input packet
#define H264D_DBG_DPB_INFO (0x00000200) //!< size, #define H264D_DBG_PPS_SPS (0x00000020)
#define H264D_DBG_DPB_MALLIC (0x00000400) //!< malloc #define H264D_DBG_LOOP_STATE (0x00000040)
#define H264D_DBG_DPB_FREE (0x00000800) //!< free #define H264D_DBG_PARSE_NALU (0x00000080)
#define H264D_DBG_DPB_DISPLAY (0x00001000) //!< display #define H264D_DBG_DPB_INFO (0x00000100) //!< size,
#define H264D_DBG_DPB_REF_ERR (0x00002000) #define H264D_DBG_DPB_MALLIC (0x00000200) //!< malloc
#define H264D_DBG_SLOT_FLUSH (0x00004000) //!< dpb buffer slot remain #define H264D_DBG_DPB_FREE (0x00000400) //!< free
#define H264D_DBG_SEI (0x00008000) #define H264D_DBG_DPB_DISPLAY (0x00000800) //!< display
#define H264D_DBG_CALLBACK (0x00010000) #define H264D_DBG_DPB_REF_ERR (0x00001000)
#define H264D_DBG_SLOT_FLUSH (0x00002000) //!< dpb buffer slot remain
#define H264D_DBG_SEI (0x00004000)
#define H264D_DBG_CALLBACK (0x00008000)
#define H264D_DBG_ERR_DUMP (0x00010000)
//!< hal marco //!< hal marco
#define H264D_DBG_GEN_REGS (0x01000000) #define H264D_DBG_GEN_REGS (0x01000000)
#define H264D_DBG_RET_REGS (0x02000000) #define H264D_DBG_RET_REGS (0x02000000)
@@ -247,6 +247,7 @@ typedef struct h264d_logctx_t {
//!< function return check //!< function return check
#define FUN_CHECK(val)\ #define FUN_CHECK(val)\
do{ if((val) < 0) {\ do{ if((val) < 0) {\
H264D_WARNNING("Function error(%d).\n", __LINE__); \
goto __FAILED;\ goto __FAILED;\
} } while (0) } } while (0)

View File

@@ -159,8 +159,8 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
pts = mpp_frame_get_pts(mframe); pts = mpp_frame_get_pts(mframe);
aDecOut->timeUs = pts; aDecOut->timeUs = pts;
if (vpu_api_debug & VPU_API_DBG_OUTPUT) { if (vpu_api_debug & VPU_API_DBG_OUTPUT) {
mpp_log("get one frame timeUs %lld, poc=%d, errinfo=%d, discard=%d", aDecOut->timeUs, mpp_log("get one frame timeUs %lld, poc=%d, errinfo=%d, discard=%d, eos=%d", aDecOut->timeUs,
mpp_frame_get_poc(mframe), mpp_frame_get_errinfo(mframe), mpp_frame_get_discard(mframe)); mpp_frame_get_poc(mframe), mpp_frame_get_errinfo(mframe), mpp_frame_get_discard(mframe), mpp_frame_get_eos(mframe));
} }
vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32); vframe->ShowTime.TimeHigh = (RK_U32)(pts >> 32);
vframe->ShowTime.TimeLow = (RK_U32)pts; vframe->ShowTime.TimeLow = (RK_U32)pts;