mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-09-27 13:32:09 +08:00
[test]: Remove vpu_api_test's dependence on mpp
Remove all mpp object from vpu.so NOTE: link_directories should be before add_library or add_executable. Change-Id: Idee25e1ccc2c3182f7b8c26c277d396e28654f3e Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
@@ -17,7 +17,11 @@ set (MPP_LEGACY_SRC
|
||||
set(VPU_VERSION "0")
|
||||
set(VPU_ABI_VERSION "1")
|
||||
|
||||
# NOTE: link_directories should be before add_library or add_executable
|
||||
link_directories(${CMAKE_BINARY_DIR}/mpp)
|
||||
|
||||
add_library(${VPU_SHARED} SHARED ${MPP_LEGACY_SRC})
|
||||
add_dependencies(${VPU_SHARED} ${MPP_SHARED})
|
||||
set_target_properties(${VPU_SHARED} PROPERTIES FOLDER "mpp/legacy")
|
||||
set_target_properties(${VPU_SHARED} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(${VPU_SHARED} PROPERTIES C_VISIBILITY_PRESET default)
|
||||
@@ -29,6 +33,7 @@ set_target_properties(${VPU_SHARED} PROPERTIES VERSION ${MPP_VERSION})
|
||||
set_target_properties(${VPU_SHARED} PROPERTIES SOVERSION ${MPP_ABI_VERSION})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${VPU_SHARED} dl ${MPP_SHARED})
|
||||
# force dynamic link
|
||||
target_link_libraries(${VPU_SHARED} -Wl,-Bdynamic dl lib${MPP_SHARED}.so)
|
||||
|
||||
install(TARGETS ${VPU_SHARED} LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
@@ -57,7 +57,7 @@ macro(add_legacy_test module)
|
||||
option(${test_tag} "Build legacy ${module} unit test" ON)
|
||||
if(${test_tag})
|
||||
add_executable(${test_name} ${test_name}.c)
|
||||
target_link_libraries(${test_name} -ldl utils)
|
||||
target_link_libraries(${test_name} dl)
|
||||
set_target_properties(${test_name} PROPERTIES FOLDER "test")
|
||||
install(TARGETS ${test_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
@@ -14,18 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define MODULE_TAG "vpu_api_demo"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "mpp_log.h"
|
||||
#include "mpp_time.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include "vpu_api.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define FOR_TEST_ENCODE 1
|
||||
|
||||
@@ -37,7 +32,6 @@
|
||||
#define DECODE_ERR_RET(err) do { ret = err; goto DECODE_OUT; } while (0)
|
||||
#define ENCODE_ERR_RET(err) do { ret = err; goto ENCODE_OUT; } while (0)
|
||||
|
||||
|
||||
typedef enum VPU_API_DEMO_RET {
|
||||
VPU_DEMO_OK = 0,
|
||||
VPU_DEMO_PARSE_HELP_OK = 1,
|
||||
@@ -70,7 +64,13 @@ typedef struct VpuApiEncInput {
|
||||
RK_U32 capability;
|
||||
} VpuApiEncInput;
|
||||
|
||||
static OptionInfo vpuApiCmd[] = {
|
||||
typedef struct VpuApiOptionInfo_t {
|
||||
const char* name;
|
||||
const char* argname;
|
||||
const char* help;
|
||||
} VpuApiOptionInfo;
|
||||
|
||||
static VpuApiOptionInfo vpuApiCmd[] = {
|
||||
{ "i", "input_file", "input bitstream file" },
|
||||
{ "o", "output_file", "output bitstream file, " },
|
||||
{ "w", "width", "the width of input bitstream" },
|
||||
@@ -91,16 +91,22 @@ RK_S32 (*vpuapi_mem_free)(VPUMemLinear_t *p);
|
||||
|
||||
static void show_usage()
|
||||
{
|
||||
mpp_log("usage: vpu_apiDemo [options] input_file, \n\n");
|
||||
printf("usage: vpu_apiDemo [options] input_file, \n\n");
|
||||
|
||||
mpp_log("Getting help:\n");
|
||||
mpp_log("-help --print options of vpu api demo\n");
|
||||
printf("Getting help:\n");
|
||||
printf("-help --print options of vpu api demo\n");
|
||||
}
|
||||
|
||||
static RK_S32 show_help()
|
||||
{
|
||||
mpp_log("usage: vpu_apiDemo [options] input_file, \n\n");
|
||||
show_options(vpuApiCmd);
|
||||
RK_S32 i;
|
||||
RK_S32 count = sizeof(vpuApiCmd) / sizeof(vpuApiCmd[0]);
|
||||
VpuApiOptionInfo *opt = vpuApiCmd;
|
||||
|
||||
printf("usage: vpu_apiDemo [opt] input_file, \n\n");
|
||||
for (i = 0; i < count; i++)
|
||||
printf("-%s %-16s\t%s\n", opt[i].name, opt[i].argname, opt[i].help);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -110,7 +116,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
RK_S32 optindex, handleoptions = 1, ret = 0;
|
||||
|
||||
if ((argc < 2) || (cmdCxt == NULL)) {
|
||||
mpp_log("vpu api demo, input parameter invalid\n");
|
||||
printf("vpu api demo, input parameter invalid\n");
|
||||
show_usage();
|
||||
return ERROR_INVALID_PARAM;
|
||||
}
|
||||
@@ -139,7 +145,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
cmdCxt->input_file[strlen(argv[optindex])] = '\0';
|
||||
cmdCxt->have_input = 1;
|
||||
} else {
|
||||
mpp_log("input file is invalid\n");
|
||||
printf("input file is invalid\n");
|
||||
ret = -1;
|
||||
goto PARSE_OPINIONS_OUT;
|
||||
}
|
||||
@@ -151,7 +157,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
cmdCxt->have_output = 1;
|
||||
break;
|
||||
} else {
|
||||
mpp_log("out file is invalid\n");
|
||||
printf("out file is invalid\n");
|
||||
ret = -1;
|
||||
goto PARSE_OPINIONS_OUT;
|
||||
}
|
||||
@@ -160,7 +166,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
cmdCxt->width = atoi(argv[optindex]);
|
||||
break;
|
||||
} else {
|
||||
mpp_log("input width is invalid\n");
|
||||
printf("input width is invalid\n");
|
||||
ret = -1;
|
||||
goto PARSE_OPINIONS_OUT;
|
||||
}
|
||||
@@ -172,7 +178,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
} else if (argv[optindex]) {
|
||||
cmdCxt->height = atoi(argv[optindex]);
|
||||
} else {
|
||||
mpp_log("input height is invalid\n");
|
||||
printf("input height is invalid\n");
|
||||
ret = -1;
|
||||
goto PARSE_OPINIONS_OUT;
|
||||
}
|
||||
@@ -182,7 +188,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
cmdCxt->codec_type = atoi(argv[optindex]);
|
||||
break;
|
||||
} else {
|
||||
mpp_log("input codec_type is invalid\n");
|
||||
printf("input codec_type is invalid\n");
|
||||
ret = -1;
|
||||
goto PARSE_OPINIONS_OUT;
|
||||
}
|
||||
@@ -190,7 +196,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
default:
|
||||
if ((*(opt + 1) != '\0') && argv[optindex]) {
|
||||
if (!strncmp(opt, "coding", 6)) {
|
||||
mpp_log("coding, argv[optindex]: %s",
|
||||
printf("coding, argv[optindex]: %s",
|
||||
argv[optindex]);
|
||||
cmdCxt->coding = atoi(argv[optindex]);
|
||||
} else if (!strncmp(opt, "vframes", 7)) {
|
||||
@@ -214,7 +220,7 @@ static RK_S32 parse_options(int argc, char **argv, VpuApiDemoCmdContext_t *cmdCx
|
||||
|
||||
PARSE_OPINIONS_OUT:
|
||||
if (ret < 0) {
|
||||
mpp_log("vpu api demo, input parameter invalid\n");
|
||||
printf("vpu api demo, input parameter invalid\n");
|
||||
show_usage();
|
||||
return ERROR_INVALID_PARAM;
|
||||
}
|
||||
@@ -231,7 +237,7 @@ static RK_S32 readBytesFromFile(RK_U8 *buf, RK_S32 aBytes, FILE *file)
|
||||
|
||||
ret = (RK_S32)fread(buf, 1, aBytes, file);
|
||||
if (ret != aBytes) {
|
||||
mpp_log("read %d bytes from file fail\n", aBytes);
|
||||
printf("read %d bytes from file fail\n", aBytes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -265,31 +271,31 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
|
||||
if ((cmd->have_input == 0) || (cmd->width <= 0) || (cmd->height <= 0)
|
||||
|| (cmd->coding <= OMX_RK_VIDEO_CodingAutoDetect)) {
|
||||
mpp_log("Warning: missing needed parameters for vpu api demo\n");
|
||||
printf("Warning: missing needed parameters for vpu api demo\n");
|
||||
}
|
||||
|
||||
if (cmd->have_input) {
|
||||
mpp_log("input bitstream w: %d, h: %d, coding: %d(%s), path: %s\n",
|
||||
printf("input bitstream w: %d, h: %d, coding: %d(%s), path: %s\n",
|
||||
cmd->width, cmd->height, cmd->coding,
|
||||
cmd->codec_type == CODEC_DECODER ? "decode" : "encode",
|
||||
cmd->input_file);
|
||||
|
||||
pInFile = fopen(cmd->input_file, "rb");
|
||||
if (pInFile == NULL) {
|
||||
mpp_log("input file not exsist\n");
|
||||
printf("input file not exsist\n");
|
||||
ENCODE_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
} else {
|
||||
mpp_log("please set input bitstream file\n");
|
||||
printf("please set input bitstream file\n");
|
||||
ENCODE_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
|
||||
if (cmd->have_output) {
|
||||
mpp_log("vpu api demo output file: %s\n",
|
||||
printf("vpu api demo output file: %s\n",
|
||||
cmd->output_file);
|
||||
pOutFile = fopen(cmd->output_file, "wb");
|
||||
if (pOutFile == NULL) {
|
||||
mpp_log("can not write output file\n");
|
||||
printf("can not write output file\n");
|
||||
ENCODE_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
}
|
||||
@@ -297,7 +303,7 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
#ifdef FOR_TEST_ENCODE
|
||||
ctx = (struct VpuCodecContext *)malloc(sizeof(struct VpuCodecContext));
|
||||
if (!ctx) {
|
||||
mpp_err("Input context has not been properly allocated");
|
||||
printf("Input context has not been properly allocated");
|
||||
return -1;
|
||||
}
|
||||
memset(ctx, 0, sizeof(struct VpuCodecContext));
|
||||
@@ -355,7 +361,7 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
enc_param->levelIdc = 40;
|
||||
|
||||
if ((ret = ctx->init(ctx, NULL, 0)) != 0) {
|
||||
mpp_log("init vpu api context fail, ret: 0x%X\n", ret);
|
||||
printf("init vpu api context fail, ret: 0x%X\n", ret);
|
||||
ENCODE_ERR_RET(ERROR_INIT_VPU);
|
||||
}
|
||||
|
||||
@@ -364,9 +370,9 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
** sps and pps of encoder output, you need to save sps and pps
|
||||
** after init.
|
||||
*/
|
||||
mpp_log("encode init ok, sps len: %d\n", ctx->extradata_size);
|
||||
printf("encode init ok, sps len: %d\n", ctx->extradata_size);
|
||||
if (pOutFile && (ctx->extradata_size > 0)) {
|
||||
mpp_log("dump %d bytes enc output stream to file\n",
|
||||
printf("dump %d bytes enc output stream to file\n",
|
||||
ctx->extradata_size);
|
||||
|
||||
/* save sps and pps */
|
||||
@@ -376,32 +382,32 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
|
||||
ret = ctx->control(ctx, VPU_API_ENC_SETFORMAT, &Format);
|
||||
if (ret)
|
||||
mpp_err("VPU_API_ENC_SETFORMAT ret %d\n", ret);
|
||||
printf("VPU_API_ENC_SETFORMAT ret %d\n", ret);
|
||||
|
||||
ret = ctx->control(ctx, VPU_API_ENC_GETCFG, enc_param);
|
||||
if (ret)
|
||||
mpp_log("VPU_API_ENC_GETCFG ret %d\n", ret);
|
||||
printf("VPU_API_ENC_GETCFG ret %d\n", ret);
|
||||
|
||||
enc_param->rc_mode = 1;
|
||||
|
||||
ret = ctx->control(ctx, VPU_API_ENC_SETCFG, enc_param);
|
||||
if (ret)
|
||||
mpp_log("VPU_API_ENC_SETCFG ret %d\n", ret);
|
||||
printf("VPU_API_ENC_SETCFG ret %d\n", ret);
|
||||
|
||||
/*
|
||||
** vpu api encode process.
|
||||
*/
|
||||
mpp_log("init vpu api context ok, input yuv stream file size: %d\n", fileSize);
|
||||
printf("init vpu api context ok, input yuv stream file size: %d\n", fileSize);
|
||||
w_align = ((ctx->width + 15) & (~15));
|
||||
h_align = ((ctx->height + 15) & (~15));
|
||||
size = w_align * h_align * 3 / 2;
|
||||
readOneFrameSize = ctx->width * ctx->height * 3 / 2;
|
||||
mpp_log("%d %d %d %d %d", ctx->width, ctx->height, w_align, h_align, size);
|
||||
printf("%d %d %d %d %d", ctx->width, ctx->height, w_align, h_align, size);
|
||||
nal = BSWAP32(nal);
|
||||
|
||||
do {
|
||||
if (ftell(pInFile) >= fileSize) {
|
||||
mpp_log("read end of file, complete\n");
|
||||
printf("read end of file, complete\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -430,7 +436,7 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
fakeTimeUs += 40000;
|
||||
}
|
||||
|
||||
mpp_log("read one frame, size: %d, timeUs: %lld, filePos: %ld\n",
|
||||
printf("read one frame, size: %d, timeUs: %lld, filePos: %ld\n",
|
||||
enc_in->size, enc_in->timeUs, ftell(pInFile));
|
||||
}
|
||||
|
||||
@@ -438,7 +444,7 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
ENCODE_ERR_RET(ERROR_VPU_DECODE);
|
||||
} else {
|
||||
enc_in->size = 0; // TODO encode completely, and set enc_in->size to 0
|
||||
mpp_log("vpu encode one frame, out len: %d, left size: %d\n",
|
||||
printf("vpu encode one frame, out len: %d, left size: %d\n",
|
||||
enc_out->size, enc_in->size);
|
||||
|
||||
/*
|
||||
@@ -447,7 +453,7 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
*/
|
||||
if ((enc_out->size) && (enc_out->data)) {
|
||||
if (pOutFile) {
|
||||
mpp_log("dump %d bytes enc output stream to file\n",
|
||||
printf("dump %d bytes enc output stream to file\n",
|
||||
enc_out->size);
|
||||
//fwrite((RK_U8*)&nal, 1, 4, pOutFile); // because output stream have start code, so here mask this code
|
||||
fwrite(enc_out->data, 1, enc_out->size, pOutFile);
|
||||
@@ -458,7 +464,7 @@ static RK_S32 vpu_encode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
msleep(3);
|
||||
usleep(3000);
|
||||
} while (1);
|
||||
|
||||
ENCODE_OUT:
|
||||
@@ -488,9 +494,9 @@ ENCODE_OUT:
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
mpp_log("encode demo fail, err: %d\n", ret);
|
||||
printf("encode demo fail, err: %d\n", ret);
|
||||
} else {
|
||||
mpp_log("encode demo complete OK.\n");
|
||||
printf("encode demo complete OK.\n");
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -521,31 +527,31 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
|
||||
if ((cmd->have_input == 0) || (cmd->width <= 0) || (cmd->height <= 0)
|
||||
|| (cmd->coding <= OMX_RK_VIDEO_CodingAutoDetect)) {
|
||||
mpp_log("Warning: missing needed parameters for vpu api demo\n");
|
||||
printf("Warning: missing needed parameters for vpu api demo\n");
|
||||
}
|
||||
|
||||
if (cmd->have_input) {
|
||||
mpp_log("input bitstream w: %d, h: %d, coding: %d(%s), path: %s\n",
|
||||
printf("input bitstream w: %d, h: %d, coding: %d(%s), path: %s\n",
|
||||
cmd->width, cmd->height, cmd->coding,
|
||||
cmd->codec_type == CODEC_DECODER ? "decode" : "encode",
|
||||
cmd->input_file);
|
||||
|
||||
pInFile = fopen(cmd->input_file, "rb");
|
||||
if (pInFile == NULL) {
|
||||
mpp_log("input file not exsist\n");
|
||||
printf("input file not exsist\n");
|
||||
DECODE_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
} else {
|
||||
mpp_log("please set input bitstream file\n");
|
||||
printf("please set input bitstream file\n");
|
||||
DECODE_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
|
||||
if (cmd->have_output) {
|
||||
mpp_log("vpu api demo output file: %s\n",
|
||||
printf("vpu api demo output file: %s\n",
|
||||
cmd->output_file);
|
||||
pOutFile = fopen(cmd->output_file, "wb");
|
||||
if (pOutFile == NULL) {
|
||||
mpp_log("can not write output file\n");
|
||||
printf("can not write output file\n");
|
||||
DECODE_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
if (cmd->record_frames == 0)
|
||||
@@ -577,7 +583,7 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
DECODE_ERR_RET(ERROR_IO);
|
||||
}
|
||||
|
||||
mpp_log("codec extra data size: %d\n", extraSize);
|
||||
printf("codec extra data size: %d\n", extraSize);
|
||||
|
||||
pExtra = (RK_U8 *)(malloc)(extraSize);
|
||||
if (pExtra == NULL) {
|
||||
@@ -600,18 +606,18 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
ctx->no_thread = 1;
|
||||
|
||||
if ((ret = ctx->init(ctx, pExtra, extraSize)) != 0) {
|
||||
mpp_log("init vpu api context fail, ret: 0x%X\n", ret);
|
||||
printf("init vpu api context fail, ret: 0x%X\n", ret);
|
||||
DECODE_ERR_RET(ERROR_INIT_VPU);
|
||||
}
|
||||
|
||||
/*
|
||||
** vpu api decoder process.
|
||||
*/
|
||||
mpp_log("init vpu api context ok, fileSize: %d\n", fileSize);
|
||||
printf("init vpu api context ok, fileSize: %d\n", fileSize);
|
||||
|
||||
do {
|
||||
if (ftell(pInFile) >= fileSize) {
|
||||
mpp_log("read end of file, complete\n");
|
||||
printf("read end of file, complete\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -644,7 +650,7 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
fakeTimeUs += 40000;
|
||||
}
|
||||
|
||||
mpp_log("read one packet, size: %d, pts: %lld, filePos: %ld\n",
|
||||
printf("read one packet, size: %d, pts: %lld, filePos: %ld\n",
|
||||
pkt->size, pkt->pts, ftell(pInFile));
|
||||
}
|
||||
|
||||
@@ -652,16 +658,16 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
pOut->size = 0;
|
||||
|
||||
if (ctx->decode_sendstream(ctx, pkt) != 0) {
|
||||
mpp_log("send packet failed");
|
||||
printf("send packet failed");
|
||||
DECODE_ERR_RET(ERROR_VPU_DECODE);
|
||||
}
|
||||
|
||||
|
||||
if ((ret = ctx->decode_getframe(ctx, pOut)) != 0) {
|
||||
mpp_log("get decoded data failed\n");
|
||||
printf("get decoded data failed\n");
|
||||
DECODE_ERR_RET(ERROR_VPU_DECODE);
|
||||
} else {
|
||||
mpp_log("vpu decode one frame, out len: %d, left size: %d\n",
|
||||
printf("vpu decode one frame, out len: %d, left size: %d\n",
|
||||
pOut->size, pkt->size);
|
||||
|
||||
/*
|
||||
@@ -677,7 +683,7 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
frameSize = wAlign16 * hAlign16 * 3 / 2;
|
||||
|
||||
if (pOutFile && (frame_count++ < cmd->record_frames)) {
|
||||
mpp_log("write %d frame(yuv420sp) data, %d bytes to file\n",
|
||||
printf("write %d frame(yuv420sp) data, %d bytes to file\n",
|
||||
frame_count, frameSize);
|
||||
|
||||
fwrite((RK_U8 *)(frame->vpumem.vir_addr), 1, frameSize, pOutFile);
|
||||
@@ -696,7 +702,7 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
msleep(3);
|
||||
usleep(3000);
|
||||
} while (!(ctx->decoder_err));
|
||||
|
||||
DECODE_OUT:
|
||||
@@ -726,9 +732,9 @@ DECODE_OUT:
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
mpp_log("decode demo fail, err: %d\n", ret);
|
||||
printf("decode demo fail, err: %d\n", ret);
|
||||
} else {
|
||||
mpp_log("encode demo complete OK.\n");
|
||||
printf("encode demo complete OK.\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -740,7 +746,7 @@ int main(int argc, char **argv)
|
||||
VpuApiDemoCmdContext_t demoCmdCtx;
|
||||
VpuApiDemoCmdContext_t *cmd = NULL;
|
||||
|
||||
mpp_log("/******* vpu api demo in *******/\n");
|
||||
printf("/******* vpu api demo in *******/\n");
|
||||
if (argc == 1) {
|
||||
show_usage();
|
||||
return 0;
|
||||
@@ -749,7 +755,7 @@ int main(int argc, char **argv)
|
||||
/* open library for access */
|
||||
vpuapi_hdl = dlopen("libvpu.so", RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (NULL == vpuapi_hdl) {
|
||||
mpp_log("failed to open libvpu.so\n");
|
||||
printf("failed to open libvpu.so\n");
|
||||
ret = -1;
|
||||
goto DEMO_OUT;
|
||||
}
|
||||
@@ -761,15 +767,15 @@ int main(int argc, char **argv)
|
||||
|
||||
if (NULL == vpuapi_open_ctx || NULL == vpuapi_close_ctx ||
|
||||
NULL == vpuapi_mem_link || NULL == vpuapi_mem_free) {
|
||||
mpp_log("failed to open vpu_open_context %p vpu_close_context %p\n",
|
||||
printf("failed to open vpu_open_context %p vpu_close_context %p\n",
|
||||
vpuapi_open_ctx, vpuapi_close_ctx);
|
||||
mpp_log("failed to open VPUMemLink %p VPUFreeLinear %p\n",
|
||||
printf("failed to open VPUMemLink %p VPUFreeLinear %p\n",
|
||||
vpuapi_mem_link, vpuapi_mem_free);
|
||||
ret = -1;
|
||||
goto DEMO_OUT;
|
||||
}
|
||||
|
||||
mpp_log("get vpuapi handle %p vpu_open_context %p vpu_close_context %p\n",
|
||||
printf("get vpuapi handle %p vpu_open_context %p vpu_close_context %p\n",
|
||||
vpuapi_hdl, vpuapi_open_ctx, vpuapi_close_ctx);
|
||||
|
||||
cmd = &demoCmdCtx;
|
||||
@@ -780,7 +786,7 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
mpp_log("parse_options fail\n\n");
|
||||
printf("parse_options fail\n\n");
|
||||
show_usage();
|
||||
DEMO_ERR_RET(ERROR_INVALID_PARAM);
|
||||
}
|
||||
@@ -799,13 +805,13 @@ int main(int argc, char **argv)
|
||||
|
||||
DEMO_OUT:
|
||||
if (ret) {
|
||||
mpp_log("vpu api demo fail, err: %d\n", ret);
|
||||
printf("vpu api demo fail, err: %d\n", ret);
|
||||
if (vpuapi_hdl) {
|
||||
dlclose(vpuapi_hdl);
|
||||
vpuapi_hdl = NULL;
|
||||
}
|
||||
} else {
|
||||
mpp_log("vpu api demo complete OK.\n");
|
||||
printf("vpu api demo complete OK.\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user