diff --git a/test/create_test_essence.cpp b/test/create_test_essence.cpp index 6c0ba7ec..8d54c9de 100644 --- a/test/create_test_essence.cpp +++ b/test/create_test_essence.cpp @@ -115,7 +115,9 @@ typedef enum TYPE_RDD36_4444 = 56, TYPE_16BIT_PCM_SAMPLES = 57, TYPE_RDD36_422_ITU2020 = 58, - TYPE_END = 59, + TYPE_MPEG2LG_MP_ML_576I = 59, + TYPE_MPEG2LG_MP_ML_576I_4_3 = 60, + TYPE_END = 61, } EssenceType; typedef struct @@ -430,13 +432,14 @@ static void write_d10(FILE *file, int type, unsigned int duration) write_buffer(file, data, frame_size); } -static void write_mpeg2lg(FILE *file, int type, unsigned int duration, bool low_delay, bool closed_gop) +static void write_mpeg2lg(FILE *file, int type, unsigned int duration, bool low_delay, bool closed_gop, + uint8_t aspect_ratio = MPEG_16_9_ASPECT_RATIO) { MPEGInfo mpeg_info; memset(&mpeg_info, 0, sizeof(mpeg_info)); mpeg_info.is_progressive = false; mpeg_info.low_delay = low_delay; - mpeg_info.aspect_ratio = MPEG_16_9_ASPECT_RATIO; + mpeg_info.aspect_ratio = aspect_ratio; uint32_t i_frame_size, non_i_frame_size; switch (type) @@ -489,6 +492,15 @@ static void write_mpeg2lg(FILE *file, int type, unsigned int duration, bool low_ mpeg_info.v_size = 1080; mpeg_info.bit_rate = (35 * 1000 * 1000) / 400; break; + case TYPE_MPEG2LG_MP_ML_576I: + i_frame_size = 19500; + non_i_frame_size = 16500; + mpeg_info.profile_level = 0x72; + mpeg_info.chroma_format = 1; + mpeg_info.h_size = 720; + mpeg_info.v_size = 576; + mpeg_info.bit_rate = (10 * 1000 * 1000) / 400; + break; case TYPE_MPEG2LG_MP_H14_1080I: case TYPE_MPEG2LG_MP_H14_1080P: default: @@ -1129,11 +1141,15 @@ int main(int argc, const char **argv) case TYPE_MPEG2LG_MP_HL_1080P_1440: case TYPE_MPEG2LG_422P_HL_720P: case TYPE_MPEG2LG_MP_HL_720P: + case TYPE_MPEG2LG_MP_ML_576I: write_mpeg2lg(file, type, duration, true, false); break; case TYPE_AS10_MPEG2LG_422P_HL_1080I: write_mpeg2lg(file, TYPE_MPEG2LG_422P_HL_1080I, duration, false, true); break; + case TYPE_MPEG2LG_MP_ML_576I_4_3: + write_mpeg2lg(file, type, duration, true, false, MPEG_4_3_ASPECT_RATIO); + break; case TYPE_UNC_SD: case TYPE_UNC_HD_1080I: case TYPE_UNC_HD_1080P: diff --git a/test/mxf_op1a/CMakeLists.txt b/test/mxf_op1a/CMakeLists.txt index 3db0a332..811fe4d4 100644 --- a/test/mxf_op1a/CMakeLists.txt +++ b/test/mxf_op1a/CMakeLists.txt @@ -9,6 +9,7 @@ set(tests dv indexfollows mpeg2lg + mpeg2lg_576i rdd36 soundonly unc diff --git a/test/mxf_op1a/mpeg2lg_mp_ml_576i_16by9.md5 b/test/mxf_op1a/mpeg2lg_mp_ml_576i_16by9.md5 new file mode 100644 index 00000000..2d5d0138 --- /dev/null +++ b/test/mxf_op1a/mpeg2lg_mp_ml_576i_16by9.md5 @@ -0,0 +1 @@ +9706391e131d72298ecc27da8984009a \ No newline at end of file diff --git a/test/mxf_op1a/mpeg2lg_mp_ml_576i_4by3.md5 b/test/mxf_op1a/mpeg2lg_mp_ml_576i_4by3.md5 new file mode 100644 index 00000000..2e4a7c4f --- /dev/null +++ b/test/mxf_op1a/mpeg2lg_mp_ml_576i_4by3.md5 @@ -0,0 +1 @@ +fcfe27b756f6d6daed2aa0158c1f61a3 \ No newline at end of file diff --git a/test/mxf_op1a/test_mpeg2lg.cmake b/test/mxf_op1a/test_mpeg2lg.cmake index 341440cf..a1f3d91a 100644 --- a/test/mxf_op1a/test_mpeg2lg.cmake +++ b/test/mxf_op1a/test_mpeg2lg.cmake @@ -1,4 +1,4 @@ -# Test creating an MXF OP1a file containing AVC video and 2 PCM tracks +# Test creating an MXF OP1a file containing MPEG2LG video and 2 PCM tracks include("${TEST_SOURCE_DIR}/test_common.cmake") diff --git a/test/mxf_op1a/test_mpeg2lg_576i.cmake b/test/mxf_op1a/test_mpeg2lg_576i.cmake new file mode 100644 index 00000000..bd67636b --- /dev/null +++ b/test/mxf_op1a/test_mpeg2lg_576i.cmake @@ -0,0 +1,84 @@ +# Test creating an MXF OP1a file containing MPEG2LG 576i video and 2 PCM tracks + +include("${TEST_SOURCE_DIR}/../testing.cmake") + + +function(run_test test aspect_ratio duration) + if(TEST_MODE STREQUAL "check") + set(output_file test_${test}_${aspect_ratio}.mxf) + elseif(TEST_MODE STREQUAL "samples") + file(MAKE_DIRECTORY ${BMX_TEST_SAMPLES_DIR}) + + set(output_file ${BMX_TEST_SAMPLES_DIR}/test_${test}_${aspect_ratio}.mxf) + else() + set(output_file test_${test}${aspect_ratio}.mxf) + endif() + + set(checksum_file ${test}_${aspect_ratio}.md5) + + set(create_test_audio ${CREATE_TEST_ESSENCE} + -t 1 + -d ${duration} + audio_${test} + ) + + set(create_command ${RAW2BMX} + --regtest + -t op1a + -y 10:11:12:13 + --clip test + -o ${output_file} + --${test} video_${test} + -q 16 --locked true --pcm audio_${test} + -q 16 --locked true --pcm audio_${test} + ) + + run_test_a( + "${TEST_MODE}" + "${BMX_TEST_WITH_VALGRIND}" + "${create_test_video}" + "${create_test_audio}" + "" + "${create_command}" + "" + "" + "" + "${output_file}" + "${checksum_file}" + "" + "" + ) +endfunction() + +function(run_tests tests duration) + list(LENGTH tests len_tests) + math(EXPR max_index "(${len_tests} / 3) - 1") + + foreach(index RANGE ${max_index}) + math(EXPR test_index "${index} * 3") + list(GET tests ${test_index} test) + + math(EXPR test_ess_type_index "${index} * 3 + 1") + list(GET tests ${test_ess_type_index} test_ess_type) + + math(EXPR test_aspect_ratio_index "${index} * 3 + 2") + list(GET tests ${test_aspect_ratio_index} test_aspect_ratio) + + set(create_test_video ${CREATE_TEST_ESSENCE} + -t ${test_ess_type} + -d ${duration} + video_${test} + ) + + run_test(${test} ${test_aspect_ratio} ${duration}) + endforeach() +endfunction() + + +set(tests + mpeg2lg_mp_ml_576i 59 16by9 + mpeg2lg_mp_ml_576i 60 4by3 +) + + +run_tests("${tests}" 24)