mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 01:02:39 +08:00
[mpi_dec_test]: Add FileReader for mpi_dec_utils
Support different format files as input: 1. Normal file, e.g. h264/h265 raw stream 2. Ivf file , e.g vp8/vp9 stream with ivf header Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com> Change-Id: I034693ae3e23bdde57c90ded7dd7248c50728122
This commit is contained in:
@@ -54,6 +54,7 @@ typedef struct {
|
|||||||
RK_S32 frame_count;
|
RK_S32 frame_count;
|
||||||
RK_S32 frame_num;
|
RK_S32 frame_num;
|
||||||
size_t max_usage;
|
size_t max_usage;
|
||||||
|
FileReader reader;
|
||||||
} MpiDecLoopData;
|
} MpiDecLoopData;
|
||||||
|
|
||||||
static int decode_simple(MpiDecLoopData *data)
|
static int decode_simple(MpiDecLoopData *data)
|
||||||
@@ -68,6 +69,7 @@ static int decode_simple(MpiDecLoopData *data)
|
|||||||
MppFrame frame = NULL;
|
MppFrame frame = NULL;
|
||||||
size_t read_size = 0;
|
size_t read_size = 0;
|
||||||
size_t packet_size = data->packet_size;
|
size_t packet_size = data->packet_size;
|
||||||
|
FileReader reader = data->reader;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (data->fp_config) {
|
if (data->fp_config) {
|
||||||
@@ -101,31 +103,30 @@ static int decode_simple(MpiDecLoopData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// when packet size is valid read the input binary file
|
// when packet size is valid read the input binary file
|
||||||
if (packet_size)
|
if (packet_size) {
|
||||||
read_size = fread(buf, 1, packet_size, data->fp_input);
|
|
||||||
|
|
||||||
if (!packet_size || read_size != packet_size || feof(data->fp_input)) {
|
data->eos = pkt_eos = reader_read(reader, &buf, &read_size);
|
||||||
if (data->frame_num < 0) {
|
|
||||||
clearerr(data->fp_input);
|
if (pkt_eos) {
|
||||||
rewind(data->fp_input);
|
if (data->frame_num < 0) {
|
||||||
if (data->fp_config) {
|
mpp_log("%p loop again\n", ctx);
|
||||||
clearerr(data->fp_config);
|
reader_rewind(reader);
|
||||||
rewind(data->fp_config);
|
if (data->fp_config) {
|
||||||
|
clearerr(data->fp_config);
|
||||||
|
rewind(data->fp_config);
|
||||||
|
}
|
||||||
|
data->eos = pkt_eos = 0;
|
||||||
|
} else {
|
||||||
|
mpp_log("%p found last packet\n", ctx);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
data->eos = pkt_eos = 0;
|
|
||||||
mpp_log("%p loop again\n", ctx);
|
|
||||||
} else {
|
|
||||||
// setup eos flag
|
|
||||||
data->eos = pkt_eos = 1;
|
|
||||||
mpp_log("%p found last packet\n", ctx);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!read_size);
|
} while (!read_size);
|
||||||
|
|
||||||
// write data to packet
|
mpp_packet_set_data(packet, buf);
|
||||||
mpp_packet_write(packet, 0, buf, read_size);
|
if (read_size > mpp_packet_get_size(packet))
|
||||||
// reset pos and set valid length
|
mpp_packet_set_size(packet, read_size);
|
||||||
mpp_packet_set_pos(packet, buf);
|
mpp_packet_set_pos(packet, buf);
|
||||||
mpp_packet_set_length(packet, read_size);
|
mpp_packet_set_length(packet, read_size);
|
||||||
// setup eos flag
|
// setup eos flag
|
||||||
@@ -486,7 +487,7 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
size_t packet_size = cmd->pkt_size;
|
size_t packet_size = cmd->pkt_size;
|
||||||
MppBuffer pkt_buf = NULL;
|
MppBuffer pkt_buf = NULL;
|
||||||
MppBuffer frm_buf = NULL;
|
MppBuffer frm_buf = NULL;
|
||||||
|
FileReader reader = NULL;
|
||||||
MpiDecLoopData data;
|
MpiDecLoopData data;
|
||||||
|
|
||||||
mpp_log("mpi_dec_test start\n");
|
mpp_log("mpi_dec_test start\n");
|
||||||
@@ -522,13 +523,8 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd->simple) {
|
if (cmd->simple) {
|
||||||
buf = mpp_malloc(char, packet_size);
|
reader_init(&reader, cmd->file_input, data.fp_input);
|
||||||
if (NULL == buf) {
|
ret = mpp_packet_init(&packet, NULL, 0);
|
||||||
mpp_err("mpi_dec_test malloc input stream buffer failed\n");
|
|
||||||
goto MPP_TEST_OUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = mpp_packet_init(&packet, buf, packet_size);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
mpp_err("mpp_packet_init failed\n");
|
mpp_err("mpp_packet_init failed\n");
|
||||||
goto MPP_TEST_OUT;
|
goto MPP_TEST_OUT;
|
||||||
@@ -624,7 +620,6 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
mpp_err("%p mpp_init failed\n", ctx);
|
mpp_err("%p mpp_init failed\n", ctx);
|
||||||
goto MPP_TEST_OUT;
|
goto MPP_TEST_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.ctx = ctx;
|
data.ctx = ctx;
|
||||||
data.mpi = mpi;
|
data.mpi = mpi;
|
||||||
data.eos = 0;
|
data.eos = 0;
|
||||||
@@ -634,6 +629,7 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
data.frame = frame;
|
data.frame = frame;
|
||||||
data.frame_count = 0;
|
data.frame_count = 0;
|
||||||
data.frame_num = cmd->frame_num;
|
data.frame_num = cmd->frame_num;
|
||||||
|
data.reader = reader;
|
||||||
|
|
||||||
if (cmd->simple) {
|
if (cmd->simple) {
|
||||||
while (!data.eos) {
|
while (!data.eos) {
|
||||||
@@ -677,9 +673,9 @@ int mpi_dec_test_decode(MpiDecTestCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPP_TEST_OUT:
|
MPP_TEST_OUT:
|
||||||
if (packet) {
|
if (data.packet) {
|
||||||
mpp_packet_deinit(&packet);
|
mpp_packet_deinit(&data.packet);
|
||||||
packet = NULL;
|
data.packet = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
@@ -693,10 +689,7 @@ MPP_TEST_OUT:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd->simple) {
|
if (cmd->simple) {
|
||||||
if (buf) {
|
reader_deinit(&reader);
|
||||||
mpp_free(buf);
|
|
||||||
buf = NULL;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (pkt_buf) {
|
if (pkt_buf) {
|
||||||
mpp_buffer_put(pkt_buf);
|
mpp_buffer_put(pkt_buf);
|
||||||
|
@@ -20,13 +20,28 @@
|
|||||||
|
|
||||||
#include "mpp_mem.h"
|
#include "mpp_mem.h"
|
||||||
#include "mpp_log.h"
|
#include "mpp_log.h"
|
||||||
#include "mpp_buffer.h"
|
|
||||||
|
|
||||||
#include "rk_mpi.h"
|
#include "rk_mpi.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "mpp_common.h"
|
#include "mpp_common.h"
|
||||||
#include "mpi_dec_utils.h"
|
#include "mpi_dec_utils.h"
|
||||||
|
|
||||||
|
#define IVF_HEADER_LENGTH 32
|
||||||
|
#define IVF_FRAME_HEADER_LENGTH 12
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FILE_NORMAL_TYPE,
|
||||||
|
FILE_IVF_TYPE,
|
||||||
|
FILE_BUTT,
|
||||||
|
} FileType;
|
||||||
|
|
||||||
|
typedef struct FileReader_t {
|
||||||
|
char *buf;
|
||||||
|
FILE *fp_input;
|
||||||
|
size_t buf_size;
|
||||||
|
size_t read_size;
|
||||||
|
FileType file_type;
|
||||||
|
} FileReaderImpl;
|
||||||
|
|
||||||
OptionInfo mpi_dec_cmd[] = {
|
OptionInfo mpi_dec_cmd[] = {
|
||||||
{"i", "input_file", "input bitstream file"},
|
{"i", "input_file", "input bitstream file"},
|
||||||
{"o", "output_file", "output bitstream file, "},
|
{"o", "output_file", "output bitstream file, "},
|
||||||
@@ -42,6 +57,133 @@ OptionInfo mpi_dec_cmd[] = {
|
|||||||
{NULL},
|
{NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static RK_U32 read_ivf_file(FileReader data)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = (FileReaderImpl*)data;
|
||||||
|
char *buf = reader->buf;
|
||||||
|
size_t data_size = 0;
|
||||||
|
size_t buf_size = reader->buf_size;
|
||||||
|
RK_U32 eos = 0;
|
||||||
|
RK_U8 ivf_data[IVF_FRAME_HEADER_LENGTH] = {0};
|
||||||
|
|
||||||
|
fread(ivf_data, 1, IVF_FRAME_HEADER_LENGTH, reader->fp_input);
|
||||||
|
data_size = ivf_data[0] |
|
||||||
|
(ivf_data[1] << 8) |
|
||||||
|
(ivf_data[2] << 16) |
|
||||||
|
(ivf_data[3] << 24);
|
||||||
|
/* buffer size not enough, realloc */
|
||||||
|
if (data_size > buf_size) {
|
||||||
|
size_t realloc_size = MPP_ALIGN(data_size, SZ_4K);
|
||||||
|
mpp_log("buf size not enough realloc size %d\n", realloc_size);
|
||||||
|
buf = mpp_realloc(buf, char, realloc_size);
|
||||||
|
if (NULL == buf) {
|
||||||
|
mpp_err("mpi_dec_test realloc input stream buffer failed\n");
|
||||||
|
}
|
||||||
|
reader->buf = buf;
|
||||||
|
reader->buf_size = realloc_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->read_size = fread(buf, 1, data_size, reader->fp_input);
|
||||||
|
/* check reach eos whether or not */
|
||||||
|
if (!data_size || reader->read_size != data_size || feof(reader->fp_input)) {
|
||||||
|
eos = 1;
|
||||||
|
}
|
||||||
|
return eos;
|
||||||
|
}
|
||||||
|
|
||||||
|
static RK_U32 read_normal_file(FileReader data)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = (FileReaderImpl*)data;
|
||||||
|
char *buf = reader->buf;
|
||||||
|
size_t buf_size = reader->buf_size;
|
||||||
|
RK_U32 eos = 0;
|
||||||
|
|
||||||
|
reader->read_size = fread(buf, 1, buf_size, reader->fp_input);
|
||||||
|
/* check reach eos whether or not */
|
||||||
|
if (!buf_size || reader->read_size != buf_size || feof(reader->fp_input))
|
||||||
|
eos = 1;
|
||||||
|
|
||||||
|
return eos;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void check_file_type(FileReader data, char *file_in)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = (FileReaderImpl*)data;
|
||||||
|
|
||||||
|
if (strstr(file_in, ".ivf")) {
|
||||||
|
reader->file_type = FILE_IVF_TYPE;
|
||||||
|
reader->buf_size = SZ_2M;
|
||||||
|
} else {
|
||||||
|
reader->file_type = FILE_NORMAL_TYPE;
|
||||||
|
reader->buf_size = SZ_4K;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RK_U32 reader_read(FileReader file_reader, char** buf, size_t *size)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = file_reader;
|
||||||
|
FileType type = reader->file_type;
|
||||||
|
RK_U32 eos = 0;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case FILE_NORMAL_TYPE : {
|
||||||
|
eos = read_normal_file(reader);
|
||||||
|
} break;
|
||||||
|
case FILE_IVF_TYPE : {
|
||||||
|
eos = read_ivf_file(reader);
|
||||||
|
} break;
|
||||||
|
default : {
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*buf = reader->buf;
|
||||||
|
*size = reader->read_size;
|
||||||
|
return eos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reader_rewind(FileReader file_reader)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = (FileReaderImpl*)file_reader;
|
||||||
|
FileType type = reader->file_type;
|
||||||
|
|
||||||
|
clearerr(reader->fp_input);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case FILE_NORMAL_TYPE : {
|
||||||
|
rewind(reader->fp_input);
|
||||||
|
} break;
|
||||||
|
case FILE_IVF_TYPE : {
|
||||||
|
fseek(reader->fp_input, IVF_HEADER_LENGTH, SEEK_SET);
|
||||||
|
} break;
|
||||||
|
default : {
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reader_init(FileReader* file_reader, char* file_in, FILE* fp_in)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = mpp_malloc(FileReaderImpl, 1);
|
||||||
|
|
||||||
|
check_file_type(reader, file_in);
|
||||||
|
|
||||||
|
reader->buf = mpp_malloc(char, reader->buf_size);
|
||||||
|
reader->fp_input = fp_in;
|
||||||
|
|
||||||
|
if (reader->file_type == FILE_IVF_TYPE)
|
||||||
|
fseek(reader->fp_input, IVF_HEADER_LENGTH, SEEK_SET);
|
||||||
|
|
||||||
|
*file_reader = reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reader_deinit(FileReader *file_reader)
|
||||||
|
{
|
||||||
|
FileReaderImpl *reader = (FileReaderImpl*)(*file_reader);
|
||||||
|
|
||||||
|
MPP_FREE(reader->buf);
|
||||||
|
MPP_FREE(reader);
|
||||||
|
*file_reader = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void mpi_dec_test_help()
|
void mpi_dec_test_help()
|
||||||
{
|
{
|
||||||
mpp_log("usage: mpi_dec_test [options]\n");
|
mpp_log("usage: mpi_dec_test [options]\n");
|
||||||
@@ -80,7 +222,7 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
opt++;
|
opt++;
|
||||||
|
|
||||||
switch (*opt) {
|
switch (*opt) {
|
||||||
case 'i':
|
case 'i' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1);
|
strncpy(cmd->file_input, next, MAX_FILE_NAME_LENGTH - 1);
|
||||||
cmd->have_input = 1;
|
cmd->have_input = 1;
|
||||||
@@ -89,8 +231,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_err("input file is invalid\n");
|
mpp_err("input file is invalid\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'o':
|
case 'o' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1);
|
strncpy(cmd->file_output, next, MAX_FILE_NAME_LENGTH - 1);
|
||||||
cmd->have_output = 1;
|
cmd->have_output = 1;
|
||||||
@@ -98,8 +240,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_log("output file is invalid\n");
|
mpp_log("output file is invalid\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'c':
|
case 'c' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
strncpy(cmd->file_config, next, MAX_FILE_NAME_LENGTH - 1);
|
strncpy(cmd->file_config, next, MAX_FILE_NAME_LENGTH - 1);
|
||||||
cmd->have_config = 1;
|
cmd->have_config = 1;
|
||||||
@@ -110,24 +252,24 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_log("output file is invalid\n");
|
mpp_log("output file is invalid\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'd':
|
case 'd' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->debug = atoi(next);;
|
cmd->debug = atoi(next);;
|
||||||
} else {
|
} else {
|
||||||
mpp_err("invalid debug flag\n");
|
mpp_err("invalid debug flag\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'w':
|
case 'w' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->width = atoi(next);
|
cmd->width = atoi(next);
|
||||||
} else {
|
} else {
|
||||||
mpp_err("invalid input width\n");
|
mpp_err("invalid input width\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'h':
|
case 'h' : {
|
||||||
if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) {
|
if ((*(opt + 1) != '\0') && !strncmp(opt, "help", 4)) {
|
||||||
mpi_dec_test_help();
|
mpi_dec_test_help();
|
||||||
err = 1;
|
err = 1;
|
||||||
@@ -138,8 +280,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_log("input height is invalid\n");
|
mpp_log("input height is invalid\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 't':
|
case 't' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->type = (MppCodingType)atoi(next);
|
cmd->type = (MppCodingType)atoi(next);
|
||||||
err = mpp_check_support_format(MPP_CTX_DEC, cmd->type);
|
err = mpp_check_support_format(MPP_CTX_DEC, cmd->type);
|
||||||
@@ -149,8 +291,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_err("invalid input coding type\n");
|
mpp_err("invalid input coding type\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'f':
|
case 'f' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->format = (MppFrameFormat)atoi(next);
|
cmd->format = (MppFrameFormat)atoi(next);
|
||||||
}
|
}
|
||||||
@@ -159,8 +301,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_err("invalid input coding type\n");
|
mpp_err("invalid input coding type\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'x':
|
case 'x' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->timeout = atoi(next);
|
cmd->timeout = atoi(next);
|
||||||
}
|
}
|
||||||
@@ -169,8 +311,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_err("invalid output timeout interval\n");
|
mpp_err("invalid output timeout interval\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 'n':
|
case 'n' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->frame_num = atoi(next);
|
cmd->frame_num = atoi(next);
|
||||||
if (cmd->frame_num < 0)
|
if (cmd->frame_num < 0)
|
||||||
@@ -179,8 +321,8 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_err("invalid frame number\n");
|
mpp_err("invalid frame number\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
case 's':
|
case 's' : {
|
||||||
if (next) {
|
if (next) {
|
||||||
cmd->nthreads = atoi(next);
|
cmd->nthreads = atoi(next);
|
||||||
}
|
}
|
||||||
@@ -188,10 +330,10 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd)
|
|||||||
mpp_err("invalid nthreads\n");
|
mpp_err("invalid nthreads\n");
|
||||||
goto PARSE_OPINIONS_OUT;
|
goto PARSE_OPINIONS_OUT;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
default:
|
default : {
|
||||||
mpp_err("skip invalid opt %c\n", *opt);
|
mpp_err("skip invalid opt %c\n", *opt);
|
||||||
break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
optindex++;
|
optindex++;
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
#define MPI_DEC_STREAM_SIZE (SZ_4K)
|
#define MPI_DEC_STREAM_SIZE (SZ_4K)
|
||||||
#define MPI_DEC_LOOP_COUNT 4
|
#define MPI_DEC_LOOP_COUNT 4
|
||||||
|
|
||||||
|
typedef void* FileReader;
|
||||||
|
|
||||||
/* For overall configure setup */
|
/* For overall configure setup */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char file_input[MAX_FILE_NAME_LENGTH];
|
char file_input[MAX_FILE_NAME_LENGTH];
|
||||||
@@ -55,4 +57,9 @@ RK_S32 mpi_dec_test_parse_options(int argc, char **argv, MpiDecTestCmd* cmd);
|
|||||||
void mpi_dec_test_show_options(MpiDecTestCmd* cmd);
|
void mpi_dec_test_show_options(MpiDecTestCmd* cmd);
|
||||||
void mpi_dec_test_help();
|
void mpi_dec_test_help();
|
||||||
|
|
||||||
|
void reader_init(FileReader* file_reader, char* file_in, FILE* fp_in);
|
||||||
|
void reader_deinit(FileReader *file_reader);
|
||||||
|
RK_U32 reader_read(FileReader file_reader, char** buf, size_t *size);
|
||||||
|
void reader_rewind(FileReader file_reader);
|
||||||
|
|
||||||
#endif
|
#endif
|
Reference in New Issue
Block a user