Skip to content

Commit

Permalink
add gtest
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Du <[email protected]>
  • Loading branch information
frankdjx committed Dec 6, 2023
1 parent 1f891c8 commit 9a09b85
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/sample/rx_st22_pipeline_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions app/sample/tx_st22_pipeline_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ 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;
ops_tx.device = ST_PLUGIN_DEVICE_AUTO;
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;

Expand Down
20 changes: 20 additions & 0 deletions tests/src/st22p_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ struct st22p_rx_digest_test_para {
bool rtcp;
bool tx_ext;
bool rx_ext;
bool interlace;
uint32_t ssrc;
};

Expand All @@ -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;
}

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -1140,6 +1144,22 @@ TEST(St22p, digest_st22_1080p_s1) {
st22p_rx_digest_test(fps, width, height, fmt, codec, compress_ratio, &para);
}

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);
para.level = ST_TEST_LEVEL_MANDATORY;
para.interlace = true;

st22p_rx_digest_test(fps, width, height, fmt, codec, compress_ratio, &para);
}

TEST(St22p, digest_st22_4k_s1) {
enum st_fps fps[1] = {ST_FPS_P59_94};
int width[1] = {1920 * 2};
Expand Down

0 comments on commit 9a09b85

Please sign in to comment.