From 9a09b859f84807714fd42fa7a47c6d4ed79a4420 Mon Sep 17 00:00:00 2001 From: Frank Du Date: Wed, 6 Dec 2023 16:19:12 +0800 Subject: [PATCH] add gtest Signed-off-by: Frank Du --- app/sample/rx_st22_pipeline_sample.c | 1 + app/sample/tx_st22_pipeline_sample.c | 2 ++ tests/src/st22p_test.cpp | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/app/sample/rx_st22_pipeline_sample.c b/app/sample/rx_st22_pipeline_sample.c index 3c6d79677..b644e5132 100644 --- a/app/sample/rx_st22_pipeline_sample.c +++ b/app/sample/rx_st22_pipeline_sample.c @@ -167,6 +167,7 @@ int main(int argc, char** argv) { ops_rx.width = ctx.width; ops_rx.height = ctx.height; ops_rx.fps = ctx.fps; + ops_rx.interlaced = ctx.interlaced; ops_rx.output_fmt = ctx.output_fmt; ops_rx.pack_type = ST22_PACK_CODESTREAM; ops_rx.codec = ctx.st22p_codec; diff --git a/app/sample/tx_st22_pipeline_sample.c b/app/sample/tx_st22_pipeline_sample.c index 544c7ff54..17a42942c 100644 --- a/app/sample/tx_st22_pipeline_sample.c +++ b/app/sample/tx_st22_pipeline_sample.c @@ -229,6 +229,7 @@ int main(int argc, char** argv) { ops_tx.width = ctx.width; ops_tx.height = ctx.height; ops_tx.fps = ctx.fps; + ops_tx.interlaced = ctx.interlaced; ops_tx.input_fmt = ctx.input_fmt; ops_tx.pack_type = ST22_PACK_CODESTREAM; ops_tx.codec = ctx.st22p_codec; @@ -236,6 +237,7 @@ int main(int argc, char** argv) { ops_tx.quality = ST22_QUALITY_MODE_QUALITY; ops_tx.codec_thread_cnt = 2; ops_tx.codestream_size = ops_tx.width * ops_tx.height * bpp / 8; + if (ops_tx.interlaced) ops_tx.codestream_size /= 2; ops_tx.framebuff_cnt = ctx.framebuff_cnt; ops_tx.notify_frame_available = tx_st22p_frame_available; diff --git a/tests/src/st22p_test.cpp b/tests/src/st22p_test.cpp index d72c0b6d6..64b042248 100644 --- a/tests/src/st22p_test.cpp +++ b/tests/src/st22p_test.cpp @@ -717,6 +717,7 @@ struct st22p_rx_digest_test_para { bool rtcp; bool tx_ext; bool rx_ext; + bool interlace; uint32_t ssrc; }; @@ -735,6 +736,7 @@ static void test_st22p_init_rx_digest_para(struct st22p_rx_digest_test_para* par para->rtcp = false; para->tx_ext = false; para->rx_ext = false; + para->interlace = false; para->ssrc = 0; } @@ -828,6 +830,7 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_tx.width = width[i]; ops_tx.height = height[i]; ops_tx.fps = fps[i]; + ops_tx.interlaced = para->interlace; ops_tx.input_fmt = fmt[i]; ops_tx.pack_type = ST22_PACK_CODESTREAM; ops_tx.codec = codec[i]; @@ -1003,6 +1006,7 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_rx.width = width[i]; ops_rx.height = height[i]; ops_rx.fps = fps[i]; + ops_rx.interlaced = para->interlace; ops_rx.output_fmt = fmt[i]; ops_rx.pack_type = ST22_PACK_CODESTREAM; ops_rx.codec = codec[i]; @@ -1140,6 +1144,22 @@ TEST(St22p, digest_st22_1080p_s1) { st22p_rx_digest_test(fps, width, height, fmt, codec, compress_ratio, ¶); } +TEST(St22p, digest_st22_1080i) { + enum st_fps fps[1] = {ST_FPS_P59_94}; + int width[1] = {1920}; + int height[1] = {1080}; + enum st_frame_fmt fmt[1] = {ST_FRAME_FMT_YUV422PLANAR10LE}; + enum st22_codec codec[1] = {ST22_CODEC_JPEGXS}; + int compress_ratio[1] = {10}; + + struct st22p_rx_digest_test_para para; + test_st22p_init_rx_digest_para(¶); + para.level = ST_TEST_LEVEL_MANDATORY; + para.interlace = true; + + st22p_rx_digest_test(fps, width, height, fmt, codec, compress_ratio, ¶); +} + TEST(St22p, digest_st22_4k_s1) { enum st_fps fps[1] = {ST_FPS_P59_94}; int width[1] = {1920 * 2};