mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[format]: format coding style
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@907 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -77,8 +77,7 @@ typedef struct avsd_cur_strm_t {
|
|||||||
RK_U8 got_nalu_flag;
|
RK_U8 got_nalu_flag;
|
||||||
} AvsdCurStream_t;
|
} AvsdCurStream_t;
|
||||||
|
|
||||||
typedef struct avsd_nalu_t
|
typedef struct avsd_nalu_t {
|
||||||
{
|
|
||||||
RK_U8 header;
|
RK_U8 header;
|
||||||
RK_U8 *pdata;
|
RK_U8 *pdata;
|
||||||
RK_U32 size;
|
RK_U32 size;
|
||||||
@@ -117,8 +116,7 @@ typedef struct avsd_bitstream_t {
|
|||||||
} AvsdBitstream_t;
|
} AvsdBitstream_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct avsd_outframe_t
|
typedef struct avsd_outframe_t {
|
||||||
{
|
|
||||||
RK_S32 nWidth;
|
RK_S32 nWidth;
|
||||||
RK_S32 nHeight;
|
RK_S32 nHeight;
|
||||||
RK_U8 *data[4]; // Y U V data
|
RK_U8 *data[4]; // Y U V data
|
||||||
|
@@ -1341,8 +1341,7 @@ MPP_RET store_picture_in_dpb(H264_DpbBuf_t *p_Dpb, H264_StorePic_t *p)
|
|||||||
if ((min_poc - p_Dpb->last_output_poc) <= p_Dpb->poc_interval) {
|
if ((min_poc - p_Dpb->last_output_poc) <= p_Dpb->poc_interval) {
|
||||||
p_Dpb->last_output_poc = min_poc;
|
p_Dpb->last_output_poc = min_poc;
|
||||||
FUN_CHECK(ret = write_stored_frame(p_Vid, p_Dpb->fs[min_pos]));
|
FUN_CHECK(ret = write_stored_frame(p_Vid, p_Dpb->fs[min_pos]));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -462,8 +462,7 @@ static MPP_RET check_dpb_field_paired(H264_FrameStore_t *p_last, H264_StorePic_t
|
|||||||
|| (p_last->is_used == 2 && cur_structure == BOTTOM_FIELD) //!< Bot + Bot
|
|| (p_last->is_used == 2 && cur_structure == BOTTOM_FIELD) //!< Bot + Bot
|
||||||
//|| ((!dec_pic->combine_flag) && p_last->is_used == 2 && cur_structure == TOP_FIELD) //!< Bot + Top + not combine
|
//|| ((!dec_pic->combine_flag) && p_last->is_used == 2 && cur_structure == TOP_FIELD) //!< Bot + Top + not combine
|
||||||
|| ((!dec_pic->combine_flag) && p_last->is_used == 1 && cur_structure == BOTTOM_FIELD) //!< Top + Bot + not combine
|
|| ((!dec_pic->combine_flag) && p_last->is_used == 1 && cur_structure == BOTTOM_FIELD) //!< Top + Bot + not combine
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
H264D_WARNNING("[check_field_paired] (discard) combine_flag=%d, last_used=%d, curr_struct=%d",
|
H264D_WARNNING("[check_field_paired] (discard) combine_flag=%d, last_used=%d, curr_struct=%d",
|
||||||
dec_pic->combine_flag, p_last->is_used, cur_structure);
|
dec_pic->combine_flag, p_last->is_used, cur_structure);
|
||||||
return ret = MPP_NOK;
|
return ret = MPP_NOK;
|
||||||
|
@@ -378,8 +378,7 @@ static MPP_RET store_cur_nalu(H264dCurCtx_t *p_Cur, H264dCurStream_t *p_strm, H2
|
|||||||
p_Inp->spspps_offset += p_strm->nalu_len + sizeof(g_start_precode);
|
p_Inp->spspps_offset += p_strm->nalu_len + sizeof(g_start_precode);
|
||||||
p_Inp->spspps_len = p_Inp->spspps_offset;
|
p_Inp->spspps_len = p_Inp->spspps_offset;
|
||||||
}
|
}
|
||||||
}
|
} else if ((p_strm->nalu_type == NALU_TYPE_SLICE)
|
||||||
else if ((p_strm->nalu_type == NALU_TYPE_SLICE)
|
|
||||||
|| (p_strm->nalu_type == NALU_TYPE_IDR)) {
|
|| (p_strm->nalu_type == NALU_TYPE_IDR)) {
|
||||||
p_Cur->p_Inp->spspps_update_flag = 1;
|
p_Cur->p_Inp->spspps_update_flag = 1;
|
||||||
p_Inp->spspps_offset = 0;
|
p_Inp->spspps_offset = 0;
|
||||||
@@ -497,8 +496,7 @@ MPP_RET fwrite_stream_to_file(H264dInputCtx_t *p_Inp, RK_U8 *pdata, RK_U32 len)
|
|||||||
p_Inp->fp = fopen(p_Inp->fname[global_file_fid], "wb");
|
p_Inp->fp = fopen(p_Inp->fname[global_file_fid], "wb");
|
||||||
if (p_Inp->fp == NULL) {
|
if (p_Inp->fp == NULL) {
|
||||||
H264D_WARNNING("[open_stream_file] can not open stream file, %s", p_Inp->fname[global_file_fid]);
|
H264D_WARNNING("[open_stream_file] can not open stream file, %s", p_Inp->fname[global_file_fid]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fwrite(p_Inp->spspps_buf, sizeof(RK_U8), p_Inp->spspps_len, p_Inp->fp);
|
fwrite(p_Inp->spspps_buf, sizeof(RK_U8), p_Inp->spspps_len, p_Inp->fp);
|
||||||
fflush(p_Inp->fp);
|
fflush(p_Inp->fp);
|
||||||
}
|
}
|
||||||
@@ -960,9 +958,7 @@ MPP_RET parse_loop(H264_DecCtx_t *p_Dec)
|
|||||||
p_Dec->p_Vid->iNumOfSlicesDecoded++;
|
p_Dec->p_Vid->iNumOfSlicesDecoded++;
|
||||||
if (p_Dec->is_parser_end) {
|
if (p_Dec->is_parser_end) {
|
||||||
p_Dec->next_state = SliceSTATE_RegisterOneFrame;
|
p_Dec->next_state = SliceSTATE_RegisterOneFrame;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||||
}
|
}
|
||||||
H264D_DBG(H264D_DBG_LOOP_STATE, "SliceSTATE_GetSliceData");
|
H264D_DBG(H264D_DBG_LOOP_STATE, "SliceSTATE_GetSliceData");
|
||||||
|
@@ -428,14 +428,12 @@ MPP_RET process_slice(H264_SLICE_t *currSlice)
|
|||||||
p_Vid->structure = FRAME;
|
p_Vid->structure = FRAME;
|
||||||
currSlice->field_pic_flag = 0;
|
currSlice->field_pic_flag = 0;
|
||||||
currSlice->bottom_field_flag = 0;
|
currSlice->bottom_field_flag = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
READ_ONEBIT(p_bitctx, &currSlice->field_pic_flag, "field_pic_flag");
|
READ_ONEBIT(p_bitctx, &currSlice->field_pic_flag, "field_pic_flag");
|
||||||
if (currSlice->field_pic_flag) {
|
if (currSlice->field_pic_flag) {
|
||||||
READ_ONEBIT(p_bitctx, &currSlice->bottom_field_flag, "field_pic_flag");
|
READ_ONEBIT(p_bitctx, &currSlice->bottom_field_flag, "field_pic_flag");
|
||||||
p_Vid->structure = currSlice->bottom_field_flag ? BOTTOM_FIELD : TOP_FIELD;
|
p_Vid->structure = currSlice->bottom_field_flag ? BOTTOM_FIELD : TOP_FIELD;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
p_Vid->structure = FRAME;
|
p_Vid->structure = FRAME;
|
||||||
currSlice->bottom_field_flag = 0;
|
currSlice->bottom_field_flag = 0;
|
||||||
}
|
}
|
||||||
@@ -444,8 +442,7 @@ MPP_RET process_slice(H264_SLICE_t *currSlice)
|
|||||||
currSlice->mb_aff_frame_flag = (currSlice->active_sps->mb_adaptive_frame_field_flag && (currSlice->field_pic_flag == 0));
|
currSlice->mb_aff_frame_flag = (currSlice->active_sps->mb_adaptive_frame_field_flag && (currSlice->field_pic_flag == 0));
|
||||||
if (currSlice->idr_flag) {
|
if (currSlice->idr_flag) {
|
||||||
READ_UE(p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
READ_UE(p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
||||||
}
|
} else if (currSlice->svc_extension_flag == 0 && currSlice->mvcExt.non_idr_flag == 0) {
|
||||||
else if (currSlice->svc_extension_flag == 0 && currSlice->mvcExt.non_idr_flag == 0) {
|
|
||||||
READ_UE(p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
READ_UE(p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
||||||
}
|
}
|
||||||
poc_used_bits = p_bitctx->used_bits; //!< init poc used bits
|
poc_used_bits = p_bitctx->used_bits; //!< init poc used bits
|
||||||
@@ -454,8 +451,7 @@ MPP_RET process_slice(H264_SLICE_t *currSlice)
|
|||||||
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1
|
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1
|
||||||
&& !currSlice->field_pic_flag) {
|
&& !currSlice->field_pic_flag) {
|
||||||
READ_SE(p_bitctx, &currSlice->delta_pic_order_cnt_bottom, "delta_pic_order_cnt_bottom");
|
READ_SE(p_bitctx, &currSlice->delta_pic_order_cnt_bottom, "delta_pic_order_cnt_bottom");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
currSlice->delta_pic_order_cnt_bottom = 0;
|
currSlice->delta_pic_order_cnt_bottom = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,12 +461,10 @@ MPP_RET process_slice(H264_SLICE_t *currSlice)
|
|||||||
|
|
||||||
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1 && !currSlice->field_pic_flag) {
|
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1 && !currSlice->field_pic_flag) {
|
||||||
READ_SE(p_bitctx, &currSlice->delta_pic_order_cnt[1], "delta_pic_order_cnt[1]");
|
READ_SE(p_bitctx, &currSlice->delta_pic_order_cnt[1], "delta_pic_order_cnt[1]");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
currSlice->delta_pic_order_cnt[1] = 0; //!< set to zero if not in stream
|
currSlice->delta_pic_order_cnt[1] = 0; //!< set to zero if not in stream
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
currSlice->delta_pic_order_cnt[0] = 0;
|
currSlice->delta_pic_order_cnt[0] = 0;
|
||||||
currSlice->delta_pic_order_cnt[1] = 0;
|
currSlice->delta_pic_order_cnt[1] = 0;
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,7 @@
|
|||||||
|
|
||||||
#define FPGA_TEST 0
|
#define FPGA_TEST 0
|
||||||
|
|
||||||
const enum
|
const enum {
|
||||||
{
|
|
||||||
H264ScalingList4x4Length = 16,
|
H264ScalingList4x4Length = 16,
|
||||||
H264ScalingList8x8Length = 64,
|
H264ScalingList8x8Length = 64,
|
||||||
} ScalingListLength;
|
} ScalingListLength;
|
||||||
|
@@ -203,7 +203,8 @@ public:
|
|||||||
VpulibDlsym()
|
VpulibDlsym()
|
||||||
: rkapi_hdl(NULL),
|
: rkapi_hdl(NULL),
|
||||||
rkvpu_open_cxt(NULL),
|
rkvpu_open_cxt(NULL),
|
||||||
rkvpu_close_cxt(NULL) {
|
rkvpu_close_cxt(NULL)
|
||||||
|
{
|
||||||
if (!!access("/dev/rkvdec", F_OK)) {
|
if (!!access("/dev/rkvdec", F_OK)) {
|
||||||
rkapi_hdl = dlopen("/system/lib/librk_on2.so", RTLD_LAZY);
|
rkapi_hdl = dlopen("/system/lib/librk_on2.so", RTLD_LAZY);
|
||||||
}
|
}
|
||||||
@@ -219,7 +220,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~VpulibDlsym() {
|
~VpulibDlsym()
|
||||||
|
{
|
||||||
if (rkapi_hdl) {
|
if (rkapi_hdl) {
|
||||||
dlclose(rkapi_hdl);
|
dlclose(rkapi_hdl);
|
||||||
mpp_log("dlclose vpu lib");
|
mpp_log("dlclose vpu lib");
|
||||||
|
@@ -253,25 +253,21 @@ static MPP_RET avsd_input_init(InputParams *inp, RK_S32 ac, char *av[])
|
|||||||
mpp_log(" -o :[file] Set output YUV file.");
|
mpp_log(" -o :[file] Set output YUV file.");
|
||||||
mpp_log(" -n :[number] Set decoded frames.");
|
mpp_log(" -n :[number] Set decoded frames.");
|
||||||
CLcount += 1;
|
CLcount += 1;
|
||||||
}
|
} else if (!strncmp(av[CLcount], "-i", 2)) {
|
||||||
else if (!strncmp(av[CLcount], "-i", 2)) {
|
|
||||||
strncpy(infile_name, av[CLcount + 1], strlen((const char*)av[CLcount + 1]) + 1);
|
strncpy(infile_name, av[CLcount + 1], strlen((const char*)av[CLcount + 1]) + 1);
|
||||||
CLcount += 2;
|
CLcount += 2;
|
||||||
}
|
} else if (!strncmp(av[CLcount], "-n", 2)) {
|
||||||
else if (!strncmp(av[CLcount], "-n", 2)) {
|
|
||||||
if (!sscanf(av[CLcount + 1], "%d", &inp->dec_num)) {
|
if (!sscanf(av[CLcount + 1], "%d", &inp->dec_num)) {
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
CLcount += 2;
|
CLcount += 2;
|
||||||
}
|
} else if (!strncmp(av[CLcount], "-o", 2)) {
|
||||||
else if (!strncmp(av[CLcount], "-o", 2)) {
|
|
||||||
if (rkv_avsd_test_debug & AVSD_TEST_DUMPYUV) {
|
if (rkv_avsd_test_debug & AVSD_TEST_DUMPYUV) {
|
||||||
inp->output_dec_pic = 1;
|
inp->output_dec_pic = 1;
|
||||||
strncpy(outfile_name, av[CLcount + 1], strlen((const char*)av[CLcount + 1]) + 1);
|
strncpy(outfile_name, av[CLcount + 1], strlen((const char*)av[CLcount + 1]) + 1);
|
||||||
}
|
}
|
||||||
CLcount += 2;
|
CLcount += 2;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mpp_err("error, %s cannot explain command! \n", av[CLcount]);
|
mpp_err("error, %s cannot explain command! \n", av[CLcount]);
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
@@ -344,8 +340,7 @@ static MPP_RET decoder_single_test(AvsdTestCtx_t *pctx)
|
|||||||
(inp->dec_num && (inp->dec_no >= inp->dec_num))) {
|
(inp->dec_num && (inp->dec_no >= inp->dec_num))) {
|
||||||
mpp_packet_init(&pkt, NULL, 0);
|
mpp_packet_init(&pkt, NULL, 0);
|
||||||
mpp_packet_set_eos(pkt);
|
mpp_packet_set_eos(pkt);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
FUN_CHECK(ret = avsd_read_data(inp));
|
FUN_CHECK(ret = avsd_read_data(inp));
|
||||||
mpp_packet_init(&pkt, inp->pbuf, inp->len);
|
mpp_packet_init(&pkt, inp->pbuf, inp->len);
|
||||||
}
|
}
|
||||||
|
@@ -207,22 +207,26 @@ public:
|
|||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void lock(MppThreadSignal id = THREAD_WORK) {
|
void lock(MppThreadSignal id = THREAD_WORK)
|
||||||
|
{
|
||||||
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
||||||
mMutexCond[id].lock();
|
mMutexCond[id].lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlock(MppThreadSignal id = THREAD_WORK) {
|
void unlock(MppThreadSignal id = THREAD_WORK)
|
||||||
|
{
|
||||||
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
||||||
mMutexCond[id].unlock();
|
mMutexCond[id].unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wait(MppThreadSignal id = THREAD_WORK) {
|
void wait(MppThreadSignal id = THREAD_WORK)
|
||||||
|
{
|
||||||
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
||||||
mMutexCond[id].wait();
|
mMutexCond[id].wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void signal(MppThreadSignal id = THREAD_WORK) {
|
void signal(MppThreadSignal id = THREAD_WORK)
|
||||||
|
{
|
||||||
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
mpp_assert(id < THREAD_SIGNAL_BUTT);
|
||||||
mMutexCond[id].signal();
|
mMutexCond[id].signal();
|
||||||
}
|
}
|
||||||
|
@@ -95,8 +95,7 @@ void MppThread::stop()
|
|||||||
const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||||
|
|
||||||
#pragma pack(push,8)
|
#pragma pack(push,8)
|
||||||
typedef struct tagTHREADNAME_INFO
|
typedef struct tagTHREADNAME_INFO {
|
||||||
{
|
|
||||||
DWORD dwType; // Must be 0x1000.
|
DWORD dwType; // Must be 0x1000.
|
||||||
LPCSTR szName; // Pointer to name (in user addr space).
|
LPCSTR szName; // Pointer to name (in user addr space).
|
||||||
DWORD dwThreadID; // Thread ID (-1=caller thread).
|
DWORD dwThreadID; // Thread ID (-1=caller thread).
|
||||||
@@ -104,7 +103,8 @@ typedef struct tagTHREADNAME_INFO
|
|||||||
} THREADNAME_INFO;
|
} THREADNAME_INFO;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
void SetThreadName(DWORD dwThreadID, const char* threadName) {
|
void SetThreadName(DWORD dwThreadID, const char* threadName)
|
||||||
|
{
|
||||||
THREADNAME_INFO info;
|
THREADNAME_INFO info;
|
||||||
info.dwType = 0x1000;
|
info.dwType = 0x1000;
|
||||||
info.szName = threadName;
|
info.szName = threadName;
|
||||||
@@ -114,8 +114,7 @@ void SetThreadName(DWORD dwThreadID, const char* threadName) {
|
|||||||
#pragma warning(disable: 6320 6322)
|
#pragma warning(disable: 6320 6322)
|
||||||
__try {
|
__try {
|
||||||
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
|
RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info);
|
||||||
}
|
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER){
|
|
||||||
}
|
}
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user