mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-08 02:20:06 +08:00
1. update cmakelist in hal part
2. update some functions git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@262 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -18,8 +18,9 @@
|
|||||||
#include "mpp_packet.h"
|
#include "mpp_packet.h"
|
||||||
#include "mpp_packet_impl.h"
|
#include "mpp_packet_impl.h"
|
||||||
#include "mpp_mem.h"
|
#include "mpp_mem.h"
|
||||||
#include "h264d_api.h"
|
|
||||||
#include "h264d_log.h"
|
#include "h264d_log.h"
|
||||||
|
#include "h264d_api.h"
|
||||||
#include "h264d_global.h"
|
#include "h264d_global.h"
|
||||||
#include "h264d_parse.h"
|
#include "h264d_parse.h"
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
|
|
||||||
static MPP_RET free_input_ctx(H264dInputCtx_t *p_Inp)
|
static MPP_RET free_input_ctx(H264dInputCtx_t *p_Inp)
|
||||||
{
|
{
|
||||||
INP_CHECK(!p_Inp);
|
INP_CHECK(!p_Inp);
|
||||||
FunctionIn(p_Inp->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Inp->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
(void)p_Inp;
|
(void)p_Inp;
|
||||||
@@ -41,7 +42,7 @@ __RETURN:
|
|||||||
}
|
}
|
||||||
static MPP_RET init_input_ctx(H264dInputCtx_t *p_Inp, MppParserInitCfg *init)
|
static MPP_RET init_input_ctx(H264dInputCtx_t *p_Inp, MppParserInitCfg *init)
|
||||||
{
|
{
|
||||||
INP_CHECK(!p_Inp && !init);
|
INP_CHECK(!p_Inp && !init);
|
||||||
FunctionIn(p_Inp->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Inp->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
p_Inp->init = *init;
|
p_Inp->init = *init;
|
||||||
@@ -54,193 +55,182 @@ __RETURN:
|
|||||||
|
|
||||||
static MPP_RET free_cur_ctx(H264dCurCtx_t *p_Cur)
|
static MPP_RET free_cur_ctx(H264dCurCtx_t *p_Cur)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
INP_CHECK(!p_Cur);
|
INP_CHECK(!p_Cur);
|
||||||
FunctionIn(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
if (p_Cur)
|
if (p_Cur) {
|
||||||
{
|
//rkv_h264d_recycle_slice(p_Cur->slice);
|
||||||
//rkv_h264d_recycle_slice(p_Cur->slice);
|
for (i = 0; i < 2; i++) {
|
||||||
for (i = 0; i < 2; i++)
|
mpp_free(p_Cur->listP[i]);
|
||||||
{
|
mpp_free(p_Cur->listB[i]);
|
||||||
mpp_free(p_Cur->listP[i]);
|
}
|
||||||
mpp_free(p_Cur->listB[i]);
|
mpp_free(p_Cur->strm.buf);
|
||||||
}
|
}
|
||||||
mpp_free(p_Cur->strm.buf);
|
|
||||||
}
|
|
||||||
FunctionOut(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
static MPP_RET init_cur_ctx(H264dCurCtx_t *p_Cur)
|
static MPP_RET init_cur_ctx(H264dCurCtx_t *p_Cur)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
INP_CHECK(!p_Cur);
|
INP_CHECK(!p_Cur);
|
||||||
FunctionIn(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
MEM_CHECK(p_Cur->strm.buf = mpp_malloc_size(RK_U8, NALU_BUF_MAX_SIZE));
|
MEM_CHECK(p_Cur->strm.buf = mpp_malloc_size(RK_U8, NALU_BUF_MAX_SIZE));
|
||||||
p_Cur->strm.max_size = NALU_BUF_MAX_SIZE;
|
p_Cur->strm.max_size = NALU_BUF_MAX_SIZE;
|
||||||
p_Cur->strm.prefixdata[0] = 0xff;
|
p_Cur->strm.prefixdata[0] = 0xff;
|
||||||
p_Cur->strm.prefixdata[1] = 0xff;
|
p_Cur->strm.prefixdata[1] = 0xff;
|
||||||
p_Cur->strm.prefixdata[2] = 0xff;
|
p_Cur->strm.prefixdata[2] = 0xff;
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++) {
|
||||||
{
|
MEM_CHECK(p_Cur->listP[i] = mpp_malloc_size(H264_StorePic_t*, MAX_LIST_SIZE * sizeof(H264_StorePic_t*))); // +1 for reordering
|
||||||
MEM_CHECK(p_Cur->listP[i] = mpp_malloc_size(H264_StorePic_t*, MAX_LIST_SIZE*sizeof(H264_StorePic_t*))); // +1 for reordering
|
MEM_CHECK(p_Cur->listB[i] = mpp_malloc_size(H264_StorePic_t*, MAX_LIST_SIZE * sizeof(H264_StorePic_t*))); // +1 for reordering
|
||||||
MEM_CHECK(p_Cur->listB[i] = mpp_malloc_size(H264_StorePic_t*, MAX_LIST_SIZE*sizeof(H264_StorePic_t*))); // +1 for reordering
|
}
|
||||||
}
|
|
||||||
FunctionOut(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
free_cur_ctx(p_Cur);
|
free_cur_ctx(p_Cur);
|
||||||
|
|
||||||
return MPP_NOK;
|
return MPP_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static MPP_RET free_vid_ctx(H264dVideoCtx_t *p_Vid)
|
static MPP_RET free_vid_ctx(H264dVideoCtx_t *p_Vid)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
INP_CHECK(!p_Vid);
|
INP_CHECK(!p_Vid);
|
||||||
FunctionIn(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
for (i = 0; i < MAX_NUM_DPB_LAYERS; i++)
|
for (i = 0; i < MAX_NUM_DPB_LAYERS; i++) {
|
||||||
{
|
mpp_free(p_Vid->p_Dpb_layer[i]);
|
||||||
mpp_free(p_Vid->p_Dpb_layer[i]);
|
}
|
||||||
}
|
|
||||||
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
static MPP_RET init_vid_ctx(H264dVideoCtx_t *p_Vid)
|
static MPP_RET init_vid_ctx(H264dVideoCtx_t *p_Vid)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
INP_CHECK(!p_Vid);
|
INP_CHECK(!p_Vid);
|
||||||
FunctionIn(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
for (i = 0; i < MAX_NUM_DPB_LAYERS; i++)
|
for (i = 0; i < MAX_NUM_DPB_LAYERS; i++) {
|
||||||
{
|
MEM_CHECK(p_Vid->p_Dpb_layer[i] = mpp_calloc(H264_DpbBuf_t, 1));
|
||||||
MEM_CHECK(p_Vid->p_Dpb_layer[i] = mpp_calloc(H264_DpbBuf_t, 1));
|
p_Vid->p_Dpb_layer[i]->layer_id = i;
|
||||||
p_Vid->p_Dpb_layer[i]->layer_id = i;
|
p_Vid->p_Dpb_layer[i]->p_Vid = p_Vid;
|
||||||
p_Vid->p_Dpb_layer[i]->p_Vid = p_Vid;
|
p_Vid->p_Dpb_layer[i]->init_done = 0;
|
||||||
p_Vid->p_Dpb_layer[i]->init_done = 0;
|
}
|
||||||
}
|
//!< init video pars
|
||||||
//!< init video pars
|
for (i = 0; i < MAXSPS; i++) {
|
||||||
for (i = 0; i < MAXSPS; i++)
|
p_Vid->spsSet[i].seq_parameter_set_id = -1;
|
||||||
{
|
p_Vid->subspsSet[i].sps.seq_parameter_set_id = -1;
|
||||||
p_Vid->spsSet[i].seq_parameter_set_id = -1;
|
}
|
||||||
p_Vid->subspsSet[i].sps.seq_parameter_set_id = -1;
|
for (i = 0; i < MAXPPS; i++) {
|
||||||
}
|
p_Vid->ppsSet[i].pic_parameter_set_id = -1;
|
||||||
for (i = 0; i < MAXPPS; i++)
|
p_Vid->ppsSet[i].seq_parameter_set_id = -1;
|
||||||
{
|
}
|
||||||
p_Vid->ppsSet[i].pic_parameter_set_id = -1;
|
//!< init active_sps
|
||||||
p_Vid->ppsSet[i].seq_parameter_set_id = -1;
|
p_Vid->active_sps = NULL;
|
||||||
}
|
p_Vid->active_subsps = NULL;
|
||||||
//!< init active_sps
|
p_Vid->active_sps_id[0] = -1;
|
||||||
p_Vid->active_sps = NULL;
|
p_Vid->active_sps_id[1] = -1;
|
||||||
p_Vid->active_subsps = NULL;
|
//!< init subspsSet
|
||||||
p_Vid->active_sps_id[0] = -1;
|
for (i = 0; i < MAXSPS; i++) {
|
||||||
p_Vid->active_sps_id[1] = -1;
|
p_Vid->subspsSet[i].sps.seq_parameter_set_id = -1;
|
||||||
//!< init subspsSet
|
p_Vid->subspsSet[i].num_views_minus1 = -1;
|
||||||
for (i = 0; i < MAXSPS; i++)
|
p_Vid->subspsSet[i].num_level_values_signalled_minus1 = -1;
|
||||||
{
|
}
|
||||||
p_Vid->subspsSet[i].sps.seq_parameter_set_id = -1;
|
|
||||||
p_Vid->subspsSet[i].num_views_minus1 = -1;
|
|
||||||
p_Vid->subspsSet[i].num_level_values_signalled_minus1 = -1;
|
|
||||||
}
|
|
||||||
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
free_vid_ctx(p_Vid);
|
free_vid_ctx(p_Vid);
|
||||||
|
|
||||||
return MPP_NOK;
|
return MPP_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET free_dxva_ctx(H264dDxvaCtx_t *p_dxva)
|
static MPP_RET free_dxva_ctx(H264dDxvaCtx_t *p_dxva)
|
||||||
{
|
{
|
||||||
INP_CHECK(!p_dxva);
|
INP_CHECK(!p_dxva);
|
||||||
FunctionIn(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
mpp_free(p_dxva->slice_short);
|
mpp_free(p_dxva->slice_short);
|
||||||
mpp_free(p_dxva->slice_long);
|
mpp_free(p_dxva->slice_long);
|
||||||
mpp_free(p_dxva->bitstream);
|
mpp_free(p_dxva->bitstream);
|
||||||
mpp_free(p_dxva->syn.buf);
|
mpp_free(p_dxva->syn.buf);
|
||||||
|
|
||||||
FunctionOut(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET init_dxva_ctx(H264dDxvaCtx_t *p_dxva)
|
static MPP_RET init_dxva_ctx(H264dDxvaCtx_t *p_dxva)
|
||||||
{
|
{
|
||||||
INP_CHECK(!p_dxva);
|
INP_CHECK(!p_dxva);
|
||||||
FunctionIn(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
p_dxva->max_slice_size = MAX_SLICE_SIZE;
|
p_dxva->max_slice_size = MAX_SLICE_SIZE;
|
||||||
MEM_CHECK(p_dxva->slice_short = mpp_calloc(DXVA_Slice_H264_Short, p_dxva->max_slice_size));
|
MEM_CHECK(p_dxva->slice_short = mpp_calloc(DXVA_Slice_H264_Short, p_dxva->max_slice_size));
|
||||||
MEM_CHECK(p_dxva->slice_long = mpp_calloc(DXVA_Slice_H264_Long, p_dxva->max_slice_size));
|
MEM_CHECK(p_dxva->slice_long = mpp_calloc(DXVA_Slice_H264_Long, p_dxva->max_slice_size));
|
||||||
p_dxva->max_strm_size = FRAME_BUF_MAX_SIZE;
|
p_dxva->max_strm_size = FRAME_BUF_MAX_SIZE;
|
||||||
MEM_CHECK(p_dxva->bitstream = mpp_malloc(RK_U8,p_dxva->max_strm_size));
|
MEM_CHECK(p_dxva->bitstream = mpp_malloc(RK_U8, p_dxva->max_strm_size));
|
||||||
MEM_CHECK(p_dxva->syn.buf = mpp_calloc(DXVA2_DecodeBufferDesc, SYNTAX_BUF_SIZE));
|
MEM_CHECK(p_dxva->syn.buf = mpp_calloc(DXVA2_DecodeBufferDesc, SYNTAX_BUF_SIZE));
|
||||||
|
|
||||||
FunctionOut(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
|
|
||||||
__FAILED:
|
__FAILED:
|
||||||
return MPP_NOK;
|
return MPP_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MPP_RET free_dec_ctx(H264_DecCtx_t *p_Dec)
|
static MPP_RET free_dec_ctx(H264_DecCtx_t *p_Dec)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
INP_CHECK(!p_Dec);
|
INP_CHECK(!p_Dec);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
for (i = 0; i < MAX_TASK_SIZE; i++)
|
for (i = 0; i < MAX_TASK_SIZE; i++) {
|
||||||
{
|
free_dxva_ctx(&p_Dec->dxva_ctx[i]);
|
||||||
free_dxva_ctx(&p_Dec->dxva_ctx[i]);
|
}
|
||||||
}
|
mpp_free(p_Dec->mem);
|
||||||
mpp_free(p_Dec->mem);
|
|
||||||
|
|
||||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
static MPP_RET init_dec_ctx(H264_DecCtx_t *p_Dec)
|
static MPP_RET init_dec_ctx(H264_DecCtx_t *p_Dec)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
INP_CHECK(p_Dec);
|
INP_CHECK(!p_Dec);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
MEM_CHECK(p_Dec->mem = mpp_calloc(H264_DecMem_t, 1));
|
MEM_CHECK(p_Dec->mem = mpp_calloc(H264_DecMem_t, 1));
|
||||||
|
|
||||||
p_Dec->dpb_mark = p_Dec->mem->dpb_mark; //!< for write out, MAX_DPB_SIZE
|
p_Dec->dpb_mark = p_Dec->mem->dpb_mark; //!< for write out, MAX_DPB_SIZE
|
||||||
p_Dec->dpb_info = p_Dec->mem->dpb_info; //!< 16
|
p_Dec->dpb_info = p_Dec->mem->dpb_info; //!< 16
|
||||||
p_Dec->refpic_info_p = p_Dec->mem->refpic_info_p; //!< 32
|
p_Dec->refpic_info_p = p_Dec->mem->refpic_info_p; //!< 32
|
||||||
p_Dec->refpic_info[0] = p_Dec->mem->refpic_info[0]; //!< [2][32]
|
p_Dec->refpic_info[0] = p_Dec->mem->refpic_info[0]; //!< [2][32]
|
||||||
p_Dec->refpic_info[1] = p_Dec->mem->refpic_info[1]; //!< [2][32]
|
p_Dec->refpic_info[1] = p_Dec->mem->refpic_info[1]; //!< [2][32]
|
||||||
p_Dec->dxva_ctx = p_Dec->mem->dxva_ctx; //!< MAX_TASK_SIZE
|
p_Dec->dxva_ctx = p_Dec->mem->dxva_ctx; //!< MAX_TASK_SIZE
|
||||||
|
|
||||||
for (i = 0; i < MAX_TASK_SIZE; i++)
|
for (i = 0; i < MAX_TASK_SIZE; i++) {
|
||||||
{
|
p_Dec->dxva_ctx[i].p_Dec = p_Dec;
|
||||||
p_Dec->dxva_ctx[i].p_Dec = p_Dec;
|
FUN_CHECK(init_dxva_ctx(&p_Dec->dxva_ctx[i]));
|
||||||
FUN_CHECK(init_dxva_ctx(&p_Dec->dxva_ctx[i]));
|
}
|
||||||
}
|
//!< init Dpb_memory Mark
|
||||||
//!< init Dpb_memory Mark
|
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
for (i = 0; i < MAX_DPB_SIZE; i++)
|
p_Dec->dpb_mark[i].index = i;
|
||||||
{
|
}
|
||||||
p_Dec->dpb_mark[i].index = i;
|
//!< set Dec support decoder method
|
||||||
}
|
p_Dec->spt_decode_mtds = MPP_DEC_BY_FRAME | MPP_DEC_BY_SLICE;
|
||||||
//!< set Dec support decoder method
|
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||||
p_Dec->spt_decode_mtds = MPP_DEC_BY_FRAME | MPP_DEC_BY_SLICE;
|
p_Dec->nalu_ret = NALU_NULL;
|
||||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
p_Dec->first_frame_flag = 1;
|
||||||
p_Dec->nalu_ret = NALU_NULL;
|
|
||||||
p_Dec->first_frame_flag = 1;
|
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
|
|
||||||
__FAILED:
|
__FAILED:
|
||||||
free_dec_ctx(p_Dec);
|
free_dec_ctx(p_Dec);
|
||||||
|
|
||||||
return MPP_NOK;
|
return MPP_NOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -299,7 +289,7 @@ MPP_RET h264d_deinit(void *decoder)
|
|||||||
{
|
{
|
||||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||||
|
|
||||||
INP_CHECK(decoder);
|
INP_CHECK(!decoder);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
free_input_ctx(p_Dec->p_Inp);
|
free_input_ctx(p_Dec->p_Inp);
|
||||||
@@ -323,7 +313,7 @@ __RETURN:
|
|||||||
*/
|
*/
|
||||||
MPP_RET h264d_reset(void *decoder)
|
MPP_RET h264d_reset(void *decoder)
|
||||||
{
|
{
|
||||||
INP_CHECK(decoder);
|
INP_CHECK(decoder);
|
||||||
|
|
||||||
(void)decoder;
|
(void)decoder;
|
||||||
__RETURN:
|
__RETURN:
|
||||||
@@ -338,7 +328,7 @@ __RETURN:
|
|||||||
*/
|
*/
|
||||||
MPP_RET h264d_flush(void *decoder)
|
MPP_RET h264d_flush(void *decoder)
|
||||||
{
|
{
|
||||||
INP_CHECK(decoder);
|
INP_CHECK(decoder);
|
||||||
|
|
||||||
(void)decoder;
|
(void)decoder;
|
||||||
__RETURN:
|
__RETURN:
|
||||||
@@ -372,10 +362,10 @@ MPP_RET h264d_control(void *decoder, RK_S32 cmd_type, void *param)
|
|||||||
*/
|
*/
|
||||||
MPP_RET h264d_parse(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
|
MPP_RET h264d_parse(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
|
||||||
{
|
{
|
||||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||||
MppPacketImpl *pkt = (MppPacketImpl *)in_pkt;
|
MppPacketImpl *pkt = (MppPacketImpl *)in_pkt;
|
||||||
INP_CHECK(!decoder && !in_pkt && !in_task);
|
INP_CHECK(!decoder && !in_pkt && !in_task);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -383,17 +373,17 @@ MPP_RET h264d_parse(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
pkt->size = (pkt->size >= 500) ? (pkt->size - 500) : 0;
|
pkt->size = (pkt->size >= 500) ? (pkt->size - 500) : 0;
|
||||||
|
|
||||||
in_task->valid = pkt->size ? 0 : 1;
|
in_task->valid = pkt->size ? 0 : 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "mpp_err.h"
|
||||||
#include "h264d_bitread.h"
|
#include "h264d_bitread.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -70,9 +71,7 @@ MPP_RET read_bits(BitReadCtx_t *bitctx, RK_S32 num_bits, RK_S32 *out)
|
|||||||
*out |= (bitctx->curr_byte_ << (bits_left - bitctx->num_remaining_bits_in_curr_byte_));
|
*out |= (bitctx->curr_byte_ << (bits_left - bitctx->num_remaining_bits_in_curr_byte_));
|
||||||
bits_left -= bitctx->num_remaining_bits_in_curr_byte_;
|
bits_left -= bitctx->num_remaining_bits_in_curr_byte_;
|
||||||
|
|
||||||
if (ret = update_currbyte(bitctx)) {
|
FUN_CHECK(ret = update_currbyte(bitctx));
|
||||||
return MPP_NOK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*out |= (bitctx->curr_byte_ >> (bitctx->num_remaining_bits_in_curr_byte_ - bits_left));
|
*out |= (bitctx->curr_byte_ >> (bitctx->num_remaining_bits_in_curr_byte_ - bits_left));
|
||||||
@@ -81,6 +80,8 @@ MPP_RET read_bits(BitReadCtx_t *bitctx, RK_S32 num_bits, RK_S32 *out)
|
|||||||
bitctx->used_bits += num_bits;
|
bitctx->used_bits += num_bits;
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
|
__FAILED:
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
@@ -106,26 +107,22 @@ MPP_RET read_ue(BitReadCtx_t *bitctx, RK_U32 *val)
|
|||||||
RK_S32 rest;
|
RK_S32 rest;
|
||||||
// Count the number of contiguous zero bits.
|
// Count the number of contiguous zero bits.
|
||||||
do {
|
do {
|
||||||
if (read_bits(bitctx, 1, &bit)) {
|
FUN_CHECK(ret = read_bits(bitctx, 1, &bit));
|
||||||
return ret = MPP_NOK;
|
|
||||||
}
|
|
||||||
num_bits++;
|
num_bits++;
|
||||||
} while (bit == 0);
|
} while (bit == 0);
|
||||||
|
|
||||||
if (num_bits > 31) {
|
VAL_CHECK(num_bits < 32);
|
||||||
return ret = MPP_NOK;
|
|
||||||
}
|
|
||||||
// Calculate exp-Golomb code value of size num_bits.
|
// Calculate exp-Golomb code value of size num_bits.
|
||||||
*val = (1 << num_bits) - 1;
|
*val = (1 << num_bits) - 1;
|
||||||
|
|
||||||
if (num_bits > 0) {
|
if (num_bits > 0) {
|
||||||
if (read_bits(bitctx, num_bits, &rest)) {
|
FUN_CHECK(ret = read_bits(bitctx, num_bits, &rest));
|
||||||
return ret = MPP_NOK;
|
|
||||||
}
|
|
||||||
*val += rest;
|
*val += rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret = MPP_OK;
|
return MPP_OK;
|
||||||
|
__FAILED:
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
@@ -137,9 +134,8 @@ MPP_RET read_se(BitReadCtx_t *bitctx, RK_S32 *val)
|
|||||||
{
|
{
|
||||||
MPP_RET ret = MPP_NOK;
|
MPP_RET ret = MPP_NOK;
|
||||||
RK_U32 ue;
|
RK_U32 ue;
|
||||||
if (ret = read_ue(bitctx, &ue)) {
|
FUN_CHECK(ret = read_ue(bitctx, &ue));
|
||||||
return ret = MPP_NOK;
|
|
||||||
}
|
|
||||||
if (ue % 2 == 0) { // odd
|
if (ue % 2 == 0) { // odd
|
||||||
*val = -(RK_S32)(ue >> 1);
|
*val = -(RK_S32)(ue >> 1);
|
||||||
} else {
|
} else {
|
||||||
@@ -147,6 +143,8 @@ MPP_RET read_se(BitReadCtx_t *bitctx, RK_S32 *val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
|
__FAILED:
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "rk_type.h"
|
#include "rk_type.h"
|
||||||
#include "rk_mpi.h"
|
#include "rk_mpi.h"
|
||||||
|
|
||||||
|
#include "h264d_log.h"
|
||||||
#include "h264d_bitread.h"
|
#include "h264d_bitread.h"
|
||||||
#include "h264d_syntax.h"
|
#include "h264d_syntax.h"
|
||||||
|
|
||||||
@@ -789,21 +791,20 @@ typedef struct h264_old_slice_par_t {
|
|||||||
#define FRAME_BUF_MAX_SIZE 64//512*1024
|
#define FRAME_BUF_MAX_SIZE 64//512*1024
|
||||||
#define FRAME_BUF_ADD_SIZE 32//512
|
#define FRAME_BUF_ADD_SIZE 32//512
|
||||||
#define SYNTAX_BUF_SIZE 5
|
#define SYNTAX_BUF_SIZE 5
|
||||||
typedef struct h264d_dxva_ctx_t
|
typedef struct h264d_dxva_ctx_t {
|
||||||
{
|
RK_U8 cfgBitstrmRaw;
|
||||||
RK_U8 cfgBitstrmRaw;
|
struct _DXVA_PicParams_H264_MVC pp;
|
||||||
struct _DXVA_PicParams_H264_MVC pp;
|
struct _DXVA_Qmatrix_H264 qm;
|
||||||
struct _DXVA_Qmatrix_H264 qm;
|
RK_U32 max_slice_size;
|
||||||
RK_U32 max_slice_size;
|
RK_U32 slice_count;
|
||||||
RK_U32 slice_count;
|
struct _DXVA_Slice_H264_Short *slice_short; //!< MAX_SLICES
|
||||||
struct _DXVA_Slice_H264_Short *slice_short; //!< MAX_SLICES
|
struct _DXVA_Slice_H264_Long *slice_long; //!< MAX_SLICES
|
||||||
struct _DXVA_Slice_H264_Long *slice_long; //!< MAX_SLICES
|
RK_U8 *bitstream;
|
||||||
RK_U8 *bitstream;
|
RK_U32 max_strm_size;
|
||||||
RK_U32 max_strm_size;
|
RK_U32 strm_offset;
|
||||||
RK_U32 strm_offset;
|
struct h264d_syntax_t syn;
|
||||||
struct h264d_syntax_t syn;
|
struct h264_dec_ctx_t *p_Dec;
|
||||||
struct h264_dec_ctx_t *p_Dec;
|
} H264dDxvaCtx_t;
|
||||||
}H264dDxvaCtx_t;
|
|
||||||
|
|
||||||
|
|
||||||
//!< input parameter
|
//!< input parameter
|
||||||
@@ -911,24 +912,23 @@ typedef struct h264d_video_ctx_t {
|
|||||||
|
|
||||||
} H264dVideoCtx_t;
|
} H264dVideoCtx_t;
|
||||||
|
|
||||||
typedef struct h264d_mem_t
|
typedef struct h264d_mem_t {
|
||||||
{
|
struct h264_dpb_mark_t dpb_mark[MAX_DPB_SIZE]; //!< for write out, MAX_DPB_SIZE
|
||||||
struct h264_dpb_mark_t dpb_mark[MAX_DPB_SIZE]; //!< for write out, MAX_DPB_SIZE
|
struct h264_dpb_info_t dpb_info[DPB_INFO_SIZE]; //!< 16
|
||||||
struct h264_dpb_info_t dpb_info[DPB_INFO_SIZE]; //!< 16
|
struct h264_refpic_info_t refpic_info_p[REFPIC_INFO_SIZE]; //!< 32
|
||||||
struct h264_refpic_info_t refpic_info_p[REFPIC_INFO_SIZE]; //!< 32
|
struct h264_refpic_info_t refpic_info[2][REFPIC_INFO_SIZE]; //!< [2][32]
|
||||||
struct h264_refpic_info_t refpic_info[2][REFPIC_INFO_SIZE]; //!< [2][32]
|
struct h264d_dxva_ctx_t dxva_ctx[MAX_TASK_SIZE];
|
||||||
struct h264d_dxva_ctx_t dxva_ctx[MAX_TASK_SIZE];
|
} H264_DecMem_t;
|
||||||
}H264_DecMem_t;
|
|
||||||
|
|
||||||
//!< decoder video parameter
|
//!< decoder video parameter
|
||||||
typedef struct h264_dec_ctx_t {
|
typedef struct h264_dec_ctx_t {
|
||||||
struct h264d_mem_t *mem;
|
struct h264d_mem_t *mem;
|
||||||
struct h264_dpb_mark_t *dpb_mark; //!< for write out, MAX_DPB_SIZE
|
struct h264_dpb_mark_t *dpb_mark; //!< for write out, MAX_DPB_SIZE
|
||||||
struct h264_dpb_info_t *dpb_info; //!< 16
|
struct h264_dpb_info_t *dpb_info; //!< 16
|
||||||
struct h264_refpic_info_t *refpic_info_p; //!< 32
|
struct h264_refpic_info_t *refpic_info_p; //!< 32
|
||||||
struct h264_refpic_info_t *refpic_info[2]; //!< [2][32]
|
struct h264_refpic_info_t *refpic_info[2]; //!< [2][32]
|
||||||
struct h264d_dxva_ctx_t *dxva_ctx;
|
struct h264d_dxva_ctx_t *dxva_ctx;
|
||||||
|
|
||||||
struct h264d_input_ctx_t *p_Inp;
|
struct h264d_input_ctx_t *p_Inp;
|
||||||
struct h264d_cur_ctx_t *p_Cur; //!< current parameters, use in read nalu
|
struct h264d_cur_ctx_t *p_Cur; //!< current parameters, use in read nalu
|
||||||
struct h264d_video_ctx_t *p_Vid; //!< parameters for video decoder
|
struct h264d_video_ctx_t *p_Vid; //!< parameters for video decoder
|
||||||
|
@@ -1,90 +1,88 @@
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2015 Rockchip Electronics Co. LTD
|
* Copyright 2015 Rockchip Electronics Co. LTD
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __H264D_PARSE_H__
|
|
||||||
#define __H264D_PARSE_H__
|
|
||||||
#include "rk_type.h"
|
|
||||||
#include "mpp_err.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
NALU_NULL = 0,
|
|
||||||
|
|
||||||
//StreamError,
|
#ifndef __H264D_PARSE_H__
|
||||||
//HaveNoStream,
|
#define __H264D_PARSE_H__
|
||||||
//NaluNotSupport,
|
#include "rk_type.h"
|
||||||
//ReadNaluError,
|
#include "mpp_err.h"
|
||||||
//NALU_ERROR,
|
|
||||||
//NALU_OK,
|
|
||||||
//StartofNalu,
|
|
||||||
//EndofStream,
|
|
||||||
//ReallocBufError,
|
|
||||||
//MidOfNalu,
|
|
||||||
//EndOfNalu,
|
|
||||||
//StartOfPicture,
|
|
||||||
//StartOfSlice,
|
|
||||||
//SkipNALU,
|
|
||||||
//NALU_SPS,
|
|
||||||
//NALU_SubSPS,
|
|
||||||
//NALU_PPS,
|
|
||||||
//NALU_SEI,
|
|
||||||
|
|
||||||
NALU_MAX,
|
|
||||||
}NALU_STATUS;
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum Rkv_slice_state_t
|
typedef enum {
|
||||||
{
|
NALU_NULL = 0,
|
||||||
SliceSTATE_NULL = 0,
|
|
||||||
SliceSTATE_IDLE,
|
|
||||||
|
|
||||||
//SliceSTATE_GetLastSlice,
|
//StreamError,
|
||||||
SliceSTATE_ResetSlice,
|
//HaveNoStream,
|
||||||
//SliceSTATE_ReadNalu,
|
//NaluNotSupport,
|
||||||
//SliceSTATE_ParseNalu,
|
//ReadNaluError,
|
||||||
//SliceSTATE_DecodeOneSlice,
|
//NALU_ERROR,
|
||||||
//SliceSTATE_InitPicture,
|
//NALU_OK,
|
||||||
//SliceSTATE_GetOuterDpbMemory,
|
//StartofNalu,
|
||||||
////SliceSTATE_InitSlice,
|
//EndofStream,
|
||||||
//SliceSTATE_GetSliceData,
|
//ReallocBufError,
|
||||||
//SliceSTATE_RegisterOneSlice,
|
//MidOfNalu,
|
||||||
//SliceSTATE_RegisterOneFrame,
|
//EndOfNalu,
|
||||||
//SliceSTATE_ExitPicture,
|
//StartOfPicture,
|
||||||
//SliceSTATE_ErrorMaster,
|
//StartOfSlice,
|
||||||
|
//SkipNALU,
|
||||||
|
//NALU_SPS,
|
||||||
|
//NALU_SubSPS,
|
||||||
|
//NALU_PPS,
|
||||||
|
//NALU_SEI,
|
||||||
|
|
||||||
//SliceSTATE_Return,
|
NALU_MAX,
|
||||||
SliceSTATE_MAX,
|
} NALU_STATUS;
|
||||||
|
|
||||||
}RKV_SLICE_STATUS;
|
|
||||||
|
typedef enum Rkv_slice_state_t {
|
||||||
|
SliceSTATE_NULL = 0,
|
||||||
|
SliceSTATE_IDLE,
|
||||||
|
|
||||||
|
//SliceSTATE_GetLastSlice,
|
||||||
|
SliceSTATE_ResetSlice,
|
||||||
#ifdef __cplusplus
|
//SliceSTATE_ReadNalu,
|
||||||
extern "C" {
|
//SliceSTATE_ParseNalu,
|
||||||
#endif
|
//SliceSTATE_DecodeOneSlice,
|
||||||
|
//SliceSTATE_InitPicture,
|
||||||
|
//SliceSTATE_GetOuterDpbMemory,
|
||||||
#ifdef __cplusplus
|
////SliceSTATE_InitSlice,
|
||||||
}
|
//SliceSTATE_GetSliceData,
|
||||||
#endif
|
//SliceSTATE_RegisterOneSlice,
|
||||||
|
//SliceSTATE_RegisterOneFrame,
|
||||||
|
//SliceSTATE_ExitPicture,
|
||||||
#endif /* __H264D_PARSE_H__ */
|
//SliceSTATE_ErrorMaster,
|
||||||
|
|
||||||
|
//SliceSTATE_Return,
|
||||||
|
SliceSTATE_MAX,
|
||||||
|
|
||||||
|
} RKV_SLICE_STATUS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __H264D_PARSE_H__ */
|
||||||
|
@@ -23,5 +23,8 @@ add_library(hal_h264d STATIC
|
|||||||
${HAL_H264D_HDR}
|
${HAL_H264D_HDR}
|
||||||
${HAL_H264D_SRC}
|
${HAL_H264D_SRC}
|
||||||
)
|
)
|
||||||
|
target_link_libraries(hal_h264d
|
||||||
|
mpp
|
||||||
|
)
|
||||||
set_target_properties(hal_h264d PROPERTIES FOLDER "mpp/hal")
|
set_target_properties(hal_h264d PROPERTIES FOLDER "mpp/hal")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user