[mpp]: fix compile error on windows

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1191 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2016-08-11 10:16:44 +00:00
parent fcd19acd9e
commit 4f7f69c1ae
9 changed files with 61 additions and 27 deletions

View File

@@ -1166,7 +1166,7 @@ MPP_RET jpegd_prepare(void *ctx, MppPacket pkt, HalDecTask *task)
RK_U32 pkt_length = 0; RK_U32 pkt_length = 0;
RK_U32 copy_length = 0; RK_U32 copy_length = 0;
void *pPacket = NULL; void *pPacket = NULL;
void *pPos = NULL; RK_U8 *pPos = NULL;
task->valid = 0; task->valid = 0;

View File

@@ -16,6 +16,8 @@
#define MODULE_TAG "h264e_api" #define MODULE_TAG "h264e_api"
#include <string.h>
#include "mpp_env.h" #include "mpp_env.h"
#include "mpp_log.h" #include "mpp_log.h"
#include "mpp_common.h" #include "mpp_common.h"

View File

@@ -18,7 +18,11 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef RKPLATFORM
#include <unistd.h> #include <unistd.h>
#endif
#include "mpp_common.h"
#include "vpu.h" #include "vpu.h"
#include "mpp_hal.h" #include "mpp_hal.h"
#include "mpp_env.h" #include "mpp_env.h"

View File

@@ -20,11 +20,15 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <sys/time.h>
#include "mpp_common.h" #ifdef RKPLATFORM
#include <sys/time.h>
#endif
#include "mpp_log.h" #include "mpp_log.h"
#include "mpp_mem.h" #include "mpp_mem.h"
#include "mpp_time.h"
#include "mpp_common.h"
#include "mpp_frame.h" #include "mpp_frame.h"
#include "hal_h264e_api.h" #include "hal_h264e_api.h"
@@ -115,7 +119,7 @@ static RK_U32 h264e_rkv_revert_csp(h264e_hal_csp_info csp_info)
dst_fmt = cswap? MPP_FMT_ABGR8888 : MPP_FMT_ARGB8888; dst_fmt = cswap? MPP_FMT_ABGR8888 : MPP_FMT_ARGB8888;
else else
dst_fmt = MPP_FMT_BUTT; dst_fmt = MPP_FMT_BUTT;
break; break;
} }
default: { default: {
@@ -177,7 +181,7 @@ static RK_U32 h264e_vpu_revert_csp(RK_U32 csp)
case H264E_VPU_CSP_BGR444: { case H264E_VPU_CSP_BGR444: {
dst_fmt = MPP_FMT_BGR444; dst_fmt = MPP_FMT_BGR444;
break; break;
} }
case H264E_VPU_CSP_RGB888: { case H264E_VPU_CSP_RGB888: {
dst_fmt = MPP_FMT_RGB888; dst_fmt = MPP_FMT_RGB888;
break; break;
@@ -193,7 +197,7 @@ static RK_U32 h264e_vpu_revert_csp(RK_U32 csp)
case H264E_VPU_CSP_BGR101010: { case H264E_VPU_CSP_BGR101010: {
dst_fmt = MPP_FMT_BGR101010; dst_fmt = MPP_FMT_BGR101010;
break; break;
} }
default: { default: {
h264e_hal_log_err("invalid csp %d", csp); h264e_hal_log_err("invalid csp %d", csp);
dst_fmt = MPP_FMT_BUTT; dst_fmt = MPP_FMT_BUTT;
@@ -1062,7 +1066,7 @@ static MPP_RET get_rkv_dbg_info(h264e_hal_rkv_dbg_info *info, h264e_syntax *syn,
H264E_HAL_FSCAN(fp, "%x\n", info->swreg73_osd_indx_tab_i[k]); H264E_HAL_FSCAN(fp, "%x\n", info->swreg73_osd_indx_tab_i[k]);
H264E_HAL_FSCAN(fp, "%x\n", info->swreg77.bsbw_addr); H264E_HAL_FSCAN(fp, "%x\n", info->swreg77.bsbw_addr);
H264E_HAL_FSCAN(fp, "%x\n", syn->keyframe_max_interval); H264E_HAL_FSCAN(fp, "%x\n", syn->keyframe_max_interval);
fgets(temp, 512, fp); fgets(temp, 512, fp);
@@ -1077,7 +1081,7 @@ static MPP_RET get_rkv_dbg_info(h264e_hal_rkv_dbg_info *info, h264e_syntax *syn,
syn->qp = info->swreg10.pic_qp; syn->qp = info->swreg10.pic_qp;
syn->frame_num = info->swreg60.frm_num; syn->frame_num = info->swreg60.frm_num;
syn->input_image_format = info->swreg14.src_cfmt; syn->input_image_format = info->swreg14.src_cfmt;
syn->transform8x8_mode = info->swreg59.trns_8x8; syn->transform8x8_mode = info->swreg59.trns_8x8;
} }
h264e_hal_debug_leave(); h264e_hal_debug_leave();
@@ -1109,7 +1113,7 @@ static MPP_RET get_rkv_syntax_in( h264e_syntax *syn, MppBuffer *hw_in_buf, MppBu
char temp[512] = {0}; char temp[512] = {0};
RK_S32 data = 0; RK_S32 data = 0;
h264e_hal_csp_info csp_info; h264e_hal_csp_info csp_info;
if (!fgets(temp, 512, fp)) if (!fgets(temp, 512, fp))
return MPP_EOS_STREAM_REACHED; return MPP_EOS_STREAM_REACHED;
@@ -1131,7 +1135,7 @@ static MPP_RET get_rkv_syntax_in( h264e_syntax *syn, MppBuffer *hw_in_buf, MppBu
H264E_HAL_FSCAN(fp, "%d\n", syn->frame_num); H264E_HAL_FSCAN(fp, "%d\n", syn->frame_num);
H264E_HAL_FSCAN(fp, "%d\n", syn->cabac_init_idc); H264E_HAL_FSCAN(fp, "%d\n", syn->cabac_init_idc);
H264E_HAL_FSCAN(fp, "%d\n", syn->idr_pic_id); H264E_HAL_FSCAN(fp, "%d\n", syn->idr_pic_id);
H264E_HAL_FSCAN(fp, "%d\n", syn->pic_order_cnt_lsb); H264E_HAL_FSCAN(fp, "%d\n", syn->pic_order_cnt_lsb);
@@ -1254,12 +1258,12 @@ MPP_RET h264e_hal_vpu_test()
MppBuffer hw_input_buf[3] = {NULL}; //Y, U, V MppBuffer hw_input_buf[3] = {NULL}; //Y, U, V
MppBuffer hw_output_strm_buf = NULL; MppBuffer hw_output_strm_buf = NULL;
RK_U32 frame_luma_stride = 0; RK_U32 frame_luma_stride = 0;
struct timeval t0; RK_S64 t0;
RK_U8 *input_sw_buf = mpp_malloc(RK_U8, MAX_FRAME_TOTAL_SIZE); RK_U8 *input_sw_buf = mpp_malloc(RK_U8, MAX_FRAME_TOTAL_SIZE);
mpp_packet_init(&extra_info_pkt, (void *)extra_info_buf, H264E_MAX_PACKETED_PARAM_SIZE); mpp_packet_init(&extra_info_pkt, (void *)extra_info_buf, H264E_MAX_PACKETED_PARAM_SIZE);
get_vpu_syntax_in(&syntax_data, hw_input_buf, hw_output_strm_buf); get_vpu_syntax_in(&syntax_data, hw_input_buf, hw_output_strm_buf);
fseek(fp_golden_syntax_in, 0L, SEEK_SET); fseek(fp_golden_syntax_in, 0L, SEEK_SET);
@@ -1315,8 +1319,8 @@ MPP_RET h264e_hal_vpu_test()
/* run hardware */ /* run hardware */
gettimeofday(&t0, NULL); t0 = mpp_time();
mpp_log("hal_h264e_start time : %d ", ((long)t0.tv_sec) * 1000 + (long)t0.tv_usec / 1000); mpp_log("hal_h264e_start time : %lld ", (RK_S64)(t0 / 1000));
hal_h264e_start(&ctx, &task_info); hal_h264e_start(&ctx, &task_info);
hal_h264e_wait(&ctx, &task_info); hal_h264e_wait(&ctx, &task_info);
@@ -1374,7 +1378,7 @@ MPP_RET h264e_hal_rkv_test()
MppBuffer hw_input_buf_mul[RKV_H264E_LINKTABLE_FRAME_NUM] = {NULL}; MppBuffer hw_input_buf_mul[RKV_H264E_LINKTABLE_FRAME_NUM] = {NULL};
MppBuffer hw_output_strm_buf_mul[RKV_H264E_LINKTABLE_FRAME_NUM] = {NULL}; MppBuffer hw_output_strm_buf_mul[RKV_H264E_LINKTABLE_FRAME_NUM] = {NULL};
RK_U32 frame_luma_stride = 0; RK_U32 frame_luma_stride = 0;
struct timeval t0; RK_S64 t0;
mpp_packet_init(&extra_info_pkt, (void *)extra_info_buf, H264E_MAX_PACKETED_PARAM_SIZE); mpp_packet_init(&extra_info_pkt, (void *)extra_info_buf, H264E_MAX_PACKETED_PARAM_SIZE);
@@ -1382,7 +1386,7 @@ MPP_RET h264e_hal_rkv_test()
get_rkv_syntax_in(&syntax_data[0], hw_input_buf_mul, hw_output_strm_buf_mul); get_rkv_syntax_in(&syntax_data[0], hw_input_buf_mul, hw_output_strm_buf_mul);
fseek(fp_golden_syntax_in, 0L, SEEK_SET); fseek(fp_golden_syntax_in, 0L, SEEK_SET);
frame_luma_stride = ((syntax_data[0].pic_luma_width + 15) & (~15)) * ((syntax_data[0].pic_luma_height + 15) & (~15)); frame_luma_stride = ((syntax_data[0].pic_luma_width + 15) & (~15)) * ((syntax_data[0].pic_luma_height + 15) & (~15));
h264e_hal_test_init(&ctx, &task_info, syntax_data); h264e_hal_test_init(&ctx, &task_info, syntax_data);
@@ -1443,8 +1447,8 @@ MPP_RET h264e_hal_rkv_test()
/* run hardware */ /* run hardware */
gettimeofday(&t0, NULL); t0 = mpp_time();
mpp_log("hal_h264e_start time : %d ", ((long)t0.tv_sec) * 1000 + (long)t0.tv_usec / 1000); mpp_log("hal_h264e_start time : %lld ", (RK_S64)(t0 / 1000));
hal_h264e_start(&ctx, &task_info); hal_h264e_start(&ctx, &task_info);
hal_h264e_wait(&ctx, &task_info); hal_h264e_wait(&ctx, &task_info);
@@ -1458,7 +1462,7 @@ MPP_RET h264e_hal_rkv_test()
__test_end: __test_end:
mpp_packet_deinit(&extra_info_pkt); mpp_packet_deinit(&extra_info_pkt);
hal_h264e_deinit(&ctx); hal_h264e_deinit(&ctx);
h264e_hal_test_deinit(&ctx, &task_info); h264e_hal_test_deinit(&ctx, &task_info);
@@ -1484,7 +1488,7 @@ int main(int argc, char **argv)
h264e_hal_test_cfg test_cfg; h264e_hal_test_cfg test_cfg;
mpp_log("******* h264e hal test start *******"); mpp_log("******* h264e hal test start *******");
if (MPP_OK != h264e_hal_test_parse_options(argc, argv, &test_cfg)) { if (MPP_OK != h264e_hal_test_parse_options(argc, argv, &test_cfg)) {
mpp_err("parse opitons failed, test is ended early"); mpp_err("parse opitons failed, test is ended early");
goto __test_end; goto __test_end;

View File

@@ -257,6 +257,23 @@ RK_S32 close_orign_vpu(VpuCodecContext **ctx)
} }
return MPP_NOK; return MPP_NOK;
} }
#else
RK_S32 check_orign_vpu()
{
return (MPP_NOK);
}
RK_S32 open_orign_vpu(VpuCodecContext **ctx)
{
(void)ctx;
return MPP_NOK;
}
RK_S32 close_orign_vpu(VpuCodecContext **ctx)
{
(void)ctx;
return MPP_NOK;
}
#endif #endif
/* /*

View File

@@ -16,7 +16,7 @@
#define MODULE_TAG "vpu_api_legacy" #define MODULE_TAG "vpu_api_legacy"
#ifndef _WIN32 #ifdef RKPLATFORM
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#include "string.h" #include "string.h"
@@ -24,6 +24,7 @@
#include "mpp_log.h" #include "mpp_log.h"
#include "mpp_mem.h" #include "mpp_mem.h"
#include "mpp_env.h" #include "mpp_env.h"
#include "mpp_time.h"
#include "mpp_common.h" #include "mpp_common.h"
#include "vpu_api_legacy.h" #include "vpu_api_legacy.h"
@@ -463,7 +464,7 @@ RK_S32 VpuApiLegacy::encode(VpuCodecContext *ctx, EncInputStream_t *aEncInStrm,
MppBufferInfo outputCommit; MppBufferInfo outputCommit;
RK_U32 use_fd_flag = 1; RK_U32 use_fd_flag = 1;
#ifndef _WIN32 #ifdef RKPLATFORM
if (fcntl(aEncInStrm->bufPhyAddr, F_GETFL, NULL) == -1) if (fcntl(aEncInStrm->bufPhyAddr, F_GETFL, NULL) == -1)
use_fd_flag = 0; use_fd_flag = 0;
#endif #endif
@@ -548,7 +549,7 @@ RK_S32 VpuApiLegacy::encode(VpuCodecContext *ctx, EncInputStream_t *aEncInStrm,
} }
if (task == NULL) { if (task == NULL) {
mpp_log("mpi dequeue from MPP_PORT_INPUT fail, task equal with NULL!"); mpp_log("mpi dequeue from MPP_PORT_INPUT fail, task equal with NULL!");
usleep(3000); msleep(3);
} else } else
break; break;
} while (1); } while (1);
@@ -606,7 +607,7 @@ RK_S32 VpuApiLegacy::encode(VpuCodecContext *ctx, EncInputStream_t *aEncInStrm,
break; break;
} }
usleep(3000); msleep(3);
} while (1); } while (1);
} else { } else {
mpp_err("mpi pointer is NULL, failed!"); mpp_err("mpi pointer is NULL, failed!");

View File

@@ -445,7 +445,7 @@ MPP_RET jpegd_parser_test(parserDemoCmdCtx *cmd)
mpp_packet_get_data(curtask->input_packet), mpp_packet_get_data(curtask->input_packet),
mpp_packet_get_size(curtask->input_packet)); mpp_packet_get_size(curtask->input_packet));
mpp_err("%s Line %d, (*input_packet):%p, length:%d", __func__, __LINE__, mpp_err("%s Line %d, (*input_packet):%p, length:%d", __FUNCTION__, __LINE__,
mpp_packet_get_data(curtask->input_packet), mpp_packet_get_data(curtask->input_packet),
mpp_packet_get_size(curtask->input_packet)); mpp_packet_get_size(curtask->input_packet));
DemoCtx.pkt_buf = buffer; DemoCtx.pkt_buf = buffer;

View File

@@ -128,6 +128,12 @@
#define chdir _chdir #define chdir _chdir
#define mkdir _mkdir #define mkdir _mkdir
#define access _access #define access _access
#define R_OK 4 /* Test for read permission. */
#define W_OK 2 /* Test for write permission. */
#define X_OK 1 /* Test for execute permission. */
#define F_OK 0 /* Test for existence. */
#elif defined(__MINGW32CE__) #elif defined(__MINGW32CE__)
#define fseeko fseeko64 #define fseeko fseeko64
#else #else

View File

@@ -162,7 +162,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd)
mpp_cfg.width = width; mpp_cfg.width = width;
mpp_cfg.height = height; mpp_cfg.height = height;
mpp_cfg.format = fmt; mpp_cfg.format = fmt;
mpp_cfg.rc_mode = 1; mpp_cfg.rc_mode = 0;
mpp_cfg.skip_cnt = 0; mpp_cfg.skip_cnt = 0;
mpp_cfg.fps_in = 30; mpp_cfg.fps_in = 30;
mpp_cfg.fps_out = 30; mpp_cfg.fps_out = 30;
@@ -238,7 +238,7 @@ int mpi_enc_test(MpiEncTestCmd *cmd)
} }
if (task == NULL) { if (task == NULL) {
mpp_log("mpi dequeue from MPP_PORT_INPUT fail, task equal with NULL!"); mpp_log("mpi dequeue from MPP_PORT_INPUT fail, task equal with NULL!");
usleep(3000); msleep(3);
} else { } else {
MppFrame frame_out = NULL; MppFrame frame_out = NULL;