[test]: Add yuyv422 and uyvy422 test case

Add yuyv422 and uyvy422 support to encoder test case: mpi_enc_test.
Note: on these two case the hor_stride should be twice of width.
With this modification test case can output correct stream now.

Change-Id: I463d3c158369d831e4558199c917023773300ac1
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2018-03-29 12:01:55 +08:00
parent 5d6b20385e
commit 87da5bef82

View File

@@ -193,6 +193,12 @@ static MPP_RET read_yuv_image(RK_U8 *buf, MpiEncTestData *p)
read_size = fread(buf_y + row * hor_stride * 4, 1, width * 4, fp);
}
} break;
case MPP_FMT_YUV422_YUYV :
case MPP_FMT_YUV422_UYVY : {
for (row = 0; row < height; row++) {
read_size = fread(buf_y + row * hor_stride, 1, width * 2, fp);
}
} break;
default : {
mpp_err_f("read image do not support fmt %d\n", fmt);
ret = MPP_ERR_VALUE;
@@ -259,6 +265,30 @@ static MPP_RET fill_yuv_image(RK_U8 *buf, MpiEncTestData *c)
}
}
} break;
case MPP_FMT_YUV422_YUYV : {
RK_U8 *p = buf_y;
for (y = 0; y < height; y++, p += hor_stride) {
for (x = 0; x < width / 2; x++) {
p[x * 4 + 0] = x * 2 + 0 + y + frame_count * 3;
p[x * 4 + 2] = x * 2 + 1 + y + frame_count * 3;
p[x * 4 + 1] = 128 + y + frame_count * 2;
p[x * 4 + 3] = 64 + x + frame_count * 5;
}
}
} break;
case MPP_FMT_YUV422_UYVY : {
RK_U8 *p = buf_y;
for (y = 0; y < height; y++, p += hor_stride) {
for (x = 0; x < width / 2; x++) {
p[x * 4 + 1] = x * 2 + 0 + y + frame_count * 3;
p[x * 4 + 3] = x * 2 + 1 + y + frame_count * 3;
p[x * 4 + 0] = 128 + y + frame_count * 2;
p[x * 4 + 2] = 64 + x + frame_count * 5;
}
}
} break;
default : {
mpp_err_f("filling function do not support type %d\n", fmt);
ret = MPP_NOK;
@@ -345,9 +375,13 @@ MPP_RET test_ctx_init(MpiEncTestData **data, MpiEncTestCmd *cmd)
}
// update resource parameter
if (p->fmt <= MPP_FMT_YUV_BUTT)
if (p->fmt <= MPP_FMT_YUV420SP_VU)
p->frame_size = p->hor_stride * p->ver_stride * 3 / 2;
else
else if (p->fmt <= MPP_FMT_YUV422_UYVY) {
// NOTE: yuyv and uyvy need to double stride
p->hor_stride *= 2;
p->frame_size = p->hor_stride * p->ver_stride;
} else
p->frame_size = p->hor_stride * p->ver_stride * 4;
p->packet_size = p->width * p->height;
//NOTE: hor_stride should be 16-MB aligned