mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[test]: Add infinite loop mode for mpi_enc_test
Change-Id: Ibf459034f89682ec2accf5c79cf437bc34804808 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -36,7 +36,7 @@ typedef struct {
|
||||
// global flow control flag
|
||||
RK_U32 frm_eos;
|
||||
RK_U32 pkt_eos;
|
||||
RK_U32 frame_count;
|
||||
RK_S32 frame_count;
|
||||
RK_U64 stream_size;
|
||||
|
||||
// src and dst
|
||||
@@ -71,7 +71,8 @@ typedef struct {
|
||||
RK_U32 ver_stride;
|
||||
MppFrameFormat fmt;
|
||||
MppCodingType type;
|
||||
RK_U32 num_frames;
|
||||
RK_S32 num_frames;
|
||||
RK_S32 loop_times;
|
||||
|
||||
// resources
|
||||
size_t header_size;
|
||||
@@ -685,8 +686,16 @@ MPP_RET test_mpp_run(MpiEncTestData *p)
|
||||
ret = read_image(buf, p->fp_input, p->width, p->height,
|
||||
p->hor_stride, p->ver_stride, p->fmt);
|
||||
if (ret == MPP_NOK || feof(p->fp_input)) {
|
||||
mpp_log("found last frame. feof %d\n", feof(p->fp_input));
|
||||
p->frm_eos = 1;
|
||||
|
||||
if (p->num_frames < 0 || p->frame_count < p->num_frames) {
|
||||
clearerr(p->fp_input);
|
||||
rewind(p->fp_input);
|
||||
p->frm_eos = 0;
|
||||
mpp_log("loop times %d\n", ++p->loop_times);
|
||||
continue;
|
||||
}
|
||||
mpp_log("found last frame. feof %d\n", feof(p->fp_input));
|
||||
} else if (ret == MPP_ERR_VALUE)
|
||||
goto RET;
|
||||
} else {
|
||||
@@ -815,7 +824,7 @@ MPP_RET test_mpp_run(MpiEncTestData *p)
|
||||
}
|
||||
}
|
||||
|
||||
if (p->num_frames && p->frame_count >= p->num_frames) {
|
||||
if (p->num_frames > 0 && p->frame_count >= p->num_frames) {
|
||||
mpp_log_f("encode max %d frames", p->frame_count);
|
||||
break;
|
||||
}
|
||||
|
@@ -320,7 +320,6 @@ MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height,
|
||||
for (row = 0; row < height; row++) {
|
||||
read_size = fread(buf_y + row * hor_stride, 1, width, fp);
|
||||
if (read_size != width) {
|
||||
mpp_err_f("read ori yuv file luma failed");
|
||||
ret = MPP_NOK;
|
||||
goto err;
|
||||
}
|
||||
@@ -329,7 +328,6 @@ MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height,
|
||||
for (row = 0; row < height / 2; row++) {
|
||||
read_size = fread(buf_u + row * hor_stride, 1, width, fp);
|
||||
if (read_size != width) {
|
||||
mpp_err_f("read ori yuv file cb failed");
|
||||
ret = MPP_NOK;
|
||||
goto err;
|
||||
}
|
||||
@@ -339,7 +337,6 @@ MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height,
|
||||
for (row = 0; row < height; row++) {
|
||||
read_size = fread(buf_y + row * hor_stride, 1, width, fp);
|
||||
if (read_size != width) {
|
||||
mpp_err_f("read ori yuv file luma failed");
|
||||
ret = MPP_NOK;
|
||||
goto err;
|
||||
}
|
||||
@@ -348,7 +345,6 @@ MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height,
|
||||
for (row = 0; row < height / 2; row++) {
|
||||
read_size = fread(buf_u + row * hor_stride / 2, 1, width / 2, fp);
|
||||
if (read_size != width / 2) {
|
||||
mpp_err_f("read ori yuv file cb failed");
|
||||
ret = MPP_NOK;
|
||||
goto err;
|
||||
}
|
||||
@@ -357,7 +353,6 @@ MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height,
|
||||
for (row = 0; row < height / 2; row++) {
|
||||
read_size = fread(buf_v + row * hor_stride / 2, 1, width / 2, fp);
|
||||
if (read_size != width / 2) {
|
||||
mpp_err_f("read ori yuv file cr failed");
|
||||
ret = MPP_NOK;
|
||||
goto err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user