mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-08 18:40:03 +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_impl.h"
|
||||
#include "mpp_mem.h"
|
||||
#include "h264d_api.h"
|
||||
|
||||
#include "h264d_log.h"
|
||||
#include "h264d_api.h"
|
||||
#include "h264d_global.h"
|
||||
#include "h264d_parse.h"
|
||||
|
||||
@@ -57,11 +58,9 @@ static MPP_RET free_cur_ctx(H264dCurCtx_t *p_Cur)
|
||||
RK_U32 i = 0;
|
||||
INP_CHECK(!p_Cur);
|
||||
FunctionIn(p_Cur->p_Dec->logctx.parr[RUN_PARSE]);
|
||||
if (p_Cur)
|
||||
{
|
||||
if (p_Cur) {
|
||||
//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]);
|
||||
}
|
||||
@@ -82,8 +81,7 @@ static MPP_RET init_cur_ctx(H264dCurCtx_t *p_Cur)
|
||||
p_Cur->strm.prefixdata[0] = 0xff;
|
||||
p_Cur->strm.prefixdata[1] = 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->listB[i] = mpp_malloc_size(H264_StorePic_t*, MAX_LIST_SIZE * sizeof(H264_StorePic_t*))); // +1 for reordering
|
||||
}
|
||||
@@ -102,8 +100,7 @@ static MPP_RET free_vid_ctx(H264dVideoCtx_t *p_Vid)
|
||||
RK_U32 i = 0;
|
||||
INP_CHECK(!p_Vid);
|
||||
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]);
|
||||
}
|
||||
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
||||
@@ -115,21 +112,18 @@ static MPP_RET init_vid_ctx(H264dVideoCtx_t *p_Vid)
|
||||
RK_U32 i = 0;
|
||||
INP_CHECK(!p_Vid);
|
||||
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));
|
||||
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]->init_done = 0;
|
||||
}
|
||||
//!< 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;
|
||||
}
|
||||
for (i = 0; i < MAXPPS; i++)
|
||||
{
|
||||
for (i = 0; i < MAXPPS; i++) {
|
||||
p_Vid->ppsSet[i].pic_parameter_set_id = -1;
|
||||
p_Vid->ppsSet[i].seq_parameter_set_id = -1;
|
||||
}
|
||||
@@ -139,8 +133,7 @@ static MPP_RET init_vid_ctx(H264dVideoCtx_t *p_Vid)
|
||||
p_Vid->active_sps_id[0] = -1;
|
||||
p_Vid->active_sps_id[1] = -1;
|
||||
//!< init subspsSet
|
||||
for (i = 0; i < MAXSPS; i++)
|
||||
{
|
||||
for (i = 0; i < MAXSPS; i++) {
|
||||
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;
|
||||
@@ -194,8 +187,7 @@ static MPP_RET free_dec_ctx(H264_DecCtx_t *p_Dec)
|
||||
RK_U32 i = 0;
|
||||
INP_CHECK(!p_Dec);
|
||||
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]);
|
||||
}
|
||||
mpp_free(p_Dec->mem);
|
||||
@@ -207,7 +199,7 @@ __RETURN:
|
||||
static MPP_RET init_dec_ctx(H264_DecCtx_t *p_Dec)
|
||||
{
|
||||
RK_U32 i = 0;
|
||||
INP_CHECK(p_Dec);
|
||||
INP_CHECK(!p_Dec);
|
||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||
|
||||
MEM_CHECK(p_Dec->mem = mpp_calloc(H264_DecMem_t, 1));
|
||||
@@ -219,14 +211,12 @@ static MPP_RET init_dec_ctx(H264_DecCtx_t *p_Dec)
|
||||
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
|
||||
|
||||
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;
|
||||
FUN_CHECK(init_dxva_ctx(&p_Dec->dxva_ctx[i]));
|
||||
}
|
||||
//!< 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;
|
||||
}
|
||||
//!< set Dec support decoder method
|
||||
@@ -299,7 +289,7 @@ MPP_RET h264d_deinit(void *decoder)
|
||||
{
|
||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||
|
||||
INP_CHECK(decoder);
|
||||
INP_CHECK(!decoder);
|
||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||
|
||||
free_input_ctx(p_Dec->p_Inp);
|
||||
@@ -391,7 +381,7 @@ MPP_RET h264d_parse(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
|
||||
|
||||
|
||||
|
||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||
__RETURN:
|
||||
return MPP_OK;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "mpp_err.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_));
|
||||
bits_left -= bitctx->num_remaining_bits_in_curr_byte_;
|
||||
|
||||
if (ret = update_currbyte(bitctx)) {
|
||||
return MPP_NOK;
|
||||
}
|
||||
FUN_CHECK(ret = update_currbyte(bitctx));
|
||||
}
|
||||
|
||||
*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;
|
||||
|
||||
return MPP_OK;
|
||||
__FAILED:
|
||||
return ret;
|
||||
}
|
||||
/*!
|
||||
***********************************************************************
|
||||
@@ -106,26 +107,22 @@ MPP_RET read_ue(BitReadCtx_t *bitctx, RK_U32 *val)
|
||||
RK_S32 rest;
|
||||
// Count the number of contiguous zero bits.
|
||||
do {
|
||||
if (read_bits(bitctx, 1, &bit)) {
|
||||
return ret = MPP_NOK;
|
||||
}
|
||||
FUN_CHECK(ret = read_bits(bitctx, 1, &bit));
|
||||
num_bits++;
|
||||
} while (bit == 0);
|
||||
|
||||
if (num_bits > 31) {
|
||||
return ret = MPP_NOK;
|
||||
}
|
||||
VAL_CHECK(num_bits < 32);
|
||||
// Calculate exp-Golomb code value of size num_bits.
|
||||
*val = (1 << num_bits) - 1;
|
||||
|
||||
if (num_bits > 0) {
|
||||
if (read_bits(bitctx, num_bits, &rest)) {
|
||||
return ret = MPP_NOK;
|
||||
}
|
||||
FUN_CHECK(ret = read_bits(bitctx, num_bits, &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;
|
||||
RK_U32 ue;
|
||||
if (ret = read_ue(bitctx, &ue)) {
|
||||
return ret = MPP_NOK;
|
||||
}
|
||||
FUN_CHECK(ret = read_ue(bitctx, &ue));
|
||||
|
||||
if (ue % 2 == 0) { // odd
|
||||
*val = -(RK_S32)(ue >> 1);
|
||||
} else {
|
||||
@@ -147,6 +143,8 @@ MPP_RET read_se(BitReadCtx_t *bitctx, RK_S32 *val)
|
||||
}
|
||||
|
||||
return MPP_OK;
|
||||
__FAILED:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include <stdio.h>
|
||||
#include "rk_type.h"
|
||||
#include "rk_mpi.h"
|
||||
|
||||
#include "h264d_log.h"
|
||||
#include "h264d_bitread.h"
|
||||
#include "h264d_syntax.h"
|
||||
|
||||
@@ -789,8 +791,7 @@ typedef struct h264_old_slice_par_t {
|
||||
#define FRAME_BUF_MAX_SIZE 64//512*1024
|
||||
#define FRAME_BUF_ADD_SIZE 32//512
|
||||
#define SYNTAX_BUF_SIZE 5
|
||||
typedef struct h264d_dxva_ctx_t
|
||||
{
|
||||
typedef struct h264d_dxva_ctx_t {
|
||||
RK_U8 cfgBitstrmRaw;
|
||||
struct _DXVA_PicParams_H264_MVC pp;
|
||||
struct _DXVA_Qmatrix_H264 qm;
|
||||
@@ -911,8 +912,7 @@ typedef struct h264d_video_ctx_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_info_t dpb_info[DPB_INFO_SIZE]; //!< 16
|
||||
struct h264_refpic_info_t refpic_info_p[REFPIC_INFO_SIZE]; //!< 32
|
||||
|
@@ -21,8 +21,7 @@
|
||||
#include "mpp_err.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
NALU_NULL = 0,
|
||||
|
||||
//StreamError,
|
||||
@@ -48,8 +47,7 @@ typedef enum
|
||||
} NALU_STATUS;
|
||||
|
||||
|
||||
typedef enum Rkv_slice_state_t
|
||||
{
|
||||
typedef enum Rkv_slice_state_t {
|
||||
SliceSTATE_NULL = 0,
|
||||
SliceSTATE_IDLE,
|
||||
|
||||
|
@@ -23,5 +23,8 @@ add_library(hal_h264d STATIC
|
||||
${HAL_H264D_HDR}
|
||||
${HAL_H264D_SRC}
|
||||
)
|
||||
|
||||
target_link_libraries(hal_h264d
|
||||
mpp
|
||||
)
|
||||
set_target_properties(hal_h264d PROPERTIES FOLDER "mpp/hal")
|
||||
|
||||
|
Reference in New Issue
Block a user