├── .clang-format ├── .github ├── config │ ├── .shellcheck │ └── path_filters.yaml ├── scripts │ ├── build_ffmpeg_plugin.sh │ ├── build_ffmpeg_plugin_msys.sh │ └── configure.ps1 └── workflows │ ├── base_build.yaml │ ├── coverity.yaml │ ├── ffmpeg_plugin_build.yaml │ └── linter.yaml ├── .gitignore ├── Build ├── coverage_linux │ └── run_coverage.sh ├── eclipse │ └── build_eclipse.sh ├── linux │ └── build.sh └── windows │ └── build.bat ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── Source ├── API │ ├── SvtJpegxs.h │ ├── SvtJpegxsDec.h │ ├── SvtJpegxsEnc.h │ └── SvtJpegxsImageBufferTools.h ├── App │ ├── Common │ │ ├── SemaphoreApp.c │ │ ├── SemaphoreApp.h │ │ └── UtilityApp.h │ ├── DecApp │ │ ├── CMakeLists.txt │ │ ├── DecAppMain.c │ │ ├── DecParamParser.c │ │ └── DecParamParser.h │ ├── EncApp │ │ ├── CMakeLists.txt │ │ ├── EncAppConfig.c │ │ ├── EncAppConfig.h │ │ └── EncAppMain.c │ ├── SampleDecoder │ │ ├── CMakeLists.txt │ │ └── main.c │ └── SampleEncoder │ │ ├── CMakeLists.txt │ │ └── main.c └── Lib │ ├── CMakeLists.txt │ ├── Common │ ├── ASM_AVX2 │ │ ├── CMakeLists.txt │ │ └── empty.c │ ├── ASM_SSE2 │ │ ├── CMakeLists.txt │ │ ├── PictureOperators_SSE2.asm │ │ ├── empty.c │ │ └── x64inc.asm │ └── Codec │ │ ├── CMakeLists.txt │ │ ├── Codestream.h │ │ ├── Definitions.h │ │ ├── EncDec.c │ │ ├── EncDec.h │ │ ├── ImageBuffer.c │ │ ├── Pi.c │ │ ├── Pi.h │ │ ├── SvtLog.c │ │ ├── SvtLog.h │ │ ├── SvtType.h │ │ ├── SvtUtility.c │ │ ├── SvtUtility.h │ │ ├── Threads │ │ ├── SvtMalloc.c │ │ ├── SvtMalloc.h │ │ ├── SvtObject.h │ │ ├── SvtThreads.c │ │ ├── SvtThreads.h │ │ ├── SystemResourceManager.c │ │ └── SystemResourceManager.h │ │ ├── common_dsp_rtcd.c │ │ └── common_dsp_rtcd.h │ ├── Decoder │ ├── ASM_AVX2 │ │ ├── CMakeLists.txt │ │ ├── Dwt53Decoder_AVX2.c │ │ ├── Dwt53Decoder_AVX2.h │ │ ├── NltDec_AVX2.c │ │ ├── NltDec_AVX2.h │ │ ├── UnPack_avx2.c │ │ └── UnPack_avx2.h │ ├── ASM_AVX512 │ │ ├── CMakeLists.txt │ │ ├── Dequant_avx512.c │ │ ├── Dequant_avx512.h │ │ ├── NltDec_avx512.c │ │ ├── NltDec_avx512.h │ │ ├── idwt-avx512.c │ │ └── idwt-avx512.h │ ├── ASM_SSE4_1 │ │ ├── CMakeLists.txt │ │ ├── Dequant_SSE4.c │ │ └── Dequant_SSE4.h │ └── Codec │ │ ├── BitstreamReader.c │ │ ├── BitstreamReader.h │ │ ├── CMakeLists.txt │ │ ├── DecHandle.c │ │ ├── DecHandle.h │ │ ├── DecThreadFinal.c │ │ ├── DecThreadFinal.h │ │ ├── DecThreadInit.c │ │ ├── DecThreadInit.h │ │ ├── DecThreadSlice.c │ │ ├── DecThreadSlice.h │ │ ├── DecThreads.c │ │ ├── DecThreads.h │ │ ├── Decoder.c │ │ ├── Decoder.h │ │ ├── Dequant.c │ │ ├── Dequant.h │ │ ├── DwtDecoder.c │ │ ├── DwtDecoder.h │ │ ├── Idwt.c │ │ ├── Idwt.h │ │ ├── Mct.c │ │ ├── Mct.h │ │ ├── NltDec.c │ │ ├── NltDec.h │ │ ├── Packing.c │ │ ├── Packing.h │ │ ├── ParseHeader.c │ │ ├── ParseHeader.h │ │ ├── Precinct.c │ │ ├── Precinct.h │ │ ├── decoder_dsp_rtcd.c │ │ └── decoder_dsp_rtcd.h │ ├── Encoder │ ├── ASM_AVX2 │ │ ├── CMakeLists.txt │ │ ├── Dwt_AVX2.c │ │ ├── Dwt_AVX2.h │ │ ├── NltEnc_avx2.c │ │ ├── NltEnc_avx2.h │ │ ├── Quant_avx2.c │ │ ├── Quant_avx2.h │ │ ├── RateControl_avx2.c │ │ ├── RateControl_avx2.h │ │ └── rate_control_helper_avx2.h │ ├── ASM_AVX512 │ │ ├── CMakeLists.txt │ │ ├── Enc_avx512.c │ │ ├── Enc_avx512.h │ │ ├── Pack_avx512.c │ │ ├── Pack_avx512.h │ │ ├── Quant_avx512.c │ │ └── Quant_avx512.h │ ├── ASM_SSE2 │ │ ├── ASM_SSE2.asm │ │ ├── CMakeLists.txt │ │ └── empty.c │ ├── ASM_SSE4_1 │ │ ├── CMakeLists.txt │ │ ├── Quant_sse4_1.c │ │ ├── Quant_sse4_1.h │ │ ├── group_coding_sse4_1.c │ │ └── group_coding_sse4_1.h │ └── Codec │ │ ├── BinarySearch.c │ │ ├── BinarySearch.h │ │ ├── BitstreamWriter.c │ │ ├── BitstreamWriter.h │ │ ├── CMakeLists.txt │ │ ├── Dwt.c │ │ ├── Dwt.h │ │ ├── DwtInput.c │ │ ├── DwtInput.h │ │ ├── DwtStageProcess.c │ │ ├── DwtStageProcess.h │ │ ├── EncHandle.c │ │ ├── EncHandle.h │ │ ├── Encoder.h │ │ ├── FinalStageProcess.c │ │ ├── FinalStageProcess.h │ │ ├── GcStageProcess.c │ │ ├── GcStageProcess.h │ │ ├── InitStageProcess.c │ │ ├── InitStageProcess.h │ │ ├── NltEnc.c │ │ ├── NltEnc.h │ │ ├── PackHeaders.c │ │ ├── PackHeaders.h │ │ ├── PackIn.c │ │ ├── PackIn.h │ │ ├── PackOut.c │ │ ├── PackOut.h │ │ ├── PackPrecinct.c │ │ ├── PackPrecinct.h │ │ ├── PackStageProcess.c │ │ ├── PackStageProcess.h │ │ ├── PiEnc.c │ │ ├── PiEnc.h │ │ ├── PictureControlSet.c │ │ ├── PictureControlSet.h │ │ ├── PreRcStageProcess.c │ │ ├── PreRcStageProcess.h │ │ ├── PrecinctEnc.c │ │ ├── PrecinctEnc.h │ │ ├── Quant.c │ │ ├── Quant.h │ │ ├── QuantStageProcess.c │ │ ├── QuantStageProcess.h │ │ ├── RateControl.c │ │ ├── RateControl.h │ │ ├── RateControlCacheType.h │ │ ├── WeightTable.c │ │ ├── WeightTable.h │ │ ├── encoder_dsp_rtcd.c │ │ └── encoder_dsp_rtcd.h │ └── pkg-config.pc.in ├── documentation ├── decoder │ ├── DecoderSnippets.md │ ├── OverallDecoderDesign.png │ ├── Picture_decomposition.png │ ├── Slice_Precinct_Packet.png │ ├── decoder-slice-sync.png │ └── svt-jpegxs-decoder-design.md └── encoder │ ├── EncoderSnippets.md │ ├── OverallEncoderDesign.png │ ├── Packet_inclusion.png │ ├── Picture_decomposition.png │ ├── Slice_Precinct_Packet.png │ ├── Slice_Thread.png │ └── svt-jpegxs-encoder-design.md ├── ffmpeg-plugin ├── 6.1 │ ├── 0001-Enable-JPEG-XS-codec-type.patch │ ├── 0002-Allow-JPEG-XS-to-be-stored-in-mp4-mkv-container.patch │ └── 0003-svt-jpegxs-encoder-and-decoder-support.patch ├── 7.0 │ ├── 0001-Enable-JPEG-XS-codec-type.patch │ ├── 0002-Allow-JPEG-XS-to-be-stored-in-mp4-mkv-container.patch │ └── 0003-svt-jpegxs-encoder-and-decoder-support.patch ├── 7.1 │ ├── 0001-Enable-JPEG-XS-codec-type.patch │ ├── 0002-Allow-JPEG-XS-to-be-stored-in-mp4-mkv-container.patch │ └── 0003-svt-jpegxs-encoder-and-decoder-support.patch ├── libsvtjpegxsdec.c ├── libsvtjpegxsenc.c └── readme.md ├── format-coding.sh ├── imtl-plugin ├── README.md ├── build.sh ├── include │ ├── log.h │ └── plugin_platform.h ├── kahawai.json ├── meson.build └── src │ ├── meson.build │ ├── st22_svt_jpeg_xs_plugin.c │ └── st22_svt_jpeg_xs_plugin.h ├── security.md ├── tests ├── FuzzyTests │ ├── decoder.c │ ├── encoder.c │ └── readme.md ├── UnitTests │ ├── CMakeLists.txt │ ├── CodeDeprecated.cc │ ├── CodeDeprecated.h │ ├── DecoderSimple.cc │ ├── DecoderSimple.h │ ├── SampleFramesData.cc │ ├── SampleFramesData.h │ ├── TestBitstreamReadWrite.cc │ ├── TestDecoder.cc │ ├── TestDequant.cc │ ├── TestDwtFrame.cc │ ├── TestDwtIdwt.cc │ ├── TestFormatConvert.cc │ ├── TestGcStageProcess.cc │ ├── TestIDWT53.cc │ ├── TestInvDwtFrame.cc │ ├── TestNlt.cc │ ├── TestPack.cc │ ├── TestPi.cc │ ├── TestQuant.cc │ ├── TestReateControl.cc │ ├── TestSample.cc │ ├── TestUnPack.cc │ ├── TestVariableLengthCoding.cc │ ├── UnitTest_AVX512 │ │ ├── CMakeLists.txt │ │ ├── CodeDeprecated-avx512.cc │ │ └── CodeDeprecated-avx512.h │ └── random.h └── scripts │ ├── CommonLib.sh │ ├── DecoderConformanceTest.sh │ ├── DecoderMultiFramesTest.sh │ ├── EncoderTest.sh │ ├── ParallelAllTests.sh │ ├── ParallelScript.sh │ ├── parrallelUT.sh │ └── validation.sh └── third_party ├── cpuinfo ├── CMakeLists.txt ├── LICENSE ├── deps │ └── clog │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── include │ │ └── clog.h │ │ └── src │ │ └── clog.c ├── include │ └── cpuinfo.h └── src │ ├── api.c │ ├── cpuinfo │ ├── common.h │ ├── internal-api.h │ ├── log.h │ └── utils.h │ ├── init.c │ └── x86 │ ├── api.h │ ├── cpuid.h │ ├── isa.c │ ├── linux │ └── init.c │ ├── mach │ └── x86_mach_init.c │ ├── vendor.c │ ├── windows │ └── init.c │ └── x86_init.c └── googletest-1.14.0 ├── .clang-format ├── .github ├── ISSUE_TEMPLATE │ ├── 00-bug_report.yml │ ├── 10-feature_request.yml │ └── config.yml └── workflows │ └── gtest-ci.yml ├── .gitignore ├── BUILD.bazel ├── CMakeLists.txt ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── LICENSE ├── README.md ├── WORKSPACE ├── ci ├── linux-presubmit.sh ├── macos-presubmit.sh └── windows-presubmit.bat ├── docs ├── _config.yml ├── _data │ └── navigation.yml ├── _layouts │ └── default.html ├── _sass │ └── main.scss ├── advanced.md ├── assets │ └── css │ │ └── style.scss ├── community_created_documentation.md ├── faq.md ├── gmock_cheat_sheet.md ├── gmock_cook_book.md ├── gmock_faq.md ├── gmock_for_dummies.md ├── index.md ├── pkgconfig.md ├── platforms.md ├── primer.md ├── quickstart-bazel.md ├── quickstart-cmake.md ├── reference │ ├── actions.md │ ├── assertions.md │ ├── matchers.md │ ├── mocking.md │ └── testing.md └── samples.md ├── googlemock ├── CMakeLists.txt ├── README.md ├── cmake │ ├── gmock.pc.in │ └── gmock_main.pc.in ├── docs │ └── README.md ├── include │ └── gmock │ │ ├── gmock-actions.h │ │ ├── gmock-cardinalities.h │ │ ├── gmock-function-mocker.h │ │ ├── gmock-matchers.h │ │ ├── gmock-more-actions.h │ │ ├── gmock-more-matchers.h │ │ ├── gmock-nice-strict.h │ │ ├── gmock-spec-builders.h │ │ ├── gmock.h │ │ └── internal │ │ ├── custom │ │ ├── README.md │ │ ├── gmock-generated-actions.h │ │ ├── gmock-matchers.h │ │ └── gmock-port.h │ │ ├── gmock-internal-utils.h │ │ ├── gmock-port.h │ │ └── gmock-pp.h ├── src │ ├── gmock-all.cc │ ├── gmock-cardinalities.cc │ ├── gmock-internal-utils.cc │ ├── gmock-matchers.cc │ ├── gmock-spec-builders.cc │ ├── gmock.cc │ └── gmock_main.cc └── test │ ├── BUILD.bazel │ ├── gmock-actions_test.cc │ ├── gmock-cardinalities_test.cc │ ├── gmock-function-mocker_test.cc │ ├── gmock-internal-utils_test.cc │ ├── gmock-matchers-arithmetic_test.cc │ ├── gmock-matchers-comparisons_test.cc │ ├── gmock-matchers-containers_test.cc │ ├── gmock-matchers-misc_test.cc │ ├── gmock-matchers_test.h │ ├── gmock-more-actions_test.cc │ ├── gmock-nice-strict_test.cc │ ├── gmock-port_test.cc │ ├── gmock-pp-string_test.cc │ ├── gmock-pp_test.cc │ ├── gmock-spec-builders_test.cc │ ├── gmock_all_test.cc │ ├── gmock_ex_test.cc │ ├── gmock_leak_test.py │ ├── gmock_leak_test_.cc │ ├── gmock_link2_test.cc │ ├── gmock_link_test.cc │ ├── gmock_link_test.h │ ├── gmock_output_test.py │ ├── gmock_output_test_.cc │ ├── gmock_output_test_golden.txt │ ├── gmock_stress_test.cc │ ├── gmock_test.cc │ └── gmock_test_utils.py ├── googletest ├── CMakeLists.txt ├── README.md ├── cmake │ ├── Config.cmake.in │ ├── gtest.pc.in │ ├── gtest_main.pc.in │ ├── internal_utils.cmake │ └── libgtest.la.in ├── docs │ └── README.md ├── include │ └── gtest │ │ ├── gtest-assertion-result.h │ │ ├── gtest-death-test.h │ │ ├── gtest-matchers.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── custom │ │ ├── README.md │ │ ├── gtest-port.h │ │ ├── gtest-printers.h │ │ └── gtest.h │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-param-util.h │ │ ├── gtest-port-arch.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ └── gtest-type-util.h ├── samples │ ├── prime_tables.h │ ├── sample1.cc │ ├── sample1.h │ ├── sample10_unittest.cc │ ├── sample1_unittest.cc │ ├── sample2.cc │ ├── sample2.h │ ├── sample2_unittest.cc │ ├── sample3-inl.h │ ├── sample3_unittest.cc │ ├── sample4.cc │ ├── sample4.h │ ├── sample4_unittest.cc │ ├── sample5_unittest.cc │ ├── sample6_unittest.cc │ ├── sample7_unittest.cc │ ├── sample8_unittest.cc │ └── sample9_unittest.cc ├── src │ ├── gtest-all.cc │ ├── gtest-assertion-result.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-matchers.cc │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc └── test │ ├── BUILD.bazel │ ├── googletest-break-on-failure-unittest.py │ ├── googletest-break-on-failure-unittest_.cc │ ├── googletest-catch-exceptions-test.py │ ├── googletest-catch-exceptions-test_.cc │ ├── googletest-color-test.py │ ├── googletest-color-test_.cc │ ├── googletest-death-test-test.cc │ ├── googletest-death-test_ex_test.cc │ ├── googletest-env-var-test.py │ ├── googletest-env-var-test_.cc │ ├── googletest-failfast-unittest.py │ ├── googletest-failfast-unittest_.cc │ ├── googletest-filepath-test.cc │ ├── googletest-filter-unittest.py │ ├── googletest-filter-unittest_.cc │ ├── googletest-global-environment-unittest.py │ ├── googletest-global-environment-unittest_.cc │ ├── googletest-json-outfiles-test.py │ ├── googletest-json-output-unittest.py │ ├── googletest-list-tests-unittest.py │ ├── googletest-list-tests-unittest_.cc │ ├── googletest-listener-test.cc │ ├── googletest-message-test.cc │ ├── googletest-options-test.cc │ ├── googletest-output-test-golden-lin.txt │ ├── googletest-output-test.py │ ├── googletest-output-test_.cc │ ├── googletest-param-test-invalid-name1-test.py │ ├── googletest-param-test-invalid-name1-test_.cc │ ├── googletest-param-test-invalid-name2-test.py │ ├── googletest-param-test-invalid-name2-test_.cc │ ├── googletest-param-test-test.cc │ ├── googletest-param-test-test.h │ ├── googletest-param-test2-test.cc │ ├── googletest-port-test.cc │ ├── googletest-printers-test.cc │ ├── googletest-setuptestsuite-test.py │ ├── googletest-setuptestsuite-test_.cc │ ├── googletest-shuffle-test.py │ ├── googletest-shuffle-test_.cc │ ├── googletest-test-part-test.cc │ ├── googletest-throw-on-failure-test.py │ ├── googletest-throw-on-failure-test_.cc │ ├── googletest-uninitialized-test.py │ ├── googletest-uninitialized-test_.cc │ ├── gtest-typed-test2_test.cc │ ├── gtest-typed-test_test.cc │ ├── gtest-typed-test_test.h │ ├── gtest-unittest-api_test.cc │ ├── gtest_all_test.cc │ ├── gtest_assert_by_exception_test.cc │ ├── gtest_dirs_test.cc │ ├── gtest_environment_test.cc │ ├── gtest_help_test.py │ ├── gtest_help_test_.cc │ ├── gtest_json_test_utils.py │ ├── gtest_list_output_unittest.py │ ├── gtest_list_output_unittest_.cc │ ├── gtest_main_unittest.cc │ ├── gtest_no_test_unittest.cc │ ├── gtest_pred_impl_unittest.cc │ ├── gtest_premature_exit_test.cc │ ├── gtest_prod_test.cc │ ├── gtest_repeat_test.cc │ ├── gtest_skip_check_output_test.py │ ├── gtest_skip_environment_check_output_test.py │ ├── gtest_skip_in_environment_setup_test.cc │ ├── gtest_skip_test.cc │ ├── gtest_sole_header_test.cc │ ├── gtest_stress_test.cc │ ├── gtest_test_macro_stack_footprint_test.cc │ ├── gtest_test_utils.py │ ├── gtest_testbridge_test.py │ ├── gtest_testbridge_test_.cc │ ├── gtest_throw_on_failure_ex_test.cc │ ├── gtest_unittest.cc │ ├── gtest_xml_outfile1_test_.cc │ ├── gtest_xml_outfile2_test_.cc │ ├── gtest_xml_outfiles_test.py │ ├── gtest_xml_output_unittest.py │ ├── gtest_xml_output_unittest_.cc │ ├── gtest_xml_test_utils.py │ ├── production.cc │ └── production.h └── googletest_deps.bzl /.github/config/.shellcheck: -------------------------------------------------------------------------------- 1 | # https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md#rc-files 2 | # ignore var is referenced but not assigned. 3 | # surrounding quotes made intentionally, 4 | # cd without pipe ignored on purpose 5 | disable=SC2154,SC2027,SC2164,SC1090 6 | -------------------------------------------------------------------------------- /.github/config/path_filters.yaml: -------------------------------------------------------------------------------- 1 | # This is used by the action https://github.com/dorny/paths-filter 2 | base_build: &base_build 3 | - 'Source/**' 4 | - 'tests/**' 5 | - 'third_party/**' 6 | - 'Build/**' 7 | - .github/workflows/base_build.yaml 8 | 9 | ffmpeg_plugin_build: &ffmpeg_plugin_build 10 | - 'ffmpeg-plugin/**' 11 | - '.github/scripts/build_ffmpeg_plugin*' 12 | - 'Source/API/**' 13 | -------------------------------------------------------------------------------- /.github/scripts/build_ffmpeg_plugin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # filepath: /home/labrat/lgrab/SVT-JPEG-XS/ffmpeg-plugin/build_ffmpeg_svtjpegxs.sh 4 | 5 | set -e 6 | 7 | # Usage: ./build_ffmpeg_svtjpegxs.sh 8 | JPEGXS_REPO=$(pwd) 9 | FFMPEG_VERSION=${1:-6.1} 10 | INSTALL_FMPEG=${2:-"n"} 11 | 12 | if [[ "$FFMPEG_VERSION" != "6.1" && "$FFMPEG_VERSION" != "7.0" ]]; then 13 | echo "Usage: $0 " 14 | echo "ffmpeg-version: 6.1|7.0 (required)" 15 | echo "install-ffmpeg: y|n (default: n)" 16 | echo "Example: $0 6.1 y" 17 | exit 1 18 | fi 19 | echo "=== 0. Create installation directory and export env variable ===" 20 | export INSTALL_DIR="$PWD/install-dir" 21 | mkdir -p "$INSTALL_DIR" 22 | 23 | echo "=== 1. Compile and install svt-jpegxs ===" 24 | cd "$JPEGXS_REPO/Build/linux" 25 | ./build.sh install --prefix "$INSTALL_DIR" 26 | 27 | echo "=== 2. Export installation location ===" 28 | export LD_LIBRARY_PATH="$INSTALL_DIR/lib:${LD_LIBRARY_PATH}" 29 | export PKG_CONFIG_PATH="$INSTALL_DIR/lib/pkgconfig:${PKG_CONFIG_PATH}" 30 | 31 | echo "=== 3. Download/Compile FFmpeg ===" 32 | cd "$PWD" 33 | git clone https://git.ffmpeg.org/ffmpeg.git "ffmpeg-${FFMPEG_VERSION}" 34 | cd "ffmpeg-${FFMPEG_VERSION}" 35 | git checkout "release/$FFMPEG_VERSION" 36 | 37 | echo "=== 4. Apply jpeg-xs plugin patches ===" 38 | git config --global user.email "runner@github.com" 39 | git config --global user.name "action-runner" 40 | cp "$JPEGXS_REPO/ffmpeg-plugin/libsvtjpegxs"* libavcodec/ 41 | git am --whitespace=fix "$JPEGXS_REPO/ffmpeg-plugin/$FFMPEG_VERSION/"*.patch 42 | 43 | echo "=== 5. Configure FFmpeg ===" 44 | ./configure --enable-libsvtjpegxs --prefix="$INSTALL_DIR" --enable-shared 45 | echo "=== 6. Build and install FFmpeg ===" 46 | make -j"$(nproc)" 47 | if [[ "$INSTALL_FMPEG" == "y" ]]; then 48 | make install 49 | else 50 | echo "=== 6.2 Skip FFmpeg installation ===" 51 | fi 52 | 53 | echo "=== Build complete! ===" 54 | echo "FFmpeg binary is in $INSTALL_DIR/bin/" 55 | -------------------------------------------------------------------------------- /.github/scripts/build_ffmpeg_plugin_msys.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | JPEGXS_REPO="${PWD}" 6 | FFMPEG_VERSION="${1:-6.1}" 7 | 8 | if [[ "$FFMPEG_VERSION" != "6.1" && "$FFMPEG_VERSION" != "7.0" ]]; then 9 | echo "Usage: $0 (default: 6.1)" 10 | exit 1 11 | fi 12 | pacman -S --noconfirm make mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-yasm mingw-w64-x86_64-diffutils mingw-w64-x86_64-winpthreads mingw-w64-x86_64-toolchain 13 | INSTALL_DIR="$PWD/install-dir" 14 | mkdir -p "$INSTALL_DIR" 15 | 16 | # 1. Compile and install svt-jpegxs 17 | cd "$JPEGXS_REPO" 18 | cmake -S . -B svtjpegxs-build -DBUILD_APPS=off -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" 19 | cmake --build svtjpegxs-build -j10 --config Release --target install 20 | 21 | # 2. Set PKG_CONFIG_PATH 22 | export LD_LIBRARY_PATH="$INSTALL_DIR/lib:${LD_LIBRARY_PATH}" 23 | export PKG_CONFIG_PATH="$INSTALL_DIR/lib/pkgconfig:${PKG_CONFIG_PATH}" 24 | 25 | # 3. Download/Compile FFmpeg 26 | cd "$PWD" 27 | git config --global user.email "runner@github.com" 28 | git config --global user.name "action-runner" 29 | 30 | git clone https://git.ffmpeg.org/ffmpeg.git "ffmpeg-$FFMPEG_VERSION" 31 | cd "ffmpeg-$FFMPEG_VERSION" 32 | git checkout "release/$FFMPEG_VERSION" 33 | 34 | # 4. Apply jpeg-xs plugin patches 35 | cp "$JPEGXS_REPO/ffmpeg-plugin/libsvtjpegxs"* libavcodec/ 36 | git am --whitespace=fix "$JPEGXS_REPO/ffmpeg-plugin/$FFMPEG_VERSION/"*.patch 37 | 38 | # 5. Configure FFmpeg 39 | ./configure --enable-libsvtjpegxs --prefix="$INSTALL_DIR" --enable-static --disable-shared 40 | 41 | # 6. Build FFmpeg 42 | make -j10 43 | 44 | echo "Build complete! FFmpeg binary is in $INSTALL_DIR/bin/" 45 | -------------------------------------------------------------------------------- /.github/workflows/coverity.yaml: -------------------------------------------------------------------------------- 1 | name: Coverity Build 2 | 3 | on: 4 | schedule: 5 | - cron: '0 18 * * *' 6 | workflow_dispatch: 7 | inputs: 8 | branch: 9 | description: 'Branch to run scans on' 10 | default: 'main' 11 | type: string 12 | env: 13 | DEBIAN_FRONTEND: noninteractive 14 | 15 | permissions: 16 | contents: read 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | coverity: 24 | runs-on: 'ubuntu-22.04' 25 | timeout-minutes: 90 26 | steps: 27 | - name: 'Harden Runner' 28 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 29 | with: 30 | egress-policy: audit 31 | 32 | - name: 'Checkout repository' 33 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 34 | with: 35 | ref: ${{ inputs.branch }} 36 | 37 | - name: 'Install dependencies' 38 | working-directory: Build/linux 39 | run: | 40 | sudo apt-get update 41 | sudo apt-get -y install nasm 42 | 43 | - name: 'Run coverity' 44 | uses: vapier/coverity-scan-action@2068473c7bdf8c2fb984a6a40ae76ee7facd7a85 # v1.8.0 45 | with: 46 | project: 'SVT-JPEG-XS' 47 | email: ${{ secrets.COVERITY_SCAN_EMAIL }} 48 | token: ${{ secrets.COVERITY_SCAN_TOKEN }} 49 | build_language: 'cxx' 50 | build_platform: 'linux64' 51 | working-directory: '${{ github.workspace }}/Build/linux' 52 | command: '${{ github.workspace }}/Build/linux/build.sh --release' 53 | 54 | - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 55 | with: 56 | name: coverity-reports 57 | path: '${{ github.workspace }}/cov-int' -------------------------------------------------------------------------------- /.github/workflows/linter.yaml: -------------------------------------------------------------------------------- 1 | name: Linter 2 | on: 3 | pull_request: 4 | workflow_call: 5 | workflow_dispatch: 6 | inputs: 7 | branch: 8 | description: Branch to run the scans on 9 | default: main 10 | type: string 11 | jobs: 12 | super-linter: 13 | name: super-linter 14 | runs-on: ubuntu-22.04 15 | timeout-minutes: 30 16 | permissions: 17 | contents: read 18 | steps: 19 | - name: Harden Runner 20 | uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 21 | with: 22 | egress-policy: audit 23 | - name: checkout repository 24 | uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 25 | with: 26 | fetch-depth: 0 27 | ref: '${{ env.INPUT_BRANCH }}' 28 | - name: Lint 29 | uses: super-linter/super-linter/slim@e1cb86b6e8d119f789513668b4b30bf17fe1efe4 30 | env: 31 | DISABLE_ERRORS: false 32 | GITHUB_TOKEN: '${{ secrets.TOKEN_GITHUB }}' 33 | BASH_SEVERITY: error 34 | VALIDATE_BASH: true 35 | LINTER_RULES_PATH: .github/config 36 | BASH_FILE_NAME: .shellcheck 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Bin/ 2 | Build/linux/ 3 | Build/windows/ 4 | Build/eclipse/ 5 | Build/coverage_linux 6 | *.yuv 7 | *.bin 8 | *.patch 9 | *.raw 10 | *.log 11 | -------------------------------------------------------------------------------- /Build/eclipse/build_eclipse.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright(c) 2024 Intel Corporation 4 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 5 | # 6 | 7 | cmake -G "Eclipse CDT4 - Ninja" ../../ -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON 8 | 9 | -------------------------------------------------------------------------------- /Source/App/Common/SemaphoreApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __APP_SEMAPHORE_H__ 7 | #define __APP_SEMAPHORE_H__ 8 | #include "SvtJpegxs.h" 9 | 10 | void* semaphore_create(uint32_t initial_count, uint32_t max_count); 11 | SvtJxsErrorType_t semaphore_destroy(void* semaphore_handle); 12 | 13 | SvtJxsErrorType_t semaphore_post(void* semaphore_handle); 14 | SvtJxsErrorType_t semaphore_block(void* semaphore_handle, int32_t timout_ms); 15 | 16 | void* app_create_thread(void* (*thread_function)(void*), void* thread_context); 17 | SvtJxsErrorType_t app_destroy_thread(void* thread_handle); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Source/App/DecApp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # APP Directory CMakeLists.txt 7 | 8 | # Include Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/App/Common/ 12 | ) 13 | 14 | file(GLOB all_files 15 | "../../API/*.h" 16 | "../Common/*.h" 17 | "../Common/*.c" 18 | "*.h" 19 | "*.c" 20 | ) 21 | 22 | # App Source Files 23 | add_executable(SvtJpegxsDecApp 24 | ${all_files}) 25 | 26 | #********** SET COMPILE FLAGS************ 27 | # Link the Decoder App 28 | target_link_libraries(SvtJpegxsDecApp 29 | SvtJpegxsLib) 30 | 31 | if(UNIX) 32 | target_link_libraries(SvtJpegxsDecApp 33 | pthread 34 | m) 35 | endif() 36 | 37 | install(TARGETS SvtJpegxsDecApp RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) 38 | -------------------------------------------------------------------------------- /Source/App/DecApp/DecParamParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | // Command line argument parsing 7 | 8 | #ifndef _DECODER_PARAMETERS_PARSE_H_ 9 | #define _DECODER_PARAMETERS_PARSE_H_ 10 | 11 | /*************************************** 12 | * Includes 13 | ***************************************/ 14 | #include 15 | #include 16 | #include 17 | #include "SvtJpegxsDec.h" 18 | #include "SvtJpegxsImageBufferTools.h" 19 | 20 | #define UNUSED(x) (void)(x) 21 | 22 | typedef struct DecoderConfig { 23 | char in_filename[1024]; 24 | char out_filename[1024]; 25 | 26 | FILE* in_file; 27 | FILE* out_file; 28 | 29 | int autodetect_bitstream_header; 30 | uint8_t* bitstream_buf_ref; 31 | size_t bitstream_buf_size; 32 | size_t bitstream_offset; 33 | 34 | uint32_t frames_count; 35 | uint32_t force_decode; 36 | uint32_t limit_fps; 37 | 38 | svt_jpeg_xs_decoder_api_t decoder; 39 | svt_jpeg_xs_image_config_t image_config; 40 | 41 | svt_jpeg_xs_frame_pool_t* frame_pool; 42 | } DecoderConfig_t; 43 | 44 | SvtJxsErrorType_t read_command_line(int32_t argc, char* const argv[], DecoderConfig_t* configs); 45 | extern uint32_t get_help(int32_t argc, char* const argv[]); 46 | void show_help(); 47 | 48 | #endif /*_DECODER_PARAMETERS_PARSE_H_*/ 49 | -------------------------------------------------------------------------------- /Source/App/EncApp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # APP Directory CMakeLists.txt 7 | 8 | # Include Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/App/Common/ 12 | ) 13 | 14 | file(GLOB all_files 15 | "../../API/*.h" 16 | "../Common/*.h" 17 | "../Common/*.c" 18 | "*.h" 19 | "*.c" 20 | ) 21 | 22 | # App Source Files 23 | add_executable(SvtJpegxsEncApp 24 | ${all_files}) 25 | 26 | #********** SET COMPILE FLAGS************ 27 | # Link the Encoder App 28 | target_link_libraries(SvtJpegxsEncApp 29 | SvtJpegxsLib) 30 | 31 | if(UNIX) 32 | target_link_libraries(SvtJpegxsEncApp 33 | pthread 34 | m) 35 | endif() 36 | 37 | 38 | install(TARGETS SvtJpegxsEncApp RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) 39 | -------------------------------------------------------------------------------- /Source/App/EncApp/EncAppConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _APP_ENCODER_CONFIG_H_ 7 | #define _APP_ENCODER_CONFIG_H_ 8 | 9 | #include 10 | #include "SvtJpegxsEnc.h" 11 | #include "SvtJpegxsImageBufferTools.h" 12 | 13 | #define MAX_NUM_TOKENS 210 14 | 15 | typedef struct EncoderConfig { 16 | /**************************************** 17 | * File I/O 18 | ****************************************/ 19 | char in_filename[1024]; 20 | char out_filename[1024]; 21 | 22 | FILE *in_file; 23 | FILE *out_file; 24 | 25 | uint8_t progress; // 0 = no progress output, 1 = normal, verbose progress 26 | uint32_t frames_count; 27 | uint32_t limit_fps; 28 | 29 | svt_jpeg_xs_encoder_api_t encoder; 30 | svt_jpeg_xs_image_config_t image_config; 31 | 32 | svt_jpeg_xs_frame_pool_t *frame_pool; 33 | } EncoderConfig_t; 34 | 35 | extern SvtJxsErrorType_t read_command_line(int32_t argc, char *const argv[], EncoderConfig_t *configs); 36 | SvtJxsErrorType_t verify_settings(EncoderConfig_t *config); 37 | extern uint32_t get_help(int32_t argc, char *const argv[]); 38 | extern uint32_t show_help(); 39 | #endif /*_APP_ENCODER_CONFIG_H_*/ 40 | -------------------------------------------------------------------------------- /Source/App/SampleDecoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # SampleDecoder Directory CMakeLists.txt 7 | 8 | # Include Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ) 12 | 13 | file(GLOB all_files 14 | "../../API/*.h" 15 | "main.c" 16 | ) 17 | 18 | # App Source Files 19 | add_executable(SvtJpegxsSampleDecoder 20 | ${all_files}) 21 | 22 | #Link only with required libraries to detect in linker time references between decoder_lib an encoder_lib 23 | set(lib_list_decoder 24 | $ 25 | $ 26 | $ 27 | $ 28 | $ 29 | $ 30 | $ 31 | cpuinfo_public 32 | ) 33 | 34 | #********** SET COMPILE FLAGS************ 35 | # Link the Decoder Sample App 36 | target_link_libraries(SvtJpegxsSampleDecoder 37 | ${lib_list_decoder}) 38 | 39 | if(UNIX) 40 | target_link_libraries(SvtJpegxsSampleDecoder 41 | pthread 42 | m) 43 | endif() 44 | 45 | add_dependencies(SvtJpegxsSampleDecoder 46 | COMMON_CODEC 47 | COMMON_ASM_SSE2 48 | COMMON_ASM_AVX2 49 | DECODER_CODEC 50 | DECODER_ASM_AVX512 51 | DECODER_ASM_AVX2 52 | DECODER_ASM_SSE4_1 53 | cpuinfo_public) 54 | 55 | install(TARGETS SvtJpegxsSampleDecoder RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) 56 | -------------------------------------------------------------------------------- /Source/App/SampleEncoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # SampleEncoder Directory CMakeLists.txt 7 | 8 | # Include Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ) 12 | 13 | file(GLOB all_files 14 | "../../API/*.h" 15 | "main.c" 16 | ) 17 | 18 | # App Source Files 19 | add_executable(SvtJpegxsSampleEncoder 20 | ${all_files}) 21 | 22 | #Link only with required libraries to detect in linker time references between decoder_lib an encoder_lib 23 | set(lib_list_encoder 24 | $ 25 | $ 26 | $ 27 | $ 28 | $ 29 | $ 30 | $ 31 | $ 32 | cpuinfo_public 33 | ) 34 | 35 | #********** SET COMPILE FLAGS************ 36 | # Link the Encoder Sample App 37 | target_link_libraries(SvtJpegxsSampleEncoder 38 | ${lib_list_encoder}) 39 | 40 | if(UNIX) 41 | target_link_libraries(SvtJpegxsSampleEncoder 42 | pthread 43 | m) 44 | endif() 45 | 46 | add_dependencies(SvtJpegxsSampleEncoder 47 | COMMON_CODEC 48 | COMMON_ASM_SSE2 49 | COMMON_ASM_AVX2 50 | ENCODER_CODEC 51 | ENCODER_ASM_SSE2 52 | ENCODER_ASM_SSE4_1 53 | ENCODER_ASM_AVX2 54 | ENCODER_ASM_AVX512 55 | cpuinfo_public) 56 | 57 | install(TARGETS SvtJpegxsSampleEncoder RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) 58 | -------------------------------------------------------------------------------- /Source/Lib/Common/ASM_AVX2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Common/ASM_AVX2 Directory CMakeLists.txt 7 | 8 | # Include Common Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE2/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2/ 14 | ) 15 | 16 | check_both_flags_add(-mavx2) 17 | 18 | if(MSVC) 19 | check_both_flags_add(/arch:AVX2) 20 | endif() 21 | 22 | file(GLOB all_files 23 | "*.h" 24 | "*.asm" 25 | "*.c") 26 | 27 | add_library(COMMON_ASM_AVX2 OBJECT ${all_files}) 28 | -------------------------------------------------------------------------------- /Source/Lib/Common/ASM_AVX2/empty.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Source/Lib/Common/ASM_SSE2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # ASM_SSE2 Directory CMakeLists.txt 7 | 8 | # Include Common Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE2/ 13 | ) 14 | 15 | check_both_flags_add(-msse2) 16 | 17 | file(GLOB all_files 18 | "*.h" 19 | "*.c") 20 | 21 | set(asm_files 22 | PictureOperators_SSE2.asm) 23 | 24 | add_library(COMMON_ASM_SSE2 OBJECT ${all_files}) 25 | 26 | asm_compile_to_target(COMMON_ASM_SSE2 ${asm_files}) 27 | -------------------------------------------------------------------------------- /Source/Lib/Common/ASM_SSE2/PictureOperators_SSE2.asm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright(c) 2024 Intel Corporation 3 | ; SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | ; 5 | 6 | %include "x64inc.asm" 7 | section .text 8 | 9 | ; ---------------------------------------------------------------------------------------- 10 | cglobal Log2_32_ASM 11 | ; If (r0 == 0) then bsr return undefined behavior. For 0 return 0 12 | or r0, 1 13 | bsr rax, r0 14 | ret 15 | -------------------------------------------------------------------------------- /Source/Lib/Common/ASM_SSE2/empty.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Common/Codec Directory CMakeLists.txt 7 | 8 | # Include Encoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE2/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2/ 14 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ 15 | ${PROJECT_SOURCE_DIR}/third_party/cpuinfo/include/ 16 | ) 17 | 18 | file(GLOB all_files 19 | "Threads/*.h" 20 | "Threads/*.c" 21 | "*.h" 22 | "*.c") 23 | 24 | add_library(COMMON_CODEC OBJECT ${all_files}) 25 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/Codestream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __CODE_STREAM_FORMAT_H__ 7 | #define __CODE_STREAM_FORMAT_H__ 8 | 9 | #define CODESTREAM_SOC (0xff10) /*Start of codestream -Mandatory*/ 10 | #define CODESTREAM_EOC (0xff11) /*End of codestream -Mandatory*/ 11 | #define CODESTREAM_PIH (0xff12) /*End of codestream -Mandatory*/ 12 | #define CODESTREAM_CDT (0xff13) /*Component table -Mandatory*/ 13 | #define CODESTREAM_WGT (0xff14) /*Weights table -Mandatory*/ 14 | #define CODESTREAM_COM (0xff15) /*Extension marker -Optional*/ 15 | #define CODESTREAM_NLT (0xff16) /*Nonlinearity marker -Optional*/ 16 | #define CODESTREAM_CWD (0xff17) /*Component-dependent wavelet decomposition marker -Optional*/ 17 | #define CODESTREAM_CTS (0xff18) /*Colour transformation specification marker -Mandatory if Cpih=3, ignore otherwise*/ 18 | #define CODESTREAM_CRG (0xff19) /*Component registration marker -Optional, mandatory if Cpih=3*/ 19 | #define CODESTREAM_SLH (0xff20) /*Slice header marker -Mandatory*/ 20 | #define CODESTREAM_CAP (0xff50) /*Capabilities Marker -Mandatory*/ 21 | 22 | #define CODESTREAM_SIZE_BYTES (2) 23 | #define PICTURE_HEADER_SIZE_BYTES (26) 24 | #define SLICE_HEADER_SIZE_BYTES (6) /*Bits: 16 + 16 + 16*/ 25 | #define PRECINCT_HEADER_SIZE_BYTES (5) /*Bits: 24 + 8 + 8*/ 26 | #define PACKET_HEADER_LONG_SIZE_BYTES (7) /*Bits: 1 + 20 + 20 + 15*/ 27 | #define PACKET_HEADER_SHORT_SIZE_BYTES (5) /*Bits: 1 + 15 + 13 + 11*/ 28 | 29 | #define BITSTREAM_BIT_POSITION_SIGN (15) 30 | #define BITSTREAM_MASK_SIGN ((uint16_t)1 << (BITSTREAM_BIT_POSITION_SIGN)) 31 | 32 | #define PRECINCT_MAX_BYTES_SIZE (1048575) /*Lprc MAX: 2^20 -1*/ 33 | 34 | #endif /*__CODE_STREAM_FORMAT_H__*/ 35 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/EncDec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _ENC_DEC_COMMON_CALCULATIONS_H_ 7 | #define _ENC_DEC_COMMON_CALCULATIONS_H_ 8 | #include "Pi.h" 9 | #include 10 | 11 | #define TRUNCATION_MAX (15) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | uint8_t compute_truncation(uint8_t gain, uint8_t priority, uint8_t quantization, uint8_t refinement); 18 | void precinct_compute_truncation_light(const pi_t *pi, precinct_t *precinct, uint8_t quantization, uint8_t refinement); 19 | uint8_t precinct_compute_truncation(const pi_t *pi, precinct_t *prec, uint8_t quantization, uint8_t refinement); 20 | const char *get_asm_level_name_str(CPU_FLAGS cpu_flags); 21 | const char *svt_jpeg_xs_get_format_name(ColourFormat_t format); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/SvtLog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2019 Intel Corporation 3 | * 4 | * This source code is subject to the terms of the BSD 2 Clause License and 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 | * was not distributed with this source code in the LICENSE file, you can 7 | * obtain it at https://www.aomedia.org/license/software-license. If the 8 | * Alliance for Open Media Patent License 1.0 was not distributed with this 9 | * source code in the PATENTS file, you can obtain it at 10 | * https://www.aomedia.org/license/patent-license. 11 | */ 12 | #include "SvtLog.h" 13 | // for getenv and fopen on windows 14 | #define _CRT_SECURE_NO_WARNINGS 15 | #include 16 | #include 17 | #include 18 | 19 | static SvtLogLevel g_log_level; 20 | static FILE *g_log_file; 21 | 22 | static void svt_log_set_level(SvtLogLevel level) { 23 | g_log_level = level; 24 | } 25 | 26 | static void svt_log_set_log_file(const char *file) { 27 | if (file) 28 | g_log_file = fopen(file, "w+"); 29 | } 30 | 31 | void svt_log_init() { 32 | const char *log = getenv("SVT_LOG"); 33 | SvtLogLevel level = SVT_LOG_INFO; 34 | if (log) 35 | level = (SvtLogLevel)atoi(log); 36 | svt_log_set_level(level); 37 | 38 | if (!g_log_file) { 39 | const char *file = getenv("SVT_LOG_FILE"); 40 | svt_log_set_log_file(file); 41 | } 42 | } 43 | 44 | static const char *log_level_str(SvtLogLevel level) { 45 | switch (level) { 46 | case SVT_LOG_FATAL: 47 | return "fatal"; 48 | case SVT_LOG_ERROR: 49 | return "error"; 50 | case SVT_LOG_WARN: 51 | return "warn"; 52 | case SVT_LOG_INFO: 53 | return "info"; 54 | case SVT_LOG_DEBUG: 55 | return "debug"; 56 | default: 57 | return "unknown"; 58 | } 59 | } 60 | 61 | void svt_log(SvtLogLevel level, const char *tag, const char *format, ...) { 62 | if (level > g_log_level) 63 | return; 64 | 65 | if (!g_log_file) 66 | g_log_file = stderr; 67 | 68 | if (tag) 69 | fprintf(g_log_file, "%s[%s]: ", tag, log_level_str(level)); 70 | 71 | va_list args; 72 | va_start(args, format); 73 | vfprintf(g_log_file, format, args); 74 | va_end(args); 75 | } 76 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/SvtType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _SVT_TYPE_H_ 7 | #define _SVT_TYPE_H_ 8 | #include 9 | #include 10 | #include 11 | 12 | // Quantization type 13 | // 14 | typedef enum _QUANT_TYPE_ { 15 | QUANT_TYPE_DEADZONE = 0, 16 | QUANT_TYPE_UNIFORM, 17 | QUANT_TYPE_MAX, 18 | } QUANT_TYPE; 19 | 20 | typedef enum CodingModeFlag { 21 | CODING_MODE_FLAG_VERTICAL_PRED = 1, 22 | CODING_MODE_FLAG_SIGNIFICANCE = 2, 23 | CODING_MODE_FLAG_INVALID = 0xFF 24 | } CodingModeFlag; 25 | 26 | #endif /*_SVT_TYPE_H_*/ 27 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/SvtUtility.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include 7 | 8 | #ifdef _WIN32 9 | #include 10 | #else 11 | #include 12 | #include 13 | #endif 14 | 15 | #include "SvtLog.h" 16 | #include "SvtUtility.h" 17 | 18 | /* assert a certain condition and report err if condition not met */ 19 | void assert_err(uint32_t condition, char* err_msg) { 20 | if (!condition) { 21 | SVT_ERROR("\n %s \n", err_msg); 22 | } 23 | assert(condition); 24 | } 25 | 26 | /***************************************** 27 | * Long Log 2 28 | * This is a quick adaptation of a Number 29 | * Leading Zeros (NLZ) algorithm to get 30 | * the log2f of a 64-bit number 31 | *****************************************/ 32 | uint64_t log2f_64_c(uint64_t x) { 33 | int64_t n = 64, c = 32; 34 | 35 | do { 36 | uint64_t y = x >> c; 37 | if (y > 0) { 38 | n -= c; 39 | x = y; 40 | } 41 | c >>= 1; 42 | } while (c > 0); 43 | 44 | return 64 - n; 45 | } 46 | 47 | /***************************************** 48 | * Long Log 2 49 | * This is a quick adaptation of a Number 50 | * Leading Zeros (NLZ) algorithm to get 51 | * the log2f of a 32-bit number 52 | *****************************************/ 53 | uint32_t log2_32_c(uint32_t x) { 54 | uint32_t log = 0; 55 | int32_t i; 56 | for (i = 4; i >= 0; --i) { 57 | const uint32_t shift = (1 << i); 58 | const uint32_t n = x >> shift; 59 | if (n != 0) { 60 | x = n; 61 | log += shift; 62 | } 63 | } 64 | return log; 65 | } 66 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/SvtUtility.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _SVT_UTILITY_H_ 7 | #define _SVT_UTILITY_H_ 8 | 9 | #include "Definitions.h" 10 | #include "common_dsp_rtcd.h" 11 | #ifdef _WIN32 12 | #include 13 | #endif 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | #include 18 | 19 | void assert_err(uint32_t condition, char* err_msg); 20 | ////************************************************** 21 | //// MACROS 22 | ////************************************************** 23 | #define MAX(x, y) ((x) > (y) ? (x) : (y)) 24 | #define MIN(x, y) ((x) < (y) ? (x) : (y)) 25 | 26 | #define DIV_ROUND_UP(val, round) (((val) + (round)-1) / (round)) 27 | #define DIV_ROUND_DOWN(val, round) ((val) / (round)) 28 | 29 | static INLINE void get_current_time(uint64_t* const seconds, uint64_t* const mseconds) { 30 | #ifdef _WIN32 31 | struct _timeb curr_time; 32 | _ftime_s(&curr_time); 33 | *seconds = (uint64_t)curr_time.time; 34 | *mseconds = (uint64_t)curr_time.millitm; 35 | #elif defined(CLOCK_MONOTONIC) && !defined(OLD_MACOS) 36 | struct timespec curr_time; 37 | clock_gettime(CLOCK_MONOTONIC, &curr_time); 38 | *seconds = (uint64_t)curr_time.tv_sec; 39 | *mseconds = (uint64_t)curr_time.tv_nsec / 1000000UL; 40 | #else 41 | struct timeval curr_time; 42 | gettimeofday(&curr_time, NULL); 43 | *seconds = (uint64_t)curr_time.tv_sec; 44 | *mseconds = (uint64_t)curr_time.tv_usec / 1000UL; 45 | #endif 46 | } 47 | 48 | static INLINE double compute_elapsed_time_in_ms(const uint64_t start_seconds, const uint64_t start_mseconds, 49 | const uint64_t finish_seconds, const uint64_t finish_mseconds) { 50 | const int64_t s_diff = (int64_t)finish_seconds - (int64_t)start_seconds, 51 | m_diff = (int64_t)finish_mseconds - (int64_t)start_mseconds; 52 | return (double)s_diff * 1000.0 + (double)m_diff; 53 | } 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /*_SVT_UTILITY_H_*/ 60 | -------------------------------------------------------------------------------- /Source/Lib/Common/Codec/common_dsp_rtcd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | // This file is generated. Do not edit. 7 | #ifndef COMMON_DSP_RTCD_H_ 8 | #define COMMON_DSP_RTCD_H_ 9 | 10 | #include "Definitions.h" 11 | 12 | #ifdef RTCD_C 13 | #define RTCD_EXTERN // CHKN RTCD call in effect. declare the function pointers in encHandle. 14 | #else 15 | #define RTCD_EXTERN extern // CHKN run time externing the function pointers. 16 | #endif 17 | 18 | /************************************** 19 | * Instruction Set Support 20 | **************************************/ 21 | 22 | #ifdef _WIN32 23 | #include 24 | #endif 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | // Helper Functions 31 | #ifdef ARCH_X86_64 32 | CPU_FLAGS get_cpu_flags(); 33 | #endif 34 | void setup_common_rtcd_internal(CPU_FLAGS flags); 35 | uint32_t log2_32_c(uint32_t x); 36 | RTCD_EXTERN uint32_t (*svt_log2_32)(uint32_t x); 37 | 38 | #ifdef ARCH_X86_64 39 | uint32_t Log2_32_ASM(uint32_t x); 40 | #endif 41 | 42 | #ifdef __cplusplus 43 | } // extern "C" 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Decoder/ASM_AVX2 Directory CMakeLists.txt 7 | 8 | # Include Decoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_SSE2/ 14 | ) 15 | 16 | check_both_flags_add(-mavx2) 17 | 18 | if(MSVC) 19 | check_both_flags_add(/arch:AVX2) 20 | endif() 21 | 22 | file(GLOB all_files 23 | "*.h" 24 | "*.asm" 25 | "*.c") 26 | 27 | 28 | add_library(DECODER_ASM_AVX2 OBJECT ${all_files}) 29 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX2/Dwt53Decoder_AVX2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DWT53DECODER_AVX2_H_ 7 | #define _DWT53DECODER_AVX2_H_ 8 | 9 | #include "DwtDecoder.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void idwt_horizontal_line_lf16_hf16_avx2(const int16_t* lf_ptr, const int16_t* hf_ptr, int32_t* out_ptr, uint32_t len, 16 | uint8_t shift); 17 | void idwt_horizontal_line_lf32_hf16_avx2(const int32_t* lf_ptr, const int16_t* hf_ptr, int32_t* out_ptr, uint32_t len, 18 | uint8_t shift); 19 | void idwt_vertical_line_avx2(const int32_t* in_lf, const int32_t* in_hf0, const int32_t* in_hf1, int32_t* out[4], uint32_t len, 20 | int32_t first_precinct, int32_t last_precinct, int32_t height); 21 | 22 | void idwt_vertical_line_recalc_avx2(const int32_t* in_lf, const int32_t* in_hf0, const int32_t* in_hf1, int32_t* out[4], 23 | uint32_t len, uint32_t precinct_line_idx); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /*_DWT53DECODER_AVX2_H_*/ 29 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX2/NltDec_AVX2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __DECODER_NLT_AVX2_H__ 7 | #define __DECODER_NLT_AVX2_H__ 8 | 9 | #include "SvtJpegxsDec.h" 10 | #include "Pi.h" 11 | #include 12 | #include "Codestream.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | void inv_sign_avx2(uint16_t* in_out, uint32_t width); 19 | void linear_output_scaling_8bit_avx2(const pi_t* const pi, int32_t* comps[MAX_COMPONENTS_NUM], uint32_t bw, uint32_t depth, 20 | svt_jpeg_xs_image_buffer_t* out); 21 | void linear_output_scaling_16bit_avx2(const pi_t* const pi, int32_t* comps[MAX_COMPONENTS_NUM], uint32_t bw, uint32_t depth, 22 | svt_jpeg_xs_image_buffer_t* out); 23 | 24 | void linear_output_scaling_8bit_line_avx2(int32_t* in, uint32_t bw, uint32_t depth, uint8_t* out, uint32_t w); 25 | void linear_output_scaling_16bit_line_avx2(int32_t* in, uint32_t bw, uint32_t depth, uint16_t* out, uint32_t w); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif //__DECODER_NLT_AVX2_H__ 32 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX2/UnPack_avx2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __UNPACK_AVX2_H__ 7 | #define __UNPACK_AVX2_H__ 8 | 9 | #include "SvtJpegxsDec.h" 10 | #include 11 | #include "Codestream.h" 12 | #include "BitstreamReader.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | SvtJxsErrorType_t unpack_data_avx2(bitstream_reader_t* bitstream, uint16_t* buf, uint32_t w, uint8_t* gclis, uint32_t group_size, 19 | uint8_t gtli, uint8_t sign_flag, uint8_t* leftover_signs_num, int32_t* precinct_bits_left); 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif //__UNPACK_AVX2_H__ 25 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX512/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Decoder/ASM_AVX512 Directory CMakeLists.txt 7 | 8 | # Include Decoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/Codec/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_SSE2/ 14 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_AVX2/ 15 | ) 16 | 17 | check_both_flags_add( 18 | -mavx512f 19 | -mavx512bw 20 | -mavx512dq 21 | -mavx512vl) 22 | 23 | if(MSVC) 24 | check_both_flags_add(/arch:AVX512) 25 | endif() 26 | 27 | file(GLOB all_files 28 | "*.h" 29 | "*.asm" 30 | "*.c") 31 | 32 | 33 | add_library(DECODER_ASM_AVX512 OBJECT ${all_files}) 34 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX512/Dequant_avx512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DEQUANT_AVX512_H 7 | #define _DEQUANT_AVX512_H 8 | 9 | #include 10 | #include 11 | #include "SvtType.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void dequant_avx512(uint16_t* buf, uint32_t buf_len, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE dq_type); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /*_DEQUANT_AVX512_H*/ 24 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX512/NltDec_avx512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __DECODER_NLT_AVX512_H__ 7 | #define __DECODER_NLT_AVX512_H__ 8 | 9 | #include "SvtJpegxsDec.h" 10 | #include "Pi.h" 11 | #include 12 | #include "Codestream.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | void linear_output_scaling_8bit_line_avx512(int32_t* in, uint32_t bw, uint32_t depth, uint8_t* out, uint32_t w); 19 | void linear_output_scaling_16bit_line_avx512(int32_t* in, uint32_t bw, uint32_t depth, uint16_t* out, uint32_t w); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif //__DECODER_NLT_AVX512_H__ 26 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_AVX512/idwt-avx512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _IDWT_AVX512_H_ 7 | #define _IDWT_AVX512_H_ 8 | 9 | #include "SvtJpegxsDec.h" 10 | #include "Pi.h" 11 | #include 12 | #include "Codestream.h" 13 | #include "DwtDecoder.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | void idwt_horizontal_line_lf16_hf16_avx512(const int16_t* lf_ptr, const int16_t* hf_ptr, int32_t* out_ptr, uint32_t len, 20 | uint8_t shift); 21 | void idwt_horizontal_line_lf32_hf16_avx512(const int32_t* lf_ptr, const int16_t* hf_ptr, int32_t* out_ptr, uint32_t len, 22 | uint8_t shift); 23 | 24 | void idwt_vertical_line_avx512(const int32_t* in_lf, const int32_t* in_hf0, const int32_t* in_hf1, int32_t* out[4], uint32_t len, 25 | int32_t first_precinct, int32_t last_precinct, int32_t height); 26 | 27 | void idwt_vertical_line_recalc_avx512(const int32_t* in_lf, const int32_t* in_hf0, const int32_t* in_hf1, int32_t* out[4], 28 | uint32_t len, uint32_t precinct_line_idx); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif /*_IDWT_AVX512_H_*/ 34 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_SSE4_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Decoder/ASM_SSE4_1 Directory CMakeLists.txt 7 | 8 | # Include Decoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 13 | ) 14 | 15 | check_both_flags_add(-msse4.1) 16 | 17 | file(GLOB all_files 18 | "*.h" 19 | "*.asm" 20 | "*.c") 21 | 22 | add_library(DECODER_ASM_SSE4_1 OBJECT ${all_files}) 23 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/ASM_SSE4_1/Dequant_SSE4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DEQUANT_SSE4_1_H 7 | #define _DEQUANT_SSE4_1_H 8 | 9 | #include 10 | #include 11 | #include "SvtType.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void dequant_sse4_1(uint16_t* buf, uint32_t buf_len, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE dq_type); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /*_DEQUANT_SSE4_1_H*/ 24 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # DECODER_CODEC Directory CMakeLists.txt 7 | 8 | # Include Decoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE2/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2/ 14 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/Codec/ 15 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_AVX512/ 16 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_AVX2/ 17 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_SSE4_1/ 18 | ) 19 | 20 | file(GLOB all_files 21 | "*.h" 22 | "*.c") 23 | 24 | add_library(DECODER_CODEC OBJECT ${all_files}) 25 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/DecThreadFinal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DECODER_THREAD_FINAL_H_ 7 | #define _DECODER_THREAD_FINAL_H_ 8 | 9 | #include "Threads/SystemResourceManager.h" 10 | #include "DecThreads.h" 11 | #include "SvtJpegxsDec.h" 12 | 13 | typedef struct { 14 | ObjectWrapper_t* wrapper_ptr_decoder_ctx; 15 | uint32_t slice_id; 16 | int32_t frame_error; 17 | } TaskFinalSync; 18 | 19 | void* thread_final_stage_kernel(void* input_ptr); 20 | 21 | /*Allocate queues and contexts for multithreading*/ 22 | SvtJxsErrorType_t final_sync_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr); 23 | void final_sync_destroyer(void_ptr p); 24 | 25 | #endif /*_DECODER_THREAD_FINAL_H_*/ 26 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/DecThreadInit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DECODER_THREAD_INIT_H_ 7 | #define _DECODER_THREAD_INIT_H_ 8 | 9 | #include "Definitions.h" 10 | #include "DecThreads.h" 11 | #include "DecHandle.h" 12 | 13 | typedef struct { 14 | svt_jpeg_xs_frame_t dec_input; 15 | SvtJxsErrorType_t flags; 16 | } TaskInputBitstream; 17 | 18 | void* thread_init_stage_kernel(void* input_ptr); 19 | 20 | /*Allocate queues and contexts for multithreading*/ 21 | SvtJxsErrorType_t input_bitstream_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr); 22 | void input_bitstream_destroyer(void_ptr p); 23 | 24 | SvtJxsErrorType_t internal_svt_jpeg_xs_decoder_send_packet(svt_jpeg_xs_decoder_api_prv_t* dec_api_prv, 25 | svt_jpeg_xs_frame_t* dec_input, uint32_t* bytes_used); 26 | 27 | #endif /*_DECODER_THREAD_INIT_H_*/ 28 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/DecThreadSlice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DECODER_THREAD_SLICE_H_ 7 | #define _DECODER_THREAD_SLICE_H_ 8 | 9 | #include "Threads/SystemResourceManager.h" 10 | #include "DecHandle.h" 11 | #include "DecThreads.h" 12 | 13 | typedef struct { 14 | const uint8_t* bitstream_buf; 15 | size_t bitstream_buf_size; 16 | 17 | ObjectWrapper_t* wrapper_ptr_decoder_ctx; 18 | svt_jpeg_xs_image_buffer_t image_buffer; 19 | uint32_t slice_id; 20 | SvtJxsErrorType_t frame_error; 21 | } TaskCalculateFrame; 22 | 23 | typedef struct UniversalThreadContext { 24 | int process_idx; 25 | svt_jpeg_xs_decoder_api_prv_t* dec_api_prv; 26 | Fifo_t* universal_consumer_fifo_ptr; 27 | Fifo_t* final_producer_fifo_ptr; 28 | 29 | svt_jpeg_xs_decoder_thread_context* dec_thread_context; 30 | } UniversalThreadContext; 31 | 32 | void* thread_universal_stage_kernel(void* input_ptr); 33 | 34 | /*Allocate queues and contexts for multithreading*/ 35 | SvtJxsErrorType_t universal_frame_task_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr); 36 | void universal_frame_task_creator_destroy(void_ptr p); 37 | SvtJxsErrorType_t universal_thread_context_ctor(ThreadContext_t* thread_context_ptr, svt_jpeg_xs_decoder_api_prv_t* dec_api_prv, 38 | int idx); 39 | 40 | #endif /*_DECODER_THREAD_SLICE_H_*/ 41 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/DecThreads.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include "DecThreads.h" 7 | #include "DecHandle.h" 8 | 9 | SvtJxsErrorType_t output_frame_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr) { 10 | UNUSED(object_init_data_ptr); 11 | TaskOutFrame* input_buffer; 12 | 13 | *object_dbl_ptr = NULL; 14 | SVT_CALLOC(input_buffer, 1, sizeof(TaskOutFrame)); 15 | *object_dbl_ptr = (void_ptr)input_buffer; 16 | 17 | return SvtJxsErrorNone; 18 | } 19 | 20 | void output_frame_destroyer(void_ptr p) { 21 | TaskOutFrame* obj = (TaskOutFrame*)p; 22 | SVT_FREE(obj); 23 | } 24 | 25 | SvtJxsErrorType_t pool_decoder_instance_create_ctor(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr) { 26 | svt_jpeg_xs_decoder_api_prv_t* dec_api_prv = (svt_jpeg_xs_decoder_api_prv_t*)object_init_data_ptr; 27 | svt_jpeg_xs_decoder_instance_t* ctx = svt_jpeg_xs_dec_instance_alloc(&dec_api_prv->dec_common); 28 | if (ctx == NULL) { 29 | return SvtJxsErrorDecoderInternal; 30 | } 31 | *object_dbl_ptr = ctx; 32 | return SvtJxsErrorNone; 33 | } 34 | 35 | void pool_decoder_instance_destroy_ctor(void_ptr p) { 36 | svt_jpeg_xs_decoder_instance_t* ctx = (svt_jpeg_xs_decoder_instance_t*)p; 37 | svt_jpeg_xs_dec_instance_free(ctx); 38 | } 39 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/DecThreads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DECODER_THREADS_H_ 7 | #define _DECODER_THREADS_H_ 8 | 9 | #include "Threads/SystemResourceManager.h" 10 | #include "SvtJpegxsDec.h" 11 | 12 | typedef struct { 13 | svt_jpeg_xs_frame_t dec_input; 14 | uint64_t frame_num; 15 | SvtJxsErrorType_t frame_error; 16 | void* user_prv_ctx; 17 | } TaskOutFrame; 18 | 19 | typedef struct ThreadContext { 20 | DctorCall dctor; 21 | void_ptr priv; 22 | } ThreadContext_t; 23 | 24 | /*Allocate queues and contexts for multithreading*/ 25 | SvtJxsErrorType_t output_frame_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr); 26 | void output_frame_destroyer(void_ptr p); 27 | SvtJxsErrorType_t pool_decoder_instance_create_ctor(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr); 28 | void pool_decoder_instance_destroy_ctor(void_ptr p); 29 | 30 | #endif /*_DECODER_THREADS_H_*/ 31 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Dequant.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include "Dequant.h" 7 | #include "Codestream.h" 8 | 9 | void inv_quant_deadzone(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli) { 10 | if (gtli == 0) { 11 | return; 12 | } 13 | for (uint32_t coeff_idx = 0; coeff_idx < size; coeff_idx++) { 14 | int8_t gcli = gclis[coeff_idx / group_size]; 15 | // Check whether a non-zero number of bit-planes is included in this code group and 16 | // whether the coefficient is non-zero 17 | if ((gcli > gtli) && (buf[coeff_idx] & ~BITSTREAM_MASK_SIGN)) { 18 | buf[coeff_idx] |= (1 << (gtli - 1)); 19 | } 20 | } 21 | } 22 | 23 | void inv_quant_uniform(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli) { 24 | if (gtli == 0) { 25 | return; 26 | } 27 | for (uint32_t coeff_idx = 0; coeff_idx < size; coeff_idx++) { 28 | int8_t gcli = gclis[coeff_idx / group_size]; 29 | // Check whether a non-zero number of bit-planes is included in this code group and 30 | // whether the coefficient is non-zero 31 | if ((gcli > gtli) && (buf[coeff_idx] & ~BITSTREAM_MASK_SIGN)) { 32 | uint16_t sign = buf[coeff_idx] & BITSTREAM_MASK_SIGN; 33 | uint16_t val = (buf[coeff_idx] & ~BITSTREAM_MASK_SIGN); 34 | uint8_t scale_value = gcli - gtli + 1; 35 | buf[coeff_idx] = 0; 36 | for (; val > 0; val >>= scale_value) { 37 | buf[coeff_idx] += val; 38 | } 39 | //insert sign 40 | buf[coeff_idx] |= sign; 41 | } 42 | } 43 | } 44 | 45 | void dequant_c(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE quant_type) { 46 | switch (quant_type) { 47 | case QUANT_TYPE_UNIFORM: 48 | inv_quant_uniform(buf, size, gclis, group_size, gtli); 49 | return; 50 | case QUANT_TYPE_DEADZONE: 51 | inv_quant_deadzone(buf, size, gclis, group_size, gtli); 52 | return; 53 | default: 54 | assert("unknown quantization"); 55 | } 56 | return; 57 | } 58 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Dequant.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DEQUANT_H 7 | #define _DEQUANT_H 8 | 9 | #include 10 | #include "SvtType.h" 11 | #include "Definitions.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void dequant_c(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE dq_type); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /*_DEQUANT_H*/ 24 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/DwtDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __DWT_DECODER_H__ 7 | #define __DWT_DECODER_H__ 8 | #include 9 | #include "Pi.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct transform_lines { 16 | //buffer_out indexing [line_start .. line_stop] 17 | uint32_t line_start; 18 | uint32_t line_stop; 19 | int32_t offset; 20 | int32_t* buffer_out[8]; 21 | } transform_lines_t; 22 | 23 | void new_transform_component_line(const pi_component_t* const component, int16_t* buffer_in[MAX_BANDS_PER_COMPONENT_NUM], 24 | int16_t* buffer_in_prev[MAX_BANDS_PER_COMPONENT_NUM], transform_lines_t* lines, 25 | uint32_t line_idx, int32_t* buffer_tmp, uint32_t precinct_num, uint8_t shift); 26 | 27 | void new_transform_component_line_recalc(const pi_component_t* const component, 28 | int16_t* buffer_in_prev_2[MAX_BANDS_PER_COMPONENT_NUM], 29 | int16_t* buffer_in_prev_1[MAX_BANDS_PER_COMPONENT_NUM], int32_t** buffer_out, 30 | uint32_t precinct_line_idx, int32_t* buffer_tmp, uint8_t shift); 31 | 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | #endif 35 | 36 | #endif /*__DWT_DECODER_H__*/ 37 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Idwt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __IDWT_H__ 7 | #define __IDWT_H__ 8 | 9 | #include 10 | #include "Pi.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | void idwt_horizontal_line_lf16_hf16_c(const int16_t* in_lf, const int16_t* in_hf, int32_t* out, uint32_t len, uint8_t shift); 17 | void idwt_horizontal_line_lf32_hf16_c(const int32_t* in_lf, const int16_t* in_hf, int32_t* out, uint32_t len, uint8_t shift); 18 | 19 | typedef void (*inv_transform_V0_ptr_t)(const pi_component_t* const component, int16_t* buff_in[MAX_BANDS_PER_COMPONENT_NUM], 20 | int32_t* buf_out, int32_t* buf_out_tmp, uint8_t shift); 21 | void inv_transform_V0_H1(const pi_component_t* const component, int16_t* buff_in[MAX_BANDS_PER_COMPONENT_NUM], int32_t* buf_out, 22 | int32_t* buf_out_tmp, uint8_t shift); 23 | void inv_transform_V0_H2(const pi_component_t* const component, int16_t* buff_in[MAX_BANDS_PER_COMPONENT_NUM], int32_t* buf_out, 24 | int32_t* buf_out_tmp, uint8_t shift); 25 | void inv_transform_V0_H3(const pi_component_t* const component, int16_t* buff_in[MAX_BANDS_PER_COMPONENT_NUM], int32_t* buf_out, 26 | int32_t* buf_out_tmp, uint8_t shift); 27 | void inv_transform_V0_H4(const pi_component_t* const component, int16_t* buff_in[MAX_BANDS_PER_COMPONENT_NUM], int32_t* buf_out, 28 | int32_t* buf_out_tmp, uint8_t shift); 29 | void inv_transform_V0_H5(const pi_component_t* const component, int16_t* buff_in[MAX_BANDS_PER_COMPONENT_NUM], int32_t* buf_out, 30 | int32_t* buf_out_tmp, uint8_t shift); 31 | 32 | void idwt_vertical_line_c(const int32_t* in_lf, const int32_t* in_hf0, const int32_t* in_hf1, int32_t* out[4], uint32_t len, 33 | int32_t first_precinct, int32_t last_precinct, int32_t height); 34 | 35 | void idwt_vertical_line_recalc_c(const int32_t* in_lf, const int32_t* in_hf0, const int32_t* in_hf1, int32_t* out[4], 36 | uint32_t len, uint32_t precinct_line_idx); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /*__IDWT_H__*/ 43 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Mct.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/Source/Lib/Decoder/Codec/Mct.c -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Mct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _MCT_H 7 | #define _MCT_H 8 | 9 | #include "Pi.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | int32_t get_cfa_pattern(const picture_header_dynamic_t* picture_header_dynamic); 15 | void mct_inverse_transform(int32_t* out_comps[MAX_COMPONENTS_NUM], const pi_t* pi, 16 | const picture_header_dynamic_t* picture_header_dynamic, uint8_t hdr_Cpih); 17 | 18 | void mct_inverse_transform_precinct(int32_t* out_comps[MAX_COMPONENTS_NUM], 19 | const picture_header_dynamic_t* picture_header_dynamic, int32_t w, int32_t h, 20 | uint8_t hdr_Cpih); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /*_MCT_H*/ 27 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/NltDec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _NLT_H 7 | #define _NLT_H 8 | 9 | #include "DecHandle.h" 10 | #include "SvtJpegxsDec.h" 11 | #include "decoder_dsp_rtcd.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void linear_output_scaling_8bit_c(const pi_t* const pi, int32_t* comps[MAX_COMPONENTS_NUM], uint32_t bw, uint32_t depth, 18 | svt_jpeg_xs_image_buffer_t* out); 19 | void linear_output_scaling_16bit_c(const pi_t* const pi, int32_t* comps[MAX_COMPONENTS_NUM], uint32_t bw, uint32_t depth, 20 | svt_jpeg_xs_image_buffer_t* out); 21 | void nlt_inverse_transform(int32_t* comps[MAX_COMPONENTS_NUM], const pi_t* pi, const picture_header_const_t* picture_header_const, 22 | const picture_header_dynamic_t* picture_header_dynamic, svt_jpeg_xs_image_buffer_t* out); 23 | 24 | void nlt_inverse_transform_line_8bit(int32_t* in, uint32_t depth, const picture_header_dynamic_t* picture_header_dynamic, 25 | uint8_t* out, int32_t w); 26 | void nlt_inverse_transform_line_16bit(int32_t* in, uint32_t depth, const picture_header_dynamic_t* picture_header_dynamic, 27 | uint16_t* out, int32_t w); 28 | void linear_output_scaling_8bit_line_c(int32_t* in, uint32_t bw, uint32_t depth, uint8_t* out, uint32_t w); 29 | void linear_output_scaling_16bit_line_c(int32_t* in, uint32_t bw, uint32_t depth, uint16_t* out, uint32_t w); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /*_NLT_H*/ 36 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/ParseHeader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __PARSE_CODESTREAM_HEADER_H_ 7 | #define __PARSE_CODESTREAM_HEADER_H_ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "DecHandle.h" 14 | #include "BitstreamReader.h" 15 | #include "SvtJpegxsDec.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | typedef struct packet_header { 21 | uint8_t raw_mode_flag; // 1 bit 22 | uint32_t data_len; // max 20 bits 23 | uint32_t gcli_len; // max 20 bits 24 | uint16_t sign_len; // max 15bits 25 | } packet_header_t; 26 | 27 | SvtJxsErrorType_t get_header(bitstream_reader_t* bitstream, picture_header_const_t* picture_header_const, 28 | picture_header_dynamic_t* picture_header_dynamic, uint32_t verbose); 29 | SvtJxsErrorType_t get_tail(bitstream_reader_t* bitstream); 30 | SvtJxsErrorType_t get_slice_header(bitstream_reader_t* bitstream, uint16_t* slice_idx); 31 | void get_packet_header(bitstream_reader_t* bitstream, int32_t use_long_header, packet_header_t* out_pkt); 32 | 33 | SvtJxsErrorType_t static_get_single_frame_size(const uint8_t* bitstream_buf, size_t bitstream_buf_size, 34 | svt_jpeg_xs_image_config_t* out_image_config, uint32_t* frame_size, 35 | uint32_t fast_search, proxy_mode_t proxy_mode); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* __PARSE_CODESTREAM_HEADER_H_ */ 41 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Precinct.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include "Precinct.h" 7 | #include "Codestream.h" 8 | 9 | void inv_sign_c(uint16_t* in_out, uint32_t width) { 10 | for (uint32_t i = 0; i < width; i++) { 11 | const uint16_t val = in_out[i]; 12 | in_out[i] = ((val & BITSTREAM_MASK_SIGN) ? -((val & ~BITSTREAM_MASK_SIGN)) : val); 13 | } 14 | } 15 | 16 | void inv_precinct_calculate_data(precinct_t* precinct, const pi_t* const pi, int dq_type) { 17 | for (uint32_t c = 0; c < pi->comps_num; c++) { 18 | for (uint32_t b = 0; b < pi->components[c].bands_num; b++) { 19 | precinct_band_t* b_data = &precinct->bands[c][b]; 20 | precinct_band_info_t* b_info = &precinct->p_info->b_info[c][b]; 21 | for (uint32_t height = 0; height < b_info->height; height++) { 22 | uint16_t* coeff_data = (b_data->coeff_data + height * pi->components[c].bands[b].width); 23 | uint8_t* gcli_data = b_data->gcli_data + height * b_info->gcli_width; 24 | dequant(coeff_data, b_info->width, gcli_data, pi->coeff_group_size, b_data->gtli, dq_type); 25 | inv_sign(coeff_data, b_info->width); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Source/Lib/Decoder/Codec/Precinct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _PRECINCT_H 7 | #define _PRECINCT_H 8 | 9 | #include "decoder_dsp_rtcd.h" 10 | #include "Pi.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | void inv_sign_c(uint16_t* in_out, uint32_t width); 17 | void inv_precinct_calculate_data(precinct_t* precinct, const pi_t* const pi, int dq_type); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* _PRECINCT_H */ 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Encoder/ASM_AVX2 Directory CMakeLists.txt 7 | 8 | # Include Encoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE2/ 14 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE4_1/ 15 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX2/ 16 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX512/ 17 | ) 18 | 19 | check_both_flags_add(-mavx2) 20 | 21 | if(MSVC) 22 | check_both_flags_add(/arch:AVX2) 23 | endif() 24 | 25 | file(GLOB all_files 26 | "*.h" 27 | "*.asm" 28 | "*.c") 29 | 30 | add_library(ENCODER_ASM_AVX2 OBJECT ${all_files}) 31 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX2/Dwt_AVX2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __ENCODER_DWT_AVX2_H__ 7 | #define __ENCODER_DWT_AVX2_H__ 8 | 9 | #include "Definitions.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void dwt_horizontal_line_avx2(int32_t* out_lf, int32_t* out_hf, const int32_t* in, uint32_t len); 16 | 17 | /*Optimization Vertical lines loops to AVX*/ 18 | void transform_vertical_loop_hf_line_0_avx2(uint32_t width, int32_t* out_hf, const int32_t* line_0, const int32_t* line_1); 19 | void transform_vertical_loop_lf_line_0_avx2(uint32_t width, int32_t* out_lf, const int32_t* in_hf, const int32_t* line_0); 20 | void transform_vertical_loop_lf_hf_line_0_avx2(uint32_t width, int32_t* out_lf, int32_t* out_hf, const int32_t* line_0, 21 | const int32_t* line_1, const int32_t* line_2); 22 | void transform_vertical_loop_lf_hf_line_x_prev_avx2(uint32_t width, int32_t* out_lf, int32_t* out_hf, const int32_t* line_p6, 23 | const int32_t* line_p5, const int32_t* line_p4, const int32_t* line_p3, 24 | const int32_t* line_p2); 25 | void transform_vertical_loop_lf_hf_hf_line_x_avx2(uint32_t width, int32_t* out_lf, int32_t* out_hf, const int32_t* in_hf_prev, 26 | const int32_t* line_0, const int32_t* line_1, const int32_t* line_2); 27 | void transform_vertical_loop_lf_hf_hf_line_last_even_avx2(uint32_t width, int32_t* out_lf, int32_t* out_hf, 28 | const int32_t* in_hf_prev, const int32_t* line_0, 29 | const int32_t* line_1); 30 | void transform_V1_Hx_precinct_recalc_HF_prev_avx2(uint32_t width, int32_t* out_tmp_line_HF_next, const int32_t* line_0, 31 | const int32_t* line_1, const int32_t* line_2); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /*__ENCODER_DWT_AVX2_H__*/ 38 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX2/NltEnc_avx2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __ENCODER_NLT_AVX2_H__ 7 | #define __ENCODER_NLT_AVX2_H__ 8 | 9 | #include "Definitions.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void image_shift_avx2(uint16_t* out_coeff_16bit, int32_t* in_coeff_32bit, uint32_t width, int32_t shift, int32_t offset); 16 | void linear_input_scaling_line_8bit_avx2(const uint8_t* src, int32_t* dst, uint32_t w, uint8_t shift, int32_t offset); 17 | void linear_input_scaling_line_16bit_avx2(const uint16_t* src, int32_t* dst, uint32_t w, uint8_t shift, int32_t offset, 18 | uint8_t bit_depth); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif /*__ENCODER_NLT_AVX2_H__*/ 25 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX2/Quant_avx2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef Quant_avx2_h 7 | #define Quant_avx2_h 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include 14 | #include "SvtType.h" 15 | #include "Definitions.h" 16 | #include "Codestream.h" 17 | 18 | void quantization_avx2(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE quant_type); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif // Quant_avx2_h 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX2/RateControl_avx2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __RATE_CONTROL_AVX2_H__ 7 | #define __RATE_CONTROL_AVX2_H__ 8 | 9 | #include "Definitions.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | uint32_t rate_control_calc_vpred_cost_nosigf_avx2(uint32_t gcli_width, uint8_t* gcli_data_top_ptr, uint8_t* gcli_data_ptr, 16 | uint8_t* vpred_bits_pack, uint8_t gtli, uint8_t gtli_max); 17 | 18 | void gc_precinct_stage_scalar_avx2(uint8_t* gcli_data_ptr, uint16_t* coeff_data_ptr_16bit, uint32_t group_size, uint32_t width); 19 | 20 | void convert_packed_to_planar_rgb_8bit_avx2(const void* in_rgb, void* out_comp1, void* out_comp2, void* out_comp3, 21 | uint32_t line_width); 22 | void convert_packed_to_planar_rgb_16bit_avx2(const void* in_rgb, void* out_comp1, void* out_comp2, void* out_comp3, 23 | uint32_t line_width); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /*__RATE_CONTROL_AVX2_H__*/ 30 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX2/rate_control_helper_avx2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include "Definitions.h" 7 | #include 8 | 9 | static INLINE __m256i vlc_encode_get_bits_avx2(__m256i x, __m256i r, __m256i t) { 10 | // assert(x < 32); 11 | // int32_t max = r - t; 12 | // if (max < 0) { 13 | // max = 0; 14 | // } 15 | __m256i max_avx2 = _mm256_subs_epu16(r, t); 16 | // int n = 0; 17 | // if (x > max) { 18 | const __m256i cmp = _mm256_cmpgt_epi16(x, max_avx2); 19 | // n = x + max; 20 | __m256i n1 = _mm256_add_epi16(x, max_avx2); 21 | // } 22 | // else { 23 | // x = x * 2; 24 | x = _mm256_slli_epi16(x, 1); 25 | // if (x < 0) { 26 | const __m256i cmp2 = _mm256_cmpgt_epi16(_mm256_setzero_si256(), x); 27 | // n = -x - 1; 28 | __m256i n2 = _mm256_sub_epi16(_mm256_abs_epi16(x), _mm256_set1_epi16(1)); 29 | // } 30 | // else { 31 | // n = x; 32 | // } 33 | __m256i n3 = _mm256_blendv_epi8(x, n2, cmp2); 34 | // } 35 | __m256i n = _mm256_blendv_epi8(n3, n1, cmp); 36 | return n; 37 | } 38 | 39 | static INLINE __m128i vlc_encode_get_bits_sse(__m128i x, __m128i r, __m128i t) { 40 | // assert(x < 32); 41 | // int32_t max = r - t; 42 | // if (max < 0) { 43 | // max = 0; 44 | // } 45 | __m128i max_avx2 = _mm_subs_epu16(r, t); 46 | // int n = 0; 47 | // if (x > max) { 48 | const __m128i cmp = _mm_cmpgt_epi16(x, max_avx2); 49 | // n = x + max; 50 | __m128i n1 = _mm_add_epi16(x, max_avx2); 51 | // } 52 | // else { 53 | // x = x * 2; 54 | x = _mm_slli_epi16(x, 1); 55 | // if (x < 0) { 56 | const __m128i cmp2 = _mm_cmpgt_epi16(_mm_setzero_si128(), x); 57 | // n = -x - 1; 58 | __m128i n2 = _mm_sub_epi16(_mm_abs_epi16(x), _mm_set1_epi16(1)); 59 | // } 60 | // else { 61 | // n = x; 62 | // } 63 | __m128i n3 = _mm_blendv_epi8(x, n2, cmp2); 64 | // } 65 | __m128i n = _mm_blendv_epi8(n3, n1, cmp); 66 | return n; 67 | } 68 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX512/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # Encoder/ASM_AVX512 Directory CMakeLists.txt 7 | 8 | # Include Encoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/API/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE2/ 14 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE4_1/ 15 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX2/ 16 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX512/ 17 | ) 18 | 19 | check_both_flags_add( 20 | -mavx512f 21 | -mavx512bw 22 | -mavx512cd 23 | -mavx512dq 24 | -mavx512vl) 25 | 26 | if(MSVC) 27 | check_both_flags_add(/arch:AVX512) 28 | endif() 29 | 30 | file(GLOB all_files 31 | "*.h" 32 | "*.asm" 33 | "*.c") 34 | 35 | add_library(ENCODER_ASM_AVX512 OBJECT ${all_files}) 36 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX512/Pack_avx512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __PACK_AVX512_H__ 7 | #define __PACK_AVX512_H__ 8 | #include "BitstreamWriter.h" 9 | #include "Codestream.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void pack_data_single_group_avx512(bitstream_writer_t *bitstream, uint16_t *buf, uint8_t gcli, uint8_t gtli); 16 | uint32_t rate_control_calc_vpred_cost_nosigf_avx512(uint32_t gcli_width, uint8_t *gcli_data_top_ptr, uint8_t *gcli_data_ptr, 17 | uint8_t *vpred_bits_pack, uint8_t gtli, uint8_t gtli_max); 18 | void rate_control_calc_vpred_cost_sigf_nosigf_avx512(uint32_t significance_width, uint32_t gcli_width, uint8_t hdr_Rm, 19 | uint32_t significance_group_size, uint8_t *gcli_data_top_ptr, 20 | uint8_t *gcli_data_ptr, uint8_t *vpred_bits_pack, 21 | uint8_t *vpred_significance, uint8_t gtli, uint8_t gtli_max, 22 | uint32_t *pack_size_gcli_sigf_reduction, uint32_t *pack_size_gcli_no_sigf); 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /*__PACK_AVX512_H__*/ 28 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_AVX512/Quant_avx512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef Quant_avx512_h 7 | #define Quant_avx512_h 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include 14 | #include "SvtType.h" 15 | #include "Definitions.h" 16 | #include "Codestream.h" 17 | 18 | void quantization_avx512(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE quant_type); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif // Quant_avx512_h 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_SSE2/ASM_SSE2.asm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Copyright(c) 2024 Intel Corporation 3 | ; SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | ; 5 | 6 | %include "x64inc.asm" 7 | section .text 8 | 9 | ; ---------------------------------------------------------------------------------------- 10 | cglobal gc_precinct_stage_scalar_loop_ASM 11 | .loop: 12 | mov r3w, [r1] ;coeff_data_ptr_16bit[0]; 13 | or r3w, [r1+2] ;coeff_data_ptr_16bit[1]; 14 | or r3w, [r1+4] ;coeff_data_ptr_16bit[2]; 15 | or r3w, [r1+6] ;coeff_data_ptr_16bit[3]; 16 | shl r3w,1 17 | or r3w,1 18 | bsr r4w, r3w 19 | mov [r2], r4b 20 | 21 | inc r2 22 | add r1, 8 ; GROUP_SIZE * sizeof(uint16_t) 23 | dec r0 24 | jnz .loop 25 | 26 | ret 27 | 28 | cglobal msb_x16_ASM 29 | mov [RSP-8], R8 30 | mov [RSP-16], R9 31 | mov [RSP-24], R10 32 | mov [RSP-32], R11 33 | 34 | bsr R8W, [r0] 35 | bsr R9W, [r0+2] 36 | bsr R10W, [r0+4] 37 | bsr R11W, [r0+6] 38 | mov [r1], R8B 39 | mov [r1+1], R9B 40 | mov [r1+2], R10B 41 | mov [r1+3], R11B 42 | add r1, 4 43 | add r0, 8 44 | 45 | bsr R8W, [r0] 46 | bsr R9W, [r0+2] 47 | bsr R10W, [r0+4] 48 | bsr R11W, [r0+6] 49 | mov [r1], R8B 50 | mov [r1+1], R9B 51 | mov [r1+2], R10B 52 | mov [r1+3], R11B 53 | add r1, 4 54 | add r0, 8 55 | 56 | bsr R8W, [r0] 57 | bsr R9W, [r0+2] 58 | bsr R10W, [r0+4] 59 | bsr R11W, [r0+6] 60 | mov [r1], R8B 61 | mov [r1+1], R9B 62 | mov [r1+2], R10B 63 | mov [r1+3], R11B 64 | add r1, 4 65 | add r0, 8 66 | 67 | bsr R8W, [r0] 68 | bsr R9W, [r0+2] 69 | bsr R10W, [r0+4] 70 | bsr R11W, [r0+6] 71 | mov [r1], R8B 72 | mov [r1+1], R9B 73 | mov [r1+2], R10B 74 | mov [r1+3], R11B 75 | 76 | mov R8, [RSP-8] 77 | mov R9, [RSP-16] 78 | mov R10, [RSP-24] 79 | mov R11, [RSP-32] 80 | ret 81 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_SSE2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # ASM_SSE2 Directory CMakeLists.txt 7 | 8 | # Include Encoder Subdirectories 9 | include_directories( 10 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_SSE2/ 11 | ) 12 | 13 | check_both_flags_add(-msse2) 14 | 15 | file(GLOB all_files 16 | "*.h" 17 | "*.c") 18 | 19 | set(asm_files 20 | ASM_SSE2.asm 21 | ) 22 | 23 | add_library(ENCODER_ASM_SSE2 OBJECT ${all_files}) 24 | 25 | asm_compile_to_target(ENCODER_ASM_SSE2 ${asm_files}) 26 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_SSE2/empty.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_SSE4_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # ASM_SSE4_1 Directory CMakeLists.txt 7 | include_directories( 8 | ${PROJECT_SOURCE_DIR}/Source/API/ 9 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 10 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ 11 | ) 12 | 13 | check_both_flags_add(-msse4.1) 14 | 15 | file(GLOB all_files 16 | "*.h" 17 | "*.c") 18 | 19 | add_library(ENCODER_ASM_SSE4_1 OBJECT ${all_files}) 20 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_SSE4_1/Quant_sse4_1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef Quant_sse4_1_h 7 | #define Quant_sse4_1_h 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include 14 | #include "SvtType.h" 15 | #include "Definitions.h" 16 | #include "Codestream.h" 17 | 18 | void quantization_sse4_1(uint16_t* buf, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli, QUANT_TYPE quant_type); 19 | void quant_uniform_sse4_1(uint16_t* buf, uint32_t size, uint8_t* gclis, uint8_t gtli); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif // Quant_sse4_1_h 25 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/ASM_SSE4_1/group_coding_sse4_1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef group_coding_sse4_1_h 7 | #define group_coding_sse4_1_h 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include 14 | #include "SvtType.h" 15 | #include "Definitions.h" 16 | #include "Codestream.h" 17 | 18 | void gc_precinct_sigflags_max_sse4_1(uint8_t* significance_data_max_ptr, uint8_t* gcli_data_ptr, uint32_t group_sign_size, 19 | uint32_t gcli_width); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif // group_coding_sse4_1_h 25 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | # ENCODER_CODEC Directory CMakeLists.txt 7 | 8 | include_directories( 9 | ${PROJECT_SOURCE_DIR}/Source/API/ 10 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ 11 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ 12 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE4_1/ 13 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX2/ 14 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX512/ 15 | ) 16 | 17 | file(GLOB all_files 18 | "*.h" 19 | "*.c") 20 | 21 | 22 | add_library(ENCODER_CODEC OBJECT ${all_files}) 23 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/DwtInput.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include 7 | 8 | #include "DwtInput.h" 9 | 10 | SvtJxsErrorType_t dwt_input_ctor(DwtInput *object_ptr, void_ptr object_init_data_ptr) { 11 | (void)object_ptr; 12 | (void)object_init_data_ptr; 13 | 14 | return SvtJxsErrorNone; 15 | } 16 | 17 | SvtJxsErrorType_t dwt_input_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr) { 18 | DwtInput *obj; 19 | 20 | *object_dbl_ptr = NULL; 21 | SVT_NEW(obj, dwt_input_ctor, object_init_data_ptr); 22 | *object_dbl_ptr = obj; 23 | 24 | return SvtJxsErrorNone; 25 | } 26 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/DwtInput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DWT_INPUT_H_ 7 | #define _DWT_INPUT_H_ 8 | 9 | #include "Definitions.h" 10 | #include "Threads/SvtObject.h" 11 | #include "Threads/SystemResourceManager.h" 12 | #include "PreRcStageProcess.h" 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | /************************************** 17 | * Process Results 18 | **************************************/ 19 | typedef struct DwtInput { 20 | DctorCall dctor; 21 | ObjectWrapper_t *pcs_wrapper_ptr; 22 | uint32_t component_id; 23 | uint64_t frame_num; 24 | PackInput_t *list_slices; /*List of slices to sync in profile: CPU.*/ 25 | } DwtInput; 26 | 27 | typedef struct DwtInputInitData { 28 | int32_t junk; 29 | } DwtInputInitData; 30 | 31 | /************************************** 32 | * Extern Function Declarations 33 | **************************************/ 34 | extern SvtJxsErrorType_t dwt_input_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /*_DWT_INPUT_H_*/ 40 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/DwtStageProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __DWT_STAGE_H__ 7 | #define __DWT_STAGE_H__ 8 | 9 | #include "Definitions.h" 10 | #include "EncHandle.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /*************************************** 17 | * Extern Function Declaration 18 | ***************************************/ 19 | SvtJxsErrorType_t dwt_stage_context_ctor(ThreadContext_t *thread_context_ptr, svt_jpeg_xs_encoder_api_prv_t *enc_api_prv, 20 | int idx); 21 | 22 | extern void *dwt_stage_kernel(void *input_ptr); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /*__DWT_STAGE_H__*/ 29 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/FinalStageProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _FINAL_STAGE_H_ 7 | #define _FINAL_STAGE_H_ 8 | 9 | #include "Definitions.h" 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct { 15 | svt_jpeg_xs_frame_t enc_input; 16 | uint64_t frame_number; 17 | int32_t frame_error; 18 | } EncoderOutputItem; 19 | 20 | /*************************************** 21 | * Extern Function Declaration 22 | ***************************************/ 23 | SvtJxsErrorType_t output_item_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr); 24 | void output_item_destroyer(void_ptr p); 25 | 26 | SvtJxsErrorType_t final_stage_context_ctor(ThreadContext_t *thread_context_ptr, svt_jpeg_xs_encoder_api_prv_t *enc_api_prv); 27 | 28 | extern void *final_stage_kernel(void *input_ptr); 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif /*_FINAL_STAGE_H_*/ 33 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/InitStageProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _INIT_STAGE_H_ 7 | #define _INIT_STAGE_H_ 8 | 9 | #include "Definitions.h" 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | typedef struct { 15 | uint64_t frame_number; 16 | svt_jpeg_xs_frame_t enc_input; 17 | } EncoderInputItem; 18 | 19 | /*************************************** 20 | * Extern Function Declaration 21 | ***************************************/ 22 | SvtJxsErrorType_t input_item_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr); 23 | void input_item_destroyer(void_ptr p); 24 | 25 | SvtJxsErrorType_t init_stage_context_ctor(ThreadContext_t *thread_contxt_ptr, svt_jpeg_xs_encoder_api_prv_t *enc_api_prv); 26 | 27 | extern void *init_stage_kernel(void *input_ptr); 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /*_INIT_STAGE_H_*/ 32 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/NltEnc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _NON_LINEAR_TRANSFORM_ENCODER_H_ 7 | #define _NON_LINEAR_TRANSFORM_ENCODER_H_ 8 | #include 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void image_shift_c(uint16_t* out_coeff_16bit, int32_t* in_coeff_32bit, uint32_t width, int32_t shift, int32_t offset); 16 | void nlt_input_scaling_line(const void* src, int32_t* dst, uint32_t width, picture_header_dynamic_t* hdr, 17 | uint8_t input_bit_depth); 18 | void linear_input_scaling_line_8bit_c(const uint8_t* src, int32_t* dst, uint32_t w, uint8_t shift, int32_t offset); 19 | void linear_input_scaling_line_16bit_c(const uint16_t* src, int32_t* dst, uint32_t w, uint8_t shift, int32_t offset, 20 | uint8_t bit_depth); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif /*_NON_LINEAR_TRANSFORM_ENCODER_H_*/ 27 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PackHeaders.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __PACK_HEADERS_ENCODER_H__ 7 | #define __PACK_HEADERS_ENCODER_H__ 8 | #include "BitstreamWriter.h" 9 | #include "Pi.h" 10 | #include "Encoder.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | struct SequenceControlSet; 17 | 18 | void write_header(bitstream_writer_t* bitstream, svt_jpeg_xs_encoder_common_t* enc_common); 19 | void write_capabilities_marker(bitstream_writer_t* bitstream, svt_jpeg_xs_encoder_common_t* enc_common); 20 | void write_picture_header(bitstream_writer_t* bitstream, pi_t* pi, svt_jpeg_xs_encoder_common_t* enc_common); 21 | void write_weight_table(bitstream_writer_t* bitstream, pi_t* pi); 22 | void write_component_table(bitstream_writer_t* bitstream, pi_t* pi, uint8_t bit_depth); 23 | void write_slice_header(bitstream_writer_t* bitstream, int slice_idx); 24 | uint32_t write_packet_header(bitstream_writer_t* bitstream, uint32_t long_hdr, uint8_t raw_coding, uint64_t data_size_bytes, 25 | uint64_t bitplane_count_size_bytes, uint64_t sign_size_bytes); 26 | void write_tail(bitstream_writer_t* bitstream); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif /*__PACK_HEADERS_ENCODER_H__*/ 33 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PackIn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include 7 | #include "PackIn.h" 8 | #include "Encoder.h" 9 | #include "Threads/SvtThreads.h" 10 | 11 | void pack_input_dctor(void_ptr p) { 12 | PackInput_t* object_ptr = (PackInput_t*)p; 13 | if (object_ptr->sync_dwt_semaphore) { 14 | SVT_DESTROY_SEMAPHORE(object_ptr->sync_dwt_semaphore); 15 | } 16 | } 17 | 18 | SvtJxsErrorType_t pack_input_ctor(PackInput_t* object_ptr, void_ptr object_init_data_ptr) { 19 | (void)object_ptr; 20 | (void)object_init_data_ptr; 21 | object_ptr->dctor = pack_input_dctor; 22 | svt_jpeg_xs_encoder_common_t* enc_common = object_init_data_ptr; 23 | if (enc_common->cpu_profile == CPU_PROFILE_CPU) { 24 | SVT_CREATE_SEMAPHORE(object_ptr->sync_dwt_semaphore, 0, 1); 25 | if (object_ptr->sync_dwt_semaphore == NULL) { 26 | return SvtJxsErrorInsufficientResources; 27 | } 28 | } 29 | else { 30 | object_ptr->sync_dwt_semaphore = NULL; 31 | } 32 | return SvtJxsErrorNone; 33 | } 34 | 35 | SvtJxsErrorType_t pack_input_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr) { 36 | PackInput_t* obj; 37 | 38 | *object_dbl_ptr = NULL; 39 | SVT_NEW(obj, pack_input_ctor, object_init_data_ptr); 40 | *object_dbl_ptr = obj; 41 | 42 | return SvtJxsErrorNone; 43 | } 44 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PackIn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef PackIn_h 7 | #define PackIn_h 8 | 9 | #include "Definitions.h" 10 | #include "Threads/SvtObject.h" 11 | #include "Threads/SystemResourceManager.h" 12 | #include "Pi.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /************************************** 19 | * slice pack process input 20 | **************************************/ 21 | typedef struct PackInput { 22 | DctorCall dctor; 23 | ObjectWrapper_t* pcs_wrapper_ptr; 24 | uint32_t slice_idx; 25 | uint32_t slice_budget_bytes; 26 | uint32_t out_bytes_begin; 27 | uint32_t out_bytes_end; 28 | uint32_t tail_bytes_begin; 29 | uint8_t write_tail; 30 | 31 | /*Sync between pack tasks. Required for some CPU Profiles.*/ 32 | volatile struct PackInput* sync_dwt_list_next; //One direction list to get next pack task in frame 33 | Handle_t sync_dwt_semaphore; 34 | volatile uint32_t sync_dwt_component_done_flag[MAX_COMPONENTS_NUM]; 35 | } PackInput_t; 36 | 37 | /************************************** 38 | * Extern Function Declarations 39 | **************************************/ 40 | extern SvtJxsErrorType_t pack_input_creator(void_ptr* object_dbl_ptr, void_ptr object_init_data_ptr); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif // PackIn_h 47 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PackOut.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include 7 | #include "PackOut.h" 8 | 9 | SvtJxsErrorType_t pack_output_ctor(PackOutput *object_ptr, void_ptr object_init_data_ptr) { 10 | UNUSED(object_ptr); 11 | UNUSED(object_init_data_ptr); 12 | return SvtJxsErrorNone; 13 | } 14 | 15 | SvtJxsErrorType_t pack_output_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr) { 16 | PackOutput *obj; 17 | 18 | *object_dbl_ptr = NULL; 19 | SVT_NEW(obj, pack_output_ctor, object_init_data_ptr); 20 | *object_dbl_ptr = obj; 21 | 22 | return SvtJxsErrorNone; 23 | } 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PackOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef PackOut_h 7 | #define PackOut_h 8 | 9 | #include "Definitions.h" 10 | #include "Threads/SvtObject.h" 11 | #include "Threads/SystemResourceManager.h" 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | /************************************** 16 | * slice pack process output 17 | **************************************/ 18 | typedef struct PackOutput { 19 | DctorCall dctor; 20 | ObjectWrapper_t *pcs_wrapper_ptr; 21 | uint32_t slice_idx; 22 | SvtJxsErrorType_t slice_error; 23 | } PackOutput; 24 | 25 | typedef struct PackOutputInitData { 26 | int32_t junk; 27 | } PackOutputInitData; 28 | 29 | /************************************** 30 | * Extern Function Declarations 31 | **************************************/ 32 | extern SvtJxsErrorType_t pack_output_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif // PackOut_h 38 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PackStageProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _PACK_STAGE_H_ 7 | #define _PACK_STAGE_H_ 8 | 9 | #include "Definitions.h" 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | /*************************************** 14 | * Extern Function Declaration 15 | ***************************************/ 16 | SvtJxsErrorType_t pack_stage_context_ctor(ThreadContext_t *thread_context_ptr, svt_jpeg_xs_encoder_api_prv_t *enc_api_prv, 17 | int idx); 18 | 19 | extern void *pack_stage_kernel(void *input_ptr); 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /*_PACK_STAGE_H_*/ 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PiEnc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _PICTURE_INFORMATION_ENCODER_H_ 7 | #define _PICTURE_INFORMATION_ENCODER_H_ 8 | #include "Pi.h" 9 | 10 | /* Information of Band */ 11 | typedef struct pi_enc_band { 12 | uint32_t coeff_buff_tmp_pos_offset_16bit; 13 | /*Encoder buffers for Group Coding*/ 14 | uint32_t gc_buff_tmp_pos_offset; 15 | uint32_t gc_buff_tmp_significance_pos_offset; 16 | /*Encoder buffers for Vertical Prediction*/ 17 | uint32_t vped_bit_pack_tmp_buff_offset; 18 | uint32_t vped_significance_tmp_buff_offset; 19 | } pi_enc_band_t; /* Indexing [0..bands_num]*/ 20 | 21 | /* Information of Component */ 22 | typedef struct pi_enc_comp { 23 | /* Information of Bands */ 24 | pi_enc_band_t bands[MAX_BANDS_PER_COMPONENT_NUM]; /* Indexing [0..bands_num]*/ 25 | } pi_enc_component_t; 26 | 27 | /*Picture Information*/ 28 | typedef struct pi_enc { 29 | uint32_t coeff_buff_tmp_size_precinct[MAX_COMPONENTS_NUM]; 30 | uint32_t gc_buff_tmp_size_precinct[MAX_COMPONENTS_NUM]; 31 | uint32_t gc_buff_tmp_significance_size_precinct[MAX_COMPONENTS_NUM]; 32 | uint32_t vped_bit_pack_size_precinct[MAX_COMPONENTS_NUM]; 33 | uint32_t vped_significance_size_precinct[MAX_COMPONENTS_NUM]; 34 | /* Information on Components */ 35 | pi_enc_component_t components[MAX_COMPONENTS_NUM]; 36 | 37 | /* Precalculate max values from weight tables */ 38 | uint8_t max_refinement; //Refinement can be less or equal to this value 39 | uint8_t max_quantization; //Quantization can be less or equal to this value 40 | } pi_enc_t; 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | int pi_compute_encoder(pi_t* pi, pi_enc_t* pi_enc, uint8_t significance_flag, uint8_t vpred_flag, uint8_t verbose); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /*_PICTURE_INFORMATION_ENCODER_H_*/ 53 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PictureControlSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _PICTURE_CONTROL_SET_H_ 7 | #define _PICTURE_CONTROL_SET_H_ 8 | 9 | #include "Definitions.h" 10 | #include "Encoder.h" 11 | #include "SvtJpegxsEnc.h" 12 | #include "Threads/SystemResourceManager.h" 13 | #include "SvtType.h" 14 | #include "SvtUtility.h" 15 | #include "GcStageProcess.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct PictureControlSet { 22 | /*!< Pointer to the dtor of the struct*/ 23 | DctorCall dctor; 24 | svt_jpeg_xs_encoder_common_t *enc_common; 25 | svt_jpeg_xs_frame_t enc_input; 26 | int32_t frame_error; 27 | uint64_t frame_number; 28 | 29 | /*Buffers to keep all data in frame*/ 30 | uint16_t *coeff_buff_ptr_16bit[MAX_COMPONENTS_NUM]; //Requires for Profile: CPU 31 | uint32_t slice_cnt; 32 | 33 | uint8_t *slice_ready_to_release_arr; 34 | uint32_t slice_released_idx; 35 | uint32_t bitstream_release_offset; 36 | } PictureControlSet; 37 | 38 | /************************************** 39 | * Extern Function Declarations 40 | **************************************/ 41 | extern SvtJxsErrorType_t picture_control_set_creator(void_ptr *object_dbl_ptr, void_ptr object_init_data_ptr); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /*_PICTURE_CONTROL_SET_H_*/ 47 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/PreRcStageProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _PRE_RC_STAGE_H_ 7 | #define _PRE_RC_STAGE_H_ 8 | 9 | #include "Definitions.h" 10 | #include "Encoder.h" 11 | #include "Threads/SystemResourceManager.h" 12 | #include "Threads/SvtThreads.h" 13 | #include "PictureControlSet.h" 14 | #include "BitstreamWriter.h" 15 | #include "PackIn.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | uint32_t write_pic_level_header_nbytes(uint8_t* buffer_ptr, size_t buffer_size, svt_jpeg_xs_encoder_common_t* enc_common); 22 | 23 | PackInput_t* pre_rc_send_frame_to_pack_slices(PictureControlSet* pcs_ptr, Fifo_t* output_buffer_fifo_ptr, uint64_t frame_num, 24 | ObjectWrapper_t* pcs_wrapper_ptr); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif /*_PRE_RC_STAGE_H_*/ 30 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/Quant.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef QuantInvQuant_h 7 | #define QuantInvQuant_h 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include 14 | #include "SvtType.h" 15 | #include "Definitions.h" 16 | 17 | void quantization_c(uint16_t* coeff_16bit, uint32_t size, uint8_t* gclis, uint32_t group_size, uint8_t gtli, 18 | QUANT_TYPE quant_type); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif // QuantInvQuant_h 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/QuantStageProcess.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include "PictureControlSet.h" 7 | #include "QuantStageProcess.h" 8 | #include "common_dsp_rtcd.h" 9 | #include "encoder_dsp_rtcd.h" 10 | #include "Quant.h" 11 | #include "PrecinctEnc.h" 12 | 13 | void precinct_quantization(PictureControlSet *pcs_ptr, pi_t *pi, precinct_enc_t *precinct) { 14 | svt_jpeg_xs_encoder_common_t *enc_common = pcs_ptr->enc_common; 15 | for (uint32_t c = 0; c < pi->comps_num; ++c) { 16 | for (uint32_t b = 0; b < pi->components[c].bands_num; ++b) { 17 | struct band_data_enc *band = &precinct->bands[c][b]; 18 | uint32_t height_lines = precinct->p_info->b_info[c][b].height; 19 | 20 | /*Not call Quanization when nothing will be quantized If gtli == 0, 21 | * because input and output is on that same buffer.*/ 22 | if (band->gtli) { 23 | for (uint32_t line = 0; line < height_lines; ++line) { 24 | quantization(band->lines_common[line].coeff_data_ptr_16bit, 25 | precinct->p_info->b_info[c][b].width, 26 | band->lines_common[line].gcli_data_ptr, 27 | pi->coeff_group_size, 28 | band->gtli, 29 | enc_common->picture_header_dynamic.hdr_Qpih); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/QuantStageProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _Q_STAGE_H_ 7 | #define _Q_STAGE_H_ 8 | #include "PrecinctEnc.h" 9 | #include "PictureControlSet.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | /*************************************** 15 | * Extern Function Declaration 16 | ***************************************/ 17 | 18 | void precinct_quantization(PictureControlSet *pcs_ptr, pi_t *pi, precinct_enc_t *precinct); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /*_Q_STAGE_H_*/ 24 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/RateControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __RATE_CONTROL_H__ 7 | #define __RATE_CONTROL_H__ 8 | #include "RateControlCacheType.h" 9 | #include "Pi.h" 10 | #include "PrecinctEnc.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | struct PictureControlSet; 17 | 18 | void rate_control_init_precinct(struct PictureControlSet *pcs_ptr, precinct_enc_t *precinct, 19 | SignHandlingStrategy coding_signs_handling); 20 | SvtJxsErrorType_t rate_control_precinct(struct PictureControlSet *pcs_ptr, precinct_enc_t *precinct, uint32_t budget_bytes, 21 | VerticalPredictionMode coding_vertical_prediction_mode, 22 | SignHandlingStrategy coding_signs_handling); 23 | SvtJxsErrorType_t rate_control_slice_quantization_fast_no_vpred_no_sign_full(struct PictureControlSet *pcs_ptr, 24 | precinct_enc_t *precincts, uint32_t prec_num, 25 | uint32_t budget_slice_bytes, 26 | SignHandlingStrategy coding_signs_handling); 27 | 28 | uint32_t rate_control_calc_vpred_cost_nosigf_c(uint32_t gcli_width, uint8_t *gcli_data_top_ptr, uint8_t *gcli_data_ptr, 29 | uint8_t *vpred_bits_pack, uint8_t gtli, uint8_t gtli_max); 30 | void rate_control_calc_vpred_cost_sigf_nosigf_c(uint32_t significance_width, uint32_t gcli_width, uint8_t hdr_Rm, 31 | uint32_t significance_group_size, uint8_t *gcli_data_top_ptr, 32 | uint8_t *gcli_data_ptr, uint8_t *vpred_bits_pack, uint8_t *vpred_significance, 33 | uint8_t gtli, uint8_t gtli_max, uint32_t *pack_size_gcli_sigf_reduction, 34 | uint32_t *pack_size_gcli_no_sigf); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /*__RATE_CONTROL_H__*/ 40 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/RateControlCacheType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef __RATE_CONTROL_CACHE_TYPE_H__ 7 | #define __RATE_CONTROL_CACHE_TYPE_H__ 8 | #include "Pi.h" 9 | #include "EncDec.h" 10 | 11 | #define SIGN_NOZERO_COEFF_LUT 0 /*Sign handling strategy, LUT slow down now*/ 12 | 13 | /* For small bands when gtli_width <=16 faster can work direct look to array for width <= 64 14 | * similar for significance_width <= 16 faster can work direct for width <= 256 */ 15 | #define LUT_SIGNIFICANE 1 16 | /*Special optimization to not go through the entire table every time when use LUT.*/ 17 | #define LUT_SIGNIFICANE_SERIAL_SUMMATION 1 18 | #define LUT_GC_SERIAL_SUMMATION 1 19 | 20 | typedef struct rc_cache_band_line { 21 | /* LookUpTable table summary all elements from line in band with that same value of Group Coding 22 | * [Band][Line][Truncation Value] - summarize exist value in line 23 | * [Band][Line][Truncation Value + 1] - maximum exist value 24 | * Optimize to uint16_t because max precinct width is (2^16-1)*/ 25 | uint16_t gc_lookup_table[TRUNCATION_MAX + 1]; 26 | #if LUT_GC_SERIAL_SUMMATION 27 | uint32_t gc_lookup_table_size_data_no_sign_handling[TRUNCATION_MAX + 1]; 28 | uint32_t gc_lookup_table_size_data_sign_handling[TRUNCATION_MAX + 1]; 29 | #endif 30 | #if LUT_SIGNIFICANE 31 | /*Get LUT table values without leftover from last group*/ 32 | uint16_t significance_max_lookup_table[TRUNCATION_MAX + 1]; 33 | #endif 34 | #if SIGN_NOZERO_COEFF_LUT 35 | /*LookUpTable: Sum of indexes: svt_log2_32((coeff_16bit[i] & ~BITSTREAM_MASK_SIGN)<<1) 36 | * Sum of zero on index 0*/ 37 | uint16_t coeff_lookup_table[TRUNCATION_MAX + 1]; 38 | #endif 39 | } rc_cache_band_line_t; 40 | 41 | #endif /*__RATE_CONTROL_CACHE_TYPE_H__*/ 42 | -------------------------------------------------------------------------------- /Source/Lib/Encoder/Codec/WeightTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _WEIGHT_TABLE_H_ 7 | #define _WEIGHT_TABLE_H_ 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | int weight_table_calculate(pi_t *pi, uint8_t verbose, ColourFormat_t color_format); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif /*_WEIGHT_TABLE_H_*/ 20 | -------------------------------------------------------------------------------- /Source/Lib/pkg-config.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@SVT_JPEGXS_INCLUDEDIR@ 4 | libdir=@SVT_JPEGXS_LIBDIR@ 5 | 6 | Name: SvtJpegxs 7 | Description: SVT (Scalable Video Technology) for JPEG XS library 8 | Version: @SVT_LIB_VERSION_MAJOR@.@SVT_LIB_VERSION_MINOR@.@SVT_LIB_VERSION_PATCH@ 9 | Libs: -L${libdir} -lSvtJpegxs 10 | Libs.private: @LIBS_PRIVATE@ 11 | Cflags: -I${includedir}/svt-jpegxs@DEC_PKG_CONFIG_EXTRA_CFLAGS@ 12 | Cflags.private: -UEB_DLL 13 | -------------------------------------------------------------------------------- /documentation/decoder/DecoderSnippets.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/decoder/DecoderSnippets.md -------------------------------------------------------------------------------- /documentation/decoder/OverallDecoderDesign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/decoder/OverallDecoderDesign.png -------------------------------------------------------------------------------- /documentation/decoder/Picture_decomposition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/decoder/Picture_decomposition.png -------------------------------------------------------------------------------- /documentation/decoder/Slice_Precinct_Packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/decoder/Slice_Precinct_Packet.png -------------------------------------------------------------------------------- /documentation/decoder/decoder-slice-sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/decoder/decoder-slice-sync.png -------------------------------------------------------------------------------- /documentation/encoder/EncoderSnippets.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/encoder/EncoderSnippets.md -------------------------------------------------------------------------------- /documentation/encoder/OverallEncoderDesign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/encoder/OverallEncoderDesign.png -------------------------------------------------------------------------------- /documentation/encoder/Packet_inclusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/encoder/Packet_inclusion.png -------------------------------------------------------------------------------- /documentation/encoder/Picture_decomposition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/encoder/Picture_decomposition.png -------------------------------------------------------------------------------- /documentation/encoder/Slice_Precinct_Packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/encoder/Slice_Precinct_Packet.png -------------------------------------------------------------------------------- /documentation/encoder/Slice_Thread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenVisualCloud/SVT-JPEG-XS/65ffc2fc5f1464cb39727ce543e1c752bcb599e4/documentation/encoder/Slice_Thread.png -------------------------------------------------------------------------------- /ffmpeg-plugin/6.1/0001-Enable-JPEG-XS-codec-type.patch: -------------------------------------------------------------------------------- 1 | From a87480ec208b481a7e1f8aa51ea6ed2e7c61e389 Mon Sep 17 00:00:00 2001 2 | From: Tomasz Szumski 3 | Date: Thu, 7 Mar 2024 08:11:23 +0100 4 | Subject: [PATCH 1/3] Enable JPEG XS codec type 5 | 6 | --- 7 | libavcodec/codec_desc.c | 9 +++++++++ 8 | libavcodec/codec_id.h | 1 + 9 | 2 files changed, 10 insertions(+) 10 | 11 | diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c 12 | index f556bb94d5..01ba4a11f2 100644 13 | --- a/libavcodec/codec_desc.c 14 | +++ b/libavcodec/codec_desc.c 15 | @@ -1960,6 +1960,15 @@ static const AVCodecDescriptor codec_descriptors[] = { 16 | .long_name = NULL_IF_CONFIG_SMALL("vMix Video"), 17 | .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, 18 | }, 19 | + { 20 | + .id = AV_CODEC_ID_JPEGXS, 21 | + .type = AVMEDIA_TYPE_VIDEO, 22 | + .name = "jpegxs", 23 | + .long_name = NULL_IF_CONFIG_SMALL("JPEG XS"), 24 | + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | 25 | + AV_CODEC_PROP_LOSSLESS, 26 | + .mime_types= MT("image/jxs"), 27 | + }, 28 | 29 | /* various PCM "codecs" */ 30 | { 31 | diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h 32 | index 29b410b8d3..4bb31c3d64 100644 33 | --- a/libavcodec/codec_id.h 34 | +++ b/libavcodec/codec_id.h 35 | @@ -324,6 +324,7 @@ enum AVCodecID { 36 | AV_CODEC_ID_EVC, 37 | AV_CODEC_ID_RTV1, 38 | AV_CODEC_ID_VMIX, 39 | + AV_CODEC_ID_JPEGXS, 40 | 41 | /* various PCM "codecs" */ 42 | AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /ffmpeg-plugin/7.0/0001-Enable-JPEG-XS-codec-type.patch: -------------------------------------------------------------------------------- 1 | From 3810837afc0e755e6742f14b4f7b6699e17c7f81 Mon Sep 17 00:00:00 2001 2 | From: Tomasz Szumski 3 | Date: Tue, 9 Jul 2024 10:04:16 +0200 4 | Subject: [PATCH 1/3] Enable JPEG XS codec type 5 | 6 | --- 7 | libavcodec/codec_desc.c | 9 +++++++++ 8 | libavcodec/codec_id.h | 1 + 9 | 2 files changed, 10 insertions(+) 10 | 11 | diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c 12 | index 3bab86db62..7cd0ea7224 100644 13 | --- a/libavcodec/codec_desc.c 14 | +++ b/libavcodec/codec_desc.c 15 | @@ -1958,6 +1958,15 @@ static const AVCodecDescriptor codec_descriptors[] = { 16 | .long_name = NULL_IF_CONFIG_SMALL("LEAD MCMP"), 17 | .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, 18 | }, 19 | + { 20 | + .id = AV_CODEC_ID_JPEGXS, 21 | + .type = AVMEDIA_TYPE_VIDEO, 22 | + .name = "jpegxs", 23 | + .long_name = NULL_IF_CONFIG_SMALL("JPEG XS"), 24 | + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | 25 | + AV_CODEC_PROP_LOSSLESS, 26 | + .mime_types= MT("image/jxs"), 27 | + }, 28 | 29 | /* various PCM "codecs" */ 30 | { 31 | diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h 32 | index c8dc21da74..97ed2bb2fb 100644 33 | --- a/libavcodec/codec_id.h 34 | +++ b/libavcodec/codec_id.h 35 | @@ -322,6 +322,7 @@ enum AVCodecID { 36 | AV_CODEC_ID_RTV1, 37 | AV_CODEC_ID_VMIX, 38 | AV_CODEC_ID_LEAD, 39 | + AV_CODEC_ID_JPEGXS, 40 | 41 | /* various PCM "codecs" */ 42 | AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /ffmpeg-plugin/7.1/0001-Enable-JPEG-XS-codec-type.patch: -------------------------------------------------------------------------------- 1 | From 3810837afc0e755e6742f14b4f7b6699e17c7f81 Mon Sep 17 00:00:00 2001 2 | From: Tomasz Szumski 3 | Date: Tue, 9 Jul 2024 10:04:16 +0200 4 | Subject: [PATCH 1/3] Enable JPEG XS codec type 5 | 6 | --- 7 | libavcodec/codec_desc.c | 9 +++++++++ 8 | libavcodec/codec_id.h | 1 + 9 | 2 files changed, 10 insertions(+) 10 | 11 | diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c 12 | index 3bab86db62..7cd0ea7224 100644 13 | --- a/libavcodec/codec_desc.c 14 | +++ b/libavcodec/codec_desc.c 15 | @@ -1958,6 +1958,15 @@ static const AVCodecDescriptor codec_descriptors[] = { 16 | .long_name = NULL_IF_CONFIG_SMALL("LEAD MCMP"), 17 | .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, 18 | }, 19 | + { 20 | + .id = AV_CODEC_ID_JPEGXS, 21 | + .type = AVMEDIA_TYPE_VIDEO, 22 | + .name = "jpegxs", 23 | + .long_name = NULL_IF_CONFIG_SMALL("JPEG XS"), 24 | + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | 25 | + AV_CODEC_PROP_LOSSLESS, 26 | + .mime_types= MT("image/jxs"), 27 | + }, 28 | 29 | /* various PCM "codecs" */ 30 | { 31 | diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h 32 | index c8dc21da74..97ed2bb2fb 100644 33 | --- a/libavcodec/codec_id.h 34 | +++ b/libavcodec/codec_id.h 35 | @@ -322,6 +322,7 @@ enum AVCodecID { 36 | AV_CODEC_ID_RTV1, 37 | AV_CODEC_ID_VMIX, 38 | AV_CODEC_ID_LEAD, 39 | + AV_CODEC_ID_JPEGXS, 40 | 41 | /* various PCM "codecs" */ 42 | AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs 43 | -- 44 | 2.34.1 45 | 46 | -------------------------------------------------------------------------------- /format-coding.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Sets the script directory to the current working directory 4 | cd "${0%/*}" 5 | #Set default bash configuration 6 | set -e 7 | 8 | find Source -regex '.*\.\(cc\|cpp\|hpp\|cu\|c\|h\)' -exec clang-format -i {} \; 9 | find tests -regex '.*\.\(cc\|cpp\|hpp\|cu\|c\|h\)' -exec clang-format -i {} \; 10 | -------------------------------------------------------------------------------- /imtl-plugin/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright(c) 2024 Intel Corporation 4 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 5 | # 6 | 7 | set -e 8 | 9 | function usage() 10 | { 11 | echo "Usage: $0 [debug]" 12 | exit 0 13 | } 14 | 15 | buildtype=release 16 | build_only=0 17 | 18 | if [ -n "$1" ]; then 19 | case $1 in 20 | "debug") 21 | buildtype=debug 22 | ;; 23 | "plain") 24 | buildtype=plain 25 | ;; 26 | "build-only") 27 | build_only=1 28 | ;; 29 | *) 30 | usage 31 | ;; 32 | esac 33 | fi 34 | 35 | WORKSPACE=$PWD 36 | PLUGINS_CPU_BUILD_DIR=${WORKSPACE}/build 37 | 38 | # build plugins 39 | meson "${PLUGINS_CPU_BUILD_DIR}" -Dbuildtype=$buildtype 40 | pushd "${PLUGINS_CPU_BUILD_DIR}" 41 | ninja 42 | if [ $build_only -eq 0 ]; then 43 | sudo ninja install 44 | fi 45 | popd 46 | -------------------------------------------------------------------------------- /imtl-plugin/include/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Intel Corporation. 3 | * 4 | * This software and the related documents are Intel copyrighted materials, 5 | * and your use of them is governed by the express license under which they 6 | * were provided to you ("License"). 7 | * Unless the License provides otherwise, you may not use, modify, copy, 8 | * publish, distribute, disclose or transmit this software or the related 9 | * documents without Intel's prior written permission. 10 | * 11 | * This software and the related documents are provided as is, with no 12 | * express or implied warranties, other than those that are expressly stated 13 | * in the License. 14 | * 15 | */ 16 | 17 | /* Header for log usage */ 18 | 19 | #ifndef _PL_LOG_HEAD_H_ 20 | #define _PL_LOG_HEAD_H_ 21 | 22 | #include 23 | 24 | /* log define */ 25 | #ifdef DEBUG 26 | #define dbg(...) \ 27 | do { \ 28 | printf(__VA_ARGS__); \ 29 | } while (0) 30 | #else 31 | #define dbg(...) \ 32 | do { \ 33 | } while (0) 34 | #endif 35 | #define info(...) \ 36 | do { \ 37 | printf(__VA_ARGS__); \ 38 | } while (0) 39 | #define warn(...) \ 40 | do { \ 41 | printf(__VA_ARGS__); \ 42 | } while (0) 43 | #define err(...) \ 44 | do { \ 45 | printf(__VA_ARGS__); \ 46 | } while (0) 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /imtl-plugin/include/plugin_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Intel Corporation. 3 | * 4 | * This software and the related documents are Intel copyrighted materials, 5 | * and your use of them is governed by the express license under which they 6 | * were provided to you ("License"). 7 | * Unless the License provides otherwise, you may not use, modify, copy, 8 | * publish, distribute, disclose or transmit this software or the related 9 | * documents without Intel's prior written permission. 10 | * 11 | * This software and the related documents are provided as is, with no 12 | * express or implied warranties, other than those that are expressly stated 13 | * in the License. 14 | * 15 | */ 16 | 17 | #ifndef _ST_PLUGIN_PLATFORM_HEAD_H_ 18 | #define _ST_PLUGIN_PLATFORM_HEAD_H_ 19 | 20 | static inline int st_pthread_mutex_init(pthread_mutex_t* mutex, 21 | pthread_mutexattr_t* attr) { 22 | return pthread_mutex_init(mutex, attr); 23 | } 24 | 25 | static inline int st_pthread_mutex_lock(pthread_mutex_t* mutex) { 26 | return pthread_mutex_lock(mutex); 27 | } 28 | 29 | static inline int st_pthread_mutex_unlock(pthread_mutex_t* mutex) { 30 | return pthread_mutex_unlock(mutex); 31 | } 32 | 33 | static inline int st_pthread_mutex_destroy(pthread_mutex_t* mutex) { 34 | return pthread_mutex_destroy(mutex); 35 | } 36 | 37 | static inline int st_pthread_cond_init(pthread_cond_t* cond, 38 | pthread_condattr_t* cond_attr) { 39 | return pthread_cond_init(cond, cond_attr); 40 | } 41 | 42 | static inline int st_pthread_cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex) { 43 | return pthread_cond_wait(cond, mutex); 44 | } 45 | 46 | static inline int st_pthread_cond_destroy(pthread_cond_t* cond) { 47 | return pthread_cond_destroy(cond); 48 | } 49 | 50 | static inline int st_pthread_cond_signal(pthread_cond_t* cond) { 51 | return pthread_cond_signal(cond); 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /imtl-plugin/kahawai.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | { 4 | "enabled": 0, 5 | "name": "intopix_jpegxs_cpu", 6 | "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_intopix_cpu.so" 7 | }, 8 | { 9 | "enabled": 0, 10 | "name": "st22_ffmpeg", 11 | "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_st22_ffmpeg.so" 12 | }, 13 | { 14 | "enabled": 0, 15 | "name": "st22_ffmpeg", 16 | "path": "/usr/local/lib64/libst_plugin_st22_ffmpeg.so" 17 | }, 18 | { 19 | "enabled": 0, 20 | "name": "st22_sample", 21 | "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_st22_sample.so" 22 | }, 23 | { 24 | "enabled": 0, 25 | "name": "st22_sample", 26 | "path": "/usr/local/lib64/libst_plugin_st22_sample.so" 27 | }, 28 | { 29 | "enabled": 0, 30 | "name": "convert_sample", 31 | "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_convert_sample.so" 32 | }, 33 | { 34 | "enabled": 0, 35 | "name": "convert_sample", 36 | "path": "/usr/local/lib64/libst_plugin_convert_sample.so" 37 | }, 38 | { 39 | "enabled": 1, 40 | "name": "st22_svt_jpeg_xs", 41 | "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_st22_svt_jpeg_xs.so" 42 | }, 43 | { 44 | "enabled": 1, 45 | "name": "st22_svt_jpeg_xs", 46 | "path": "/usr/local/lib64/libst_plugin_st22_svt_jpeg_xs.so" 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /imtl-plugin/meson.build: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | project('svt-jpeg-xs plugin for intel media transport libraray', 'c', default_options: ['c_std=gnu11', 'buildtype=release'], version: '0.1',) 7 | 8 | # allow experimental api 9 | add_global_arguments('-DALLOW_EXPERIMENTAL_API', language : 'c') 10 | 11 | cc = meson.get_compiler('c') 12 | 13 | mtl_dep = dependency('mtl', required : true) 14 | libpthread_dep = cc.find_library('pthread', required : true) 15 | jpegxs_dep = dependency('SvtJpegxs', required : true) 16 | 17 | # add include directory 18 | plugins_include_dir = [ include_directories('include'), ] 19 | 20 | # add source file 21 | subdir('src') 22 | 23 | plugins_c_args = [] 24 | #enable warning as error 25 | plugins_c_args += ['-Werror'] 26 | plugins_c_args += ['-Wall'] 27 | #simd build option, enable sse4.2 default, todo: do we need AVX2/AVX512 for app ? 28 | plugins_c_args += ['-msse4.2'] 29 | 30 | plugins_ld_args = [] 31 | 32 | # build st22 svt jpeg xs plugin lib 33 | shared_library('st_plugin_st22_svt_jpeg_xs', st22_svt_jpeg_xs_plugin_sources, 34 | c_args : plugins_c_args, 35 | link_args : plugins_ld_args, 36 | include_directories : plugins_include_dir, 37 | dependencies: [mtl_dep, libpthread_dep, jpegxs_dep], 38 | install: true 39 | ) 40 | -------------------------------------------------------------------------------- /imtl-plugin/src/meson.build: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | st22_svt_jpeg_xs_plugin_sources = files('st22_svt_jpeg_xs_plugin.c') 7 | -------------------------------------------------------------------------------- /imtl-plugin/src/st22_svt_jpeg_xs_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _ST22_SVT_JPEG_XS_HEAD_H_ 7 | #define _ST22_SVT_JPEG_XS_HEAD_H_ 8 | 9 | 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #define MAX_ST22_ENCODER_SESSIONS (8) 17 | #define MAX_ST22_DECODER_SESSIONS (8) 18 | 19 | struct st22_encoder_session { 20 | int idx; 21 | 22 | struct st22_encoder_create_req req; 23 | st22p_encode_session session_p; 24 | 25 | volatile bool stop_send; 26 | pthread_t encode_thread_send; 27 | pthread_cond_t wake_cond_send; 28 | pthread_mutex_t wake_mutex_send; 29 | 30 | volatile bool stop_get; 31 | pthread_t encode_thread_get; 32 | pthread_cond_t wake_cond_get; 33 | pthread_mutex_t wake_mutex_get; 34 | 35 | int frame_cnt; 36 | int frame_idx; 37 | 38 | svt_jpeg_xs_encoder_api_t* codec_ctx; 39 | }; 40 | 41 | struct st22_decoder_session { 42 | int idx; 43 | 44 | struct st22_decoder_create_req req; 45 | st22p_decode_session session_p; 46 | 47 | volatile bool stop_send; 48 | pthread_t decode_thread_send; 49 | pthread_cond_t wake_cond_send; 50 | pthread_mutex_t wake_mutex_send; 51 | 52 | volatile bool stop_get; 53 | pthread_t decode_thread_get; 54 | pthread_cond_t wake_cond_get; 55 | pthread_mutex_t wake_mutex_get; 56 | 57 | int frame_cnt; 58 | int frame_idx; 59 | 60 | svt_jpeg_xs_decoder_api_t* codec_ctx; 61 | svt_jpeg_xs_image_config_t image_config; 62 | }; 63 | 64 | struct st22_svt_jpeg_xs_ctx { 65 | st22_encoder_dev_handle encoder_dev_handle; 66 | st22_decoder_dev_handle decoder_dev_handle; 67 | struct st22_encoder_session* encoder_sessions[MAX_ST22_ENCODER_SESSIONS]; 68 | struct st22_decoder_session* decoder_sessions[MAX_ST22_DECODER_SESSIONS]; 69 | }; 70 | 71 | /* the APIs for plugin */ 72 | int st_plugin_get_meta(struct st_plugin_meta* meta); 73 | st_plugin_priv st_plugin_create(mtl_handle st); 74 | int st_plugin_free(st_plugin_priv handle); 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /security.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. 3 | 4 | ## Reporting a Vulnerability 5 | Please report any security vulnerabilities in this project [utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). -------------------------------------------------------------------------------- /tests/UnitTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | cmake_minimum_required(VERSION 3.10) 7 | 8 | add_subdirectory(UnitTest_AVX512) 9 | 10 | include_directories( 11 | ${gtest_SOURCE_DIR}/include 12 | ${gtest_SOURCE_DIR} 13 | ${PROJECT_SOURCE_DIR}/tests/UnitTests 14 | ${PROJECT_SOURCE_DIR}/tests/UnitTests/UnitTest_AVX512 15 | ${PROJECT_SOURCE_DIR}/Source/API 16 | ${PROJECT_SOURCE_DIR}/Source/App/EncApp 17 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec 18 | ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2 19 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec 20 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_SSE4_1 21 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX2 22 | ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/ASM_AVX512 23 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/Codec/ 24 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_AVX512/ 25 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_AVX2/ 26 | ${PROJECT_SOURCE_DIR}/Source/Lib/Decoder/ASM_SSE4_1/ 27 | ) 28 | 29 | #ALL LIBS 30 | set(lib_list_all 31 | $ 32 | $ 33 | $ 34 | $ 35 | $ 36 | $ 37 | $ 38 | $ 39 | $ 40 | $ 41 | $ 42 | $ 43 | $ 44 | cpuinfo_public 45 | ) 46 | 47 | #UT TESTS SOURCES 48 | file(GLOB all_files 49 | "*.h" 50 | "*.cc" 51 | "*.cpp") 52 | 53 | check_both_flags_add(-mavx2) 54 | 55 | if(MSVC) 56 | check_both_flags_add(/arch:AVX2) 57 | endif() 58 | 59 | #UT MAIN 60 | add_executable(SvtJpegxsUnitTests ${all_files}) 61 | 62 | target_link_libraries(SvtJpegxsUnitTests PUBLIC 63 | ${lib_list_all} 64 | gtest 65 | gtest_main) 66 | 67 | add_dependencies(SvtJpegxsUnitTests SvtJpegxsLib SvtJpegxsUnitTests_AVX512) 68 | 69 | add_test(SvtJpegxsUnitTests ${CMAKE_OUTPUT_DIRECTORY}/SvtJpegxsUnitTests) 70 | -------------------------------------------------------------------------------- /tests/UnitTests/DecoderSimple.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _DECODER_SIMPLE_H_ 7 | #define _DECODER_SIMPLE_H_ 8 | #include "stdint.h" 9 | #include "DecHandle.h" 10 | 11 | typedef struct DecoderSimple { 12 | uint32_t verbose; 13 | svt_jpeg_xs_decoder_common_t dec_common; /*Common decoder*/ 14 | svt_jpeg_xs_decoder_instance_t* instance_ctx; 15 | svt_jpeg_xs_image_config image_config; 16 | svt_jpeg_xs_image_buffer_t* image_out; 17 | svt_jpeg_xs_decoder_thread_context* dec_thread_context; 18 | } DecoderSimple_t; 19 | 20 | void decoder_simple_init_rtcd(CPU_FLAGS use_cpu_flags); 21 | SvtJxsErrorType_t decoder_simple_alloc(DecoderSimple_t* decoder, const uint8_t* bitstream_buf, size_t bitstream_length); 22 | void decoder_simple_free(DecoderSimple_t* decoder); 23 | SvtJxsErrorType_t decoder_simple_get_frame(DecoderSimple_t* decoder, const uint8_t* bitstream_buf, size_t bitstream_buf_size); 24 | 25 | /*Tools*/ 26 | int32_t find_bitstream_header(uint8_t* bitstream_buf_ref, size_t bitstream_length); 27 | 28 | #endif /*_DECODER_SIMPLE_H_*/ 29 | -------------------------------------------------------------------------------- /tests/UnitTests/SampleFramesData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _SAMPLE_DATA_FRAMES_H_ 7 | #define _SAMPLE_DATA_FRAMES_H_ 8 | #include "stdint.h" 9 | 10 | extern const uint8_t Frame_Sample_1_16x16_8bit_422_bitstream[]; 11 | extern const uint32_t Frame_Sample_1_16x16_8bit_422_bitstream_size; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /tests/UnitTests/TestSample.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #include "gtest/gtest.h" 7 | #include "Pi.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | // int abc(int a); 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | TEST(SampleUT, Sample1) { 18 | ASSERT_EQ(1, 1); 19 | ASSERT_NE(1, 0); 20 | } 21 | 22 | TEST(SampleUT, Sample2) { 23 | ASSERT_EQ(1, 1); 24 | ASSERT_NE(1, 0); 25 | } 26 | 27 | TEST(SampleUT, sample_test) { 28 | //Test with test sample function from encoder 29 | pi_t pi; 30 | uint32_t sx[MAX_COMPONENTS_NUM] = {1, 2, 2}; 31 | uint32_t sy[MAX_COMPONENTS_NUM] = {1, 1, 1}; 32 | int ret = pi_compute(&pi, 1 /*Init encoder*/, 3, 4, 8, 200, 100, 5, 2, 0, sx, sy, 4, 16); 33 | EXPECT_EQ(ret, 0); 34 | 35 | ASSERT_EQ(pi.comps_num, 3); 36 | } 37 | -------------------------------------------------------------------------------- /tests/UnitTests/UnitTest_AVX512/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright(c) 2024 Intel Corporation 3 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | # 5 | 6 | cmake_minimum_required(VERSION 3.10) 7 | 8 | include_directories( 9 | ${PROJECT_SOURCE_DIR}/tests/UnitTests 10 | ${PROJECT_SOURCE_DIR}/Source/API 11 | ) 12 | 13 | #UT TESTS SOURCES 14 | file(GLOB all_files 15 | "*.h" 16 | "*.cc" 17 | "*.cpp") 18 | 19 | #Support AVX2 and AVX512 20 | check_both_flags_add( 21 | -mavx2 22 | -mavx512f 23 | -mavx512bw 24 | -mavx512dq 25 | -mavx512vl) 26 | 27 | if(MSVC) 28 | check_both_flags_add(/arch:AVX2) 29 | check_both_flags_add(/arch:AVX512) 30 | endif() 31 | 32 | add_library(SvtJpegxsUnitTests_AVX512 OBJECT ${all_files}) 33 | -------------------------------------------------------------------------------- /tests/UnitTests/UnitTest_AVX512/CodeDeprecated-avx512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2024 Intel Corporation 3 | * SPDX - License - Identifier: BSD - 2 - Clause - Patent 4 | */ 5 | 6 | #ifndef _UT_CODE_DEPRECATED_AVX512_H_ 7 | #define _UT_CODE_DEPRECATED_AVX512_H_ 8 | 9 | #include "SvtJpegxs.h" 10 | 11 | int dwt_vertical_depricated_avx512(int32_t* out_lf, int32_t* out_hf, const int32_t* in, uint32_t width, uint32_t height, 12 | uint32_t stride_lf, uint32_t stride_hf, uint32_t stride_in); 13 | 14 | int dwt_horizontal_depricated_avx512(int32_t* out_lf, int32_t* out_hf, const int32_t* in, uint32_t width, uint32_t height, 15 | uint32_t stride_lf, uint32_t stride_hf, uint32_t stride_in); 16 | 17 | #endif /*_UT_CODE_DEPRECATED_AVX512_H_*/ 18 | -------------------------------------------------------------------------------- /tests/scripts/ParallelAllTests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright(c) 2025 Intel Corporation 4 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 5 | # 6 | 7 | 8 | echo "Example: $0 parallel_number" 9 | nproc=$1 10 | script_params="" 11 | 12 | index=0 13 | for ARG in "$@"; do 14 | if (($index >= 1)); then 15 | #echo $ARG 16 | script_params="$script_params $ARG" 17 | fi 18 | index=$((index+1)) 19 | done 20 | 21 | [[ -z "$nproc" ]] && nproc=1 22 | echo "Run Parallel All NPROC: $nproc params: $script_params" 23 | chmod +x ./CommonLib.sh 24 | chmod +x ./ParallelScript.sh 25 | chmod +x ./DecoderConformanceTest.sh 26 | chmod +x ./DecoderMultiFramesTest.sh 27 | chmod +x ./EncoderTest.sh 28 | 29 | error=0 30 | if [[ $error -eq 0 ]]; then 31 | echo RUN DECODER CONFORMANCE TEST 32 | ./ParallelScript.sh $nproc ./DecoderConformanceTest.sh $script_params 33 | ret=$? 34 | [[ $ret -ne 0 ]] && error=$ret 35 | fi 36 | if [[ $error -eq 0 ]]; then 37 | echo RUN DECODER MULTI FRAMES TEST 38 | ./ParallelScript.sh $nproc ./DecoderMultiFramesTest.sh $script_params 39 | ret=$? 40 | [[ $ret -ne 0 ]] && error=$ret 41 | fi 42 | if [[ $error -eq 0 ]]; then 43 | echo RUN ENOCDER TEST 44 | ./ParallelScript.sh $nproc ./EncoderTest.sh $script_params 45 | ret=$? 46 | [[ $ret -ne 0 ]] && error=$ret 47 | fi 48 | 49 | if [ $error -eq 0 ]; then 50 | echo "DONE OK" 51 | else 52 | echo "FAIL !!" 53 | fi 54 | 55 | echo Exit $0 script with exit $error 56 | exit $error 57 | -------------------------------------------------------------------------------- /tests/scripts/parrallelUT.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright(c) 2025 Intel Corporation 4 | # SPDX - License - Identifier: BSD - 2 - Clause - Patent 5 | # 6 | 7 | 8 | exec=$1 9 | nproc=$2 10 | param=$3 11 | valgrind="" 12 | tmp_dir="tmp_ut_parallel" 13 | 14 | echo "Example: ${0} UT_exe [parallel_number] [valgrind]" 15 | 16 | [[ -z "$nproc" ]] && nproc=1 17 | 18 | echo "Run UT Parallel NPROC: $nproc" 19 | echo "UT: $exec" 20 | if [ "$param" = "valgrind" ]; then 21 | echo "Valgrind: ON" 22 | valgrind="valgrind " 23 | else 24 | echo "Valgrind: OFF" 25 | fi 26 | 27 | cmd="$valgrind$exec" 28 | echo "Run command: $cmd" 29 | mkdir $tmp_dir 30 | 31 | pid_array=() 32 | export GTEST_TOTAL_SHARDS=$nproc 33 | for index in $(seq 0 $(($nproc-1))); do 34 | export GTEST_SHARD_INDEX=$index 35 | ${cmd} > $tmp_dir/out_$index.txt 2>&1 & pid_id=$! 36 | pid_array+=("${pid_id}") 37 | echo "Run: $index/$nproc PID: $pid_id" 38 | done 39 | 40 | error=0 41 | error_list="" 42 | if [ ! ${#pid_array[@]} -ne 0 ]; then 43 | error=1 44 | echo "NOT START ANY JOB!!!" 45 | else 46 | echo "Wait ${#pid_array[@]} jobs..." 47 | index=0 48 | index_first_error=0 49 | for pid in "${pid_array[@]}"; do 50 | wait $pid 51 | ret=$? 52 | echo "Job $index/$nproc return: $ret" 53 | if [[ $ret -ne 0 ]]; then 54 | error_list="$error_list\nJob $index/$nproc return ERROR: $ret" 55 | if [[ $error -eq 0 ]]; then 56 | error=$ret 57 | index_first_error=$index 58 | fi 59 | fi 60 | index=$((index+1)) 61 | done 62 | 63 | #Print output 64 | for index in $(seq 0 $(($nproc-1))); do 65 | echo "Out: $index/$nproc" 66 | cat "$tmp_dir/out_$index.txt" 67 | done 68 | #Print again job with first error 69 | if [ $error -ne 0 ]; then 70 | echo 71 | echo "Parallel Out: $index_first_error/$nproc FIRST ERROR: $error" 72 | cat "$tmp_dir/out_$index_first_error.txt" 73 | fi 74 | 75 | #echo -e change \n to break line 76 | echo -e $error_list 77 | fi 78 | 79 | rm -fr $tmp_dir 80 | 81 | if [ $error -ne 0 ]; then 82 | echo "FAIL !!" 83 | else 84 | echo "DONE OK" 85 | fi 86 | echo Exit $0 script with exit $error 87 | exit $error -------------------------------------------------------------------------------- /third_party/cpuinfo/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Google LLC 2 | Copyright (c) 2017-2018 Facebook Inc. 3 | Copyright (C) 2012-2017 Georgia Institute of Technology 4 | Copyright (C) 2010-2012 Marat Dukhan 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /third_party/cpuinfo/deps/clog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR) 2 | 3 | INCLUDE(GNUInstallDirs) 4 | 5 | # ---[ Project and semantic versioning. 6 | PROJECT(clog C CXX) 7 | 8 | if(POLICY CMP0063) 9 | cmake_policy(SET CMP0063 NEW) 10 | endif() 11 | 12 | # ---[ Options. 13 | SET(CLOG_RUNTIME_TYPE "default" CACHE STRING "Type of runtime library (shared, static, or default) to use") 14 | SET_PROPERTY(CACHE CLOG_RUNTIME_TYPE PROPERTY STRINGS default static shared) 15 | IF(ANDROID) 16 | OPTION(CLOG_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" OFF) 17 | ELSE() 18 | OPTION(CLOG_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" ON) 19 | ENDIF() 20 | OPTION(CLOG_BUILD_TESTS "Build clog tests" ON) 21 | 22 | # ---[ CMake options 23 | IF(CLOG_BUILD_TESTS) 24 | ENABLE_TESTING() 25 | ENDIF() 26 | 27 | MACRO(CLOG_TARGET_RUNTIME_LIBRARY target) 28 | IF(MSVC AND NOT CLOG_RUNTIME_TYPE STREQUAL "default") 29 | IF(CLOG_RUNTIME_TYPE STREQUAL "shared") 30 | TARGET_COMPILE_OPTIONS(${target} PRIVATE 31 | "/MD$<$:d>") 32 | ELSEIF(CLOG_RUNTIME_TYPE STREQUAL "static") 33 | TARGET_COMPILE_OPTIONS(${target} PRIVATE 34 | "/MT$<$:d>") 35 | ENDIF() 36 | ENDIF() 37 | ENDMACRO() 38 | 39 | # ---[ clog library 40 | ADD_LIBRARY(clog OBJECT src/clog.c) 41 | SET_TARGET_PROPERTIES(clog PROPERTIES 42 | C_STANDARD 99 43 | C_EXTENSIONS NO) 44 | CLOG_TARGET_RUNTIME_LIBRARY(clog) 45 | SET_TARGET_PROPERTIES(clog PROPERTIES PUBLIC_HEADER include/clog.h) 46 | TARGET_INCLUDE_DIRECTORIES(clog BEFORE PUBLIC include) 47 | IF(CLOG_LOG_TO_STDIO) 48 | TARGET_COMPILE_DEFINITIONS(clog PRIVATE CLOG_LOG_TO_STDIO=1) 49 | ELSE() 50 | TARGET_COMPILE_DEFINITIONS(clog PRIVATE CLOG_LOG_TO_STDIO=0) 51 | ENDIF() -------------------------------------------------------------------------------- /third_party/cpuinfo/deps/clog/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2018 Marat Dukhan 2 | Copyright (c) 2017-2018 Facebook Inc. 3 | Copyright (c) 2017 Georgia Institute of Technology 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/api.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #ifdef __linux__ 9 | #include 10 | #include 11 | #if !defined(__NR_getcpu) 12 | #include 13 | #endif 14 | #endif 15 | 16 | bool cpuinfo_is_initialized = false; -------------------------------------------------------------------------------- /third_party/cpuinfo/src/cpuinfo/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #define CPUINFO_COUNT_OF(array) (sizeof(array) / sizeof(0[array])) 13 | 14 | #if defined(__GNUC__) 15 | #define CPUINFO_LIKELY(condition) (__builtin_expect(!!(condition), 1)) 16 | #define CPUINFO_UNLIKELY(condition) (__builtin_expect(!!(condition), 0)) 17 | #else 18 | #define CPUINFO_LIKELY(condition) (!!(condition)) 19 | #define CPUINFO_UNLIKELY(condition) (!!(condition)) 20 | #endif 21 | 22 | #ifndef CPUINFO_INTERNAL 23 | #if defined(__ELF__) 24 | #define CPUINFO_INTERNAL __attribute__((__visibility__("internal"))) 25 | #elif defined(__MACH__) 26 | #define CPUINFO_INTERNAL __attribute__((__visibility__("hidden"))) 27 | #else 28 | #define CPUINFO_INTERNAL 29 | #endif 30 | #endif 31 | 32 | #ifndef CPUINFO_PRIVATE 33 | #if defined(__ELF__) 34 | #define CPUINFO_PRIVATE __attribute__((__visibility__("hidden"))) 35 | #elif defined(__MACH__) 36 | #define CPUINFO_PRIVATE __attribute__((__visibility__("hidden"))) 37 | #else 38 | #define CPUINFO_PRIVATE 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/cpuinfo/log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #define CPUINFO_LOG_DEBUG_PARSERS 0 8 | 9 | #ifndef CPUINFO_LOG_LEVEL 10 | #define CPUINFO_LOG_LEVEL CLOG_ERROR 11 | #endif 12 | 13 | CLOG_DEFINE_LOG_DEBUG(cpuinfo_log_debug, "cpuinfo", CPUINFO_LOG_LEVEL); 14 | CLOG_DEFINE_LOG_INFO(cpuinfo_log_info, "cpuinfo", CPUINFO_LOG_LEVEL); 15 | CLOG_DEFINE_LOG_WARNING(cpuinfo_log_warning, "cpuinfo", CPUINFO_LOG_LEVEL); 16 | CLOG_DEFINE_LOG_ERROR(cpuinfo_log_error, "cpuinfo", CPUINFO_LOG_LEVEL); 17 | CLOG_DEFINE_LOG_FATAL(cpuinfo_log_fatal, "cpuinfo", CPUINFO_LOG_LEVEL); 18 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/cpuinfo/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | inline static uint32_t bit_length(uint32_t n) { 7 | const uint32_t n_minus_1 = n - 1; 8 | if (n_minus_1 == 0) { 9 | return 0; 10 | } else { 11 | #ifdef _MSC_VER 12 | unsigned long bsr; 13 | _BitScanReverse(&bsr, n_minus_1); 14 | return bsr + 1; 15 | #else 16 | return 32 - __builtin_clz(n_minus_1); 17 | #endif 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/init.c: -------------------------------------------------------------------------------- 1 | #if defined(_WIN32) || defined(__CYGWIN__) 2 | #include 3 | #elif !defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__) 4 | #include 5 | #endif 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #ifdef __APPLE__ 12 | #include "TargetConditionals.h" 13 | #endif 14 | 15 | 16 | #if defined(_WIN32) || defined(__CYGWIN__) 17 | static INIT_ONCE init_guard = INIT_ONCE_STATIC_INIT; 18 | #elif !defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__) 19 | static pthread_once_t init_guard = PTHREAD_ONCE_INIT; 20 | #else 21 | static bool init_guard = false; 22 | #endif 23 | 24 | bool CPUINFO_ABI cpuinfo_initialize(void) { 25 | #if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64 26 | #if defined(__MACH__) && defined(__APPLE__) 27 | pthread_once(&init_guard, &cpuinfo_x86_mach_init); 28 | #elif defined(__linux__) 29 | pthread_once(&init_guard, &cpuinfo_x86_linux_init); 30 | #elif defined(_WIN32) || defined(__CYGWIN__) 31 | InitOnceExecuteOnce(&init_guard, &cpuinfo_x86_windows_init, NULL, NULL); 32 | #else 33 | cpuinfo_log_error("operating system is not supported in cpuinfo"); 34 | #endif 35 | #elif CPUINFO_ARCH_ARM || CPUINFO_ARCH_ARM64 36 | #if defined(__linux__) 37 | pthread_once(&init_guard, &cpuinfo_arm_linux_init); 38 | #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE 39 | pthread_once(&init_guard, &cpuinfo_arm_mach_init); 40 | #elif defined(__MACH__) && defined(__APPLE__) 41 | pthread_once(&init_guard, &cpuinfo_arm_mach_init); 42 | #else 43 | cpuinfo_log_error("operating system is not supported in cpuinfo"); 44 | #endif 45 | #elif CPUINFO_ARCH_ASMJS || CPUINFO_ARCH_WASM || CPUINFO_ARCH_WASMSIMD 46 | #if defined(__EMSCRIPTEN_PTHREADS__) 47 | pthread_once(&init_guard, &cpuinfo_emscripten_init); 48 | #else 49 | if (!init_guard) { 50 | cpuinfo_emscripten_init(); 51 | } 52 | init_guard = true; 53 | #endif 54 | #else 55 | cpuinfo_log_error("processor architecture is not supported in cpuinfo"); 56 | #endif 57 | return cpuinfo_is_initialized; 58 | } 59 | 60 | void CPUINFO_ABI cpuinfo_deinitialize(void) { 61 | } 62 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/x86/cpuid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #if defined(__GNUC__) 5 | #include 6 | #elif defined(_MSC_VER) 7 | #include 8 | #endif 9 | 10 | #if CPUINFO_MOCK 11 | #include 12 | #endif 13 | #include 14 | 15 | 16 | #if defined(__GNUC__) || defined(_MSC_VER) 17 | static inline struct cpuid_regs cpuid(uint32_t eax) { 18 | #if CPUINFO_MOCK 19 | uint32_t regs_array[4]; 20 | cpuinfo_mock_get_cpuid(eax, regs_array); 21 | return (struct cpuid_regs) { 22 | .eax = regs_array[0], 23 | .ebx = regs_array[1], 24 | .ecx = regs_array[2], 25 | .edx = regs_array[3], 26 | }; 27 | #else 28 | struct cpuid_regs regs; 29 | #if defined(__GNUC__) 30 | __cpuid(eax, regs.eax, regs.ebx, regs.ecx, regs.edx); 31 | #else 32 | int regs_array[4]; 33 | __cpuid(regs_array, (int) eax); 34 | regs.eax = regs_array[0]; 35 | regs.ebx = regs_array[1]; 36 | regs.ecx = regs_array[2]; 37 | regs.edx = regs_array[3]; 38 | #endif 39 | return regs; 40 | #endif 41 | } 42 | 43 | static inline struct cpuid_regs cpuidex(uint32_t eax, uint32_t ecx) { 44 | #if CPUINFO_MOCK 45 | uint32_t regs_array[4]; 46 | cpuinfo_mock_get_cpuidex(eax, ecx, regs_array); 47 | return (struct cpuid_regs) { 48 | .eax = regs_array[0], 49 | .ebx = regs_array[1], 50 | .ecx = regs_array[2], 51 | .edx = regs_array[3], 52 | }; 53 | #else 54 | struct cpuid_regs regs; 55 | #if defined(__GNUC__) 56 | __cpuid_count(eax, ecx, regs.eax, regs.ebx, regs.ecx, regs.edx); 57 | #else 58 | int regs_array[4]; 59 | __cpuidex(regs_array, (int) eax, (int) ecx); 60 | regs.eax = regs_array[0]; 61 | regs.ebx = regs_array[1]; 62 | regs.ecx = regs_array[2]; 63 | regs.edx = regs_array[3]; 64 | #endif 65 | return regs; 66 | #endif 67 | } 68 | #endif 69 | 70 | static inline uint64_t xgetbv(uint32_t ext_ctrl_reg) { 71 | #ifdef _MSC_VER 72 | return (uint64_t)_xgetbv((unsigned int)ext_ctrl_reg); 73 | #else 74 | uint32_t lo, hi; 75 | __asm__(".byte 0x0F, 0x01, 0xD0" : "=a" (lo), "=d" (hi) : "c" (ext_ctrl_reg)); 76 | return ((uint64_t) hi << 32) | (uint64_t) lo; 77 | #endif 78 | } 79 | 80 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/x86/linux/init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | 13 | void cpuinfo_x86_linux_init(void) { 14 | struct cpuinfo_x86_processor x86_processor; 15 | memset(&x86_processor, 0, sizeof(x86_processor)); 16 | cpuinfo_x86_init_processor(&x86_processor); 17 | } 18 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/x86/mach/x86_mach_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | void cpuinfo_x86_mach_init(void) { 11 | struct cpuinfo_x86_processor x86_processor; 12 | memset(&x86_processor, 0, sizeof(x86_processor)); 13 | cpuinfo_x86_init_processor(&x86_processor); 14 | } 15 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/x86/windows/init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #ifdef __GNUC__ 14 | #define CPUINFO_ALLOCA __builtin_alloca 15 | #else 16 | #define CPUINFO_ALLOCA _alloca 17 | #endif 18 | 19 | 20 | 21 | BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PVOID* context) { 22 | struct cpuinfo_x86_processor x86_processor; 23 | ZeroMemory(&x86_processor, sizeof(x86_processor)); 24 | cpuinfo_x86_init_processor(&x86_processor); 25 | 26 | return TRUE; 27 | } 28 | -------------------------------------------------------------------------------- /third_party/cpuinfo/src/x86/x86_init.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | struct cpuinfo_x86_isa cpuinfo_isa = { 0 }; 13 | CPUINFO_INTERNAL uint32_t cpuinfo_x86_clflush_size = 0; 14 | 15 | void cpuinfo_x86_init_processor(struct cpuinfo_x86_processor* processor) { 16 | const struct cpuid_regs leaf0 = cpuid(0); 17 | const uint32_t max_base_index = leaf0.eax; 18 | const enum cpuinfo_vendor vendor = processor->vendor = 19 | cpuinfo_x86_decode_vendor(leaf0.ebx, leaf0.ecx, leaf0.edx); 20 | 21 | const struct cpuid_regs leaf0x80000000 = cpuid(UINT32_C(0x80000000)); 22 | const uint32_t max_extended_index = 23 | leaf0x80000000.eax >= UINT32_C(0x80000000) ? leaf0x80000000.eax : 0; 24 | 25 | const struct cpuid_regs leaf0x80000001 = max_extended_index >= UINT32_C(0x80000001) ? 26 | cpuid(UINT32_C(0x80000001)) : (struct cpuid_regs) { 0, 0, 0, 0 }; 27 | 28 | if (max_base_index >= 1) { 29 | const struct cpuid_regs leaf1 = cpuid(1); 30 | processor->cpuid = leaf1.eax; 31 | 32 | cpuinfo_isa = cpuinfo_x86_detect_isa(leaf1, leaf0x80000001, 33 | max_base_index, max_extended_index, vendor); 34 | } 35 | if (max_extended_index >= UINT32_C(0x80000004)) { 36 | struct cpuid_regs brand_string[3]; 37 | for (uint32_t i = 0; i < 3; i++) { 38 | brand_string[i] = cpuid(UINT32_C(0x80000002) + i); 39 | } 40 | memcpy(processor->brand_string, brand_string, sizeof(processor->brand_string)); 41 | cpuinfo_log_debug("raw CPUID brand string: \"%48s\"", processor->brand_string); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/.clang-format: -------------------------------------------------------------------------------- 1 | # Run manually to reformat a file: 2 | # clang-format -i --style=file 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/.github/ISSUE_TEMPLATE/10-feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Propose a new feature. 3 | title: "[FR]: Please title this feature request" 4 | labels: "enhancement" 5 | body: 6 | - type: textarea 7 | id: version 8 | attributes: 9 | label: Does the feature exist in the most recent commit? 10 | description: We recommend using the latest commit from GitHub in your projects. 11 | validations: 12 | required: true 13 | - type: textarea 14 | id: why 15 | attributes: 16 | label: Why do we need this feature? 17 | description: Ideally, explain why a combination of existing features cannot be used instead. 18 | validations: 19 | required: true 20 | - type: textarea 21 | id: proposal 22 | attributes: 23 | label: Describe the proposal. 24 | description: Include a detailed description of the feature, with usage examples. 25 | validations: 26 | required: true 27 | - type: textarea 28 | id: platform 29 | attributes: 30 | label: Is the feature specific to an operating system, compiler, or build system version? 31 | description: If it is, please specify which versions. 32 | validations: 33 | required: true 34 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Get Help 4 | url: https://github.com/google/googletest/discussions 5 | about: Please ask and answer questions here. 6 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/.github/workflows/gtest-ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | env: 8 | BAZEL_CXXOPTS: -std=c++14 9 | 10 | jobs: 11 | Linux: 12 | runs-on: ubuntu-latest 13 | steps: 14 | 15 | - uses: actions/checkout@v3 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Tests 20 | run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ... 21 | 22 | macOS: 23 | runs-on: macos-latest 24 | steps: 25 | 26 | - uses: actions/checkout@v3 27 | with: 28 | fetch-depth: 0 29 | 30 | - name: Tests 31 | run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ... 32 | 33 | 34 | Windows: 35 | runs-on: windows-latest 36 | steps: 37 | 38 | - uses: actions/checkout@v3 39 | with: 40 | fetch-depth: 0 41 | 42 | - name: Tests 43 | run: bazel test --cxxopt=/std:c++14 --features=external_include_paths --test_output=errors ... 44 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore CI build directory 2 | build/ 3 | xcuserdata 4 | cmake-build-debug/ 5 | .idea/ 6 | bazel-bin 7 | bazel-genfiles 8 | bazel-googletest 9 | bazel-out 10 | bazel-testlogs 11 | # python 12 | *.pyc 13 | 14 | # Visual Studio files 15 | .vs 16 | *.sdf 17 | *.opensdf 18 | *.VC.opendb 19 | *.suo 20 | *.user 21 | _ReSharper.Caches/ 22 | Win32-Debug/ 23 | Win32-Release/ 24 | x64-Debug/ 25 | x64-Release/ 26 | 27 | # VSCode files 28 | .cache/ 29 | cmake-variants.yaml 30 | 31 | # Ignore autoconf / automake files 32 | Makefile.in 33 | aclocal.m4 34 | configure 35 | build-aux/ 36 | autom4te.cache/ 37 | googletest/m4/libtool.m4 38 | googletest/m4/ltoptions.m4 39 | googletest/m4/ltsugar.m4 40 | googletest/m4/ltversion.m4 41 | googletest/m4/lt~obsolete.m4 42 | googlemock/m4 43 | 44 | # Ignore generated directories. 45 | googlemock/fused-src/ 46 | googletest/fused-src/ 47 | 48 | # macOS files 49 | .DS_Store 50 | googletest/.DS_Store 51 | googletest/xcode/.DS_Store 52 | 53 | # Ignore cmake generated directories and files. 54 | CMakeFiles 55 | CTestTestfile.cmake 56 | Makefile 57 | cmake_install.cmake 58 | googlemock/CMakeFiles 59 | googlemock/CTestTestfile.cmake 60 | googlemock/Makefile 61 | googlemock/cmake_install.cmake 62 | googlemock/gtest 63 | /bin 64 | /googlemock/gmock.dir 65 | /googlemock/gmock_main.dir 66 | /googlemock/RUN_TESTS.vcxproj.filters 67 | /googlemock/RUN_TESTS.vcxproj 68 | /googlemock/INSTALL.vcxproj.filters 69 | /googlemock/INSTALL.vcxproj 70 | /googlemock/gmock_main.vcxproj.filters 71 | /googlemock/gmock_main.vcxproj 72 | /googlemock/gmock.vcxproj.filters 73 | /googlemock/gmock.vcxproj 74 | /googlemock/gmock.sln 75 | /googlemock/ALL_BUILD.vcxproj.filters 76 | /googlemock/ALL_BUILD.vcxproj 77 | /lib 78 | /Win32 79 | /ZERO_CHECK.vcxproj.filters 80 | /ZERO_CHECK.vcxproj 81 | /RUN_TESTS.vcxproj.filters 82 | /RUN_TESTS.vcxproj 83 | /INSTALL.vcxproj.filters 84 | /INSTALL.vcxproj 85 | /googletest-distribution.sln 86 | /CMakeCache.txt 87 | /ALL_BUILD.vcxproj.filters 88 | /ALL_BUILD.vcxproj 89 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Note: CMake support is community-based. The maintainers do not use CMake 2 | # internally. 3 | 4 | cmake_minimum_required(VERSION 3.13) 5 | 6 | project(googletest-distribution) 7 | set(GOOGLETEST_VERSION 1.14.0) 8 | 9 | if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX) 10 | set(CMAKE_CXX_EXTENSIONS OFF) 11 | endif() 12 | 13 | enable_testing() 14 | 15 | include(CMakeDependentOption) 16 | include(GNUInstallDirs) 17 | 18 | #Note that googlemock target already builds googletest 19 | option(BUILD_GMOCK "Builds the googlemock subproject" ON) 20 | option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) 21 | option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF) 22 | 23 | if(BUILD_GMOCK) 24 | add_subdirectory( googlemock ) 25 | else() 26 | add_subdirectory( googletest ) 27 | endif() 28 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "com_google_googletest") 2 | 3 | load("//:googletest_deps.bzl", "googletest_deps") 4 | googletest_deps() 5 | 6 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 7 | 8 | http_archive( 9 | name = "rules_python", # 2023-07-31T20:39:27Z 10 | sha256 = "1250b59a33c591a1c4ba68c62e95fc88a84c334ec35a2e23f46cbc1b9a5a8b55", 11 | strip_prefix = "rules_python-e355becc30275939d87116a4ec83dad4bb50d9e1", 12 | urls = ["https://github.com/bazelbuild/rules_python/archive/e355becc30275939d87116a4ec83dad4bb50d9e1.zip"], 13 | ) 14 | 15 | http_archive( 16 | name = "bazel_skylib", # 2023-05-31T19:24:07Z 17 | sha256 = "08c0386f45821ce246bbbf77503c973246ed6ee5c3463e41efc197fa9bc3a7f4", 18 | strip_prefix = "bazel-skylib-288731ef9f7f688932bd50e704a91a45ec185f9b", 19 | urls = ["https://github.com/bazelbuild/bazel-skylib/archive/288731ef9f7f688932bd50e704a91a45ec185f9b.zip"], 20 | ) 21 | 22 | http_archive( 23 | name = "platforms", # 2023-07-28T19:44:27Z 24 | sha256 = "40eb313613ff00a5c03eed20aba58890046f4d38dec7344f00bb9a8867853526", 25 | strip_prefix = "platforms-4ad40ef271da8176d4fc0194d2089b8a76e19d7b", 26 | urls = ["https://github.com/bazelbuild/platforms/archive/4ad40ef271da8176d4fc0194d2089b8a76e19d7b.zip"], 27 | ) 28 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/ci/windows-presubmit.bat: -------------------------------------------------------------------------------- 1 | SETLOCAL ENABLEDELAYEDEXPANSION 2 | 3 | SET BAZEL_EXE=%KOKORO_GFILE_DIR%\bazel-5.1.1-windows-x86_64.exe 4 | 5 | SET PATH=C:\Python34;%PATH% 6 | SET BAZEL_PYTHON=C:\python34\python.exe 7 | SET BAZEL_SH=C:\tools\msys64\usr\bin\bash.exe 8 | SET CMAKE_BIN="cmake.exe" 9 | SET CTEST_BIN="ctest.exe" 10 | SET CTEST_OUTPUT_ON_FAILURE=1 11 | SET CMAKE_BUILD_PARALLEL_LEVEL=16 12 | SET CTEST_PARALLEL_LEVEL=16 13 | 14 | IF EXIST git\googletest ( 15 | CD git\googletest 16 | ) ELSE IF EXIST github\googletest ( 17 | CD github\googletest 18 | ) 19 | 20 | IF %errorlevel% neq 0 EXIT /B 1 21 | 22 | :: ---------------------------------------------------------------------------- 23 | :: CMake 24 | MKDIR cmake_msvc2022 25 | CD cmake_msvc2022 26 | 27 | %CMAKE_BIN% .. ^ 28 | -G "Visual Studio 17 2022" ^ 29 | -DPYTHON_EXECUTABLE:FILEPATH=c:\python37\python.exe ^ 30 | -DPYTHON_INCLUDE_DIR:PATH=c:\python37\include ^ 31 | -DPYTHON_LIBRARY:FILEPATH=c:\python37\lib\site-packages\pip ^ 32 | -Dgtest_build_samples=ON ^ 33 | -Dgtest_build_tests=ON ^ 34 | -Dgmock_build_tests=ON 35 | IF %errorlevel% neq 0 EXIT /B 1 36 | 37 | %CMAKE_BIN% --build . --target ALL_BUILD --config Debug -- -maxcpucount 38 | IF %errorlevel% neq 0 EXIT /B 1 39 | 40 | %CTEST_BIN% -C Debug --timeout 600 41 | IF %errorlevel% neq 0 EXIT /B 1 42 | 43 | CD .. 44 | RMDIR /S /Q cmake_msvc2022 45 | 46 | :: ---------------------------------------------------------------------------- 47 | :: Bazel 48 | 49 | SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community 50 | %BAZEL_EXE% test ... ^ 51 | --compilation_mode=dbg ^ 52 | --copt=/std:c++14 ^ 53 | --copt=/WX ^ 54 | --features=external_include_paths ^ 55 | --keep_going ^ 56 | --test_output=errors ^ 57 | --test_tag_filters=-no_test_msvc2017 58 | IF %errorlevel% neq 0 EXIT /B 1 59 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/_config.yml: -------------------------------------------------------------------------------- 1 | title: GoogleTest 2 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/_data/navigation.yml: -------------------------------------------------------------------------------- 1 | nav: 2 | - section: "Get Started" 3 | items: 4 | - title: "Supported Platforms" 5 | url: "/platforms.html" 6 | - title: "Quickstart: Bazel" 7 | url: "/quickstart-bazel.html" 8 | - title: "Quickstart: CMake" 9 | url: "/quickstart-cmake.html" 10 | - section: "Guides" 11 | items: 12 | - title: "GoogleTest Primer" 13 | url: "/primer.html" 14 | - title: "Advanced Topics" 15 | url: "/advanced.html" 16 | - title: "Mocking for Dummies" 17 | url: "/gmock_for_dummies.html" 18 | - title: "Mocking Cookbook" 19 | url: "/gmock_cook_book.html" 20 | - title: "Mocking Cheat Sheet" 21 | url: "/gmock_cheat_sheet.html" 22 | - section: "References" 23 | items: 24 | - title: "Testing Reference" 25 | url: "/reference/testing.html" 26 | - title: "Mocking Reference" 27 | url: "/reference/mocking.html" 28 | - title: "Assertions" 29 | url: "/reference/assertions.html" 30 | - title: "Matchers" 31 | url: "/reference/matchers.html" 32 | - title: "Actions" 33 | url: "/reference/actions.html" 34 | - title: "Testing FAQ" 35 | url: "/faq.html" 36 | - title: "Mocking FAQ" 37 | url: "/gmock_faq.html" 38 | - title: "Code Samples" 39 | url: "/samples.html" 40 | - title: "Using pkg-config" 41 | url: "/pkgconfig.html" 42 | - title: "Community Documentation" 43 | url: "/community_created_documentation.html" 44 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/assets/css/style.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | @import "jekyll-theme-primer"; 5 | @import "main"; 6 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/community_created_documentation.md: -------------------------------------------------------------------------------- 1 | # Community-Created Documentation 2 | 3 | The following is a list, in no particular order, of links to documentation 4 | created by the Googletest community. 5 | 6 | * [Googlemock Insights](https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/googletest/insights.md), 7 | by [ElectricRCAircraftGuy](https://github.com/ElectricRCAircraftGuy) 8 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/index.md: -------------------------------------------------------------------------------- 1 | # GoogleTest User's Guide 2 | 3 | ## Welcome to GoogleTest! 4 | 5 | GoogleTest is Google's C++ testing and mocking framework. This user's guide has 6 | the following contents: 7 | 8 | * [GoogleTest Primer](primer.md) - Teaches you how to write simple tests using 9 | GoogleTest. Read this first if you are new to GoogleTest. 10 | * [GoogleTest Advanced](advanced.md) - Read this when you've finished the 11 | Primer and want to utilize GoogleTest to its full potential. 12 | * [GoogleTest Samples](samples.md) - Describes some GoogleTest samples. 13 | * [GoogleTest FAQ](faq.md) - Have a question? Want some tips? Check here 14 | first. 15 | * [Mocking for Dummies](gmock_for_dummies.md) - Teaches you how to create mock 16 | objects and use them in tests. 17 | * [Mocking Cookbook](gmock_cook_book.md) - Includes tips and approaches to 18 | common mocking use cases. 19 | * [Mocking Cheat Sheet](gmock_cheat_sheet.md) - A handy reference for 20 | matchers, actions, invariants, and more. 21 | * [Mocking FAQ](gmock_faq.md) - Contains answers to some mocking-specific 22 | questions. 23 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/platforms.md: -------------------------------------------------------------------------------- 1 | # Supported Platforms 2 | 3 | GoogleTest follows Google's 4 | [Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support). 5 | See 6 | [this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md) 7 | for a list of currently supported versions compilers, platforms, and build 8 | tools. 9 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/docs/samples.md: -------------------------------------------------------------------------------- 1 | # Googletest Samples 2 | 3 | If you're like us, you'd like to look at 4 | [googletest samples.](https://github.com/google/googletest/blob/main/googletest/samples) 5 | The sample directory has a number of well-commented samples showing how to use a 6 | variety of googletest features. 7 | 8 | * Sample #1 shows the basic steps of using googletest to test C++ functions. 9 | * Sample #2 shows a more complex unit test for a class with multiple member 10 | functions. 11 | * Sample #3 uses a test fixture. 12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to 13 | get the best of both libraries. 14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in 15 | derived fixtures. 16 | * Sample #6 demonstrates type-parameterized tests. 17 | * Sample #7 teaches the basics of value-parameterized tests. 18 | * Sample #8 shows using `Combine()` in value-parameterized tests. 19 | * Sample #9 shows use of the listener API to modify Google Test's console 20 | output and the use of its reflection API to inspect test results. 21 | * Sample #10 shows use of the listener API to implement a primitive memory 22 | leak checker. 23 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/README.md: -------------------------------------------------------------------------------- 1 | # Googletest Mocking (gMock) Framework 2 | 3 | ### Overview 4 | 5 | Google's framework for writing and using C++ mock classes. It can help you 6 | derive better designs of your system and write better tests. 7 | 8 | It is inspired by: 9 | 10 | * [jMock](http://www.jmock.org/) 11 | * [EasyMock](http://www.easymock.org/) 12 | * [Hamcrest](http://code.google.com/p/hamcrest/) 13 | 14 | It is designed with C++'s specifics in mind. 15 | 16 | gMock: 17 | 18 | - Provides a declarative syntax for defining mocks. 19 | - Can define partial (hybrid) mocks, which are a cross of real and mock 20 | objects. 21 | - Handles functions of arbitrary types and overloaded functions. 22 | - Comes with a rich set of matchers for validating function arguments. 23 | - Uses an intuitive syntax for controlling the behavior of a mock. 24 | - Does automatic verification of expectations (no record-and-replay needed). 25 | - Allows arbitrary (partial) ordering constraints on function calls to be 26 | expressed. 27 | - Lets a user extend it by defining new matchers and actions. 28 | - Does not use exceptions. 29 | - Is easy to learn and use. 30 | 31 | Details and examples can be found here: 32 | 33 | * [gMock for Dummies](https://google.github.io/googletest/gmock_for_dummies.html) 34 | * [Legacy gMock FAQ](https://google.github.io/googletest/gmock_faq.html) 35 | * [gMock Cookbook](https://google.github.io/googletest/gmock_cook_book.html) 36 | * [gMock Cheat Sheet](https://google.github.io/googletest/gmock_cheat_sheet.html) 37 | 38 | GoogleMock is a part of 39 | [GoogleTest C++ testing framework](http://github.com/google/googletest/) and a 40 | subject to the same requirements. 41 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/cmake/gmock.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gmock 5 | Description: GoogleMock (without main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Requires: gtest = @PROJECT_VERSION@ 9 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 11 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/cmake/gmock_main.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gmock_main 5 | Description: GoogleMock (with main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Requires: gmock = @PROJECT_VERSION@ 9 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 11 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/docs/README.md: -------------------------------------------------------------------------------- 1 | # Content Moved 2 | 3 | We are working on updates to the GoogleTest documentation, which has moved to 4 | the top-level [docs](../../docs) directory. 5 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/include/gmock/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gmock-port.h` 6 | 7 | The following macros can be defined: 8 | 9 | ### Flag related macros: 10 | 11 | * `GMOCK_DECLARE_bool_(name)` 12 | * `GMOCK_DECLARE_int32_(name)` 13 | * `GMOCK_DECLARE_string_(name)` 14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)` 15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)` 16 | * `GMOCK_DEFINE_string_(name, default_val, doc)` 17 | * `GMOCK_FLAG_GET(flag_name)` 18 | * `GMOCK_FLAG_SET(flag_name, value)` 19 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/include/gmock/internal/custom/gmock-generated-actions.h: -------------------------------------------------------------------------------- 1 | // IWYU pragma: private, include "gmock/gmock.h" 2 | // IWYU pragma: friend gmock/.* 3 | 4 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 5 | #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 6 | 7 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 8 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/include/gmock/internal/custom/gmock-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Injection point for custom user configurations. See README for details 31 | 32 | // IWYU pragma: private, include "gmock/gmock.h" 33 | // IWYU pragma: friend gmock/.* 34 | 35 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 36 | #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 37 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 38 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/include/gmock/internal/custom/gmock-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | // IWYU pragma: private, include "gmock/gmock.h" 35 | // IWYU pragma: friend gmock/.* 36 | 37 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 38 | #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 39 | 40 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 41 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/test/gmock-port_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Google Mock - a framework for writing C++ mock classes. 31 | // 32 | // This file tests the internal cross-platform support utilities. 33 | 34 | #include "gmock/internal/gmock-port.h" 35 | 36 | #include "gtest/gtest.h" 37 | 38 | // NOTE: if this file is left without tests for some reason, put a dummy 39 | // test here to make references to symbols in the gtest library and avoid 40 | // 'undefined symbol' linker errors in gmock_main: 41 | 42 | TEST(DummyTest, Dummy) {} 43 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/test/gmock_link2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Google Mock - a framework for writing C++ mock classes. 31 | // 32 | // This file is for verifying that various Google Mock constructs do not 33 | // produce linker errors when instantiated in different translation units. 34 | // Please see gmock_link_test.h for details. 35 | 36 | #define LinkTest LinkTest2 37 | 38 | #include "test/gmock_link_test.h" 39 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googlemock/test/gmock_link_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Google Mock - a framework for writing C++ mock classes. 31 | // 32 | // This file is for verifying that various Google Mock constructs do not 33 | // produce linker errors when instantiated in different translation units. 34 | // Please see gmock_link_test.h for details. 35 | 36 | #define LinkTest LinkTest1 37 | 38 | #include "test/gmock_link_test.h" 39 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | include(CMakeFindDependencyMacro) 3 | if (@GTEST_HAS_PTHREAD@) 4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@) 5 | find_dependency(Threads) 6 | endif() 7 | 8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") 9 | check_required_components("@project_name@") 10 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/cmake/gtest.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gtest 5 | Description: GoogleTest (without main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ 9 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 10 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/cmake/gtest_main.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gtest_main 5 | Description: GoogleTest (with main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Requires: gtest = @PROJECT_VERSION@ 9 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 11 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/cmake/libgtest.la.in: -------------------------------------------------------------------------------- 1 | # libgtest.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Names of this library. 8 | library_names='libgtest.so' 9 | 10 | # Is this an already installed library? 11 | installed=yes 12 | 13 | # Should we warn about portability when linking against -modules? 14 | shouldnotlink=no 15 | 16 | # Files to dlopen/dlpreopen 17 | dlopen='' 18 | dlpreopen='' 19 | 20 | # Directory that this library needs to be installed in: 21 | libdir='@CMAKE_INSTALL_FULL_LIBDIR@' 22 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/docs/README.md: -------------------------------------------------------------------------------- 1 | # Content Moved 2 | 3 | We are working on updates to the GoogleTest documentation, which has moved to 4 | the top-level [docs](../../docs) directory. 5 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Logging: 19 | 20 | * `GTEST_LOG_(severity)` 21 | * `GTEST_CHECK_(condition)` 22 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 23 | 24 | ### Threading: 25 | 26 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 27 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 28 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 29 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 30 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 31 | * `GTEST_LOCK_EXCLUDED_(locks)` 32 | 33 | ### Underlying library support features 34 | 35 | * `GTEST_HAS_CXXABI_H_` 36 | 37 | ### Exporting API symbols: 38 | 39 | * `GTEST_API_` - Specifier for exported symbols. 40 | 41 | ## Header `gtest-printers.h` 42 | 43 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 44 | custom printer. 45 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/include/gtest/internal/custom/gtest-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/include/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // 35 | // Injection point for custom user configurations. See README for details 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | 32 | #ifndef GOOGLETEST_SAMPLES_SAMPLE1_H_ 33 | #define GOOGLETEST_SAMPLES_SAMPLE1_H_ 34 | 35 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 36 | int Factorial(int n); 37 | 38 | // Returns true if and only if n is a prime number. 39 | bool IsPrime(int n); 40 | 41 | #endif // GOOGLETEST_SAMPLES_SAMPLE1_H_ 42 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "sample4.h" 31 | 32 | #include "gtest/gtest.h" 33 | 34 | namespace { 35 | // Tests the Increment() method. 36 | 37 | TEST(Counter, Increment) { 38 | Counter c; 39 | 40 | // Test that counter 0 returns 0 41 | EXPECT_EQ(0, c.Decrement()); 42 | 43 | // EXPECT_EQ() evaluates its arguments exactly once, so they 44 | // can have side effects. 45 | 46 | EXPECT_EQ(0, c.Increment()); 47 | EXPECT_EQ(1, c.Increment()); 48 | EXPECT_EQ(2, c.Increment()); 49 | 50 | EXPECT_EQ(3, c.Decrement()); 51 | } 52 | 53 | } // namespace 54 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/googletest-param-test-invalid-name1-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "gtest/gtest.h" 31 | 32 | namespace { 33 | class DummyTest : public ::testing::TestWithParam {}; 34 | 35 | TEST_P(DummyTest, Dummy) {} 36 | 37 | INSTANTIATE_TEST_SUITE_P(InvalidTestName, DummyTest, 38 | ::testing::Values("InvalidWithQuotes"), 39 | ::testing::PrintToStringParamName()); 40 | 41 | } // namespace 42 | 43 | int main(int argc, char *argv[]) { 44 | testing::InitGoogleTest(&argc, argv); 45 | return RUN_ALL_TESTS(); 46 | } 47 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/googletest-setuptestsuite-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "gtest/gtest.h" 31 | 32 | class SetupFailTest : public ::testing::Test { 33 | protected: 34 | static void SetUpTestSuite() { ASSERT_EQ("", "SET_UP_FAIL"); } 35 | }; 36 | 37 | TEST_F(SetupFailTest, NoopPassingTest) {} 38 | 39 | class TearDownFailTest : public ::testing::Test { 40 | protected: 41 | static void TearDownTestSuite() { ASSERT_EQ("", "TEAR_DOWN_FAIL"); } 42 | }; 43 | 44 | TEST_F(TearDownFailTest, NoopPassingTest) {} 45 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/googletest-uninitialized-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "gtest/gtest.h" 31 | 32 | TEST(DummyTest, Dummy) { 33 | // This test doesn't verify anything. We just need it to create a 34 | // realistic stage for testing the behavior of Google Test when 35 | // RUN_ALL_TESTS() is called without 36 | // testing::InitGoogleTest() being called first. 37 | } 38 | 39 | int main() { return RUN_ALL_TESTS(); } 40 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | #include "test/gtest-typed-test_test.h" 34 | 35 | // Tests that the same type-parameterized test case can be 36 | // instantiated in different translation units linked together. 37 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 38 | INSTANTIATE_TYPED_TEST_SUITE_P(Vector, ContainerTest, 39 | testing::Types >); 40 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // This program is meant to be run by gtest_help_test.py. Do not run 31 | // it directly. 32 | 33 | #include "gtest/gtest.h" 34 | 35 | // When a help flag is specified, this program should skip the tests 36 | // and exit with 0; otherwise the following test will be executed, 37 | // causing this program to exit with a non-zero code. 38 | TEST(HelpFlagTest, ShouldNotBeRun) { 39 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 40 | } 41 | 42 | #ifdef GTEST_HAS_DEATH_TEST 43 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 44 | #endif 45 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "gtest/gtest.h" 31 | 32 | // Tests that we don't have to define main() when we link to 33 | // gtest_main instead of gtest. 34 | 35 | namespace { 36 | 37 | TEST(GTestMainTest, ShouldSucceed) {} 38 | 39 | } // namespace 40 | 41 | // We are using the main() function defined in gtest_main.cc, so we 42 | // don't define it here. 43 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/gtest_skip_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: arseny.aprelev@gmail.com (Arseny Aprelev) 31 | // 32 | 33 | #include "gtest/gtest.h" 34 | 35 | using ::testing::Test; 36 | 37 | TEST(SkipTest, DoesSkip) { 38 | GTEST_SKIP() << "skipping single test"; 39 | EXPECT_EQ(0, 1); 40 | } 41 | 42 | class Fixture : public Test { 43 | protected: 44 | void SetUp() override { 45 | GTEST_SKIP() << "skipping all tests for this fixture"; 46 | } 47 | }; 48 | 49 | TEST_F(Fixture, SkipsOneTest) { EXPECT_EQ(5, 7); } 50 | 51 | TEST_F(Fixture, SkipsAnotherTest) { EXPECT_EQ(99, 100); } 52 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/gtest_testbridge_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Google LLC. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // This program is meant to be run by gtest_test_filter_test.py. Do not run 31 | // it directly. 32 | 33 | #include "gtest/gtest.h" 34 | 35 | // These tests are used to detect if filtering is working. Only 36 | // 'TestThatSucceeds' should ever run. 37 | 38 | TEST(TestFilterTest, TestThatSucceeds) {} 39 | 40 | TEST(TestFilterTest, TestThatFails) { 41 | ASSERT_TRUE(false) << "This test should never be run."; 42 | } 43 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyOne : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 1); } 38 | void TearDown() override { RecordProperty("TearDownProp", 1); } 39 | }; 40 | 41 | TEST_F(PropertyOne, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 1); 43 | } 44 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | 35 | PrivateCode::PrivateCode() : x_(0) {} 36 | -------------------------------------------------------------------------------- /third_party/googletest-1.14.0/googletest_deps.bzl: -------------------------------------------------------------------------------- 1 | """Load dependencies needed to use the googletest library as a 3rd-party consumer.""" 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | 5 | def googletest_deps(): 6 | """Loads common dependencies needed to use the googletest library.""" 7 | 8 | if not native.existing_rule("com_googlesource_code_re2"): 9 | http_archive( 10 | name = "com_googlesource_code_re2", # 2023-03-17T11:36:51Z 11 | sha256 = "cb8b5312a65f2598954545a76e8bce913f35fbb3a21a5c88797a4448e9f9b9d9", 12 | strip_prefix = "re2-578843a516fd1da7084ae46209a75f3613b6065e", 13 | urls = ["https://github.com/google/re2/archive/578843a516fd1da7084ae46209a75f3613b6065e.zip"], 14 | ) 15 | 16 | if not native.existing_rule("com_google_absl"): 17 | http_archive( 18 | name = "com_google_absl", # 2023-08-01T14:59:13Z 19 | sha256 = "d2c09bf3b3aba57ad87a56082020bee2948445407756e92ddaf3595396086853", 20 | strip_prefix = "abseil-cpp-22091f4c0d6626b3ef40446ce3d4ccab19425ca3", 21 | urls = ["https://github.com/abseil/abseil-cpp/archive/22091f4c0d6626b3ef40446ce3d4ccab19425ca3.zip"], 22 | ) 23 | --------------------------------------------------------------------------------