From 6aafd284c0c59af9933f56cf84e3acf3fd7623c8 Mon Sep 17 00:00:00 2001 From: "build@apk-groulx" Date: Mon, 7 Jun 2021 00:01:45 +0000 Subject: [PATCH] update --- .gitignore | 3 + apk/v3.13/main/amf-headers/APKBUILD | 55 + .../9999-Fix-build-on-Alpine-edge-45352.patch | 0 ...digit-present-on-alpine-non-portable.patch | 0 ...c-version-of-ApplicationInsights-dot.patch | 0 .../9999-fixed-net40-location.patch | 0 .../9999-runtime-link-order.patch | 0 .../9999-sdk-telemetry-optout.patch | 0 .../main/{dotnet-sdk => dotnet}/APKBUILD | 38 +- .../main/{dotnet-sdk => dotnet}/dotnet.sh | 0 apk/v3.13/main/ffnvcodec-headers/APKBUILD | 58 + .../0001-Fixed-build-for-musl.patch | 40 + apk/v3.13/main/intel-media-sdk/APKBUILD | 76 + .../tools/CMakeLists.txt | 24 - .../tools/asg-hevc/CMakeLists.txt | 16 - .../tools/asg-hevc/asg-hevc.vcxproj | 205 -- .../tools/asg-hevc/asg-hevc.vcxproj.filters | 111 - .../tools/asg-hevc/include/asglog.h | 135 -- .../tools/asg-hevc/include/block_structures.h | 349 --- .../include/frame_change_descriptor.h | 138 -- .../tools/asg-hevc/include/frame_marker.h | 48 - .../tools/asg-hevc/include/frame_processor.h | 172 -- .../tools/asg-hevc/include/frame_reorder.h | 146 -- .../tools/asg-hevc/include/generator.h | 55 - .../tools/asg-hevc/include/hevc_defs.h | 72 - .../tools/asg-hevc/include/inputparameters.h | 234 -- .../tools/asg-hevc/include/inter_test.h | 49 - .../tools/asg-hevc/include/intra_test.h | 141 -- .../tools/asg-hevc/include/mvmvp_processor.h | 132 - .../tools/asg-hevc/include/random_generator.h | 61 - .../tools/asg-hevc/include/refcontrol.h | 98 - .../tools/asg-hevc/include/test_processor.h | 101 - .../tools/asg-hevc/include/util_defs.h | 638 ----- .../tools/asg-hevc/include/verifier.h | 97 - .../tools/asg-hevc/src/asg-hevc.cpp | 94 - .../tools/asg-hevc/src/block_structures.cpp | 364 --- .../tools/asg-hevc/src/frame_marker.cpp | 191 -- .../tools/asg-hevc/src/frame_processor.cpp | 1824 -------------- .../tools/asg-hevc/src/frame_reorder.cpp | 465 ---- .../tools/asg-hevc/src/generator.cpp | 117 - .../tools/asg-hevc/src/inputparameters.cpp | 551 ----- .../tools/asg-hevc/src/mvmvp_processor.cpp | 734 ------ .../tools/asg-hevc/src/random_generator.cpp | 67 - .../tools/asg-hevc/src/refcontrol.cpp | 227 -- .../tools/asg-hevc/src/test_processor.cpp | 505 ---- .../tools/asg-hevc/src/util_defs.cpp | 116 - .../tools/asg-hevc/src/verifier.cpp | 1055 -------- .../tools/bs_parser_hevc/CMakeLists.txt | 10 - .../tools/bs_parser_hevc/bs_parser_hevc.def | 13 - .../bs_parser_hevc/bs_parser_hevc.vcxproj | 207 -- .../bs_parser_hevc.vcxproj.filters | 102 - .../tools/bs_parser_hevc/include/bs_def.h | 73 - .../tools/bs_parser_hevc/include/bs_mem+.h | 300 --- .../bs_parser_hevc/include/bs_parser++.h | 90 - .../tools/bs_parser_hevc/include/bs_parser.h | 43 - .../tools/bs_parser_hevc/include/bs_reader.h | 247 -- .../tools/bs_parser_hevc/include/bs_reader2.h | 418 ---- .../tools/bs_parser_hevc/include/bs_thread.h | 115 - .../bs_parser_hevc/include/common_cabac.h | 91 - .../bs_parser_hevc/include/hevc2_parser.h | 623 ----- .../bs_parser_hevc/include/hevc2_struct.h | 983 -------- .../bs_parser_hevc/include/hevc2_trace.h | 64 - .../tools/bs_parser_hevc/include/hevc_cabac.h | 351 --- .../bs_parser_hevc/include/hevc_struct.h | 931 -------- .../tools/bs_parser_hevc/src/bs_reader.cpp | 288 --- .../tools/bs_parser_hevc/src/bs_reader2.cpp | 523 ---- .../tools/bs_parser_hevc/src/bs_thread.cpp | 602 ----- .../tools/bs_parser_hevc/src/common_cabac.cpp | 183 -- .../tools/bs_parser_hevc/src/dll_main.cpp | 107 - .../tools/bs_parser_hevc/src/hevc2_cabac.cpp | 898 ------- .../tools/bs_parser_hevc/src/hevc2_dec.cpp | 1677 ------------- .../bs_parser_hevc/src/hevc2_headers.cpp | 2120 ----------------- .../tools/bs_parser_hevc/src/hevc2_parser.cpp | 1011 -------- .../tools/bs_parser_hevc/src/hevc2_ssdata.cpp | 2060 ---------------- .../tools/bs_parser_hevc/src/hevc2_trace.cpp | 201 -- .../tools/bs_parser_hevc/src/hevc_cabac.cpp | 577 ----- .../bs_parser_hevc/src/hevc_cabac_tables.cpp | 219 -- .../bs_parser_hevc/src/hevc_sdec_ctx.cpp | 400 ---- .../tools/hevc_fei_extractor/CMakeLists.txt | 15 - .../hevc_fei_extractor.vcxproj | 184 -- .../hevc_fei_extractor.vcxproj.filters | 22 - .../tools/hevc_fei_extractor/src/main.cpp | 678 ------ .../tools/tracer/CMakeLists.txt | 78 - .../tools/tracer/README.md | 57 - .../tools/tracer/config/config.cpp | 203 -- .../tools/tracer/config/config.h | 48 - .../tools/tracer/dumps/dump.cpp | 476 ---- .../tools/tracer/dumps/dump.h | 714 ------ .../tools/tracer/dumps/dump_mfxbrc.cpp | 100 - .../tools/tracer/dumps/dump_mfxcommon.cpp | 113 - .../tools/tracer/dumps/dump_mfxdefs.cpp | 41 - .../tools/tracer/dumps/dump_mfxenc.cpp | 42 - .../tools/tracer/dumps/dump_mfxfei.cpp | 802 ------- .../tools/tracer/dumps/dump_mfxla.cpp | 112 - .../tools/tracer/dumps/dump_mfxplugin.cpp | 96 - .../tools/tracer/dumps/dump_mfxsession.cpp | 26 - .../tools/tracer/dumps/dump_mfxstructures.cpp | 1633 ------------- .../tools/tracer/dumps/dump_mfxvideo.cpp | 47 - .../tools/tracer/dumps/dump_mfxvp8.cpp | 54 - .../tools/tracer/gui/ConfigManager.cs | 52 - .../tools/tracer/gui/EtlDataCollector.cs | 173 -- .../tools/tracer/gui/EtlToTextConverter.cs | 69 - .../tools/tracer/gui/Import.cs | 186 -- .../tools/tracer/gui/MsdkAnalyzerCpp.cs | 64 - .../tools/tracer/gui/Program.cs | 98 - .../tools/tracer/gui/Program.ico | Bin 141616 -> 0 bytes .../tracer/gui/Properties/AssemblyInfo.cs | 47 - .../gui/Properties/Resources.Designer.cs | 117 - .../tracer/gui/Properties/Resources.resx | 138 -- .../gui/Properties/Settings.Designer.cs | 26 - .../tracer/gui/Properties/Settings.settings | 7 - .../tracer/gui/SdkAnalyzerForm.Designer.cs | 189 -- .../tools/tracer/gui/SdkAnalyzerForm.cs | 246 -- .../tools/tracer/gui/SdkAnalyzerForm.resx | 123 - .../tools/tracer/gui/WinApi.cs | 136 -- .../tools/tracer/gui/app.config | 3 - .../tools/tracer/gui/embed_manifest.bat | 25 - .../tools/tracer/gui/tracer.csproj | 152 -- .../tools/tracer/gui/tracer.exe.manifest | 26 - .../tools/tracer/gui/tracer_vs12.csproj | 184 -- .../tools/tracer/libmfx.map | 97 - .../tools/tracer/loggers/ilog.h | 36 - .../tools/tracer/loggers/log.cpp | 131 - .../tools/tracer/loggers/log.h | 64 - .../tools/tracer/loggers/log_console.cpp | 63 - .../tools/tracer/loggers/log_console.h | 33 - .../tools/tracer/loggers/log_etw_events.cpp | 48 - .../tools/tracer/loggers/log_etw_events.h | 37 - .../tools/tracer/loggers/log_file.cpp | 97 - .../tools/tracer/loggers/log_file.h | 52 - .../tools/tracer/loggers/log_syslog.cpp | 38 - .../tools/tracer/loggers/log_syslog.h | 36 - .../tools/tracer/loggers/thread_info.h | 52 - .../tools/tracer/loggers/timer.h | 105 - .../tools/tracer/mfx-tracer-config.vcxproj | 153 -- .../tools/tracer/mfx-tracer.def | 76 - .../tools/tracer/mfx-tracer.vcxproj | 213 -- .../tools/tracer/mfx-tracer_vs12.sln | 150 -- .../tracer/tools/configure/CMakeLists.txt | 2 - .../tracer/tools/configure/config_manager.cpp | 135 -- .../tracer/tools/configure/config_manager.h | 43 - .../tools/tracer/tools/configure/main.cpp | 158 -- .../tools/tracer/tools/configure/strfuncs.h | 44 - .../tools/tracer/tools/shared_mem_server.h | 85 - .../tools/tracer/tracer/bits/mfxcallbacks.h | 78 - .../tools/tracer/tracer/bits/mfxfunctions.h | 129 - .../tools/tracer/tracer/exports.cpp | 341 --- .../tools/tracer/tracer/functions_table.h | 192 -- .../tools/tracer/tracer/tracer.cpp | 49 - .../tools/tracer/tracer/tracer.h | 40 - .../tools/tracer/tracer/tracer_linux.cpp | 242 -- .../tools/tracer/tracer/tracer_windows.cpp | 323 --- .../tools/tracer/wrappers/mfx_core.cpp | 303 --- .../tools/tracer/wrappers/mfx_structures.h | 53 - .../tools/tracer/wrappers/mfx_video_core.cpp | 489 ---- .../tracer/wrappers/mfx_video_decode.cpp | 451 ---- .../tools/tracer/wrappers/mfx_video_enc.cpp | 361 --- .../tracer/wrappers/mfx_video_encode.cpp | 581 ----- .../tools/tracer/wrappers/mfx_video_fei.cpp | 289 --- .../tools/tracer/wrappers/mfx_video_user.cpp | 1471 ------------ .../tools/tracer/wrappers/mfx_video_vpp.cpp | 426 ---- ...util-clean-up-unused-FF_SYMVER-macro.patch | 55 + ...8cca6e51db0f19928c12d0348deaa17137b3.patch | 83 + apk/v3.13/main/jellyfin-ffmpeg/APKBUILD | 241 ++ apk/v3.13/main/jellyfin/APKBUILD | 72 + apk/v3.13/main/jellyfin/jellyfin.conf | 6 + apk/v3.13/main/jellyfin/jellyfin.initd | 35 + apk/v3.13/main/jellyfin/jellyfin.service | 13 + apk/v3.13/main/zimg/APKBUILD | 59 + .../0001-Attempt-to-fix-musl-build-2.patch | 24 + .../zvbi/0001-Attempt-to-fix-musl-build.patch | 28 + apk/v3.13/main/zvbi/APKBUILD | 39 + apk/v3.13/main/zvbi/fix-musl-build.patch | 41 + apk/v3.13/main/zvbi/zvbi-va_copy.patch | 12 + 174 files changed, 965 insertions(+), 40240 deletions(-) create mode 100644 .gitignore create mode 100644 apk/v3.13/main/amf-headers/APKBUILD rename apk/v3.13/main/{dotnet-sdk => dotnet}/9999-Fix-build-on-Alpine-edge-45352.patch (100%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/9999-Fix-last-version-digit-present-on-alpine-non-portable.patch (100%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/9999-Fixed-problematic-version-of-ApplicationInsights-dot.patch (100%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/9999-fixed-net40-location.patch (100%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/9999-runtime-link-order.patch (100%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/9999-sdk-telemetry-optout.patch (100%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/APKBUILD (89%) rename apk/v3.13/main/{dotnet-sdk => dotnet}/dotnet.sh (100%) create mode 100644 apk/v3.13/main/ffnvcodec-headers/APKBUILD create mode 100644 apk/v3.13/main/intel-media-sdk/0001-Fixed-build-for-musl.patch create mode 100644 apk/v3.13/main/intel-media-sdk/APKBUILD delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/CMakeLists.txt delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/CMakeLists.txt delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj.filters delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/asglog.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/block_structures.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_change_descriptor.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_marker.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_processor.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_reorder.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/generator.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/hevc_defs.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inputparameters.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inter_test.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/intra_test.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/mvmvp_processor.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/random_generator.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/refcontrol.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/test_processor.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/util_defs.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/verifier.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/asg-hevc.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/block_structures.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_marker.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_processor.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_reorder.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/generator.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/inputparameters.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/mvmvp_processor.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/random_generator.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/refcontrol.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/test_processor.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/util_defs.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/verifier.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/CMakeLists.txt delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.def delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj.filters delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_def.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_mem+.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser++.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader2.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_thread.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/common_cabac.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_parser.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_struct.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_trace.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_cabac.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_struct.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader2.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_thread.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/common_cabac.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/dll_main.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_cabac.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_dec.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_headers.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_parser.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_ssdata.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_trace.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac_tables.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_sdec_ctx.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/CMakeLists.txt delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj.filters delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/src/main.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/CMakeLists.txt delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/README.md delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxbrc.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxcommon.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxdefs.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxenc.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxfei.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxla.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxplugin.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxsession.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxstructures.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvideo.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvp8.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/ConfigManager.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlDataCollector.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlToTextConverter.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Import.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/MsdkAnalyzerCpp.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.ico delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/AssemblyInfo.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.Designer.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.resx delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.Designer.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.settings delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.Designer.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.resx delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/WinApi.cs delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/app.config delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/embed_manifest.bat delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.csproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.exe.manifest delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer_vs12.csproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/libmfx.map delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/ilog.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/thread_info.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/timer.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/mfx-tracer-config.vcxproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/mfx-tracer.def delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/mfx-tracer.vcxproj delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/mfx-tracer_vs12.sln delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tools/configure/CMakeLists.txt delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tools/configure/config_manager.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tools/configure/config_manager.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tools/configure/main.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tools/configure/strfuncs.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tools/shared_mem_server.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/bits/mfxcallbacks.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/bits/mfxfunctions.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/exports.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/functions_table.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/tracer.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/tracer.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/tracer_linux.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/tracer/tracer_windows.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_core.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_structures.h delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_core.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_decode.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_enc.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_encode.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_fei.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_user.cpp delete mode 100644 apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/wrappers/mfx_video_vpp.cpp create mode 100644 apk/v3.13/main/jellyfin-ffmpeg/0001-libavutil-clean-up-unused-FF_SYMVER-macro.patch create mode 100644 apk/v3.13/main/jellyfin-ffmpeg/3e098cca6e51db0f19928c12d0348deaa17137b3.patch create mode 100644 apk/v3.13/main/jellyfin-ffmpeg/APKBUILD create mode 100644 apk/v3.13/main/jellyfin/APKBUILD create mode 100644 apk/v3.13/main/jellyfin/jellyfin.conf create mode 100644 apk/v3.13/main/jellyfin/jellyfin.initd create mode 100644 apk/v3.13/main/jellyfin/jellyfin.service create mode 100644 apk/v3.13/main/zimg/APKBUILD create mode 100644 apk/v3.13/main/zvbi/0001-Attempt-to-fix-musl-build-2.patch create mode 100644 apk/v3.13/main/zvbi/0001-Attempt-to-fix-musl-build.patch create mode 100644 apk/v3.13/main/zvbi/APKBUILD create mode 100644 apk/v3.13/main/zvbi/fix-musl-build.patch create mode 100644 apk/v3.13/main/zvbi/zvbi-va_copy.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b6651d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.tar +*.tar.gz +*.tar.xz diff --git a/apk/v3.13/main/amf-headers/APKBUILD b/apk/v3.13/main/amf-headers/APKBUILD new file mode 100644 index 0000000..9d47206 --- /dev/null +++ b/apk/v3.13/main/amf-headers/APKBUILD @@ -0,0 +1,55 @@ +# Maintainer: Maxime Gauduin +# Contributor: Daniel Bermond + +pkgname=amf-headers +pkgver=1.4.18 +pkgrel=0 +pkgdesc='Header files for AMD Advanced Media Framework' +arch='noarch' +url=https://github.com/GPUOpen-LibrariesAndSDKs/AMF/ +license='MIT' +makedepends='git' +_gittag=7a83513f8a0c9f2b2b6270dbb294cd942d27a499 +_giturl=https://github.com/GPUOpen-LibrariesAndSDKs/AMF +source="${pkgname}-${pkgver}.tar.gz" +options="!check" + +builddir="$srcdir/$pkgname" + +snapshot() { + mkdir -p "$srcdir" + cd "${srcdir}" + if ! [ -d $pkgname.git ]; then + git clone $_giturl $pkgname.git || return 1 + cd $pkgname.git + else + cd $pkgname.git + git fetch || return 1 + fi + + echo "Checking out" + git checkout $_gittag + echo "Repo archive" + git archive --prefix="$pkgname/" -o $pkgname.tar --format "tar" $_gittag + + gzip $pkgname.tar -c > "$SRCDEST"/$pkgname-$pkgver.tar.gz + ln -s "$SRCDEST"/$pkgname-$pkgver.tar.gz "$startdir"/$pkgname-$pkgver.tar.gz +} + + +pkgver() { + cd "$builddir" + + git describe --tags | sed 's/^v//' +} + +package() { + cd "${builddir}" + install -dm 755 "${pkgdir}"/usr/include + mkdir "${pkgdir}/usr/include/AMF" + cp -r amf/public/include/* "${pkgdir}"/usr/include/AMF/. + install -Dm 644 LICENSE.txt -t "${pkgdir}"/usr/share/licenses/amf-headers/ +} + +# vim: ts=2 sw=2 et: +sha512sums="2133612498444877f4aefeadd8d1aa0aa960999f0cb093b1a67bbc7d5c2633424fe6ca4ef4c967c1fa03033de3c926bcbad3915693339be4d08d21df4a4c2b77 amf-headers-1.4.18.tar.gz" diff --git a/apk/v3.13/main/dotnet-sdk/9999-Fix-build-on-Alpine-edge-45352.patch b/apk/v3.13/main/dotnet/9999-Fix-build-on-Alpine-edge-45352.patch similarity index 100% rename from apk/v3.13/main/dotnet-sdk/9999-Fix-build-on-Alpine-edge-45352.patch rename to apk/v3.13/main/dotnet/9999-Fix-build-on-Alpine-edge-45352.patch diff --git a/apk/v3.13/main/dotnet-sdk/9999-Fix-last-version-digit-present-on-alpine-non-portable.patch b/apk/v3.13/main/dotnet/9999-Fix-last-version-digit-present-on-alpine-non-portable.patch similarity index 100% rename from apk/v3.13/main/dotnet-sdk/9999-Fix-last-version-digit-present-on-alpine-non-portable.patch rename to apk/v3.13/main/dotnet/9999-Fix-last-version-digit-present-on-alpine-non-portable.patch diff --git a/apk/v3.13/main/dotnet-sdk/9999-Fixed-problematic-version-of-ApplicationInsights-dot.patch b/apk/v3.13/main/dotnet/9999-Fixed-problematic-version-of-ApplicationInsights-dot.patch similarity index 100% rename from apk/v3.13/main/dotnet-sdk/9999-Fixed-problematic-version-of-ApplicationInsights-dot.patch rename to apk/v3.13/main/dotnet/9999-Fixed-problematic-version-of-ApplicationInsights-dot.patch diff --git a/apk/v3.13/main/dotnet-sdk/9999-fixed-net40-location.patch b/apk/v3.13/main/dotnet/9999-fixed-net40-location.patch similarity index 100% rename from apk/v3.13/main/dotnet-sdk/9999-fixed-net40-location.patch rename to apk/v3.13/main/dotnet/9999-fixed-net40-location.patch diff --git a/apk/v3.13/main/dotnet-sdk/9999-runtime-link-order.patch b/apk/v3.13/main/dotnet/9999-runtime-link-order.patch similarity index 100% rename from apk/v3.13/main/dotnet-sdk/9999-runtime-link-order.patch rename to apk/v3.13/main/dotnet/9999-runtime-link-order.patch diff --git a/apk/v3.13/main/dotnet-sdk/9999-sdk-telemetry-optout.patch b/apk/v3.13/main/dotnet/9999-sdk-telemetry-optout.patch similarity index 100% rename from apk/v3.13/main/dotnet-sdk/9999-sdk-telemetry-optout.patch rename to apk/v3.13/main/dotnet/9999-sdk-telemetry-optout.patch diff --git a/apk/v3.13/main/dotnet-sdk/APKBUILD b/apk/v3.13/main/dotnet/APKBUILD similarity index 89% rename from apk/v3.13/main/dotnet-sdk/APKBUILD rename to apk/v3.13/main/dotnet/APKBUILD index b67e971..0eb7bb0 100644 --- a/apk/v3.13/main/dotnet-sdk/APKBUILD +++ b/apk/v3.13/main/dotnet/APKBUILD @@ -4,11 +4,10 @@ # Contributor: Max Liebkies # Contributor: Krzysztof Bogacki -_pkgbase=dotnet -pkgname=dotnet-sdk +pkgname=dotnet pkgdesc='The .NET Core SDK' pkgver=5.0.6 -pkgrel=0 +pkgrel=1 arch='x86_64' url=https://www.microsoft.com/net/core license='MIT' @@ -40,11 +39,11 @@ makedepends=' # libssl1.1 # libstdc++zlib #' -subpackages="$_pkgbase-host:host $_pkgbase-runtime:runtime aspnet-runtime:aspnet_runtime:noarch netstandard-targeting-pack:netstandard_targeting_pack:noarch $_pkgbase-targeting-pack:targeting_pack aspnet-targeting-pack:aspnet_targeting_pack:noarch" +subpackages="$pkgname-sdk:sdk $pkgname-host:host $pkgname-runtime:runtime aspnet-runtime:aspnet_runtime:noarch netstandard-targeting-pack:netstandard_targeting_pack:noarch $pkgname-targeting-pack:targeting_pack aspnet-targeting-pack:aspnet_targeting_pack:noarch" _gittag=a8f12771179965da9f48646ded87068d379563b9 _giturl=https://github.com/dotnet/source-build source=" - $_pkgbase-$pkgver.tar.gz + $pkgname-$pkgver.tar.gz dotnet.sh 9999-runtime-link-order.patch 9999-sdk-telemetry-optout.patch @@ -54,7 +53,7 @@ source=" 9999-fixed-net40-location.patch https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh " -builddir="$srcdir/$_pkgbase" +builddir="$srcdir/$pkgname" snapshot() { mkdir -p "$srcdir" @@ -70,10 +69,10 @@ snapshot() { echo "Checking out" git checkout $_gittag echo "Repo archive" - git archive --prefix="$_pkgbase/" -o $_pkgbase.tar --format "tar" $_gittag + git archive --prefix="$pkgname/" -o $pkgname.tar --format "tar" $_gittag - gzip $pkgname.tar -c > "$SRCDEST"/$_pkgbase-$pkgver.tar.gz - ln -s "$SRCDEST"/$_pkgbase-$pkgver.tar.gz "$startdir"/$_pkgbase-$pkgver.tar.gz + gzip $pkgname.tar -c > "$SRCDEST"/$pkgname-$pkgver.tar.gz + ln -s "$SRCDEST"/$pkgname-$pkgver.tar.gz "$startdir"/$pkgname-$pkgver.tar.gz } @@ -137,6 +136,19 @@ build() { } package() { + depends=' + $pkgname-sdk + $pkgname-host + $pkgname-runtime + $pkgname-targetting-pack + aspnet-runtime + aspnet-targeting-pack + netstandard-targeting-pack + ' + mkdir -p "${pkgdir}" +} + +sdk() { depends=' dotnet-runtime dotnet-targeting-pack @@ -148,9 +160,9 @@ package() { cd "$builddir"/artifacts/x64/Release - install -dm 755 "$pkgdir"/usr/share/dotnet "$pkgdir"/usr/share/licenses - bsdtar -xf dotnet-sdk-*.tar.gz -C "${pkgdir}"/usr/share/dotnet/ --no-same-owner sdk templates - ln -s dotnet-host "${pkgdir}"/usr/share/licenses/dotnet-sdk + install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses + bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner sdk templates + ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/dotnet-sdk } @@ -186,7 +198,7 @@ runtime() { libgcc musl icu - krdb5-libs + krb5-libs libunwind zlib openssl diff --git a/apk/v3.13/main/dotnet-sdk/dotnet.sh b/apk/v3.13/main/dotnet/dotnet.sh similarity index 100% rename from apk/v3.13/main/dotnet-sdk/dotnet.sh rename to apk/v3.13/main/dotnet/dotnet.sh diff --git a/apk/v3.13/main/ffnvcodec-headers/APKBUILD b/apk/v3.13/main/ffnvcodec-headers/APKBUILD new file mode 100644 index 0000000..cf5c9aa --- /dev/null +++ b/apk/v3.13/main/ffnvcodec-headers/APKBUILD @@ -0,0 +1,58 @@ +# Maintainer: Maxime Gauduin +# Contributor: Daniel Bermond + +pkgname=ffnvcodec-headers +pkgver=11.0.10.1 +pkgrel=0 +pkgdesc='FFmpeg version of headers required to interface with Nvidias codec APIs' +arch='noarch' +url=https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git +license='MIT' +makedepends='git sed' +_gittag=315ad740ac77282c7cea67ba31f2e4b373132919 +_giturl=https://git.videolan.org/git/ffmpeg/nv-codec-headers +source="$pkgname-$pkgver.tar.gz" +options='!check' + +builddir="$srcdir/$pkgname" + +snapshot() { + mkdir -p "$srcdir" + cd "${srcdir}" + if ! [ -d $pkgname.git ]; then + git clone $_giturl $pkgname.git || return 1 + cd $pkgname.git + else + cd $pkgname.git + git fetch || return 1 + fi + + echo "Checking out" + git checkout $_gittag + echo "Repo archive" + git archive --prefix="$pkgname/" -o $pkgname.tar --format "tar" $_gittag + + gzip $pkgname.tar -c > "$SRCDEST"/$pkgname-$pkgver.tar.gz + ln -s "$SRCDEST"/$pkgname-$pkgver.tar.gz "$startdir"/$pkgname-$pkgver.tar.gz +} + +pkgver() { + git describe --tags | sed 's/^n//' +} + +build() { + cd "${builddir}" + make PREFIX=/usr + sed -n '4,25p' include/ffnvcodec/nvEncodeAPI.h > LICENSE # Extract license + sed -i '1,22s/^.\{,3\}//' LICENSE # Delete C comments +} + +package() { + cd "${builddir}" + mkdir -p "${pkgdir}" + make PREFIX=/usr DESTDIR="${pkgdir}" install + install -Dm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/ffnvcodec-headers/ +} + +# vim: ts=2 sw=2 et: +sha512sums="2f70f981e227bb5eb25e365270bc79cba855975e365d116f434e823c5e00e73eb2d802ccb1f1c143dab9c434546439ca4dba8dd968f538d382ee69b27e3bc932 ffnvcodec-headers-11.0.10.1.tar.gz" diff --git a/apk/v3.13/main/intel-media-sdk/0001-Fixed-build-for-musl.patch b/apk/v3.13/main/intel-media-sdk/0001-Fixed-build-for-musl.patch new file mode 100644 index 0000000..47cc6c9 --- /dev/null +++ b/apk/v3.13/main/intel-media-sdk/0001-Fixed-build-for-musl.patch @@ -0,0 +1,40 @@ +From 785d96be2c3be8c96c8dc3f8275bae435cf1cd3b Mon Sep 17 00:00:00 2001 +From: "build@apk-groulx" +Date: Sun, 6 Jun 2021 20:36:23 +0000 +Subject: [PATCH] Fixed build for musl + +--- + tools/tracer/tracer/tracer_linux.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/tracer/tracer/tracer_linux.cpp b/tools/tracer/tracer/tracer_linux.cpp +index bea1c070..14d7f07b 100644 +--- a/tools/tracer/tracer/tracer_linux.cpp ++++ b/tools/tracer/tracer/tracer_linux.cpp +@@ -78,9 +78,9 @@ mfxStatus MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session) + Log::WriteLog(context.dump_mfxStatus("status", MFX_ERR_MEMORY_ALLOC)); + return MFX_ERR_MEMORY_ALLOC; + } +- loader->dlhandle = dlopen(g_mfxlib, RTLD_NOW|RTLD_LOCAL|RTLD_DEEPBIND); ++ loader->dlhandle = dlopen(g_mfxlib, RTLD_NOW|RTLD_LOCAL); + if(!loader->dlhandle) +- loader->dlhandle = dlopen(g_mfxlib_in_dir, RTLD_NOW|RTLD_LOCAL|RTLD_DEEPBIND); ++ loader->dlhandle = dlopen(g_mfxlib_in_dir, RTLD_NOW|RTLD_LOCAL); + if (!loader->dlhandle){ + Log::WriteLog(context.dump("ver", ver)); + Log::WriteLog(context.dump("session", *session)); +@@ -184,9 +184,9 @@ mfxStatus MFXInitEx(mfxInitParam par, mfxSession *session) + Log::WriteLog(context.dump_mfxStatus("status", MFX_ERR_MEMORY_ALLOC)); + return MFX_ERR_MEMORY_ALLOC; + } +- loader->dlhandle = dlopen(g_mfxlib, RTLD_NOW|RTLD_LOCAL|RTLD_DEEPBIND); ++ loader->dlhandle = dlopen(g_mfxlib, RTLD_NOW|RTLD_LOCAL); + if(!loader->dlhandle) +- loader->dlhandle = dlopen(g_mfxlib_in_dir, RTLD_NOW|RTLD_LOCAL|RTLD_DEEPBIND); ++ loader->dlhandle = dlopen(g_mfxlib_in_dir, RTLD_NOW|RTLD_LOCAL); + if (!loader->dlhandle){ + Log::WriteLog(context.dump("par", par)); + Log::WriteLog(context.dump("session", *session)); +-- +2.30.2 + diff --git a/apk/v3.13/main/intel-media-sdk/APKBUILD b/apk/v3.13/main/intel-media-sdk/APKBUILD new file mode 100644 index 0000000..3ecfc36 --- /dev/null +++ b/apk/v3.13/main/intel-media-sdk/APKBUILD @@ -0,0 +1,76 @@ +# Maintainer: Daniel Bermond + +pkgname=intel-media-sdk +pkgver=21.1.3 +pkgrel=0 +pkgdesc='API to access hardware-accelerated video on Intel Gen graphics hardware platforms' +arch='x86_64' +url='https://software.intel.com/en-us/media-sdk/' +license='MIT' +makedepends=' + libdrm-dev + libva-dev + wayland-dev + intel-media-driver-dev + cmake + libpciaccess-dev + libx11-dev + libxcb-dev + python3' + +source="https://github.com/Intel-Media-SDK/MediaSDK/archive/intel-mediasdk-${pkgver}.tar.gz + https://github.com/Intel-Media-SDK/MediaSDK/commit/f6925886f27a39eed2e43c5b7b6c342d00f7a970.patch + 0001-Fixed-build-for-musl.patch" + +subpackages="libmfx:libmfx" +builddir="${srcdir}/MediaSDK-intel-mediasdk-${pkgver}" + +build() { + cd "${builddir}" + cmake -B build \ + -DBUILD_ALL:BOOL='ON' \ + -DBUILD_TOOLS:BOOL='ON' \ + -DCMAKE_BUILD_TYPE:STRING='None' \ + -DCMAKE_INSTALL_PREFIX:PATH='/usr' \ + -DCMAKE_INSTALL_LIBDIR:PATH='lib' \ + -DENABLE_ITT:BOOL='OFF' \ + -DENABLE_OPENCL:BOOL='OFF' \ + -DENABLE_WAYLAND:BOOL='ON' \ + -DENABLE_X11_DRI3:BOOL='ON' \ + -Wno-dev + make -C build +} + +check() { + cd "${builddir}" + make -C build test +} + +package() { + depends="libdrm libva wayland libmfx=${pkgver} intel-media-driver" + cd "${builddir}" + + make -C build DESTDIR="$pkgdir" install + ln -s ../share/mfx/samples/libcttmetrics.so "${pkgdir}/usr/lib/libcttmetrics.so" + install -D -m644 "${builddir}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}" + + mkdir -p "${srcdir}"/libmfx/include "${srcdir}"/libmfx/lib/pkgconfig + mv "${pkgdir}/usr/include/mfx" "${srcdir}"/libmfx/include + mv "${pkgdir}/usr/lib/libmfx.so"* "${srcdir}"/libmfx/lib + mv "${pkgdir}"/usr/lib/pkgconfig/mfx.pc "${srcdir}"/libmfx/lib/pkgconfig + mv "${pkgdir}"/usr/lib/pkgconfig/libmfx.pc "${srcdir}"/libmfx/lib/pkgconfig + rm -r "${pkgdir}/usr/include" +} + +libmfx() { + pkgdesc='Intel Media SDK dispatcher library' + depends='gcc' + cd "${builddir}" + + mkdir -p "${subpkgdir}" + mv "${srcdir}"/libmfx "${subpkgdir}"/usr + install -D -m644 "${builddir}"/LICENSE -t "${subpkgdir}/usr/share/licenses/${pkgname}" +} +sha512sums="d840db69da285302c1afdcf305c32ec88029c5951af6d2570404b118a9cc8e02345082f5116da496b1b0fdedfa435bac1c7968fbf8e7c9d12e2e5ef687784eda intel-mediasdk-21.1.3.tar.gz +c1d56964982b2fc6b5fbc128080d9b5607dbac4470111b62bcc8b52789a40a23dd8c59ed7757e6e8e238db9b828c9afd68060b539ad7800bde42f6e2fc22d854 f6925886f27a39eed2e43c5b7b6c342d00f7a970.patch +6049eebb5f1cc2068e50cb3ed672d29f54a53924f435b88e402905f3664bf25d52556547ff68163c67892bc56e60c793bd18092b21a19f1fb0f27b80f18d4dfd 0001-Fixed-build-for-musl.patch" diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/CMakeLists.txt b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/CMakeLists.txt deleted file mode 100644 index 37a31a8..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2017-2020 Intel Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -add_subdirectory(asg-hevc) -add_subdirectory(bs_parser_hevc) -add_subdirectory(bs_parser_hevc/tools/hevc_fei_extractor) -add_subdirectory(tracer) diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/CMakeLists.txt b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/CMakeLists.txt deleted file mode 100644 index 1322ac2..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -find_path( FEI_INCLUDE mfxfeihevc.h PATHS ${MFX_INCLUDE} ) - -include_directories ( - ${CMAKE_CURRENT_SOURCE_DIR}/../../samples/sample_common/include - ${CMAKE_CURRENT_SOURCE_DIR}/include -) - -list( APPEND LIBS sample_common ) - -set( defs " -DMFX_VERSION_USE_LATEST " ) -set(DEPENDENCIES libmfx) - -make_executable( shortname universal ) - -install( TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -set( defs "" ) diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj deleted file mode 100644 index a52d7ae..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj +++ /dev/null @@ -1,205 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {270C4BB6-C45C-4541-8F9C-47D30C4744F1} - Win32Proj - 10.0.17134.0 - - - - Application - true - v141 - - - Application - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - - - false - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - - - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - - - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - false - - - - MFX_VERSION_USE_LATEST;_WIN32;WIN32;_DEBUG;NOMINMAX;MFX_DEPRECATED_OFF; _UNICODE;UNICODE;%(PreprocessorDefinitions) - MultiThreadedDebug - Level3 - ProgramDatabase - Disabled - $(ProjectDir)\include;$(ProjectDir)\..\..\api\include;$(ProjectDir)\..\..\samples\sample_common\include\vm;$(ProjectDir)\..\..\samples\sample_common\src;$(ProjectDir)\..\..\samples\sample_common\include;$(INTELMEDIASDKROOT)\include;%(AdditionalIncludeDirectories) - false - - - MachineX86 - DebugFastLink - Console - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);%(AdditionalLibraryDirectories) - - - - - MFX_VERSION_USE_LATEST;_WIN32;WIN32;NDEBUG;NOMINMAX;MFX_DEPRECATED_OFF; _UNICODE;UNICODE;%(PreprocessorDefinitions) - MultiThreaded - Level3 - ProgramDatabase - $(ProjectDir)\include;$(ProjectDir)\..\..\api\include;$(ProjectDir)\..\..\samples\sample_common\include\vm;$(ProjectDir)\..\..\samples\sample_common\src;$(ProjectDir)\..\..\samples\sample_common\include;$(INTELMEDIASDKROOT)\include;%(AdditionalIncludeDirectories) - false - - - MachineX86 - true - Console - true - true - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib; sample_common.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)\include;$(ProjectDir)\..\..\api\include;$(ProjectDir)\..\..\samples\sample_common\include\vm;$(ProjectDir)\..\..\samples\sample_common\src;$(ProjectDir)\..\..\samples\sample_common\include;$(INTELMEDIASDKROOT)\include;%(AdditionalIncludeDirectories) - - - - - Level3 - - - - - true - MFX_VERSION_USE_LATEST;_WIN64;WIN64;_DEBUG;NOMINMAX;MFX_DEPRECATED_OFF; _UNICODE;UNICODE;%(PreprocessorDefinitions) - MultiThreadedDebug - ProgramDatabase - - - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib; sample_common.lib;%(AdditionalDependencies) - Console - - - - - $(ProjectDir)\include;$(ProjectDir)\..\..\api\include;$(ProjectDir)\..\..\samples\sample_common\include\vm;$(ProjectDir)\..\..\samples\sample_common\src;$(ProjectDir)\..\..\samples\sample_common\include;$(INTELMEDIASDKROOT)\include;%(AdditionalIncludeDirectories) - - - - - Level3 - true - MFX_VERSION_USE_LATEST;_WIN64;WIN64;NDEBUG;NOMINMAX;MFX_DEPRECATED_OFF; _UNICODE;UNICODE;%(PreprocessorDefinitions) - true - MultiThreaded - - - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);%(AdditionalLibraryDirectories) - Console - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib; sample_common.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5fadb243-53c3-4776-a20f-8bd65c10cf41} - - - - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj.filters b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj.filters deleted file mode 100644 index 239f930..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/asg-hevc.vcxproj.filters +++ /dev/null @@ -1,111 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/asglog.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/asglog.h deleted file mode 100644 index 68c1b33..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/asglog.h +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASGLOG_H__ -#define __ASGLOG_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include -#include -#include - -#include "mfxdefs.h" -#include "block_structures.h" - -//Logger object, basically a tee into cout and log file -class ASGLog -{ -public: - //Tuple field designations - enum { MVX = 0, MVY = 1, REFIDX = 2 }; - - void Init(const InputParams& params) - { - m_bVerbose = params.m_bVerbose; - if (params.m_bUseLog) - { - m_LogFileOutput.open(params.m_LogFileName.c_str(), std::ofstream::out); - if (!m_LogFileOutput.is_open()) - { - throw std::string("ERROR: ASGLog: unable to open log file"); - } - } - } - - //Convenient ofstream-style operator<< with chaining feature - template - ASGLog& operator<<(const T& output) - { - if (m_bVerbose) - { - std::cout << output; - } - if (m_LogFileOutput.is_open()) - { - m_LogFileOutput << output; - } - return *this; - } - - //Specialization for basic block info output - ASGLog& operator<< (const CTUDescriptor& outCTU) - { - return (*this << "CTU " << static_cast(outCTU)); - } - - ASGLog& operator<< (const CUBlock& outCU) - { - return (*this << "CU " << static_cast(outCU)); - } - - ASGLog& operator<< (const PUBlock& outPU) - { - return (*this << "PU " << static_cast(outPU)); - } - - //Specialization for basic block info output - ASGLog& operator<< (const BaseBlock& outBB) - { - std::stringstream ss; - ss << outBB.m_BHeight << "x" << outBB.m_BWidth << - " (" << outBB.m_AdrX << ";" << outBB.m_AdrY << ")"; - return (*this << ss.str()); - } - - //Specialization for MV log output - ASGLog& operator<< (const std::tuple& MV) - { - std::stringstream ss; - - ss << "(" << std::get(MV) << ";" << std::get(MV) << ";" << std::get(MV) << ")"; - - return (*this << ss.str()); - } - - //Specialization for I/O stream manipulators (i.e. std::endl) - ASGLog& operator<< (std::ostream&(*pMan)(std::ostream&)) - { - if (m_bVerbose) - { - std::cout << *pMan; - } - if (m_LogFileOutput.is_open()) - { - m_LogFileOutput << *pMan; - } - return *this; - } - ~ASGLog() - { - if (m_LogFileOutput.is_open()) - { - m_LogFileOutput.close(); - } - } - -private: - bool m_bVerbose = false; - std::ofstream m_LogFileOutput; -}; - -#endif // MFX_VERSION > 1024 - -#endif //__ASGLOG_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/block_structures.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/block_structures.h deleted file mode 100644 index d326a2b..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/block_structures.h +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __BLOCK_STRUCTURES_H__ -#define __BLOCK_STRUCTURES_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "inter_test.h" -#include "intra_test.h" -#include "util_defs.h" - -enum COLOR_COMPONENT { - LUMA_Y = 0, - CHROMA_U = 1, - CHROMA_V = 2 -}; - -enum PRED_TYPE { - INTRA_PRED = 0, - INTER_PRED = 1, -}; - -struct RefSampleAvail -{ - //parameter answers the question whether samples in the extention of left border to the bottom are final ones - //and won't be overwritten by any following blocks - bool LeftDown; - //parameter answers the question whether samples in the extention of above border to the right are final ones - //and won't be overwritten by any following blocks - bool UpRight; - RefSampleAvail(bool leftdown = true, bool upright = true) : LeftDown(leftdown), UpRight(upright) {} -}; - -//base block structure with size and coordinates -struct BaseBlock { - mfxU32 m_AdrX; - mfxU32 m_AdrY; - mfxU32 m_BWidth; - mfxU32 m_BHeight; - - BaseBlock(mfxU32 adrX = 0, mfxU32 adrY = 0, mfxU32 bWidth = 0, mfxU32 bHeight = 0) - : m_AdrX(adrX), - m_AdrY(adrY), - m_BWidth(bWidth), - m_BHeight(bHeight) - {} - - // Returns true if two rectangles intersect or closer to each other than specified by x_sp and y_sp - bool CheckForIntersect(const BaseBlock& other_block, mfxU32 x_sp = 0, mfxU32 y_sp = 0) const - { - return !((m_AdrX >= other_block.m_AdrX + other_block.m_BWidth + x_sp || - other_block.m_AdrX >= m_AdrX + m_BWidth + x_sp) // If one rectangle is on side of other - - || (m_AdrY >= other_block.m_AdrY + other_block.m_BHeight + y_sp || - other_block.m_AdrY >= m_AdrY + m_BHeight + y_sp)); // If one rectangle is above other - } - - //Returns true if the block is inside frame boundaries - bool IsInRange(const mfxFrameInfo& info) const - { - return ((info.Width > 0 && info.Height > 0) && - (m_AdrX + m_BWidth <= (mfxU32)info.Width) && - (m_AdrY + m_BHeight <= (mfxU32)info.Height)); - } - - //Returns true if the block is inside another block - bool IsInBlock(const BaseBlock& otherBlock) const - { - return (m_AdrX >= otherBlock.m_AdrX && m_AdrX + m_BWidth <= otherBlock.m_AdrX + otherBlock.m_BWidth - && m_AdrY >= otherBlock.m_AdrY && m_AdrY + m_BHeight <= otherBlock.m_AdrY + otherBlock.m_BHeight); - } - - void GetChildBlock(std::vector& childrenBlocks) const; - void GetChildRefSampleInfo(const RefSampleAvail & currAvail, const BaseBlock & ctu, std::vector& childrenRefSampleAvail) const; - - bool operator==(const BaseBlock& rhs) const - { - return (m_AdrX == rhs.m_AdrX && m_AdrY == rhs.m_AdrY && - m_BWidth == rhs.m_BWidth && m_BHeight == rhs.m_BHeight); - } -}; - -//Struct representing a single node in a quad-tree -struct QuadTreeNode -{ - std::shared_ptr m_pParent; - std::vector m_Children; - mfxU8 m_Level; - QuadTreeNode() : m_pParent(nullptr), m_Level(0) {} - QuadTreeNode(std::shared_ptr pParent, mfxU8 level) : - m_pParent(pParent), - m_Level(level) - {} - void MakeChildren() - { - for (mfxU32 i = 0; i < 4; i++) - { - QuadTreeNode node(std::make_shared(this), m_Level + 1); - m_Children.push_back(node); - } - } -}; - -//Structure representing a quad-tree as a whole -struct QuadTree -{ - QuadTreeNode root; - void Clear() - { - root.m_Children.clear(); - } - bool IsEmpty() - { - return root.m_Children.empty(); - } - - //This recursive function fills outVec with BaseBlocks, coordinates and sizes of which correspond to - //the quad-tree structure specified by the quad-tree root node and the base size and coordinates of - //the "root node " - void GetQuadTreeBlocksRecur(QuadTreeNode & node, mfxU32 baseAdrX, mfxU32 baseAdrY, mfxU32 baseSize, std::vector& outVec); - //this function is a modification of the one above - //it keeps track of refSamples availability for every block - //thus it outputs outVec of IntraBlock structures and is used when intra prediction is enabled - - //now algorithm works fine assuming that CTUs cannot lie next to each other - //but it limits some cases for intra/inter mix - - void GetQuadTreeRefSampleAvailVector(QuadTreeNode & node, BaseBlock & currBlock, const BaseBlock & ctu, std::vector& outVec); - - //TODO: develop this function taking into account that INTER coded noise blocks are written prior to INTRA prediction - //and include available refSamples for it - void GetQuadTreeRefSampleAvailVectorRecur(QuadTreeNode & node, BaseBlock& currBlock, const RefSampleAvail& currAvail, const BaseBlock& CTU, std::vector& outVec); -}; - -//block handling patch data which was generated via intra prediction -struct PatchBlock : BaseBlock -{ - std::unique_ptr PatchData; - mfxU8 *m_YPlane = nullptr; - mfxU8 *m_UPlane = nullptr; - mfxU8 *m_VPlane = nullptr; - - //Copy constructor - PatchBlock(const PatchBlock& rhs); - - //Assignment operator - PatchBlock& operator=(const PatchBlock& rhs); - - PatchBlock(const BaseBlock& BB); - - //constructor that memsets PatchBlock with the particurlar sample - PatchBlock(const BaseBlock& BB, mfxU8 y_comp, mfxU8 u_comp, mfxU8 v_comp); - - //constructor that fills PatchBlock with coresponding data from the otherPatch - PatchBlock(const BaseBlock& dstBlock, const PatchBlock& srcBlock); - - //constructor that filles PatchBlock with coresponding data from the surface - PatchBlock(const BaseBlock& BB, const ExtendedSurface& surf); - - //distance between current PatchBlock and other_patch counted as a sum of abs differences between luma components over all samples - mfxU32 CalcYSAD(const PatchBlock& otherPatch) const; - - //AdrX and AdrY are given in the luma plane space (i.e. raw frame coords) - mfxU8 GetSampleI420(COLOR_COMPONENT comp, mfxU32 AdrX, mfxU32 AdrY) const; - - //Inserts refPatch into this PatchBlock, if refPatch is located inside this PatchBlock - void InsertAnotherPatch(const PatchBlock & refPatch); -}; - -//Structure representing a prediction unit -struct PUBlock : BaseBlock -{ - PUBlock(mfxU32 adrX = 0, mfxU32 adrY = 0, mfxU32 bWidth = 0, mfxU32 bHeight = 0) : - BaseBlock(adrX, adrY, bWidth, bHeight), - m_MV(), - m_MVP(), - predFlagL0(false), - predFlagL1(false) - {} - - // Attention: MV and MVP are given in quarter-sample units. Consider scaling when working with PUMotionVector. - PUMotionVector m_MV; //Contains complete motion vector (i.e. predictor + additional vector inside SW) - PUMotionVector m_MVP; //Contains motion vector predictor only - - // Index of this PU's MVP inside the generation pool - // 4 predictors are in pool, valid values are in range [0, 3] - // -1 indicates no MVP was applied to this PU's MV - mfxI16 usedMVPIndex = -1; - - // Index of the generation pool used to choose MVP from for this PU - // -1 indicates no MVP was applied to this PU's MV - mfxI16 usedMVPPoolNo = -1; - - // Prediction flags - bool predFlagL0; - bool predFlagL1; - - //Returns a BaseBlock with coordinates that are shifted by the m_MV L0 motion vector - //relative to the current PU position - BaseBlock GetShiftedBaseBlock(REF_LIST_INDEX list) const; - - //Returns true if both the block itself and blocks shifted by - //L0 and L1 motion vectors are inside frame boundaries - bool IsPUInRange(const mfxFrameInfo& info) const - { - mfxI64 posXL0 = (mfxI64)m_AdrX + (m_MV.MV[0].x >> 2); - mfxI64 posYL0 = (mfxI64)m_AdrY + (m_MV.MV[0].y >> 2); - - mfxI64 posXL1 = (mfxI64)m_AdrX + (m_MV.MV[1].x >> 2); - mfxI64 posYL1 = (mfxI64)m_AdrY + (m_MV.MV[1].y >> 2); - - //TODO: This may lead to slow performance for tightly packed test CTUs - return (IsInRange(info) && - posXL0 >= 0 && (posXL0 + m_BWidth <= info.Width) && - posYL0 >= 0 && (posYL0 + m_BHeight <= info.Height)&& - posXL1 >= 0 && (posXL1 + m_BWidth <= info.Width) && - posYL1 >= 0 && (posYL1 + m_BHeight <= info.Height)); - } - - //For VERIFY purposes. Will only work correctly if ASG PU with correct predFlags is on the left-hand side - bool operator==(const PUBlock& rhs) const - { - return (static_cast(*this) == static_cast(rhs) && - (predFlagL0 == rhs.predFlagL0) && (predFlagL1 == rhs.predFlagL1) && - (!predFlagL0 || m_MV.GetL0MVTuple() == rhs.m_MV.GetL0MVTuple()) && - (!predFlagL1 || m_MV.GetL1MVTuple() == rhs.m_MV.GetL1MVTuple())); - } -}; - -//Structure representing a transform unit -struct TUBlock : BaseBlock -{ - //different intra modes can be set for luma and chroma - INTRA_MODE m_IntraModeLuma = INTRA_MODE::DC; - INTRA_MODE m_IntraModeChroma = INTRA_MODE::DC; - RefSampleAvail m_RefSampleAvail; - - TUBlock(const BaseBlock& base) : BaseBlock(base) {} - TUBlock(const BaseBlock& base, INTRA_MODE intraModeLuma, INTRA_MODE intraModeChroma) : - BaseBlock(base), - m_IntraModeLuma(intraModeLuma), - m_IntraModeChroma(intraModeChroma) - {} -}; - -//Structure representing a coding unit -struct CUBlock : BaseBlock -{ - // Quadtree representing TU structure - QuadTree m_TUQuadTree; - PRED_TYPE m_PredType = INTRA_PRED; //intra or inter - INTRA_PART_MODE m_IntraPartMode = INTRA_NONE; //partitioning into different intra modes - INTER_PART_MODE m_InterPartMode = INTER_NONE; //partitioning into PUs - std::vector m_PUVec; //PU and TU partitioning can be - std::vector m_TUVec; //performed independently - - CUBlock(const BaseBlock& base) : BaseBlock(base) {} - - void BuildPUsVector(INTER_PART_MODE mode); - - //For VERIFY purposes - bool operator==(const CUBlock& rhs) const - { - return (static_cast(*this) == static_cast(rhs) && - m_PUVec == rhs.m_PUVec); - } -}; - -// Descriptor of CTU -struct CTUDescriptor : BaseBlock -{ - // Coordinates in CTUs - mfxU32 m_AdrXInCTU = 0; - mfxU32 m_AdrYInCTU = 0; - - // Quadtree representing CU structure - QuadTree m_CUQuadTree; - - // Contains CU blocks according to the m_CUQuadTree structure - // Gets filled in GetCUVecInCTU - std::vector m_CUVec; - - // Contains MVP pools used in MV generator for PUs inside this CTU - // Gets filled in DumpMVPPools - std::vector> m_MVPGenPools; - - CTUDescriptor(mfxU32 addr_x = 0, mfxU32 addr_y = 0, mfxU32 b_addr_x = 0, mfxU32 b_addr_y = 0, mfxU32 b_width = 0, mfxU32 b_height = 0) - : BaseBlock(b_addr_x, b_addr_y, b_width, b_height) - , m_AdrXInCTU(addr_x) - , m_AdrYInCTU(addr_y) - {}; - - bool operator==(const CTUDescriptor& rhs) const - { - return (m_AdrXInCTU == rhs.m_AdrXInCTU && - m_AdrYInCTU == rhs.m_AdrYInCTU && - m_CUVec == rhs.m_CUVec); - } - - std::vector GetTotalPUsVec() const - { - std::vector retVec; - for (auto& CU : m_CUVec) - { - retVec.insert(retVec.end(), CU.m_PUVec.begin(), CU.m_PUVec.end()); - } - return retVec; - } -}; - -using FrameOccRefBlockRecord = std::map>; - -struct InterpolWorkBlock : BaseBlock -{ - InterpolWorkBlock() {}; - InterpolWorkBlock(const BaseBlock& block) : - BaseBlock(block), - m_YArr(block.m_BHeight * block.m_BWidth, LUMA_DEFAULT), - m_UArr(block.m_BHeight / 2 * block.m_BWidth / 2, CHROMA_DEFAULT), - m_VArr(block.m_BHeight / 2 * block.m_BWidth / 2, CHROMA_DEFAULT) - {} - std::vector m_YArr; - std::vector m_UArr; - std::vector m_VArr; -}; - -#endif // MFX_VERSION - -#endif //__BLOCK_STRUCTURES_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_change_descriptor.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_change_descriptor.h deleted file mode 100644 index 76ee9e8..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_change_descriptor.h +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_FRAME_CHANGE_DESCRIPTOR_H__ -#define __ASG_HEVC_FRAME_CHANGE_DESCRIPTOR_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "block_structures.h" -#include "inputparameters.h" - -// Descriptor containing all information about frame -struct FrameChangeDescriptor -{ - FRAME_MARKER m_changeType = SKIP; // type of frame - mfxU16 m_testType = UNDEFINED_TYPE; // test type (i.e. use or not split or use) - PROCESSING_MODE m_procMode = UNDEFINED_MODE; // processing mode - mfxU32 m_frameNumber = 0; // frame number in display order - ExtendedSurface* m_frame = nullptr; // ExtendedSurface for current frame - mfxU16 m_frameType = MFX_FRAMETYPE_UNKNOWN; // Frame type, used for bi-prediction decision - bool m_bUseBiDirSW = true; // Whether or not bi-directional search window should be used - // instead of one-directional - - std::vector m_vCTUdescr; // vector of generated blocks inside current frame - - std::list m_refDescrList0; // L0 list - std::list m_refDescrList1; // L1 list - - std::vector m_OccupiedRefBlocks; // vector of blocks on the current frame - // already taken by PUs from other frames - - mfxU32 GetFrameCropW() const - { - return m_frame ? m_frame->Info.CropW : 0; - } - mfxU32 GetFrameCropH() const - { - return m_frame ? m_frame->Info.CropH : 0; - } - - FrameOccRefBlockRecord BackupOccupiedRefBlocks() - { - FrameOccRefBlockRecord ret; - for (const FrameChangeDescriptor& descr : m_refDescrList0) - { - ret[descr.m_frameNumber] = descr.m_OccupiedRefBlocks; - } - - for (const FrameChangeDescriptor& descr : m_refDescrList1) - { - ret[descr.m_frameNumber] = descr.m_OccupiedRefBlocks; - } - return ret; - } - - void RestoreOccupiedRefBlocks(FrameOccRefBlockRecord& bak) - { - for (FrameChangeDescriptor& descr : m_refDescrList0) - { - if (bak.find(descr.m_frameNumber) != bak.end()) - { - descr.m_OccupiedRefBlocks = std::move(bak[descr.m_frameNumber]); - } - else - { - throw std::string("ERROR: RestoreOccupiedRefBlocks: occupied block data not found in backup for L0"); - } - } - - for (FrameChangeDescriptor& descr : m_refDescrList1) - { - if (bak.find(descr.m_frameNumber) != bak.end()) - { - descr.m_OccupiedRefBlocks = std::move(bak[descr.m_frameNumber]); - } - else - { - throw std::string("ERROR: RestoreOccupiedRefBlocks: occupied block data not found in backup for L1"); - } - } - return; - } - - bool IsNewPUValid(const PUBlock & newPU) const - { - return newPU.IsPUInRange(m_frame->Info) && - !CheckNewPUForIntersection(newPU); - } - - bool CheckNewPUForIntersection(const PUBlock & newPU) const - { - if (newPU.predFlagL0) - { - const auto& frameDescrL0 = std::next(m_refDescrList0.begin(), newPU.m_MV.RefIdx.RefL0); - BaseBlock shiftPU_L0 = newPU.GetShiftedBaseBlock(L0); - for (const auto& occBlock : frameDescrL0->m_OccupiedRefBlocks) - { - if (occBlock.CheckForIntersect(shiftPU_L0)) return true; - } - } - - if (newPU.predFlagL1) - { - const auto& frameDescrL1 = std::next(m_refDescrList1.begin(), newPU.m_MV.RefIdx.RefL1); - BaseBlock shiftPU_L1 = newPU.GetShiftedBaseBlock(L1); - for (const auto& occBlock : frameDescrL1->m_OccupiedRefBlocks) - { - if (occBlock.CheckForIntersect(shiftPU_L1)) return true; - } - } - - return false; - } -}; - - -#endif - -#endif // __ASG_HEVC_FRAME_CHANGE_DESCRIPTOR_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_marker.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_marker.h deleted file mode 100644 index 3f5b360..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_marker.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_FRAME_MAKER_H__ -#define __ASG_FRAME_MAKER_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "inputparameters.h" - -inline bool GenerateInterMBs(mfxU16 test_type) { return !!(test_type & (~(GENERATE_INTRA | GENERATE_SPLIT))); } -inline bool HasBFramesInGOP(mfxU16 refDist) { return refDist > 1; } - -class FrameMarker -{ -public: - void PreProcessStreamConfig(InputParams & params); -private: - void BuildRefLists(const InputParams & params); - void TagFrames(const InputParams & params); - bool HasAlreadyUsedRefs(mfxU32 frame, mfxU8 list); - void SetRefList(mfxU32 frame, mfxU8 list, std::vector & refFrames, mfxU32 & num_gen); - - std::vector m_vProcessingParams; // FrameProcessingParam for entire stream -}; - -#endif // MFX_VERSION - -#endif // __ASG_FRAME_MAKER_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_processor.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_processor.h deleted file mode 100644 index 044488a..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_processor.h +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_FRAME_PROCESSOR_H__ -#define __ASG_HEVC_FRAME_PROCESSOR_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include - -#include "util_defs.h" - -#include "block_structures.h" -#include "frame_change_descriptor.h" -#include "intra_test.h" -#include "inter_test.h" -#include "mvmvp_processor.h" -#include "random_generator.h" - -class FrameProcessor -{ -public: - FrameProcessor() = default; - - void Init(const InputParams ¶ms); - - void ProcessFrame(FrameChangeDescriptor & frame_descr); - - // For verification - void GenQuadTreeInCTUWithBitMask(CTUDescriptor& CTU, mfxU32 bitMask); - -private: - - //work with particular samples in the frame - bool IsSampleAvailable(mfxU32 X, mfxU32 Y); - mfxU8 GetSampleI420(COLOR_COMPONENT comp, mfxU32 AdrX, mfxU32 AdrY, mfxFrameSurface1* surf); - - void GenRandomQuadTreeStructure(QuadTree & QT, mfxU8 minDepth, mfxU8 maxDepth); - void GenCUVecInCTU(CTUDescriptor & ctu, mfxU16 test_type); - void GenRandomTUQuadTreeInCU(CUBlock & cu_block); - void GenRandomCUQuadTreeInCTU(CTUDescriptor & ctu); - void GetRefSampleAvailFlagsForTUsInCTU(CTUDescriptor & CTU); - //checking if reference samples for INTRA prediction of the current block are mostly constant - //TODO: develop flexible criterion of mostly uniform ref samples - bool IsBlockUniform(const BaseBlock& block, PatchBlock& tempFrame); - void AlterBorderSamples(const BaseBlock& block, PatchBlock& tempFrame); - //counting the particurlar intra mode prediction for TU - void MakeTUIntraPrediction(const TUBlock& refBlock, PatchBlock& targetBlock); - //worst intra mode is found here in order to reach more contrast - void ChooseContrastIntraMode(const BaseBlock & block, std::vector& tu_block_vec, PatchBlock& frame); - //function that makes intra prediction for refBlock of particular colorComp plane and saves it into currPlane buffer - void GetIntraPredPlane(const BaseBlock& refBlock, INTRA_MODE currMode, const PatchBlock& frame, COLOR_COMPONENT colorComp, mfxU8* currPlane); - //function that makes a patch from refBlock with all color components intra predicted - PatchBlock GetIntraPatchBlock(const TUBlock & refBlock, const PatchBlock& patch); - //intra prediction for particluar TU block and particular intra mode is made here - void MakeIntraPredInCTU(CTUDescriptor & ctu, FrameChangeDescriptor & descr); - - //only TU tree intraPartitionMode is determined here - void MakeIntraCU(CUBlock & cu_block); - void MakeInterCU(CUBlock & cu_block, mfxU16 test_type); - mfxU8 CeilLog2(mfxU32 size); - //methods used for INTRA prediction - - //filling vector with adjacent samples - //all coordinates and sizes here are measured in samples of colorComp - void FillIntraRefSamples(mfxU32 cSize, mfxU32 cAdrX, mfxU32 cAdrY, const PatchBlock& frame, COLOR_COMPONENT colorComp, std::vector& refSamples); - - //choosing filter for the vector of reference samples and making it if needed - void ThreeTapFilter(std::vector& RefSamples, mfxU8 size); - void StrongFilter(std::vector& RefSamples, mfxU8 size); - FILTER_TYPE ChooseFilter(std::vector& RefSamples, mfxU8 size, INTRA_MODE intra_type); - FILTER_TYPE MakeFilter(std::vector& RefSamples, mfxU8 size, INTRA_MODE type); - - //making a projection if needed - mfxU8 MakeProjRefArray(const std::vector& RefSamples, mfxU8 size, const IntraParams& IntraMode, std::vector& ProjRefSamples); - - //generating prediction using a perticular mode and saving it in IntraPatch structure - void PlanarPrediction(const std::vector& RefSamples, mfxU8 size, mfxU8 * patch); - void DCPrediction(const std::vector& RefSamples, mfxU8 size, mfxU8 * patch); - void AngularPrediction(const std::vector& RefSamples, mfxU8 size, IntraParams& IntraMode, mfxU8 * patch); - void MakePostFilter(const std::vector& RefSamples, mfxU8 cSize, INTRA_MODE currMode, mfxU8* currPlane); - void GenerateIntraPrediction(const std::vector& RefSamples, mfxU8 blockSize, INTRA_MODE currMode, mfxU8* currPlane); - - //function generating INTRA prediction for TU leaves of the tree - void ApplyTUIntraPrediction(const TUBlock & block, ExtendedSurface& surf); - void ApplyIntraPredInCTU(const CTUDescriptor & CTU, FrameChangeDescriptor & frame_descr); - void PutPatchIntoFrame(const PatchBlock & BP, mfxFrameSurface1& surf); - //end of intra methods - - //methods used for INTER prediction - void GenPredFlagsForPU(PUBlock & PU, mfxU16 frameType); - void ApplyInterPredInCTU(CTUDescriptor & CTU, FrameChangeDescriptor & frame_descr); - - void GenCTUParams(FrameChangeDescriptor & frame_descr); - void GenAndApplyPrediction(FrameChangeDescriptor & frame_descr); - bool MakeInterPredInCTU(CTUDescriptor & CTU, FrameChangeDescriptor & frameDescr); - - void PutNoiseBlocksIntoFrames(const PUBlock & pu, const FrameChangeDescriptor & frameDescr, mfxU32 num_coeff = 12, mfxU32 level = 48); - void FillInBlock4x4(mfxU32 num_coeff, mfxU32 level, mfxU8 block[16]); - void FillDeltaBlocks4x4(mfxI8 blockL0[16], mfxI8 blockL1[16]); - void ApplyDeltaPerPixel(const PUBlock & PU, const mfxI8 deltaBlock[16], const mfxU8 inBlock[16], mfxU8 outBlock[16]); - void Inverse4x4(mfxI32 *src, mfxU32 s_pitch, mfxI32 *dst, mfxU32 d_pitch); - void PutBlock4x4(mfxU32 x0, mfxU32 y0, mfxU8 block[16], mfxFrameSurface1 * surf); - mfxU8 ClipIntToChar(mfxI32 x); - void TraceBackAndPutBlockIntoFrame(const PUBlock & PU, FrameChangeDescriptor & descr); - InterpolWorkBlock GetInterpolWorkBlockPreWP(const BaseBlock & PU, std::pair fractOffset, mfxFrameSurface1 * surfTo); - PatchBlock ApplyDefaultWeightedPrediction(InterpolWorkBlock & workBlockL0); - PatchBlock ApplyDefaultWeightedPrediction(InterpolWorkBlock & workBlockL0, InterpolWorkBlock & workBlockL1); - - mfxU8 SetCorrectMVPBlockSize(mfxU8 mvpBlockSizeParam); - - void UnlockSurfaces(FrameChangeDescriptor & frame_descr); - - void GenRandomQuadTreeSubstrRecur(QuadTreeNode & node, mfxU8 minDepth, mfxU8 maxDepth); - // For verification - void GenQuadTreeWithBitMaskRecur(QuadTreeNode& node, mfxU32 bitMask); - // Used only in quarter-pixel interpolation. Luma sample value should fit in mfxI32. - mfxI32 GetClippedSample(COLOR_COMPONENT comp, mfxI32 AdrX, mfxI32 AdrY, mfxFrameSurface1* surf); - - mfxI32 CalculateLumaPredictionSamplePreWP(const std::pair& refSampleLocationFull, - const std::pair& refSampleLocationFract, mfxFrameSurface1* refSurface); - - mfxI32 ApplyVerticalSubSampleLumaFilter(mfxU32 x, mfxU32 y, mfxFrameSurface1 * refSurface, const mfxI32* coeff); - mfxI32 ApplyHorizontalSubSampleLumaFilter(mfxU32 x, mfxU32 y, mfxFrameSurface1 * refSurface, const mfxI32* coeff); - - // These function used in only in CalculateLumaPredictionSamplePreWP - // In specifictation default weighted prediction is the final scaling step for sample prediction. (p.168) - mfxU8 GetDefaultWeightedPredSample(mfxI32 predSampleLX); - mfxU8 GetDefaultWeightedPredSample(mfxI32 predSampleL0, mfxI32 predSampleL1); - - mfxU32 m_Height = 0; // in pixels - mfxU32 m_Width = 0; - mfxU32 m_HeightInCTU = 0; // in CTUs - mfxU32 m_WidthInCTU = 0; - mfxU32 m_CropH = 0; // Unaligned size - mfxU32 m_CropW = 0; - - mfxU16 m_SubPelMode = 0; // Valid values are: 0, 1 or 3 - - bool m_IsForceExtMVPBlockSize = false; - mfxU32 m_ForcedExtMVPBlockSize = 0; - mfxU32 m_GenMVPBlockSize = 0; - - CTUStructure m_CTUStr; // Some parameters related to CTU generation, i.e. restrictions on CTUs - - PROCESSING_MODE m_ProcMode = UNDEFINED_MODE; // processing mode -}; - -#endif // MFX_VERSION - -#endif // __ASG_HEVC_FRAME_PROCESSOR_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_reorder.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_reorder.h deleted file mode 100644 index b8647d2..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/frame_reorder.h +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_FRAME_REORDER_H__ -#define __ASG_FRAME_REORDER_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include -#include "inputparameters.h" - -enum NALU_TYPE -{ - TRAIL_N = 0, - TRAIL_R, - RASL_N, - RASL_R, - IDR_W_RADL, - CRA_NUT -}; - -inline bool isBFF(mfxVideoParam const & video) -{ - return ((video.mfx.FrameInfo.PicStruct & MFX_PICSTRUCT_FIELD_BOTTOM) == MFX_PICSTRUCT_FIELD_BOTTOM); -} - -mfxI32 GetFrameNum(bool bField, mfxI32 Poc, bool bSecondField); - -mfxU8 GetFrameType( - mfxVideoParam const & video, - mfxU32 pictureOrder, - bool isPictureOfLastFrame); - -class FrameReorder -{ -public: - FrameReorder(const InputParams & params) : - m_nMaxFrames(params.m_numFrames), - m_BRefType(params.m_BRefType), - m_GopOptFlag(params.m_GopOptFlag), - m_NumRef(params.m_NumRef), - m_UseGPB(params.m_UseGPB), - m_NumRefActiveP(params.m_NumRefActiveP), - m_NumRefActiveBL0(params.m_NumRefActiveBL0), - m_NumRefActiveBL1(params.m_NumRefActiveBL1), - m_lastIdr(0), - m_anchorPOC(-1) - {}; - ExternalFrame CreateExternalFrame(mfxI32 order, const mfxVideoParam& param); - inline size_t GetBufferedQueueSize() const - { - return m_queue.size(); - }; -private: - mfxU32 m_nMaxFrames; - mfxU16 m_BRefType; - mfxU16 m_GopOptFlag; - mfxU16 m_NumRef; - bool m_UseGPB; - mfxU16 m_NumRefActiveP; - mfxU16 m_NumRefActiveBL0; - mfxU16 m_NumRefActiveBL1; - - class LastReorderedFieldInfo - { - public: - mfxI32 m_poc; - bool m_bReference; - bool m_bFirstField; - - LastReorderedFieldInfo() : - m_poc(-1), - m_bReference(false), - m_bFirstField(false) {} - - void Reset() - { - m_poc = -1; - m_bReference = false; - m_bFirstField = false; - } - void SaveInfo(Frame const & frame) - { - m_poc = frame.Poc; - m_bReference = ((frame.Type & MFX_FRAMETYPE_REF) != 0); - m_bFirstField = !frame.bSecondField; - } - void CorrectFrameInfo(Frame & frame) - { - if (!isCorrespondSecondField(frame)) - return; - // copy params to the 2nd field - if (m_bReference) - frame.Type |= MFX_FRAMETYPE_REF; - } - bool isCorrespondSecondField(Frame const & frame) - { - if (m_poc + 1 != frame.Poc || !frame.bSecondField || !m_bFirstField) - return false; - return true; - } - bool bFirstField() { return m_bFirstField; } - }; - - typedef std::vector FrameArray; - typedef std::vector::iterator FrameIterator; - FrameArray m_queue; - LastReorderedFieldInfo m_lastFieldInfo; - FrameArray m_dpb; - mfxI32 m_lastIdr; // for POC calculation - mfxI32 m_anchorPOC; // for P-Pyramid - Frame m_lastFrame; - - mfxU8 GetNALUType(Frame const & frame, bool isRAPIntra); - bool HasL1(mfxI32 poc); - mfxU32 BRefOrder(mfxU32 displayOrder, mfxU32 begin, mfxU32 end, mfxU32 counter, bool & ref); - mfxU32 GetBiFrameLocation(mfxU32 displayOrder, mfxU32 num, bool &ref); - mfxU32 BPyrReorder(const std::vector & bframes); - FrameIterator Reorder(bool flush, bool bFields); - FrameIterator Reorder(FrameIterator begin, FrameIterator end, bool flush, bool bFields); -}; - -#endif // MFX_VERSION - -#endif // __ASG_FRAME_REORDER_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/generator.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/generator.h deleted file mode 100644 index c11343b..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/generator.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __GENERATOR_H__ -#define __GENERATOR_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "refcontrol.h" -#include "test_processor.h" - -class Generator : public TestProcessor { -public: - explicit Generator() {} - - ~Generator() {} - -private: - void Init() override; - - // Get surface and load new YUV frame from file to it - ExtendedSurface* PrepareSurface() override; - - // Save all data - void DropFrames() override; - void DropBuffers(ExtendedSurface& surf) override; - virtual void SavePSData() override; - - CSmplYUVReader m_FileReader; - CSmplYUVWriter m_FileWriter; - BufferWriter m_BufferWriter; -}; - -#endif // MFX_VERSION - -#endif // __GENERATOR_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/hevc_defs.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/hevc_defs.h deleted file mode 100644 index fd8f7da..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/hevc_defs.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __HEVC_DEFS_H__ -#define __HEVC_DEFS_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -//HEVC standard-defined limits on block sizes in terms of luma samples - -//CTUs -#define HEVC_MIN_CTU_SIZE 16 -#define HEVC_MAX_CTU_SIZE 64 - -#define HEVC_MIN_LOG2_CTU_SIZE 4 -#define HEVC_MAX_LOG2_CTU_SIZE 6 - -//CUs -//Min size is 8x8, max size is equal to current CTU size -#define HEVC_MIN_CU_SIZE 8 -#define HEVC_MIN_LOG2_CU_SIZE 3 - -//PUs -//Min size is either 4x8 or 8x4, max size is equal to current CU size -#define HEVC_MIN_PU_SIZE_LO 4 -#define HEVC_MIN_PU_SIZE_HI 8 - -//TUs -//Min size is 4x4, max size is 32x32 (cannot be larger than CU min size) -#define HEVC_MIN_TU_SIZE 4 -#define HEVC_MAX_TU_SIZE 32 - -#define HEVC_MIN_LOG2_TU_SIZE 2 -#define HEVC_MAX_LOG2_TU_SIZE 5 - -//Maximum QP value -#define HEVC_MAX_QP 51 - -// Luma sub-sample interpolation filter -#define LUMA_SUBSAMPLE_INTERPOLATION_FILTER_POSITIONS 4 -#define LUMA_TAPS_NUMBER 8 - -const mfxI32 LUMA_SUBSAMPLE_FILTER_COEFF[LUMA_SUBSAMPLE_INTERPOLATION_FILTER_POSITIONS][LUMA_TAPS_NUMBER] = -{ - { 0, 0, 0, 1, 0, 0, 0, 0 }, - { -1, 4, -10, 58, 17, -5, 1, 0 }, - { -1, 4, -11, 40, 40, -11, 4, -1 }, - { 0, 1, -5, 17, 58, -10, 4, -1 }, -}; - -#endif // MFX_VERSION - -#endif //__HEVC_DEFS_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inputparameters.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inputparameters.h deleted file mode 100644 index f01df8e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inputparameters.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_INPUT_PARAMETERS_H__ -#define __ASG_HEVC_INPUT_PARAMETERS_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include -#include - -#include "base_allocator.h" -#include "hevc_defs.h" -#include "util_defs.h" - -enum PROCESSING_MODE -{ - UNDEFINED_MODE = 0, - GENERATE, - VERIFY -}; - -// TODO: use std::bitset instead -enum -{ - UNDEFINED_TYPE = 0, - GENERATE_MV = 1 << 0, - GENERATE_PREDICTION = 1 << 1, - GENERATE_SPLIT = 1 << 2, - GENERATE_INTRA = 1 << 3, - GENERATE_INTER = 1 << 4, - GENERATE_PICSTRUCT = 1 << 5, - GENERATE_REPACK_CTRL = 1 << 6 -}; - -enum FRAME_MARKER -{ - GEN = 1, - MOD = 2, - SKIP = 3 -}; - -// Restrictions on CTU for generation of noisy blocks -struct CTUStructure -{ - //Below are default values that should be most relaxed - mfxU32 log2CTUSize = HEVC_MIN_LOG2_CTU_SIZE; - mfxU32 CTUSize = 1 << log2CTUSize; - mfxU32 minLog2CUSize = HEVC_MIN_LOG2_CU_SIZE; - mfxU32 maxLog2CUSize = HEVC_MIN_LOG2_CTU_SIZE; //NB: can be less than CTU size inside asg-hevc - //Standard specifies that CTU size is set equal to - //1 << maxLog2CUSize, but this is for encoder only: - //inside asg-hevc, we will maintain this separate upper - //limit on max CU size - - mfxU32 minLog2TUSize = HEVC_MIN_LOG2_TU_SIZE; //Must be less than minLog2CUSize - mfxU32 maxLog2TUSize = HEVC_MIN_LOG2_CTU_SIZE; - mfxU32 maxTUQTDepth = HEVC_MAX_LOG2_CTU_SIZE - HEVC_MIN_LOG2_TU_SIZE; //Overrides min TU size while - //building TU quadtree in CU - mfxU32 CTUMaxNum = 128; - mfxU32 MVRange = 12; - mfxU32 CTUDist = 3; //Default minimum distance between generated CTU blocks in terms of CTU - - bool bCUToPUSplit = true; //Whether or not CUs should be further split into PUs - bool bForceSymmetricPU = false; //Support only symmetric modes for CU into PU partioning - - inline mfxU32 GetMaxNumCuInCtu() - { - return (1 << (2 * (log2CTUSize - HEVC_MIN_LOG2_CU_SIZE))); - } -}; - -struct Frame -{ - mfxU32 DisplayOrder = 0xffffffff; - mfxU32 Type = MFX_FRAMETYPE_UNKNOWN; - mfxU8 NalType = 0xff; - mfxI32 Poc = -1; - mfxU32 Bpo = 0xffffffff; - bool bSecondField = false; - bool bBottomField = false; - mfxI32 LastRAP = -1; - mfxI32 IPoc = -1; - mfxI32 PrevIPoc = -1; - mfxI32 NextIPoc = -1; -}; - -struct ExternalFrame -{ - mfxU32 DisplayOrder; - mfxU32 Type; - mfxU8 NalType; - mfxI32 Poc; - bool bSecondField; - bool bBottomField; - std::vector ListX[2]; -}; - -// Structure which used for initial stream marking - -struct FrameProcessingParam -{ - FRAME_MARKER Mark = SKIP; - std::vector ReferencesL0; - std::vector ReferencesL1; - - mfxU32 DisplayOrder = 0xffffffff; - mfxU32 EncodedOrder = 0xffffffff; - - mfxU32 Type = MFX_FRAMETYPE_UNKNOWN; - std::vector ListX[2]; - - FrameProcessingParam & operator= (const ExternalFrame& rhs) - { - DisplayOrder = rhs.DisplayOrder; - Type = rhs.Type; - ListX[0] = rhs.ListX[0]; - ListX[1] = rhs.ListX[1]; - - return *this; - } -}; - -struct Thresholds -{ - // asg should exit with non-zero if MV/split-passrate is lower than threshold - mfxU32 mvThres = 0; - mfxU32 splitThres = 0; -}; - -class InputParams -{ -public: - - void ParseInputString(msdk_char **strInput, mfxU8 nArgNum); - - mfxU16 m_TestType = UNDEFINED_TYPE; - PROCESSING_MODE m_ProcMode = UNDEFINED_MODE; - - mfxU32 m_width = 0; - mfxU32 m_height = 0; - mfxU32 m_numFrames = 0; - - mfxU16 m_PicStruct = MFX_PICSTRUCT_PROGRESSIVE; - mfxU16 m_BRefType = MFX_B_REF_OFF; - mfxU16 m_GopOptFlag = 0; - mfxU16 m_GopSize = 1; - mfxU16 m_RefDist = 1; - mfxU16 m_NumRef = 1; - mfxU16 m_nIdrInterval = 0xffff; - mfxU16 m_NumRefActiveP = 3; - mfxU16 m_NumRefActiveBL0 = 3; - mfxU16 m_NumRefActiveBL1 = 1; - bool m_UseGPB = true; - - // Which blocks to use (it might be possible to forbid CUs of some sizes) - // TODO: extend and add to code - mfxU16 m_block_size_mask = 3; // 0 - invalid, 001 - 16x16, 010 - 32x32, 100 - 64x64 - - // Specifies which sub pixel precision mode is used in motion prediction. - // Valid values are: 0 ; 1 ; 3 (integer, half, quarter). 0x0 is default - mfxU16 m_SubPixelMode = 0; - - bool m_bVerbose = false; - bool m_bPrintHelp = false; - bool m_bUseLog = false; - - // Specifies the external MVP block size which is written to mfxFeiHevcEncMVPredictors::BlockSize - // Valid values are: 0 ; 1; 2; 3 (no MVP, MVP enabled for 16x16/32x32/64x64 block) - bool m_bIsForceExtMVPBlockSize = false; - mfxU32 m_ForcedExtMVPBlockSize = 0; - - // Specifies MVP block size used in the actual generation - // Valid values are the same as for m_ForcedExtMVPBlockSize - mfxU32 m_GenMVPBlockSize = 0; - - // For repack ctrl - mfxU32 m_NumAddPasses = 8; // Number of additional passes w/o first pass with clear QP value - mfxU8 m_DeltaQP[8] = {1,2,3,3,4,4,4,4}; - mfxU8 m_InitialQP = 26; - - msdk_string m_InputFileName; - msdk_string m_OutputFileName; - - msdk_string m_LogFileName; - - msdk_string m_PredBufferFileName; // filename for predictors ext buffer output - msdk_string m_PicStructFileName; // filename for pictures structure output - - msdk_string m_PakCtuBufferFileName; // filename for PAK CTU ext buffer input - msdk_string m_PakCuBufferFileName; // filename for PAK CU ext buffer input - - msdk_string m_RepackCtrlFileName; // filename for repack constrol output/input - msdk_string m_RepackStrFileName; // filename for multiPakStr input - msdk_string m_RepackStatFileName; // filename for repack stat input - - CTUStructure m_CTUStr; - - Thresholds m_Thresholds; - // Actual number of MV predictors enabled in FEI ENCODE. Used in verification mode - mfxU16 m_NumMVPredictors = 4; - - std::vector m_vProcessingParams; // FrameProcessingParam for entire stream - -private: - mfxU16 ParseSubPixelMode(msdk_char * strRawSubPelMode); - int GetIntArgument(msdk_char ** strInput, mfxU8 index, mfxU8 nArgNum); - msdk_string GetStringArgument(msdk_char ** strInput, mfxU8 index, mfxU8 nArgNum); -}; - -#endif // MFX_VERSION - -#endif // __ASG_HEVC_INPUT_PARAMETERS_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inter_test.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inter_test.h deleted file mode 100644 index b6d9d99..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/inter_test.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -//Some consts and enums for intra prediction - -#ifndef __INTER_TEST_H__ -#define __INTER_TEST_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "mfxdefs.h" - -enum INTER_PART_MODE { - INTER_NONE = -1, - INTER_2Nx2N = 0, - INTER_2NxN, - INTER_Nx2N, - INTER_NxN, - INTER_2NxnU, - INTER_2NxnD, - INTER_nLx2N, - INTER_nRx2N -}; -const mfxU32 INTER_PART_MODE_NUM = 8; -const mfxU32 INTER_8x8CU_PART_MODE_NUM = 3; //For 8x8 CUs only first 3 modes are available -const mfxU32 INTER_SYMM_PART_MODE_NUM = 4; //First 4 modes are symmetric - -#endif // MFX_VERSION - -#endif //__INTER_TEST_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/intra_test.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/intra_test.h deleted file mode 100644 index 8c0f464..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/intra_test.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -//Some consts and enums for intra prediction - -#ifndef __INTRA_TEST_H__ -#define __INTRA_TEST_H__ - -#include "mfxvideo.h" -#include - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "mfxdefs.h" - -enum INTRA_PART_MODE { - INTRA_NONE = -1, - INTRA_2Nx2N = 0, - INTRA_NxN = 1 -}; - -enum INTRA_MODE { - NONE = -1, - PLANAR = 0, - DC = 1, - ANG2 = 2, - ANG3 = 3, - ANG4 = 4, - ANG5 = 5, - ANG6 = 6, - ANG7 = 7, - ANG8 = 8, - ANG9 = 9, - ANG10_HOR = 10, - ANG11 = 11, - ANG12 = 12, - ANG13 = 13, - ANG14 = 14, - ANG15 = 15, - ANG16 = 16, - ANG17 = 17, - ANG18 = 18, - ANG19 = 19, - ANG20 = 20, - ANG21 = 21, - ANG22 = 22, - ANG23 = 23, - ANG24 = 24, - ANG25 = 25, - ANG26_VER = 26, - ANG27 = 27, - ANG28 = 28, - ANG29 = 29, - ANG30 = 30, - ANG31 = 31, - ANG32 = 32, - ANG33 = 33, - ANG34 = 34 -}; -const mfxU32 INTRA_MODE_NUM = 35; //Planar + DC + 33 angular modes (2 thru 34) - -enum INTRA_DIR { - HORIZONTAL, - VERTICAL, - DIR_NOT_SPECIFIED -}; - -enum FILTER_TYPE { - NO_FILTER, - THREE_TAP_FILTER, - STRONG_INTRA_SMOOTHING_FILTER -}; - -const mfxI8 angParam[] = { 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32 }; -const mfxI32 inverseAngParam[] = { -256, -315, -390, -482, -630, -910, -1638, -4096 }; - -inline bool isValidIntraMode(INTRA_MODE mode) -{ - // NONE is not a valid mode to operate - return PLANAR <= mode && mode <= ANG34; -} - -struct IntraParams { - INTRA_MODE intraMode = NONE; - INTRA_DIR direction = DIR_NOT_SPECIFIED; - mfxI8 intraPredAngle = 0; - mfxI32 invAngle = 0; - - IntraParams(INTRA_MODE mode) - : intraMode(mode) - { - if (!isValidIntraMode(mode)) - { - throw std::string("ERROR: IntraParams: incorrect intra mode"); - } - - if (intraMode == PLANAR || intraMode == DC) - { - return; - } - - if (intraMode < ANG18) - { - direction = HORIZONTAL; - intraPredAngle = angParam[intraMode - 2]; - - if (intraMode > ANG10_HOR) - invAngle = inverseAngParam[18 - intraMode]; - } - else - { - direction = VERTICAL; - intraPredAngle = -angParam[intraMode - 18]; - - if (intraMode < ANG26_VER) - invAngle = inverseAngParam[intraMode - 18]; - } - } -}; - -#endif // MFX_VERSION - -#endif // !__INTRA_TEST_H__ - diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/mvmvp_processor.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/mvmvp_processor.h deleted file mode 100644 index f0368ca..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/mvmvp_processor.h +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_MVMVP_PROCESSOR_H__ -#define __ASG_HEVC_MVMVP_PROCESSOR_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include - -#include "block_structures.h" -#include "frame_change_descriptor.h" -#include "random_generator.h" - -class MVMVPProcessor -{ -public: - MVMVPProcessor() = delete; - - MVMVPProcessor(mfxU32 extGenMVPBlockSize, mfxU16 extSubPelMode) : - m_GenMVPBlockSize(extGenMVPBlockSize), - m_SubPelMode(extSubPelMode), m_DoUseIntra(false) {} - - // Initiates an MVMVPProcessor with data from CTU - void InitMVPGridData(const CTUDescriptor& CTU, const FrameChangeDescriptor & frameDescr); - - bool GenValidMVMVPForPU(PUBlock & PU, const FrameChangeDescriptor & frameDescr); - - bool GenValidMVForPU(PUBlock & PU, const FrameChangeDescriptor & frameDescr); - - void FillFrameMVPExtBuffer(FrameChangeDescriptor& frameDescr); - - void GetMVPPools(std::vector> &outMVPPools); - -private: - - //Structure representing a single MVP block - struct MVPBlock : BaseBlock - { - MVPBlock(mfxU32 adrX = 0, mfxU32 adrY = 0, mfxU32 bWidth = 0, mfxU32 bHeight = 0) : - BaseBlock(adrX, adrY, bWidth, bHeight), mvpPoolGroupNo(MVP_INVALID_POOL_GROUP) {} - - // No. of generation MVP pool group - // For each two MVP blocks from the same group - // MVP pools should be equal - mfxI32 mvpPoolGroupNo = MVP_INVALID_POOL_GROUP; - - bool IsAlreadyInGroup() const { return mvpPoolGroupNo != MVP_INVALID_POOL_GROUP; } - - bool IsInGroup(mfxI32 extGroupNo) const { return mvpPoolGroupNo == extGroupNo; } - - void SetGroup(mfxI32 extGroupNo) { mvpPoolGroupNo = extGroupNo; } - - mfxI32 GetGroupNo() const { return mvpPoolGroupNo; } - }; - - static constexpr mfxI32 MVP_INVALID_POOL_GROUP = -1; - mfxU32 m_GenMVPBlockSize = 0; - mfxU16 m_SubPelMode = 0; - - std::vector m_mvpBlockGrid; - - // Type to store 32x32 MVP blocks. First value is actual BaseBlock - // Second one is no. (m_mvpBlockGrid) of left upper 16x16 block in the group - typedef std::pair MVP32x32BlockGroup; - - std::vector> m_mvpPools; - - // Checking test case type - bool m_DoUseIntra = false; - - // Custom hasher used in unordered_map - struct BaseBlockHasher - { - std::size_t operator() (const BaseBlock& key) const - { - return std::hash()(key.m_AdrX) ^ ((std::hash()(key.m_AdrY) << 1) >> 1) - ^ (std::hash()(key.m_BHeight) << 1) ^ (std::hash()(key.m_BWidth) >> 1); - } - }; - - std::unordered_map m_PUtoMVPPoolGroupMap; - - PUMotionVector GenerateMVP(const CTUDescriptor& CTU, const FrameChangeDescriptor& frameChangeDescr); - - PUMotionVector GenerateMV(const FrameChangeDescriptor& frameDescr); - - mfxI32 GetRandomMVComponent(mfxI32 lower, mfxI32 upper); - - // Functions used to put all PUs in CTU and MVP blocks in the correct MVP pool groups - // according to INTER splitting and MVPBlockSize parameter - // All these functions return actual number of MVP pool groups to generate - mfxI32 ConstructMVPPoolGroups(const CTUDescriptor& CTU); - - mfxI32 PutPUAndMVPBlocksIn16x16MVPPoolGroups(const CTUDescriptor& CTU); - mfxI32 PutPUAndMVPBlocksIn32x32MVPPoolGroups(const CTUDescriptor& CTU); - mfxI32 PutPUAndMVPBlocksInSingleMVPPoolGroup(const CTUDescriptor& CTU); - - // Functions used in MVP Ext buffer dumping - - // Gets offset in mfxExtFeiHevcEncMVPredictors::Data buffer for the provided MVP block element - mfxU32 CalculateOffsetInMVPredictorsBuffer(mfxU32 bufferPitch, const MVPBlock& mvpBlock); - - // Fill one mfxFeiHevcEncMVPredictors element in mfxExtFeiHevcEncMVPredictors::Data buffer - // associated with provided MVP block - void PutMVPIntoExtBuffer(const MVPBlock& mvpBlock, mfxExtFeiHevcEncMVPredictors* outputBuf); -}; - -#endif // MFX_VERSION - -#endif // __ASG_HEVC_MVMVP_PROCESSOR_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/random_generator.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/random_generator.h deleted file mode 100644 index 445e494..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/random_generator.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_RANDOM_GENERATOR_H__ -#define __ASG_HEVC_RANDOM_GENERATOR_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include - -#include "block_structures.h" - - -class ASGRandomGenerator -{ -public: - static ASGRandomGenerator& GetInstance(); - - mfxI32 GetRandomNumber(mfxI32 min, mfxI32 max); - mfxI32 GetRandomSign(); - bool GetRandomBit(); - mfxI32 GetRandomPicField(); - - // This method is considered as DEPRECATED - DO NOT USE IT IN THE FUTURE CHANGES - // The only purpose of this function to support previous code - // in order to sync with data generated with the previous ASG versions - void SeedGenerator(mfxU32 extSeed); - -private: - static constexpr mfxU32 DEFAULT_SEED = 1; - - ASGRandomGenerator(mfxU32 seed = DEFAULT_SEED) : m_Gen(seed) {} - - std::mt19937 m_Gen; // random number generator -}; - -// Alias for static GetInstance to use in client code -constexpr auto GetRandomGen = &ASGRandomGenerator::GetInstance; - -#endif // MFX_VERSION - -#endif // __ASG_HEVC_RANDOM_GENERATOR_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/refcontrol.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/refcontrol.h deleted file mode 100644 index 362778d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/refcontrol.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __REFCONTROL_H__ -#define __REFCONTROL_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include - -#include "inputparameters.h" -#include "random_generator.h" - -// These structures are used in asg-hevc-based PicStruct test - -struct PictureInfo -{ - mfxI32 orderCount = -1; // display order - mfxI32 codingOrder = -1; - mfxU32 frameType = MFX_FRAMETYPE_UNKNOWN; // IPB, IDR, ST/LT - mfxU32 picStruct = MFX_PICSTRUCT_UNKNOWN; // TF/BF - - bool operator==(const PictureInfo& rhs) const - { - return codingOrder == rhs.codingOrder && - orderCount == rhs.orderCount && - picStruct == rhs.picStruct && - frameType == rhs.frameType; - } -}; - -struct RefState -{ - PictureInfo picture; - std::vector DPB; // stores FrameOrder (POC) - std::vector RefListActive[2]; // (POC), any from DPB, can be repeated - - void Dump(std::fstream& fp) const; - bool Load(std::fstream& fp); // returns false on error - - bool operator==(const RefState& rhs) const - { - return - picture == rhs.picture && - DPB == rhs.DPB && - RefListActive[0] == rhs.RefListActive[0] && - RefListActive[1] == rhs.RefListActive[1]; - } -}; - -class RefControl -{ -public: - std::vector RefLogInfo; - - void Add(mfxI32 frameOrder); - void Encode(mfxI32 frameOrder); - void SetParams(const InputParams& params); -private: - mfxU32 maxDPBSize = 1; // max num ref + 1 for current - mfxU32 maxDelay = 1; // == number of allocated surfaces used in encoder reordering - - std::vector DPB; // can temporary be maxDPBSize+1, stores all active pictures - - std::vector RPB; // reordered picture buffer, pic goes to DPB when coded - - InputParams m_params; - mfxI32 m_lastIDR = 0; -}; - -// TODO: Replace global functions with lambdas -bool IsOlder(const PictureInfo& a, const PictureInfo& b); -bool IsInCodingOrder(const RefState& a, const RefState& b); - - -#endif // MFX_VERSION - -#endif // __REFCONTROL_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/test_processor.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/test_processor.h deleted file mode 100644 index 144ce92..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/test_processor.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_TEST_PROCESSOR_H__ -#define __ASG_HEVC_TEST_PROCESSOR_H__ - -#include "mfxvideo.h" -#include "sample_defs.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include - -#include "sample_utils.h" -#include "base_allocator.h" - -#include "inputparameters.h" -#include "frame_processor.h" -#include "util_defs.h" -#include "asglog.h" - -#include "refcontrol.h" - -class TestProcessor -{ -public: - virtual ~TestProcessor() {} - - void RunTest(const InputParams & params); - void RunPSTest(const InputParams & params); - - void RunRepackGenerate(); - void RunRepackVerify(); - - static ASGLog asgLog; - -protected: - void Init(const InputParams ¶ms); - virtual void Init() = 0; - - explicit TestProcessor() : fpPicStruct(), fpRepackCtrl(), fpRepackStr(), fpRepackStat() {} - - ExtendedSurface* GetFreeSurf(); - - // Get surface - virtual ExtendedSurface* PrepareSurface() { return nullptr; } - - void ChangePicture(ExtendedSurface& surf); - - void PrepareDescriptor(FrameChangeDescriptor & descr, const mfxU32 frameNum); - - // Save all data - virtual void DropFrames() {} - virtual void DropBuffers(ExtendedSurface& surf) {} - virtual void SavePSData() = 0; - - // Verification mode - virtual void VerifyDesc(FrameChangeDescriptor & frame_descr) {} - - InputParams m_InputParams; - std::vector m_vProcessingParams; // markers for all frames - std::list m_ProcessedFramesDescr; // DPB analogue - FrameProcessor m_FrameProcessor; // Class which performs processing of frame - std::list m_Surfaces; // Surface pool - - std::fstream fpPicStruct; - RefControl m_RefControl; - - std::fstream fpRepackCtrl; - std::fstream fpRepackStr; - std::fstream fpRepackStat; - -private: - //used to be global - - // used once in TestProcessor - std::list GetReferences(const std::list & RecentProcessed, const std::vector& ref_idx); - // never used actually - std::list GetSkips(const std::list & RecentProcessed); -}; - -#endif // MFX_VERSION - -#endif // __ASG_HEVC_TEST_PROCESSOR_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/util_defs.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/util_defs.h deleted file mode 100644 index 24c67c1..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/util_defs.h +++ /dev/null @@ -1,638 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __ASG_HEVC_UTILS_H__ -#define __ASG_HEVC_UTILS_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include -#include -#include - -#include "mfxdefs.h" -#include "mfxfeihevc.h" -#include "sample_defs.h" - -#define CHECK_THROW_ERR(STS, MESSAGE) { \ - if (STS < MFX_ERR_NONE)\ - throw std::string(std::string("ERROR: (") + ConvertMfxStatusToString(STS) + std::string(") ") + MESSAGE);\ - else if (STS > MFX_ERR_NONE) \ - std::cout << "WARNING: (" << ConvertMfxStatusToString(STS) << ") " << MESSAGE << std::endl; \ -} - -#define CHECK_THROW_ERR_BOOL(EXPR, MESSAGE) { \ - if (!EXPR) \ - throw std::string(MESSAGE); \ -} - -#define ASG_HEVC_ERR_LOW_PASS_RATE 100 - -#define LUMA_DEFAULT 0 -#define CHROMA_DEFAULT 127 -#define MAX_GEN_MV_ATTEMPTS 100 -#define MVP_BLOCK_SIZE 16 -#define MVP_PER_16x16_BLOCK 4 -#define MVMVP_SIZE_LIMIT 2048 //Hardware-imposed limit for either of MV/MVP coordinates in quarter-pixel - //units. To be increased in PV5 - -#define HW_SEARCH_ELEMENT_SIZE 16 //Hardware search element size in pixels (i.e. each 16x16 block in a CTU - //will be searched for in a search window centered on this 16x16 block) - -#define LOG2_MV_COMPARE_BASE_BLOCK_SIZE 2 //While comparing MVs of ASG and FEI CTUs, motion vectors will be compared - //on basis of square blocks of this size - -#define DELTA_PIXEL_BI_DIRECT 15 // Delta for bi-prediction test. This value will be used as difference between L0 and L1 references PUs -#define SPLIT_LOG_TABLE_SYM_WIDTH 12 //Width of a table field in split testing partition size table output - -//For repack ctrl -#define HEVC_MAX_NUMPASSES 8 //Number of additional passes with delta QPs - -std::string ConvertMfxStatusToString(mfxStatus sts); - -enum REF_LIST_INDEX -{ - L0 = 0, - L1 = 1 -}; - -template -inline T Clip3(const T valueToClip, const T low, const T high) -{ - if (valueToClip < low) - { - return low; - } - else if (valueToClip > high) - { - return high; - } - - return valueToClip; -} - -// Inaccurate limits. For one directional limit is width*height <= 2000; for Bi-dir 1000 -const mfxU32 SKL_SW_LIM_OD[2] = { 48, 40 }; // One-directional Motion Estimation Search Window limit; 0 - width, 1 - height -const mfxU32 SKL_SW_LIM_BD[2] = { 32, 32 }; // Bi-directional Motion Estimation Search Window limit; 0 - width, 1 - height - - -struct PUMotionVector -{ - PUMotionVector(mfxU8 refl0, mfxU8 refl1, mfxI16 MV1_x, mfxI16 MV1_y, mfxI16 MV2_x, mfxI16 MV2_y) - { - RefIdx = { refl0, refl1 }; - - MV[0] = { MV1_x, MV1_y }; - MV[1] = { MV2_x, MV2_y }; - } - - PUMotionVector() : PUMotionVector(0, 0, 0, 0, 0, 0) {} - - PUMotionVector(const PUMotionVector& vec) = default; - PUMotionVector& operator= (const PUMotionVector& vec) = default; - - bool CheckMVPExceedsSizeLimits() const - { - return (abs(MV[0].x) > MVMVP_SIZE_LIMIT || abs(MV[0].y) > MVMVP_SIZE_LIMIT - || abs(MV[1].x) > MVMVP_SIZE_LIMIT || abs(MV[1].y) > MVMVP_SIZE_LIMIT); - } - - bool operator==(const PUMotionVector& rhs) const - { - return (MV[0].x == rhs.MV[0].x && - MV[0].y == rhs.MV[0].y && - MV[1].x == rhs.MV[1].x && - MV[1].y == rhs.MV[1].y && - RefIdx.RefL0 == rhs.RefIdx.RefL0 && - RefIdx.RefL1 == rhs.RefIdx.RefL1); - } - - // Important: refIdx is not affected, i.e. inherited from this - const PUMotionVector operator+ (const PUMotionVector& rhs) const - { - return PUMotionVector(RefIdx.RefL0 , RefIdx.RefL1 , - MV[0].x + rhs.MV[0].x, MV[0].y + rhs.MV[0].y, - MV[1].x + rhs.MV[1].x, MV[1].y + rhs.MV[1].y); - } - - inline std::tuple GetL0MVTuple() const - { - return std::make_tuple(MV[0].x, MV[0].y, (mfxU32) RefIdx.RefL0); - } - - inline std::tuple GetL1MVTuple() const - { - return std::make_tuple(MV[1].x, MV[1].y, (mfxU32)RefIdx.RefL1); - } - - struct { - mfxU8 RefL0 : 4; - mfxU8 RefL1 : 4; - } RefIdx; - - mfxI16Pair MV[2]; /* index is 0 for L0 and 1 for L1 */ -}; - -struct Counters -{ - //Mapping (width;height) to (total) partitioning blocks - struct BlockSizeMapFEI : std::map, mfxU32> - { - inline void AddBlockTotal(mfxU32 width, mfxU32 height) - { - this->operator[](std::make_pair(width, height))++; - } - - inline mfxU32 GetTotalCount() - { - mfxU32 count = 0; - for (auto& blockSizeRecord : *this) - { - count += blockSizeRecord.second; - } - return count; - } - - void PrintTable() - { - std::stringstream tmp; - for (auto& blockSizeRecord : *this) - { - tmp.str(""); - tmp << blockSizeRecord.first.first << 'x' << blockSizeRecord.first.second; - std::cout << std::setw(SPLIT_LOG_TABLE_SYM_WIDTH) << tmp.str(); - } - std::cout << std::endl; - for (auto& blockSizeRecord : *this) - { - std::cout << std::setw(SPLIT_LOG_TABLE_SYM_WIDTH) << blockSizeRecord.second; - } - std::cout << std::endl; - } - }; - - //Mapping (width;height) to (correct in FEI; total) partitioning blocks - struct BlockSizeMapASG : std::map, std::pair> - { - inline void AddBlockCorrect(mfxU32 width, mfxU32 height) - { - this->operator[](std::make_pair(width, height)).first++; - } - - inline void AddBlockTotal(mfxU32 width, mfxU32 height) - { - this->operator[](std::make_pair(width, height)).second++; - } - - inline mfxU32 GetCorrectCount() - { - mfxU32 count = 0; - for (auto& blockSizeRecord : *this) - { - count += blockSizeRecord.second.first; - } - return count; - } - - inline mfxU32 GetTotalCount() - { - mfxU32 count = 0; - for (auto& blockSizeRecord : *this) - { - count += blockSizeRecord.second.second; - } - return count; - } - - void PrintTable() - { - std::stringstream tmp; - for (auto& blockSizeRecord : *this) - { - tmp.str(""); - tmp << blockSizeRecord.first.first << 'x' << blockSizeRecord.first.second; - std::cout << std::setw(SPLIT_LOG_TABLE_SYM_WIDTH) << tmp.str(); - } - std::cout << std::endl; - for (auto& blockSizeRecord : *this) - { - tmp.str(""); - tmp << blockSizeRecord.second.first << '/' << blockSizeRecord.second.second; - std::cout << std::setw(SPLIT_LOG_TABLE_SYM_WIDTH) << tmp.str(); - } - std::cout << std::endl; - } - }; - - BlockSizeMapASG m_testPUSizeMapASG; - BlockSizeMapFEI m_testPUSizeMapFEI; - - BlockSizeMapASG m_testCUSizeMapASG; - BlockSizeMapFEI m_testCUSizeMapFEI; - - mfxU32 m_testCTUs = 0; - - // MV - mfxU32 m_correctMVCmpBlocksL0 = 0; - mfxU32 m_correctMVCmpBlocksL1 = 0; - mfxU32 m_correctMVCmpBlocksBi = 0; - - mfxU32 m_totalMVCmpBlocksL0 = 0; - mfxU32 m_totalMVCmpBlocksL1 = 0; - mfxU32 m_totalMVCmpBlocksBi = 0; - - // Shouldn't affect test result - mfxU32 m_correctMVCmpBlocksL0PerMVPIndex[MVP_PER_16x16_BLOCK] = { 0, 0, 0, 0 }; - mfxU32 m_correctMVCmpBlocksL1PerMVPIndex[MVP_PER_16x16_BLOCK] = { 0, 0, 0, 0 }; - mfxU32 m_correctMVCmpBlocksBiPerMVPIndex[MVP_PER_16x16_BLOCK] = { 0, 0, 0, 0 }; - - mfxU32 m_totalMVCmpBlocksL0PerMVPIndex[MVP_PER_16x16_BLOCK] = { 0, 0, 0 ,0 }; - mfxU32 m_totalMVCmpBlocksL1PerMVPIndex[MVP_PER_16x16_BLOCK] = { 0, 0, 0, 0 }; - mfxU32 m_totalMVCmpBlocksBiPerMVPIndex[MVP_PER_16x16_BLOCK] = { 0, 0, 0, 0 }; - - //Won't affect test result - mfxU32 m_correctMVsL0FromBiMVCmpBlocks = 0; - mfxU32 m_correctMVsL1FromBiMVCmpBlocks = 0; - - mfxU32 m_correctRecords = 0; - mfxU32 m_totalPics = 0; - - //Splits - mfxU32 m_correctCUs = 0; - mfxU32 m_totalCUsASG = 0; - mfxU32 m_totalCUsFEI = 0; - - mfxU32 m_correctPUs = 0; - mfxU32 m_totalPUsASG = 0; - mfxU32 m_totalPUsFEI = 0; - - //Counters for exact matches - mfxU32 m_exactCTUs = 0; - mfxU32 m_exactCUs = 0; - mfxU32 m_exactPUs = 0; -}; - -// Wrapper on extension buffers -class ExtendedBuffer -{ -public: - - explicit ExtendedBuffer(mfxU32 id, mfxU32 pitch, mfxU32 height) - { - switch (id) - { - // Fill buffer. Track dynamic memory with smart pointer - - case MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED: - { - memset(&m_mvPred, 0, sizeof(m_mvPred)); - - m_mvPred.Header.BufferId = MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED; - m_mvPred.Header.BufferSz = sizeof(m_mvPred); - - mfxU64 data_size = pitch * height * sizeof(mfxFeiHevcEncMVPredictors); - - m_data.reset(new mfxU8[data_size]); - - m_mvPred.Data = reinterpret_cast(m_data.get()); - memset(m_mvPred.Data, 0, data_size); - - m_mvPred.Pitch = pitch; - m_mvPred.Height = height; - break; - } - case MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC: - { - memset(&m_pakCtuRecord, 0, sizeof(m_pakCtuRecord)); - - m_pakCtuRecord.Header.BufferId = MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC; - m_pakCtuRecord.Header.BufferSz = sizeof(m_pakCtuRecord); - - mfxU64 data_size = pitch * height * sizeof(mfxFeiHevcPakCtuRecordV0); - - m_data.reset(new mfxU8[data_size]); - - m_pakCtuRecord.Data = reinterpret_cast(m_data.get()); - memset(m_pakCtuRecord.Data, 0, data_size); - - m_pakCtuRecord.Pitch = pitch; - m_pakCtuRecord.Height = height; - - break; - } - case MFX_EXTBUFF_HEVCFEI_PAK_CU_REC: - { - memset(&m_pakCuRecord, 0, sizeof(m_pakCuRecord)); - - m_pakCuRecord.Header.BufferId = MFX_EXTBUFF_HEVCFEI_PAK_CU_REC; - m_pakCuRecord.Header.BufferSz = sizeof(m_pakCuRecord); - - mfxU64 data_size = pitch * height * sizeof(mfxFeiHevcPakCuRecordV0); - m_data.reset(new mfxU8[data_size]); - - m_pakCuRecord.Data = reinterpret_cast(m_data.get()); - memset(m_pakCuRecord.Data, 0, data_size); - - m_pakCuRecord.Pitch = pitch; - m_pakCuRecord.Height = height; - - break; - } - } - } - - // Hold this entry first in class - union - { - mfxExtFeiHevcEncMVPredictors m_mvPred; - mfxExtFeiHevcPakCtuRecordV0 m_pakCtuRecord; - mfxExtFeiHevcPakCuRecordV0 m_pakCuRecord; - }; - - std::unique_ptr m_data; -}; - -// Wrapper on mfxFrameSurface1 -class ExtendedSurface : public mfxFrameSurface1 -{ -public: - //Flag to track whether the surface in the pool has been written to disk, - //but not reused by another frame - bool isWritten = false; - mfxU32 encodedOrder = 0xffffffff; - - ExtendedSurface() = default; - ExtendedSurface(ExtendedSurface &&) = default; - ExtendedSurface(const ExtendedSurface &) = delete; - ExtendedSurface& operator= (const ExtendedSurface& vec) = delete; - - // Fill info about current surface. Track dynamic memory by smart pointer - void AllocData(mfxU32 width, mfxU32 height) - { - // Only I420 is supported for now - - Info.FourCC = MFX_FOURCC_YV12; - Info.ChromaFormat = MFX_CHROMAFORMAT_YUV420; - Info.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; - - Info.Width = MSDK_ALIGN16(width); - Info.Height = (MFX_PICSTRUCT_PROGRESSIVE == Info.PicStruct) ? - MSDK_ALIGN16(height) : MSDK_ALIGN32(height); - - Info.CropW = width; - Info.CropH = height; - - mfxU32 size = Info.CropH * Info.CropW * 3 / 2; - pSurfData.reset(new mfxU8[size]); - memset(pSurfData.get(), 0, size); //Zero-init - - Data.Y = pSurfData.get(); - Data.U = Data.Y + Info.CropH * Info.CropW; - Data.V = Data.U + Info.CropH * Info.CropW / 4; - Data.Pitch = Info.CropW; - } - - // Attach buffer to surface - // - // Important: after this operation, original buffer is no longer valid. All further ownership is taken by surface - void AttachBuffer(ExtendedBuffer & buffer) - { - - ExtBuffers.push_back(std::move(buffer)); // Dynamic memory is moved to new instance of ExtendedBuffer - - // Headers of all buffers should be in same place in memory, because union is used - vExtBuffersData.push_back(&ExtBuffers.back().m_mvPred.Header); - - ++Data.NumExtParam; - Data.ExtParam = vExtBuffersData.data(); - } - - // Get attached buffer by id - mfxExtBuffer* GetBuffer(mfxU32 id) - { - auto it = find_if(vExtBuffersData.begin(), vExtBuffersData.end(), - [&](mfxExtBuffer* buffer) { return buffer->BufferId == id; }); - - if (it == vExtBuffersData.end()) - throw std::string("ERROR: ExtendedSurface::GetBuffer: no buffer with id: ") + std::to_string(id); - - return *it; - } - - - void ForceMVPBlockSizeInOutputBuffer(mfxU32 forcedBlockSize) - { - for (mfxU32 i = 0; i < Data.NumExtParam; ++i) - { - mfxExtBuffer* buffer = Data.ExtParam[i]; - if (buffer == nullptr) - { - throw std::string("ERROR: ForceMVPBlockSizeInOutputBuffer: null pointer reference"); - } - if (buffer->BufferId == MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED) - { - mfxExtFeiHevcEncMVPredictors* mvpBuff = reinterpret_cast(buffer); - - for (mfxU32 i = 0; i < mvpBuff->Height * mvpBuff->Pitch; i++) - { - mvpBuff->Data[i].BlockSize = forcedBlockSize; - } - } - } - } - -private: - std::unique_ptr pSurfData; // Surface pixels - - std::list ExtBuffers; // List of ext buffers - std::vector vExtBuffersData; // Array of pointers -}; - -// This class performs writing of ext buffers to appropriate file -class BufferWriter -{ -public: - - // Start tracking of current buffer; fopen the file with file_name - void AddBuffer(mfxU32 id, msdk_string fileName) - { - FILE* fp = NULL; - - MSDK_FOPEN(fp, fileName.c_str(), MSDK_STRING("wb")); - - if (!fp) - throw std::string("ERROR: BufferWriter::AddBuffer : fopen_s failed"); - - m_bufferFileTable[id] = fp; //Add current file pointer to the map (buf ID->file) - } - - // Find buffer's file pointer in table by buffer id and write the content. - void WriteBuffer(mfxExtBuffer* buffer) - { - FILE* fp; - - if (m_bufferFileTable.find(buffer->BufferId) != m_bufferFileTable.end()) - { - fp = m_bufferFileTable[buffer->BufferId]; - } - else - { - throw std::string("ERROR: BufferWriter::WriteBuffer : unknown buffer with id: ") + std::to_string(buffer->BufferId); - } - - switch (buffer->BufferId) - { - case MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED: - { - mfxExtFeiHevcEncMVPredictors* mvpBuff = reinterpret_cast(buffer); - - auto numWritten = fwrite(mvpBuff->Data, sizeof(mfxFeiHevcEncMVPredictors) * mvpBuff->Pitch * mvpBuff->Height, 1, fp); - - if (numWritten != 1) - throw std::string("ERROR: BufferWriter::WriteBuffer : fwrite failed"); - } - break; - - default: - throw std::string("ERROR: BufferWriter::WriteBuffer : unknown buffer with id: ") + std::to_string(buffer->BufferId); - break; - } - - return; - } - - // Zero buffer's data - void ResetBuffer(mfxExtBuffer* buffer) - { - switch (buffer->BufferId) - { - case MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED: - { - mfxExtFeiHevcEncMVPredictors* mvpBuff = reinterpret_cast(buffer); - memset(mvpBuff->Data, 0, sizeof(mfxFeiHevcEncMVPredictors) * mvpBuff->Pitch * mvpBuff->Height); - break; - } - default: - throw std::string("ERROR: BufferWriter::ResetBuffer : unknown buffer with id: ") + std::to_string(buffer->BufferId); - break; - } - - return; - } - - // Close all file pointers - ~BufferWriter() - { - for (auto & fp : m_bufferFileTable) - { - fflush(fp.second); - fclose(fp.second); - } - } - -private: - std::map m_bufferFileTable; // map of id - file pointer -}; - -// This class performs reading of ext buffers from appropriate file -class BufferReader -{ -public: - - // Start tracking of current buffer; fopen the file with file_name - void AddBuffer(mfxU32 id, msdk_string fileName) - { - FILE* fp = NULL; - - MSDK_FOPEN(fp, fileName.c_str(), MSDK_STRING("rb")); - - if (!fp) - throw std::string("ERROR: BufferReader::AddBuffer : fopen_s failed"); - - m_bufferFileTable[id] = fp; //Add current file pointer to the map (buf ID->file) - } - - // Find buffer's file pointer in table by buffer id and write the content. - void ReadBuffer(mfxExtBuffer* buffer) //Function for reading can read 1 CU structure per call - { - FILE* fp; - - if (m_bufferFileTable.find(buffer->BufferId) != m_bufferFileTable.end()) - { - fp = m_bufferFileTable[buffer->BufferId]; - } - else - { - throw std::string("ERROR: BufferReader::ReadBuffer : unknown buffer with id: ") + std::to_string(buffer->BufferId); - } - - switch (buffer->BufferId) - { - case MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC: - { - mfxExtFeiHevcPakCtuRecordV0* pakCtuBuff = reinterpret_cast(buffer); - - auto numRead = fread(pakCtuBuff->Data, sizeof(mfxFeiHevcPakCtuRecordV0) * pakCtuBuff->Pitch * pakCtuBuff->Height, 1, fp); - - if (numRead != 1) - throw std::string("ERROR: BufferReader::ReadBuffer : fread failed"); - } - break; - - case MFX_EXTBUFF_HEVCFEI_PAK_CU_REC: - { - mfxExtFeiHevcPakCuRecordV0* pakCuBuff = reinterpret_cast(buffer); - - auto numRead = fread(pakCuBuff->Data, sizeof(mfxFeiHevcPakCuRecordV0) * pakCuBuff->Pitch * pakCuBuff->Height, 1, fp); - - if (numRead != 1) - throw std::string("ERROR: BufferReader::ReadBuffer : fread failed"); - } - break; - - default: - throw std::string("ERROR: BufferReader::ReadBuffer : unknown buffer with id: ") + std::to_string(buffer->BufferId); - break; - } - - return; - } - - // Close all file pointers - ~BufferReader() - { - for (auto & fp : m_bufferFileTable) - { - fflush(fp.second); - fclose(fp.second); - } - } - -private: - std::map m_bufferFileTable; // map of id - file pointer -}; - -#endif // MFX_VERSION - -#endif // __ASG_HEVC_UTILS_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/verifier.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/verifier.h deleted file mode 100644 index 014db6a..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/include/verifier.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __VERIFIER_H__ -#define __VERIFIER_H__ - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "refcontrol.h" -#include "test_processor.h" - -class Verifier : public TestProcessor { -public: - explicit Verifier() {} - - ~Verifier() {}; - - // Verification mode - void CheckStatistics(Thresholds thres); - -private: - struct MVCompareBlock : BaseBlock - { - bool predFlagL0 = false; - bool predFlagL1 = false; - bool bIsIntra = false; - mfxI16 usedMVPIndex = -1; - mfxI16 usedMVPPoolNo = -1; - PUMotionVector MV; - }; - - const mfxU32 MV_CMP_BLOCK_SIZE = (1 << LOG2_MV_COMPARE_BASE_BLOCK_SIZE); - - std::list m_errorMsgList; - - void Init() override; - - // Get surface - ExtendedSurface* PrepareSurface() override; - - // Save all data - void DropFrames() override; - virtual void SavePSData() override; - - // Verification mode - void VerifyDesc(FrameChangeDescriptor & frame_descr) override; - void ExtractMVs(const CTUDescriptor& ctuDescr, std::vector& mvCmpBlocks); - void CompareSplits(const CTUDescriptor& ctuDescrASG, const CTUDescriptor& ctuDescrFEI); - - void CompareMVs(const CTUDescriptor& asgCTUDescriptor, const CTUDescriptor& feiCTUDescriptor); - void CompareMVBlocks(const MVCompareBlock& asgMVCmpBlock, const MVCompareBlock& feiMVCmpBlock); - void CalculateTotalMVCmpBlocksInCTU(std::vector& mvCmpBlocks); - - void CountExactMatches(const CTUDescriptor& asgCTUDescriptor, const CTUDescriptor& feiCTUDescriptor); - CTUDescriptor ConvertFeiOutInLocalStr(const mfxFeiHevcPakCtuRecordV0& ctuPakFromFEI, const ExtendedBuffer& tmpCuBuff, const mfxU32 startCuOffset); - - void PrintPercentRatio(mfxU32 numerator, mfxU32 denominator); - bool CheckLowerThreshold(mfxU32 numerator, mfxU32 denominator, mfxU32 threshold = 100); - - void CheckMVs(Thresholds threshold); - void CheckL0MVs(Thresholds threshold); - void CheckL1MVs(Thresholds threshold); - void CheckBiMVs(Thresholds threshold); - - void CheckL0MVsPerMVPIndex(Thresholds threshold); - void CheckL1MVsPerMVPIndex(Thresholds threshold); - void CheckBiMVsPerMVPIndex(Thresholds threshold); - - void CheckSplits(Thresholds threshold); - void CheckPicStruct(); - - BufferReader m_BufferReader; - Counters m_Counters; -}; - -#endif // MFX_VERSION - -#endif // __VERIFIER_H__ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/asg-hevc.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/asg-hevc.cpp deleted file mode 100644 index bd2de5d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/asg-hevc.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#include -#include - -#include "inputparameters.h" -#include "test_processor.h" -#include "generator.h" -#include "verifier.h" - -using namespace std; - - -#if defined(_WIN32) || defined(_WIN64) -mfxI32 _tmain(mfxI32 argc, msdk_char *argv[]) -#else -int main(int argc, char *argv[]) -#endif -{ -#if MFX_VERSION < MFX_VERSION_NEXT - cout << "ERROR: For correct work minimal API MFX_VERSION_NEXT version is required" << endl; - return -1; - -#else - try { - InputParams params; - - params.ParseInputString(argv, argc); - if (params.m_bPrintHelp) { - return 0; - } - - switch (params.m_ProcMode) - { - case GENERATE: - { - Generator generator; - generator.RunTest(params); - } - break; - - case VERIFY: - { - Verifier verifier; - verifier.RunTest(params); - - if (params.m_TestType == GENERATE_REPACK_CTRL) - break; - - verifier.CheckStatistics(params.m_Thresholds); - } - break; - - default: - throw std::string("ERROR: Undefined processing mode"); - break; - } - } - catch (std::string& e) { - cout << e << endl; - return -1; - } - catch (int sts) - { - return sts; - } - catch (...) { - cout << "ERROR: Unexpected exception triggered" << endl; - return -1; - } - return 0; - -#endif // MFX_VERSION -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/block_structures.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/block_structures.cpp deleted file mode 100644 index 03e1040..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/block_structures.cpp +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "block_structures.h" - -void BaseBlock::GetChildBlock(std::vector& childrenBlocks) const -{ - childrenBlocks.clear(); - childrenBlocks.reserve(4); - - //sizes and positions - mfxU32 childHeight = m_BHeight / 2; - mfxU32 childWidth = m_BWidth / 2; - for (mfxU32 i = 0; i < 4; i++) - { - childrenBlocks.emplace_back(m_AdrX + childWidth * (i % 2), m_AdrY + childHeight * (i / 2), childHeight, childWidth); - } -} - -void BaseBlock::GetChildRefSampleInfo(const RefSampleAvail & currAvail, const BaseBlock & ctu, std::vector& childrenRefSampleAvail) const -{ - childrenRefSampleAvail.clear(); - childrenRefSampleAvail.resize(4); - - //is left down block available for children - childrenRefSampleAvail[0].LeftDown = true; - childrenRefSampleAvail[1].LeftDown = false; - - if (m_AdrY + m_BHeight == ctu.m_AdrY + ctu.m_BHeight) - { - childrenRefSampleAvail[2].LeftDown = true; - childrenRefSampleAvail[3].LeftDown = true; - } - else - { - childrenRefSampleAvail[2].LeftDown = currAvail.LeftDown; - childrenRefSampleAvail[3].LeftDown = false; - } - - //is up right block available for children - childrenRefSampleAvail[0].UpRight = true; - childrenRefSampleAvail[2].UpRight = true; - - if (m_AdrX + m_BWidth == ctu.m_AdrX + ctu.m_BWidth) - { - childrenRefSampleAvail[1].UpRight = true; - childrenRefSampleAvail[3].UpRight = true; - } - else - { - childrenRefSampleAvail[1].UpRight = currAvail.UpRight; - childrenRefSampleAvail[3].UpRight = false; - } -} - -//This recursive function fills outVec with BaseBlocks, coordinates and sizes of which correspond to -//the quad-tree structure specified by the quad-tree root node and the base size and coordinates of -//the "root node " -void QuadTree::GetQuadTreeBlocksRecur(QuadTreeNode & node, mfxU32 baseAdrX, mfxU32 baseAdrY, mfxU32 baseSize, std::vector& outVec) -{ - if (!node.m_Children.empty()) - { - for (mfxU32 i_y = 0; i_y < 2; i_y++) - { - for (mfxU32 i_x = 0; i_x < 2; i_x++) - { - QuadTreeNode& child = node.m_Children[2 * i_y + i_x]; - mfxU32 childSize = baseSize / 2; - mfxU32 childAdrX = baseAdrX + i_x * childSize; - mfxU32 childAdrY = baseAdrY + i_y * childSize; - GetQuadTreeBlocksRecur(child, childAdrX, childAdrY, childSize, outVec); - } - } - } - else - { - outVec.emplace_back(baseAdrX, baseAdrY, baseSize, baseSize); - return; - } -} - -void QuadTree::GetQuadTreeRefSampleAvailVector(QuadTreeNode & node, BaseBlock & currBlock, const BaseBlock & ctu, std::vector& outVec) -{ - RefSampleAvail helper(true, true); - GetQuadTreeRefSampleAvailVectorRecur(node, currBlock, helper, ctu, outVec); -} - -void QuadTree::GetQuadTreeRefSampleAvailVectorRecur(QuadTreeNode & node, BaseBlock & currBlock, const RefSampleAvail& currAvail, const BaseBlock & ctu, std::vector& outVec) -{ - if (!node.m_Children.empty()) - { - //children blocks, refSamples availability for children is counted here - std::vector childrenBlocks; - currBlock.GetChildBlock(childrenBlocks); - std::vector childrenRefSamplesInfo; - currBlock.GetChildRefSampleInfo(currAvail, ctu, childrenRefSamplesInfo); - - //recursive call for children - for (mfxU32 i = 0; i < 4; i++) - { - GetQuadTreeRefSampleAvailVectorRecur(node.m_Children[i], childrenBlocks[i], childrenRefSamplesInfo[i], ctu, outVec); - } - } - else - { - - //put leaves into outVec in depth-first order - outVec.emplace_back(currAvail); - } - return; -} - -PatchBlock::PatchBlock(const PatchBlock & rhs) : PatchBlock(static_cast(rhs)) -{ - memcpy(PatchData.get(), rhs.PatchData.get(), sizeof(mfxU8) * m_BWidth * m_BHeight * 3 / 2); -} - -PatchBlock & PatchBlock::operator=(const PatchBlock & rhs) -{ - BaseBlock::operator=(rhs); - - mfxU32 sq = m_BWidth * m_BHeight; - PatchData.reset(new mfxU8[sq * 3 / 2]); - - memcpy(PatchData.get(), rhs.PatchData.get(), sizeof(mfxU8) * sq * 3 / 2); - - m_YPlane = PatchData.get(); - m_UPlane = m_YPlane + sq; - m_VPlane = m_UPlane + (sq / 4); - - return *this; -} - -PatchBlock::PatchBlock(const BaseBlock& BB) : BaseBlock(BB) -{ - mfxU32 sq = m_BWidth * m_BHeight; - PatchData.reset(new mfxU8[sq * 3 / 2]); - m_YPlane = PatchData.get(); - m_UPlane = m_YPlane + sq; - m_VPlane = m_UPlane + (sq / 4); - - memset(m_YPlane, LUMA_DEFAULT, sq); - memset(m_UPlane, CHROMA_DEFAULT, sq / 4); - memset(m_VPlane, CHROMA_DEFAULT, sq / 4); -} - -//constructor that memsets PatchBlock with the particurlar sample -PatchBlock::PatchBlock(const BaseBlock& BB, mfxU8 y_comp, mfxU8 u_comp, mfxU8 v_comp) : BaseBlock(BB) -{ - mfxU32 sq = m_BWidth * m_BHeight; - PatchData.reset(new mfxU8[sq * 3 / 2]); - m_YPlane = PatchData.get(); - m_UPlane = m_YPlane + sq; - m_VPlane = m_UPlane + (sq / 4); - - memset(m_YPlane, y_comp, sq); - memset(m_UPlane, u_comp, sq / 4); - memset(m_VPlane, v_comp, sq / 4); -} - -//constructor that fills PatchBlock with coresponding data from the srcPatch -PatchBlock::PatchBlock(const BaseBlock& dstBlock, const PatchBlock& srcBlock) : PatchBlock(dstBlock) -{ - if (!dstBlock.IsInBlock(srcBlock)) - { - throw std::string("ERROR: PatchBlock: new PatchBlock should be located inside the old one in frame coords"); - } - - //Calculating the coords of dstBlock relative to srcBlock - mfxU32 offsetX = dstBlock.m_AdrX - srcBlock.m_AdrX; - mfxU32 offsetY = dstBlock.m_AdrY - srcBlock.m_AdrY; - - for (mfxU32 i = 0; i < m_BHeight; i++) - { - memcpy(m_YPlane + i * m_BWidth, srcBlock.m_YPlane + (offsetY + i) * srcBlock.m_BWidth + offsetX, m_BWidth); - } - for (mfxU32 i = 0; i < m_BHeight / 2; i++) - { - memcpy(m_UPlane + i * (m_BWidth / 2), srcBlock.m_UPlane + (offsetY / 2 + i) * (srcBlock.m_BWidth / 2) + offsetX / 2, m_BWidth / 2); - memcpy(m_VPlane + i * (m_BWidth / 2), srcBlock.m_VPlane + (offsetY / 2 + i) * (srcBlock.m_BWidth / 2) + offsetX / 2, m_BWidth / 2); - } -} - -//constructor that filles PatchBlock with coresponding data from the surface -PatchBlock::PatchBlock(const BaseBlock & BB, const ExtendedSurface & surf) : PatchBlock(BB) -{ - if (!BB.IsInBlock(BaseBlock(0, 0, surf.Info.CropW, surf.Info.CropH))) - { - throw std::string("ERROR: PatchBlock: new patchBlock should be located inside the surface"); - } - - for (mfxU32 i = 0; i < m_BHeight; i++) - { - memcpy(m_YPlane + i * m_BWidth, surf.Data.Y + (m_AdrY + i) * surf.Data.Pitch + m_AdrX, m_BWidth); - } - for (mfxU32 i = 0; i < m_BHeight / 2; i++) - { - memcpy(m_UPlane + i * (m_BWidth / 2), surf.Data.U + (m_AdrY / 2 + i) * (surf.Data.Pitch / 2) + m_AdrX / 2, m_BWidth / 2); - memcpy(m_VPlane + i * (m_BWidth / 2), surf.Data.V + (m_AdrY / 2 + i) * (surf.Data.Pitch / 2) + m_AdrX / 2, m_BWidth / 2); - } -} - -//distance between current PatchBlock and other_patch counted as a sum of abs differences between luma components over all samples -mfxU32 PatchBlock::CalcYSAD(const PatchBlock & otherPatch) const -{ - mfxU32 curDiff = 0; - if (m_BHeight == otherPatch.m_BHeight && m_BWidth == otherPatch.m_BWidth) - { - for (mfxU32 i = 0; i < m_BHeight*m_BWidth; i++) - { - curDiff += abs(m_YPlane[i] - otherPatch.m_YPlane[i]); - } - } - else - { - throw std::string("ERROR: CalcYSAD: block size mismatch"); - } - return curDiff; -} - -//compAdrX and compAdrY are given in the comp color space -mfxU8 PatchBlock::GetSampleI420(COLOR_COMPONENT comp, mfxU32 compAdrX, mfxU32 compAdrY) const -{ - switch (comp) - { - case LUMA_Y: - return m_YPlane[compAdrY * m_BWidth + compAdrX]; - case CHROMA_U: - return m_UPlane[compAdrY * (m_BWidth / 2) + compAdrX]; - case CHROMA_V: - return m_VPlane[compAdrY * (m_BWidth / 2) + compAdrX]; - default: - throw std::string("ERROR: Trying to get unspecified component"); - } -} - -//Inserts refPatch into this PatchBlock, if refPatch is located inside this PatchBlock -void PatchBlock::InsertAnotherPatch(const PatchBlock & refPatch) -{ - if (!refPatch.IsInBlock(*this)) - { - throw std::string("ERROR: InsertAnotherPatch: refPatch should be inside targetPatch\n"); - } - - //Calculating coordinate offset of refPatch relative to this PatchBlock - mfxU32 offsetX = refPatch.m_AdrX - m_AdrX; - mfxU32 offsetY = refPatch.m_AdrY - m_AdrY; - - //luma - for (mfxU32 i = 0; i < refPatch.m_BHeight; i++) - { - memcpy(m_YPlane + (offsetY + i) * m_BWidth + offsetX, refPatch.m_YPlane + i * refPatch.m_BWidth, refPatch.m_BWidth); - } - //chroma U, V - for (mfxU32 i = 0; i < refPatch.m_BHeight / 2; ++i) - { - memcpy(m_UPlane + (offsetY / 2 + i) * m_BWidth / 2 + offsetX / 2, refPatch.m_UPlane + i * (refPatch.m_BWidth / 2), refPatch.m_BWidth / 2); - memcpy(m_VPlane + (offsetY / 2 + i) * m_BWidth / 2 + offsetX / 2, refPatch.m_VPlane + i * (refPatch.m_BWidth / 2), refPatch.m_BWidth / 2); - } - return; -} - -//Returns a BaseBlock with coordinates that are shifted by the m_MV motion vector -//from the corresponding list relative to the current PU position -BaseBlock PUBlock::GetShiftedBaseBlock(REF_LIST_INDEX list) const -{ - mfxI64 posX = (mfxI64) m_AdrX + (m_MV.MV[list].x >> 2); - mfxI64 posY = (mfxI64) m_AdrY + (m_MV.MV[list].y >> 2); - - if (posX < 0 && posY < 0) - { - throw std::string("ERROR: GetShiftedBaseBlock: negative resulting block coords"); - } - - return BaseBlock((mfxU32) posX, (mfxU32) posY, m_BWidth, m_BHeight); -} - -void CUBlock::BuildPUsVector(INTER_PART_MODE mode) -{ - switch (mode) - { - case INTER_2NxN: - // UP PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth, m_BHeight / 2)); - // DOWN PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY + m_BHeight / 2, m_BWidth, m_BHeight / 2)); - break; - - case INTER_Nx2N: - // LEFT PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth / 2, m_BHeight)); - // RIGHT PU - m_PUVec.emplace_back(PUBlock(m_AdrX + m_BWidth / 2, m_AdrY, m_BWidth / 2, m_BHeight)); - break; - - case INTER_NxN: - // TOP LEFT PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth / 2, m_BHeight / 2)); - // TOP RIGHT PU - m_PUVec.emplace_back(PUBlock(m_AdrX + m_BWidth / 2, m_AdrY, m_BWidth / 2, m_BHeight / 2)); - // BOT LEFT PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY + m_BHeight / 2, m_BWidth / 2, m_BHeight / 2)); - // BOT RIGHT PU - m_PUVec.emplace_back(PUBlock(m_AdrX + m_BWidth / 2, m_AdrY + m_BHeight / 2, m_BWidth / 2, m_BHeight / 2)); - break; - - case INTER_2NxnU: - // UP SMALL PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth, m_BHeight / 4)); - // DOWN LARGE PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY + m_BHeight / 4, m_BWidth, (m_BHeight * 3) / 4)); - break; - - case INTER_2NxnD: - // UP LARGE PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth, (m_BHeight * 3) / 4)); - // DOWN SMALL PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY + (m_BHeight * 3) / 4, m_BWidth, m_BHeight / 4)); - break; - - case INTER_nLx2N: - // LEFT SMALL PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth / 4, m_BHeight)); - // RIGHT LARGE PU - m_PUVec.emplace_back(PUBlock(m_AdrX + m_BWidth / 4, m_AdrY, (m_BWidth * 3) / 4, m_BHeight)); - break; - - case INTER_nRx2N: - // LEFT LARGE PU - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, (m_BWidth * 3) / 4, m_BHeight)); - // RIGHT SMALL PU - m_PUVec.emplace_back(PUBlock(m_AdrX + (m_BWidth * 3) / 4, m_AdrY, m_BWidth / 4, m_BHeight)); - break; - - case INTER_2Nx2N: - default: - m_PUVec.emplace_back(PUBlock(m_AdrX, m_AdrY, m_BWidth, m_BHeight)); - break; - } - return; -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_marker.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_marker.cpp deleted file mode 100644 index 6e1e6de..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_marker.cpp +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "frame_marker.h" -#include "frame_reorder.h" - -void FrameMarker::PreProcessStreamConfig(InputParams & params) -{ - try - { - BuildRefLists(params); - TagFrames(params); - - params.m_vProcessingParams = m_vProcessingParams; - } - catch (std::string & e) { - std::cout << e << std::endl; - throw std::string("ERROR: FrameMarker::PreProcessStreamConfig"); - } - return; -} - -void FrameMarker::BuildRefLists(const InputParams & params) -{ - // Parameters for reordering - m_vProcessingParams.resize(params.m_numFrames); - - FrameReorder reorder(params); - - mfxVideoParam param = {}; - param.mfx.GopOptFlag = params.m_GopOptFlag; - param.mfx.GopPicSize = params.m_GopSize; - param.mfx.GopRefDist = params.m_RefDist; - param.mfx.IdrInterval = params.m_nIdrInterval; - param.mfx.FrameInfo.PicStruct = params.m_PicStruct; - - // Construction of the frame with correct lists - // Reference list creating - mfxU32 idxEncoded = 0; - for (mfxU32 idxFrame = 0; idxFrame < params.m_numFrames; ++idxFrame) - { - ExternalFrame f = reorder.CreateExternalFrame(idxFrame, param); - if (f.Poc != -1) - { - m_vProcessingParams.at(f.DisplayOrder) = f; - m_vProcessingParams.at(f.DisplayOrder).EncodedOrder = idxEncoded; - ++idxEncoded; - } - } - // Drain buffered frames - while (reorder.GetBufferedQueueSize() != 0) - { - ExternalFrame f = reorder.CreateExternalFrame(-1, param); - m_vProcessingParams.at(f.DisplayOrder) = f; - m_vProcessingParams.at(f.DisplayOrder).EncodedOrder = idxEncoded; - ++idxEncoded; - } - - return; -} - -void FrameMarker::TagFrames(const InputParams & params) -{ - mfxVideoParam param = {}; - param.mfx.GopOptFlag = params.m_GopOptFlag; - param.mfx.GopPicSize = params.m_GopSize; - param.mfx.GopRefDist = params.m_RefDist; - param.mfx.IdrInterval = params.m_nIdrInterval; - param.mfx.FrameInfo.PicStruct = params.m_PicStruct; - - std::vector refFramesL0; - std::vector refFramesL1; - refFramesL0.reserve(std::max(params.m_NumRefActiveP, params.m_NumRefActiveBL0)); - refFramesL1.reserve(params.m_NumRefActiveBL1); - - mfxU32 num_gen = 0, num_mod = 0; - - if (GenerateInterMBs(params.m_TestType)) - { - // Current test requires P/B frames - - // Creating of the processing parameters for each frame - // It contains mark of the frame, reference frames for MOD frames (test frame) - // For frames with mark GEN or SKIP reference frames are empty - for (mfxU32 idxFrame = 0; idxFrame < params.m_numFrames; ++idxFrame) - { - // Clear references - refFramesL0.clear(); - refFramesL1.clear(); - - // Marker shouldn't set P-frames as MOD in presets with B-frames - if ((m_vProcessingParams.at(idxFrame).Type & MFX_FRAMETYPE_P) && !HasBFramesInGOP(params.m_RefDist)) - { - // We need to check number of available reference and their status - // If they already are MOD or GEN we won't use them - if (m_vProcessingParams.at(idxFrame).ListX[0].size() == params.m_NumRefActiveP && !HasAlreadyUsedRefs(idxFrame, 0)) - { - SetRefList(idxFrame, 0, refFramesL0, num_gen); - m_vProcessingParams.at(idxFrame).ReferencesL0 = refFramesL0; - if (params.m_UseGPB) - { - SetRefList(idxFrame, 1, refFramesL1, num_gen); - m_vProcessingParams.at(idxFrame).ReferencesL1 = refFramesL1; - } - - m_vProcessingParams.at(idxFrame).Mark = MOD; - ++num_mod; - } - } - else if (m_vProcessingParams.at(idxFrame).Type & MFX_FRAMETYPE_B) - { - // We need to check number of available reference and their status - // If they already are MOD or GEN we won't use them - if ((m_vProcessingParams.at(idxFrame).ListX[0].size() == params.m_NumRefActiveBL0 && !HasAlreadyUsedRefs(idxFrame, 0)) - && (m_vProcessingParams.at(idxFrame).ListX[1].size() == params.m_NumRefActiveBL1 && !HasAlreadyUsedRefs(idxFrame, 1))) - { - SetRefList(idxFrame, 0, refFramesL0, num_gen); - SetRefList(idxFrame, 1, refFramesL1, num_gen); - m_vProcessingParams.at(idxFrame).ReferencesL0 = refFramesL0; - m_vProcessingParams.at(idxFrame).ReferencesL1 = refFramesL1; - m_vProcessingParams.at(idxFrame).Mark = MOD; - ++num_mod; - } - } - } - } - else - { - // Intra test only - for (mfxU32 idxFrame = 0; idxFrame < params.m_numFrames; ++idxFrame) - { - m_vProcessingParams.at(idxFrame).Mark = MOD; - ++num_mod; - } - } - - // Check that preset is valid, i.e. at least test_frames_percent_min frames are utilized for testing - const mfxU32 test_frames_percent_min = 15; - - mfxU32 test_frames_percent = 100 * (num_gen + num_mod) / params.m_numFrames; - - if (test_frames_percent < test_frames_percent_min) - throw std::string("ERROR: FrameMaker::CreateProcessingParams: Current preset involves too few frames"); -} - -bool FrameMarker::HasAlreadyUsedRefs(mfxU32 frame, mfxU8 list) -{ - for (mfxU32 idxRefLX = 0; idxRefLX < m_vProcessingParams.at(frame).ListX[list].size(); ++idxRefLX) - { - if (m_vProcessingParams.at(m_vProcessingParams.at(frame).ListX[list][idxRefLX].DisplayOrder).Mark != SKIP) - { - return true; - } - } - return false; -} - -void FrameMarker::SetRefList(mfxU32 frame, mfxU8 list, std::vector & refFrames, mfxU32 & num_gen) -{ - for (mfxU32 idxRefLX = 0; idxRefLX < m_vProcessingParams.at(frame).ListX[list].size(); ++idxRefLX) - { - mfxU32 idxFrameLX = m_vProcessingParams.at(frame).ListX[list].at(idxRefLX).DisplayOrder; - refFrames.push_back(idxFrameLX); - m_vProcessingParams.at(idxFrameLX).Mark = GEN; - ++num_gen; - } - return; -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_processor.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_processor.cpp deleted file mode 100644 index 5cc8fdb..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_processor.cpp +++ /dev/null @@ -1,1824 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "frame_processor.h" -#include "random_generator.h" - - -// Initialize parameters -void FrameProcessor::Init(const InputParams ¶ms) -{ - m_CropH = params.m_height; - m_CropW = params.m_width; - - m_CTUStr = params.m_CTUStr; - - // align by CUSize - m_Height = MSDK_ALIGN(m_CropH, m_CTUStr.CTUSize); - m_Width = MSDK_ALIGN(m_CropW, m_CTUStr.CTUSize); - - m_HeightInCTU = m_Height / m_CTUStr.CTUSize; - m_WidthInCTU = m_Width / m_CTUStr.CTUSize; - - m_ProcMode = params.m_ProcMode; - - m_SubPelMode = params.m_SubPixelMode; - - m_IsForceExtMVPBlockSize = params.m_bIsForceExtMVPBlockSize; - m_ForcedExtMVPBlockSize = params.m_ForcedExtMVPBlockSize; - m_GenMVPBlockSize = SetCorrectMVPBlockSize(params.m_GenMVPBlockSize); -} - -// Beginning of processing of current frame. Only MOD frames are processed - -void FrameProcessor::ProcessFrame(FrameChangeDescriptor & frame_descr) -{ - try - { - switch (frame_descr.m_changeType) - { - case GEN: - return; - break; - - case MOD: - GenCTUParams(frame_descr); - GenAndApplyPrediction(frame_descr); - UnlockSurfaces(frame_descr); - break; - - case SKIP: - UnlockSurfaces(frame_descr); - break; - - default: - return; - break; - } - } - catch (std::string & e) { - std::cout << e << std::endl; - throw std::string("ERROR: FrameProcessor::ProcessFrame"); - } - return; -} - -bool FrameProcessor::IsSampleAvailable(mfxU32 AdrX, mfxU32 AdrY) -{ - return (AdrY < m_CropH && AdrX < m_CropW); -} - -// Only I420 color format are supported -mfxU8 FrameProcessor::GetSampleI420(COLOR_COMPONENT comp, mfxU32 AdrX, mfxU32 AdrY, mfxFrameSurface1* surf) -{ - if (surf == nullptr) - { - throw std::string("ERROR: GetSampleI420: null pointer reference"); - } - - switch (comp) - { - case LUMA_Y: - return surf->Data.Y[AdrY * surf->Data.Pitch + AdrX]; - case CHROMA_U: - return surf->Data.U[(AdrY / 2) * (surf->Data.Pitch / 2) + (AdrX / 2)]; - case CHROMA_V: - return surf->Data.V[(AdrY / 2) * (surf->Data.Pitch / 2) + (AdrX / 2)]; - default: - throw std::string("ERROR: Trying to get unspecified component"); - } -} - -mfxI32 FrameProcessor::GetClippedSample(COLOR_COMPONENT comp, mfxI32 X, mfxI32 Y, mfxFrameSurface1 * surf) -{ - mfxU32 clippedX = Clip3(X, 0, (mfxI32)m_CropW); - mfxU32 clippedY = Clip3(Y, 0, (mfxI32)m_CropH); - - return GetSampleI420(comp, clippedX, clippedY, surf); -} - -// These functions are to be used after applying CalculateLumaPredictionSamplePreWP -// In specification default weighted prediction is the final scaling step for sample prediction. -// predSampleL0 is an interpolated Luma sample value which is calculated in CalculateLumaPredictionSamplePreWP() -// Output is final scaled and rounded Luma value which returns in CalculateLumaPredictionSamplePreWP() -// See 8.5.3.3.4.2 "Default weighted sample prediction process" from 4.0 ITU-T H.265 (V4) 2016-12-22 -mfxU8 FrameProcessor::GetDefaultWeightedPredSample(mfxI32 predSampleLx) -{ - // These shift and offset variables are defined in H265 standard for 8 bit color depth - constexpr mfxU16 shift1 = 6; - constexpr mfxU16 offset1 = 1 << (shift1 - 1); // 2^5 = 32 - - constexpr mfxI32 upperBound = (1 << 8) - 1; // 2^8 - 1 = 255 - mfxI32 predSample = (predSampleLx + offset1) >> shift1; - - return mfxU8(Clip3(predSample, 0, upperBound)); -} - -// Alternative in case working with B-frames -mfxU8 FrameProcessor::GetDefaultWeightedPredSample(mfxI32 predSampleL0, mfxI32 predSampleL1) -{ - // These shift and offset variables are defined in H265 standard for 8 bit color depth - mfxU16 shift2 = 7; - mfxU16 offset2 = 1 << (shift2 - 1); // 2^6 = 64 - - mfxI32 upperBound = (1 << 8) - 1; // 2^8 - 1 = 255 - - mfxI32 predSample = (predSampleL0 + predSampleL1 + offset2) >> shift2; - - return mfxU8(Clip3(predSample, 0, upperBound)); -} - -void FrameProcessor::GenRandomQuadTreeStructure(QuadTree& QT, mfxU8 minDepth, mfxU8 maxDepth) -{ - if (!QT.IsEmpty()) - { - QT.Clear(); - } - - GenRandomQuadTreeSubstrRecur(QT.root, minDepth, maxDepth); -} - -void FrameProcessor::GenRandomQuadTreeSubstrRecur(QuadTreeNode& node, mfxU8 minDepth, mfxU8 maxDepth) -{ - if (node.m_Level < minDepth || - (node.m_Level < maxDepth && GetRandomGen().GetRandomBit())) - { - node.MakeChildren(); - for (auto& child : node.m_Children) - { - GenRandomQuadTreeSubstrRecur(child, minDepth, maxDepth); - } - } - return; -} - -//Make a quad-tree structure inside ctu's QuadTree from FEI output -void FrameProcessor::GenQuadTreeInCTUWithBitMask(CTUDescriptor& CTU, mfxU32 bitMask) -{ - if (bitMask & 1) - { - CTU.m_CUQuadTree.root.MakeChildren(); - GenQuadTreeWithBitMaskRecur(CTU.m_CUQuadTree.root, bitMask >> 1); - } - - return; -} - -void FrameProcessor::GenQuadTreeWithBitMaskRecur(QuadTreeNode& node, mfxU32 bitMask) -{ - for (mfxU32 i = 0; i < 4; i++) - { - if (bitMask & (1 << i)) - { - node.m_Children[i].MakeChildren(); - - if (node.m_Children[i].m_Level < 2) - { - GenQuadTreeWithBitMaskRecur(node.m_Children[i], bitMask >> 4 * (i + 1)); - } - } - } - - return; -} - -//Fills CU vector inside CTU with correct CU blocks in CTU quad-tree z-scan order -//For each CU, depending on the test type, its prediction mode is selected -//and further CU partitioning/mode selection is made (i.e. PU and TU partitioning -//and per TU intra mode selection) -void FrameProcessor::GenCUVecInCTU(CTUDescriptor& ctu, mfxU16 testType) -{ - QuadTree& QT = ctu.m_CUQuadTree; - std::vector tmpVec; - QT.GetQuadTreeBlocksRecur(QT.root, ctu.m_AdrX, ctu.m_AdrY, ctu.m_BHeight, tmpVec); - - for (auto& block : tmpVec) - { - CUBlock cu_block(block); - - if (testType & GENERATE_INTER && testType & GENERATE_INTRA) - { - cu_block.m_PredType = (GetRandomGen().GetRandomBit()) ? - INTRA_PRED : INTER_PRED; - } - else if (testType & GENERATE_INTER) - { - cu_block.m_PredType = INTER_PRED; - } - else - { - cu_block.m_PredType = INTRA_PRED; - } - - if (cu_block.m_PredType == INTRA_PRED) - { - MakeIntraCU(cu_block); - } - else if (cu_block.m_PredType == INTER_PRED) - { - MakeInterCU(cu_block, testType); - } - - ctu.m_CUVec.push_back(cu_block); - } -} - -void FrameProcessor::GetRefSampleAvailFlagsForTUsInCTU(CTUDescriptor & CTU) -{ - QuadTree& QT = CTU.m_CUQuadTree; - std::vector CURefSampleAvailVec; - //CTU is set with RefSamples available in both directions here. - //this should be made by guaranteeing that CTUs are far from each other - //(at least one initial CTU between two substituted CTUs in both directions) - QT.GetQuadTreeRefSampleAvailVector(QT.root, CTU, CTU, CURefSampleAvailVec); - - if (CURefSampleAvailVec.size() != CTU.m_CUVec.size()) - { - throw std::string("ERROR: GetRefSampleAvailFlagsForTUsInCTU: mismatching CU and RefSampleAvail vector sizes"); - } - - for (mfxU32 i = 0; i < CTU.m_CUVec.size(); i++) - { - CUBlock & CU = CTU.m_CUVec[i]; - if (CU.m_PredType == INTRA_PRED) - { - QuadTree& RQT = CU.m_TUQuadTree; - std::vector TURefSampleAvailVec; - - RQT.GetQuadTreeRefSampleAvailVectorRecur(RQT.root, CU, CURefSampleAvailVec[i], CTU, TURefSampleAvailVec); - for (mfxU32 j = 0; j < CU.m_TUVec.size(); j++) - { - TUBlock& TU = CU.m_TUVec[j]; - TU.m_RefSampleAvail = TURefSampleAvailVec[j]; - } - } - } -} - -void FrameProcessor::GenRandomTUQuadTreeInCU(CUBlock& cu_block) -{ - QuadTree& quadTreeTU = cu_block.m_TUQuadTree; - mfxU32 minTUDepth = std::max(0, mfxI32(CeilLog2(cu_block.m_BHeight) - m_CTUStr.maxLog2TUSize)); - mfxU32 maxTUDepth = std::min(CeilLog2(cu_block.m_BHeight) - m_CTUStr.minLog2TUSize, m_CTUStr.maxTUQTDepth); - - GenRandomQuadTreeStructure(quadTreeTU, minTUDepth, maxTUDepth); -} - - -//Make a quad-tree structure inside ctu's QuadTree so that all CU blocks inside CTU -//have a size smaller than specified by maxLog2CUSize and larger than specified by minLog2CUSize -void FrameProcessor::GenRandomCUQuadTreeInCTU(CTUDescriptor& ctu) -{ - QuadTree& quadTreeCU = ctu.m_CUQuadTree; - mfxU32 minCUDepth = std::max(0, mfxI32(CeilLog2(ctu.m_BHeight) - m_CTUStr.maxLog2CUSize)); - mfxU32 maxCUDepth = CeilLog2(ctu.m_BHeight) - m_CTUStr.minLog2CUSize; - GenRandomQuadTreeStructure(quadTreeCU, minCUDepth, maxCUDepth); -} - -//TODO: -bool FrameProcessor::IsBlockUniform(const BaseBlock& block, PatchBlock& frame) -{ - return false; -} - -//TODO: -void FrameProcessor::AlterBorderSamples(const BaseBlock& block, PatchBlock& frame) -{ - -} - -void FrameProcessor::ChooseContrastIntraMode(const BaseBlock& block, std::vector& block_vec, PatchBlock& frame) -{ - if (IsBlockUniform(block, frame)) - { - AlterBorderSamples(block, frame); - } - - //distance between initial block and intra predicted patch should be maximized - mfxU32 maxDist = 0; //max num of diff that can be reached is 32x32x256 = 2^18 - //initial block filled with samples from the frame - PatchBlock refBlock(block, frame); - //here Patch with max distance from the initBlock will be stored - PatchBlock maxDistPatch(block); - //mode corresponding to maxDistPatch - INTRA_MODE maxDistMode = PLANAR; - - //choose TUs inside block - std::vector TUInCurrBlock; - for (auto& TU : block_vec) - { - if (TU.IsInBlock(block)) - { - TUInCurrBlock.emplace_back(TU); - } - } - - //check whether there is TU inside block with no left-down or up-right refSamples available - //if so, we can't use corresponding modes and we limit maxModeAvail minModeAvail - // and minAngModeAvail in appropriate manner - //if left-down samples aren't available, modes 2 - 9 are prohibited - //if up-right samples aren't available, modes 27 - 34 are prohibited - //in both cases planar mode is prohibited because it uses samples p[-1][N] and p[N][-1] - //in coordinates relative to the block, where N is the size of block - //see HEVC algorighms and structures page 101(112) - //Vivienne Sze Madhukar Budagavi Gary J.Sullivan High Efficiency Video Coding(HEVC) Algorithms and Architectures 2014 - - mfxU32 minModeAvail = INTRA_MODE::PLANAR; - mfxU32 minAngModeAvail = INTRA_MODE::ANG2; - mfxU32 maxModeAvail = INTRA_MODE::ANG34; - for (auto& TU : TUInCurrBlock) - { - if (!TU.m_RefSampleAvail.LeftDown) - { - minAngModeAvail = INTRA_MODE::ANG10_HOR; - minModeAvail = INTRA_MODE::DC; - } - if (!TU.m_RefSampleAvail.UpRight) - { - maxModeAvail = INTRA_MODE::ANG26_VER; - minModeAvail = INTRA_MODE::DC; - } - } - - for (mfxU32 i = minModeAvail; i <= maxModeAvail; i++) - { - if (i < INTRA_MODE::ANG2 || i >= minAngModeAvail) - { - //iterate over TUs of current CU and save predicted TUs into frame - for (auto& TU : TUInCurrBlock) - { - TU.m_IntraModeChroma = TU.m_IntraModeLuma = INTRA_MODE(i); - MakeTUIntraPrediction(TU, frame); - } - //get curPatch from frame - PatchBlock curPatch(block, frame); - //count distance between initial block and current patch - mfxU32 curDist = refBlock.CalcYSAD(curPatch); - //save patch which is the farthest from the initial CU block - if (curDist > maxDist) - { - maxDist = curDist; - maxDistPatch = curPatch; - maxDistMode = INTRA_MODE(i); - } - } - } - - for (auto& TU : block_vec) - { - if (TU.IsInBlock(block)) - { - //for now chroma intra mode is set equal to luma intra mode - TU.m_IntraModeChroma = TU.m_IntraModeLuma = maxDistMode; - } - } - - frame.InsertAnotherPatch(maxDistPatch); - - return; -} - -//Generates a quad-tree TU structure inside the cu_block and fills the TU block vector -//inside cu_block with correct TU blocks corresponding to the CU quad-tree TU structure -//Selects an intra mode for each generated TU -void FrameProcessor::MakeIntraCU(CUBlock& cu_block) -{ - QuadTree& QT = cu_block.m_TUQuadTree; - GenRandomTUQuadTreeInCU(cu_block); - - std::vector tmpVec; - QT.GetQuadTreeBlocksRecur(QT.root, cu_block.m_AdrX, cu_block.m_AdrY, cu_block.m_BHeight, tmpVec); - cu_block.m_TUVec.clear(); - for (auto& block : tmpVec) - { - cu_block.m_TUVec.emplace_back(TUBlock(block, PLANAR, PLANAR)); - } - - mfxU32 minCUSize = 1 << m_CTUStr.minLog2CUSize; - //Special case for CUs of size equal to minCUSize: - //we can choose intra mode for every quarter - //see last paragraph on p.228(238) in HEVC Algorithms and Architectures - if (cu_block.m_BHeight == minCUSize && cu_block.m_BWidth == minCUSize - && tmpVec.size() >= 4 && GetRandomGen().GetRandomBit()) - { - cu_block.m_IntraPartMode = INTRA_NxN; - } - else - { - cu_block.m_IntraPartMode = INTRA_2Nx2N; - } -} - -void FrameProcessor::MakeIntraPredInCTU(CTUDescriptor& ctu, FrameChangeDescriptor & descr) -{ - ExtendedSurface& surf = *descr.m_frame; - //save frame data in temporary patchBlock - PatchBlock framePatchBlock(BaseBlock(0, 0, surf.Info.CropW, surf.Info.CropH), surf); - for (auto& cu : ctu.m_CUVec) - { - if (cu.m_PredType == INTRA_PRED) - { - if (cu.m_IntraPartMode == INTRA_NxN) - { - std::vector childrenBlocks; - cu.GetChildBlock(childrenBlocks); - for (mfxU32 i = 0; i < 4; i++) - { - //choose the most contrast intra mode for every quarter of CU - ChooseContrastIntraMode(childrenBlocks[i], cu.m_TUVec, framePatchBlock); - } - } - else - { - ChooseContrastIntraMode(cu, cu.m_TUVec, framePatchBlock); - } - } - } -} - -//Chooses the inter partitioning mode for the CU and fills the PU vector inside it with PUs -//corresponding to the chosen mode -void FrameProcessor::MakeInterCU(CUBlock& cu_block, mfxU16 testType) -{ - INTER_PART_MODE mode = INTER_PART_MODE::INTER_NONE; - - mfxU32 max_mode_num = -1; - - if (!(testType & GENERATE_SPLIT) || !m_CTUStr.bCUToPUSplit) - { - mode = INTER_PART_MODE::INTER_2Nx2N; //If no split is specified or CU to PU split is forbidden, - //the CU will contain a single PU - } - else - { - if (cu_block.m_BHeight == 8 && cu_block.m_BWidth == 8) - { - //Minimum PU size is 4x8 or 8x4, which means that only first 3 inter partitioning - //modes are available for 8x8 CU - //Condition when only symmetric modes are supported in case of 8x8 CU is satisfied by default - max_mode_num = INTER_8x8CU_PART_MODE_NUM - 1; - } - else if (m_CTUStr.bForceSymmetricPU) - { - //No check for 8x8 CU case here. It is already processed - max_mode_num = INTER_SYMM_PART_MODE_NUM - 1; - } - else - { - max_mode_num = INTER_PART_MODE_NUM - 1; - } - - bool isCUMinSized = (CeilLog2(cu_block.m_BHeight) == m_CTUStr.minLog2CUSize); - // CU split into 4 square PUs is only allowed for the CUs - // of the smallest size (see p.61-62 of doi:10.1007/978-3-319-06895-4) - do - { - mode = (INTER_PART_MODE) GetRandomGen().GetRandomNumber(0, max_mode_num); - } - while (!isCUMinSized && mode == INTER_PART_MODE::INTER_NxN); - - } - - cu_block.BuildPUsVector(mode); - cu_block.m_InterPartMode = mode; -} - -mfxU8 FrameProcessor::CeilLog2(mfxU32 size) -{ - mfxU8 ret = 0; - while (size > 1) - { - size /= 2; - ret++; - } - return ret; -} - -// First round of generation: choose CTU on current MOD frame -// -// FrameChangeDescriptor & frameDescr - descriptor of current MOD frame - -void FrameProcessor::GenCTUParams(FrameChangeDescriptor & frame_descr) -{ - mfxI32 maxAttempt = 100; - - // Try no more than maxAttempt times to generate no more than m_CTUStr.CTUMaxNum CTUs - for (mfxI32 i = 0; i < maxAttempt && frame_descr.m_vCTUdescr.size() < m_CTUStr.CTUMaxNum; ++i) - { - // TODO: this part could be improved with aggregate initialization - CTUDescriptor tempCTUDsc; - - // Do not choose last CTU in row/column to avoid effects of alignment - // m_WidthInCTU-1 is a coordinate of last CTU in row - tempCTUDsc.m_AdrXInCTU = GetRandomGen().GetRandomNumber(0, m_WidthInCTU - 2); - tempCTUDsc.m_AdrYInCTU = GetRandomGen().GetRandomNumber(0, m_HeightInCTU - 2); - - // Calculate pixel coordinates and size - tempCTUDsc.m_AdrX = tempCTUDsc.m_AdrXInCTU * m_CTUStr.CTUSize; - tempCTUDsc.m_AdrY = tempCTUDsc.m_AdrYInCTU * m_CTUStr.CTUSize; - tempCTUDsc.m_BWidth = tempCTUDsc.m_BHeight = m_CTUStr.CTUSize; - - // Checks if current CTU intersects with or is too close to any of already generated - auto it = find_if(frame_descr.m_vCTUdescr.begin(), frame_descr.m_vCTUdescr.end(), - [&](const CTUDescriptor& dscr){ return dscr.CheckForIntersect(tempCTUDsc, m_CTUStr.CTUSize * m_CTUStr.CTUDist, m_CTUStr.CTUSize * m_CTUStr.CTUDist); }); - - if (it == frame_descr.m_vCTUdescr.end()) - { - // If no intersection, put generated block to vector - frame_descr.m_vCTUdescr.push_back(std::move(tempCTUDsc)); - } - } - - return; -} - -// Second round of test: Generate partitions and MVs. Write down pixels to MOD and all reference GEN frames -// Remove a CTU generated in the previous round from the test set -// if it is impossible to place it without intersecting other CTUs -// -// FrameChangeDescriptor & frameDescr - descriptor of current MOD frame - -void FrameProcessor::GenAndApplyPrediction(FrameChangeDescriptor & frameDescr) -{ - // Iterate over all generated in GenCTUParams CTUs (see round 1) - auto it_ctu = frameDescr.m_vCTUdescr.begin(); - - if (!(frameDescr.m_testType & GENERATE_SPLIT)) - { - //If no split is specified, set min/max CU size to CTU size - //so that the CTU quad-tree only contains single node after generation - m_CTUStr.minLog2CUSize = CeilLog2(m_CTUStr.CTUSize); - m_CTUStr.maxLog2CUSize = CeilLog2(m_CTUStr.CTUSize); - } - - - while (it_ctu != frameDescr.m_vCTUdescr.end()) - { - auto &CTU = *it_ctu; - - //make a tree and save CUs into the vector inside CTU - GenRandomCUQuadTreeInCTU(CTU); - GenCUVecInCTU(CTU, frameDescr.m_testType); - if (frameDescr.m_testType & GENERATE_INTRA) - { - GetRefSampleAvailFlagsForTUsInCTU(CTU); - } - - FrameOccRefBlockRecord bak = frameDescr.BackupOccupiedRefBlocks(); - - bool bMVGenSuccess = true; - if (frameDescr.m_testType & GENERATE_INTER) - { - bMVGenSuccess = MakeInterPredInCTU(CTU, frameDescr); - } - if (bMVGenSuccess) - { - //Inter prediction must be applied first - //because intra blocks should use noise pixels from - //adjacent inter CUs and not unchanged picture pixels - //in the same spot - ApplyInterPredInCTU(CTU, frameDescr); - - //most contrast intra mode is chosen here - MakeIntraPredInCTU(CTU, frameDescr); - ApplyIntraPredInCTU(CTU, frameDescr); - it_ctu++; - } - else - { - //Unable to put the CTU into reference frames without intersection - //Restore backup reference block info: - frameDescr.RestoreOccupiedRefBlocks(bak); - - //Remove current CTU from the test block list and updating the iterator - it_ctu = frameDescr.m_vCTUdescr.erase(it_ctu); - } - } - - return; -} - -//Generates MV and MVP for all PUs in CTU -bool FrameProcessor::MakeInterPredInCTU(CTUDescriptor& CTU, FrameChangeDescriptor& frameDescr) -{ - // First, need to construct an MVP grid and vector pools according to CTU partioning - MVMVPProcessor mvmvpProcessor(m_GenMVPBlockSize, m_SubPelMode); - - if (frameDescr.m_testType & GENERATE_PREDICTION) - { - mvmvpProcessor.InitMVPGridData(CTU, frameDescr); - } - - for (auto& CU : CTU.m_CUVec) - { - if (CU.m_PredType == INTER_PRED) - { - for (auto& PU : CU.m_PUVec) - { - // Set prediction flags for each PU - GenPredFlagsForPU(PU, frameDescr.m_frameType); - - bool bMVGenSuccess = false; - if (frameDescr.m_testType & GENERATE_PREDICTION) - { - bMVGenSuccess = mvmvpProcessor.GenValidMVMVPForPU(PU, frameDescr); - } - else - { - bMVGenSuccess = mvmvpProcessor.GenValidMVForPU(PU, frameDescr); - } - - if (bMVGenSuccess) - { - // Store the shifted PU as a BaseBlock in the corresponding reference frame descriptor - if (PU.predFlagL0) - { - auto itL0 = std::next(frameDescr.m_refDescrList0.begin(), PU.m_MV.RefIdx.RefL0); - itL0->m_OccupiedRefBlocks.emplace_back(PU.GetShiftedBaseBlock(L0)); - } - - if (PU.predFlagL1) - { - auto itL1 = std::next(frameDescr.m_refDescrList1.begin(), PU.m_MV.RefIdx.RefL1); - itL1->m_OccupiedRefBlocks.emplace_back(PU.GetShiftedBaseBlock(L1)); - } - } - else - { - //MV prediction has failed; need to discard the whole CTU - return false; - } - } - } - } - - //MVs for all PUs in CTU have been generated - - // If predictors required, put them to ext buffer - if (frameDescr.m_testType & GENERATE_PREDICTION && frameDescr.m_procMode == GENERATE) - { - //Only output predictors if CTU contains at least one inter CU - auto it = std::find_if(CTU.m_CUVec.begin(), CTU.m_CUVec.end(), - [](const CUBlock& CU) { return CU.m_PredType == INTER_PRED; }); - - if (it != CTU.m_CUVec.end()) - { - mvmvpProcessor.FillFrameMVPExtBuffer(frameDescr); - } - } - - if ((frameDescr.m_testType & GENERATE_PREDICTION) && frameDescr.m_procMode == VERIFY) - { - mvmvpProcessor.GetMVPPools(CTU.m_MVPGenPools); - } - - return true; -} - - -void FrameProcessor::GenPredFlagsForPU(PUBlock & PU, mfxU16 frameType) -{ - PU.predFlagL0 = true; // Set prediction flag for P-frames - if (frameType & MFX_FRAMETYPE_B) - { - // Each PU requires 1 or more reference - mfxI32 maxValue = 2; - if (PU.m_BWidth == 4 || PU.m_BHeight == 4) - maxValue = 1; // For PUs 8x4 or 4x8 we can use only unidirectional prediction - - switch (GetRandomGen().GetRandomNumber(0, maxValue)) - { - case 0: - PU.predFlagL0 = true; - PU.predFlagL1 = false; - break; - case 1: - PU.predFlagL0 = false; - PU.predFlagL1 = true; - break; - case 2: - PU.predFlagL0 = true; - PU.predFlagL1 = true; - break; - } - } - - return; -} - -//Iterates over CUs in CTU and applies inter prediction for inter CUs -void FrameProcessor::ApplyInterPredInCTU(CTUDescriptor& CTU, FrameChangeDescriptor & frameDescr) -{ - for (auto& CU : CTU.m_CUVec) - { - if (CU.m_PredType == INTER_PRED) - { - for (auto& PU : CU.m_PUVec) - { - // Advance to reference descriptor of desired frame - // NB: using reverse iterator here because RefIdx starts counting from the end of the list - - // Generate noisy PU in GEN frames pixels - // This function should be called in both (generate and verify) modes, because includes work with random generator - PutNoiseBlocksIntoFrames(PU, frameDescr); - - // Trace back those pixels (using q-pel interpolation if required) and put to current MOD frame - // This function should be called only in the generate mode - if (m_ProcMode == GENERATE) - { - TraceBackAndPutBlockIntoFrame(PU, frameDescr); - } - } - } - } -} - -// Generate and put noisy pixels to surface surf, which corresponds to block BP coordinates - -// Fill the block with 4x4 noise blocks -void FrameProcessor::PutNoiseBlocksIntoFrames(const PUBlock & PU, const FrameChangeDescriptor & frameDescr, mfxU32 num_coeff, mfxU32 level) -{ - BaseBlock BPL0, BPL1; - - mfxFrameSurface1* refSurfL0 = nullptr; - mfxFrameSurface1* refSurfL1 = nullptr; - - if (PU.predFlagL0) - { - if (frameDescr.m_refDescrList0.size() <= PU.m_MV.RefIdx.RefL0) - { - throw std::string("ERROR: PutNoiseBlockIntoFrames: incorrect reference index for list 0"); - } - auto &refDescrL0 = *next(frameDescr.m_refDescrList0.begin(), PU.m_MV.RefIdx.RefL0); - - // Get frame of reference GEN frame - refSurfL0 = refDescrL0.m_frame; - if (refSurfL0 == nullptr) - { - throw std::string("ERROR: PutNoiseBlockIntoFrames: null pointer reference"); - } - - BPL0 = PU.GetShiftedBaseBlock(L0); - } - - if (PU.predFlagL1) - { - if (frameDescr.m_refDescrList1.size() <= PU.m_MV.RefIdx.RefL1) - { - throw std::string("ERROR: PutNoiseBlockIntoFrames: incorrect reference index for list 1"); - } - auto &refDescrL1 = *next(frameDescr.m_refDescrList1.begin(), PU.m_MV.RefIdx.RefL1); - - // Get frame of reference GEN frame - refSurfL1 = refDescrL1.m_frame; - if (refSurfL1 == nullptr) - { - throw std::string("ERROR: PutNoiseBlockIntoFrames: null pointer reference"); - } - - BPL1 = PU.GetShiftedBaseBlock(L1); - } - - //Check that PU can be subdivided evenly into 4x4 blocks - if (PU.m_BWidth % 4 || PU.m_BHeight % 4) - { - throw std::string("ERROR: PutNoiseBlockIntoFrame: invalid block size"); - } - mfxU32 Block4x4NumX = PU.m_AdrX / 4; - mfxU32 Block4x4NumY = PU.m_AdrY / 4; - mfxU32 FrameWidthIn4x4Blocks = (m_Width + 3) / 4; - mfxU32 FrameHeightIn4x4Blocks = (m_Height + 3) / 4; - - mfxU32 seedOff = frameDescr.m_frame->Data.FrameOrder * FrameWidthIn4x4Blocks * FrameHeightIn4x4Blocks; - mfxU32 seed = 0; - - mfxU32 BPWidthIn4x4Blocks = PU.m_BWidth / 4; - mfxU32 BPHeightIn4x4Blocks = PU.m_BHeight / 4; - mfxU8 block[16] = {}, blockAdjusted[16] = {}; - mfxI8 blockDeltaL0[16] = {}, blockDeltaL1[16] = {}; - - for (mfxU32 i = 0; i < BPHeightIn4x4Blocks; i++) - { - for (mfxU32 j = 0; j < BPWidthIn4x4Blocks; j++) - { - //Calculate seed from the 4x4 block position inside the PU - seed = seedOff + FrameWidthIn4x4Blocks * (Block4x4NumY + i) + Block4x4NumX + j; - GetRandomGen().SeedGenerator(seed); - - //Calculate noise pixel values - FillInBlock4x4(num_coeff, level, block); - - //Calculate delta for difference between L0 and L1 references - if (PU.predFlagL0 && PU.predFlagL1) - FillDeltaBlocks4x4(blockDeltaL0, blockDeltaL1); - - if (m_ProcMode == GENERATE) - { - if (PU.predFlagL0) - { - ApplyDeltaPerPixel(PU, blockDeltaL0, block, blockAdjusted); - PutBlock4x4(BPL0.m_AdrX + j * 4, BPL0.m_AdrY + i * 4, blockAdjusted, refSurfL0); - } - - if (PU.predFlagL1) - { - ApplyDeltaPerPixel(PU, blockDeltaL1, block, blockAdjusted); - PutBlock4x4(BPL1.m_AdrX + j * 4, BPL1.m_AdrY + i * 4, blockAdjusted, refSurfL1); - } - } - } - } -} - -// Fill block[16] with noise pixels, using up to num_coeff first random DCT coefficients -// in the range of (-level; +level) -void FrameProcessor::FillInBlock4x4(mfxU32 num_coeff, mfxU32 level, mfxU8 block[16]) -{ - if (block == nullptr) - { - throw std::string("ERROR: FillInBlock4x4: null pointer reference"); - } - - if (num_coeff < 1 || num_coeff > 16) - { - throw std::string("\nERROR: Wrong num_coeff in FrameProcessor::FillInBlock4x4"); - } - if (level > 255) - { - throw std::string("\nERROR: Wrong level in FrameProcessor::FillInBlock4x4"); - } - - mfxI32 coeff[16]; - mfxI32 pixels[16]; - mfxU32 scan[16] = { 0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15 }; - memset(coeff, 0, sizeof(coeff)); - for (mfxU32 i = 0; i < num_coeff; i++) - { - coeff[scan[i]] = level* GetRandomGen().GetRandomNumber(0, 256) / 256 - level / 2; - } - if (m_ProcMode == GENERATE) - { - Inverse4x4(coeff, 4, pixels, 4); - for (mfxU32 i = 0; i < 16; i++) - { - block[i] = ClipIntToChar(128 + pixels[i]); - } - } - - return; -} - -void FrameProcessor::FillDeltaBlocks4x4(mfxI8 blockL0[16], mfxI8 blockL1[16]) -{ - if (blockL0 == nullptr || blockL1 == nullptr) - { - throw std::string("ERROR: FillDeltaBlocks4x4: null pointer reference"); - } - - for (mfxU32 i = 0; i < 16; i++) - { - blockL0[i] = GetRandomGen().GetRandomNumber(0, DELTA_PIXEL_BI_DIRECT); - blockL1[i] = -blockL0[i]; - } - - - return; -} - -void FrameProcessor::ApplyDeltaPerPixel(const PUBlock & PU, const mfxI8 deltaBlock[16], const mfxU8 inBlock[16], mfxU8 outBlock[16]) -{ - if (inBlock == nullptr || outBlock == nullptr) - { - throw std::string("ERROR: ApplyDeltaPerPixel: null pointer reference"); - } - - for (mfxU8 i = 0; i < 16; i++) - { - outBlock[i] = ClipIntToChar(inBlock[i] + deltaBlock[i]); - } - - return; -} - -mfxU8 FrameProcessor::ClipIntToChar(mfxI32 x) -{ - if (x < 0) - return 0; - else if (x > 255) - return 255; - - return (mfxU8)x; -} - -//Perform inverse 4x4 DCT -void FrameProcessor::Inverse4x4(mfxI32 *src, mfxU32 s_pitch, mfxI32 *dst, mfxU32 d_pitch) -{ - if (src == nullptr || dst == nullptr) - { - throw std::string("ERROR: Inverse4x4: null pointer reference"); - } - const mfxU32 BLOCK_SIZE = 4; - mfxI32 tmp[16]; - mfxI32 *pTmp = tmp, *pblock; - mfxI32 p0, p1, p2, p3; - mfxI32 t0, t1, t2, t3; - - // Horizontal - for (mfxU32 i = 0; i < BLOCK_SIZE; i++) - { - pblock = src + i*s_pitch; - t0 = *(pblock++); - t1 = *(pblock++); - t2 = *(pblock++); - t3 = *(pblock); - - p0 = t0 + t2; - p1 = t0 - t2; - p2 = (t1 >> 1) - t3; - p3 = t1 + (t3 >> 1); - - *(pTmp++) = p0 + p3; - *(pTmp++) = p1 + p2; - *(pTmp++) = p1 - p2; - *(pTmp++) = p0 - p3; - } - - // Vertical - for (mfxU32 i = 0; i < BLOCK_SIZE; i++) - { - pTmp = tmp + i; - t0 = *pTmp; - t1 = *(pTmp += BLOCK_SIZE); - t2 = *(pTmp += BLOCK_SIZE); - t3 = *(pTmp += BLOCK_SIZE); - - p0 = t0 + t2; - p1 = t0 - t2; - p2 = (t1 >> 1) - t3; - p3 = t1 + (t3 >> 1); - - *(dst + 0 * d_pitch + i) = p0 + p3; - *(dst + 1 * d_pitch + i) = p1 + p2; - *(dst + 2 * d_pitch + i) = p1 - p2; - *(dst + 3 * d_pitch + i) = p0 - p3; - } -} - -void FrameProcessor::PutBlock4x4(mfxU32 x0, mfxU32 y0, mfxU8 block[16], mfxFrameSurface1* surf) -{ - if (surf == nullptr) - { - throw std::string("ERROR: PutBlock4x4: null pointer reference"); - } - //put block in the current frame, x0, y0 pixel coordinates - for (mfxU32 y = 0; y < 4; y++) - { - for (mfxU32 x = 0; x < 4; x++) - { - *(surf->Data.Y + (y0 + y)* surf->Data.Pitch + x0 + x) = block[4 * y + x]; - *(surf->Data.U + ((y0 + y) / 2) * (surf->Data.Pitch / 2) + (x0 + x) / 2) = CHROMA_DEFAULT; - *(surf->Data.V + ((y0 + y) / 2) * (surf->Data.Pitch / 2) + (x0 + x) / 2) = CHROMA_DEFAULT; - } - } - return; -} - - -// Trace back pixels from block BP shifted by MV coordinates on GEN frame surf_from to MOD frame surf_to -// -// bp - block on MOD frame -// mv - it's shift on GEN frame -// surf_from - GEN frame surf -// surf_to - MOD frame surf - -void FrameProcessor::TraceBackAndPutBlockIntoFrame(const PUBlock & PU, FrameChangeDescriptor & descr) -{ - std::pair fractOffsetL0(PU.m_MV.MV[0].x & 3, PU.m_MV.MV[0].y & 3); - std::pair fractOffsetL1(PU.m_MV.MV[1].x & 3, PU.m_MV.MV[1].y & 3); - - auto itL0 = std::next(descr.m_refDescrList0.begin(), PU.m_MV.RefIdx.RefL0); - auto itL1 = std::next(descr.m_refDescrList1.begin(), PU.m_MV.RefIdx.RefL1); - - mfxFrameSurface1* surfDest = nullptr; - mfxFrameSurface1* surfL0Ref = nullptr; - mfxFrameSurface1* surfL1Ref = nullptr; - - surfDest = descr.m_frame; - - if (itL0 != descr.m_refDescrList0.end()) - { - surfL0Ref = itL0->m_frame; - } - else - { - throw("ERROR: TraceBackAndPutBlockIntoFrame: L0 ref not found"); - } - - if (descr.m_frameType & MFX_FRAMETYPE_B) - { - if (itL1 != descr.m_refDescrList1.end()) - { - surfL1Ref = itL1->m_frame; - } - else - { - throw("ERROR: TraceBackAndPutBlockIntoFrame: L1 ref not found"); - } - } - - PatchBlock outPatch(PU); - InterpolWorkBlock workBlockL0; - InterpolWorkBlock workBlockL1; - - if (PU.predFlagL0 && PU.predFlagL1) - { - workBlockL0 = GetInterpolWorkBlockPreWP(PU.GetShiftedBaseBlock(L0), fractOffsetL0, surfL0Ref); - workBlockL1 = GetInterpolWorkBlockPreWP(PU.GetShiftedBaseBlock(L1), fractOffsetL1, surfL1Ref); - outPatch = ApplyDefaultWeightedPrediction(workBlockL0, workBlockL1); - } - else if (PU.predFlagL0) - { - workBlockL0 = GetInterpolWorkBlockPreWP(PU.GetShiftedBaseBlock(L0), fractOffsetL0, surfL0Ref); - outPatch = ApplyDefaultWeightedPrediction(workBlockL0); - } - else if (PU.predFlagL1) - { - workBlockL1 = GetInterpolWorkBlockPreWP(PU.GetShiftedBaseBlock(L1), fractOffsetL1, surfL1Ref); - outPatch = ApplyDefaultWeightedPrediction(workBlockL1); - } - else - throw("ERROR: TraceBackAndPutBlockIntoFrame: predFlagL0 and predFlagL1 are equal 0"); - - //Adjust outPatch coords so that they correspond to the unshifted PU - outPatch.m_AdrX = PU.m_AdrX; - outPatch.m_AdrY = PU.m_AdrY; - - PutPatchIntoFrame(outPatch, *surfDest); - - return; -} - - -InterpolWorkBlock FrameProcessor::GetInterpolWorkBlockPreWP(const BaseBlock & blockFrom, std::pair fractOffset, mfxFrameSurface1* surfFrom) -{ - if (surfFrom == nullptr) - { - throw std::string("ERROR: GetInterpolWorkBlockPreWP: null pointer reference"); - } - InterpolWorkBlock workBlock(blockFrom); - - //Luma - for (mfxU32 i = 0; i < blockFrom.m_BHeight; i++) - { - for (mfxU32 j = 0; j < blockFrom.m_BWidth; j++) - { - mfxU32 offset = i * blockFrom.m_BWidth + j; - workBlock.m_YArr[offset] = CalculateLumaPredictionSamplePreWP( - std::make_pair(blockFrom.m_AdrX + j, blockFrom.m_AdrY + i), fractOffset, surfFrom); - } - } - - // Chroma(YV12 / I420 only) - TODO: enable correct interpolation for chroma - //NB: MFX_FOURCC_YV12 is an umbrella designation for both YV12 and I420 here, as - //the process of copying pixel values in memory is the same - - //TODO: implement proper chroma interpolation - if (surfFrom->Info.FourCC == MFX_FOURCC_YV12) - { - for (mfxU32 i = 0; i < blockFrom.m_BHeight / 2; ++i) - { - for (mfxU32 j = 0; j < blockFrom.m_BWidth / 2; j++) - { - mfxU32 offsetChr = i * blockFrom.m_BWidth / 2 + j; - workBlock.m_UArr[offsetChr] = surfFrom->Data.U[ - (blockFrom.m_AdrY / 2 + i) * surfFrom->Data.Pitch / 2 + blockFrom.m_AdrX / 2 + j]; - workBlock.m_VArr[offsetChr] = surfFrom->Data.V[ - (blockFrom.m_AdrY / 2 + i) * surfFrom->Data.Pitch / 2 + blockFrom.m_AdrX / 2 + j]; - - //For now, just scale uninterpolated chroma so that we can call default weighted prediction - //on chroma components the same way we do with luma - workBlock.m_UArr[offsetChr] <<= 6; - workBlock.m_VArr[offsetChr] <<= 6; - } - } - } - - return workBlock; -} - -PatchBlock FrameProcessor::ApplyDefaultWeightedPrediction(InterpolWorkBlock & workBlockLx) -{ - PatchBlock outPatch(static_cast(workBlockLx)); - - //Luma - for (mfxU32 i = 0; i < outPatch.m_BHeight * outPatch.m_BWidth; i++) - { - outPatch.m_YPlane[i] = GetDefaultWeightedPredSample(workBlockLx.m_YArr[i]); - } - - //Chroma - for (mfxU32 i = 0; i < outPatch.m_BHeight / 2 * outPatch.m_BWidth / 2; i++) - { - outPatch.m_UPlane[i] = GetDefaultWeightedPredSample(workBlockLx.m_UArr[i]); - outPatch.m_VPlane[i] = GetDefaultWeightedPredSample(workBlockLx.m_VArr[i]); - } - return outPatch; -} - -PatchBlock FrameProcessor::ApplyDefaultWeightedPrediction(InterpolWorkBlock & workBlockL0, InterpolWorkBlock & workBlockL1) -{ - if (workBlockL0.m_BHeight != workBlockL1.m_BHeight || workBlockL0.m_BWidth != workBlockL1.m_BWidth) - { - throw std::string("ERROR: ApplyDefaultWeightedPrediction: InterpolWorkBlocks for bi-prediction must have same size"); - } - PatchBlock outPatch(static_cast(workBlockL0)); - for (mfxU32 i = 0; i < outPatch.m_BHeight * outPatch.m_BWidth; i++) - { - outPatch.m_YPlane[i] = GetDefaultWeightedPredSample(workBlockL0.m_YArr[i], workBlockL1.m_YArr[i]); - } - - for (mfxU32 i = 0; i < outPatch.m_BHeight / 2 * outPatch.m_BWidth / 2; i++) - { - outPatch.m_UPlane[i] = GetDefaultWeightedPredSample(workBlockL0.m_UArr[i], workBlockL1.m_UArr[i]); - outPatch.m_VPlane[i] = GetDefaultWeightedPredSample(workBlockL0.m_VArr[i], workBlockL1.m_VArr[i]); - } - - return outPatch; -} - -mfxU8 FrameProcessor::SetCorrectMVPBlockSize(mfxU8 mvpBlockSizeParam) -{ - if (!mvpBlockSizeParam) - { - switch (m_CTUStr.CTUSize) - { - case 16: - return 1; - case 32: - return 2; - case 64: - return 3; - default: - break; - } - } - return mvpBlockSizeParam; -} - -// Returns predicted luma value (Y) for sample with provided location on reference frame given in quarter-pixel units -// -// refSamplePositionFull - (xInt,yInt) Luma location on the reference frame given in full-sample units. Assumed (x,y) has correct value. -// refSamplePositionFract - (xFract,yFract) Luma location on the reference frame given in quarter-sample units. -// refSurface - reference frame, containing luma samples -// Luma interpolation process described in H265 standard (p.163 - 165) - -mfxI32 FrameProcessor::CalculateLumaPredictionSamplePreWP(const std::pair& refSamplePositionFull, - const std::pair& refSamplePositionFract, mfxFrameSurface1 * refSurface) -{ - mfxU32 xFull = refSamplePositionFull.first; - mfxU32 yFull = refSamplePositionFull.second; - mfxU32 xFract = refSamplePositionFract.first; - mfxU32 yFract = refSamplePositionFract.second; - - // These shift variables used below are specified in H265 spec for 8 bit Luma depth - // shift1 := 0 - // shift2 := 6 - // shift3 := 6 - - // Stores output of the sub-sample filtering process - mfxI32 interpolatedSample = 0; - - /* - // Integer and quarter sample positions used for interpolation - - A-10 O O O | A00 a00 b00 c00 | A10 O O O A20 - d-10 O O O | d00 e00 f00 g00 | d10 O O O d20 - h-10 O O O | h00 i00 j00 k00 | h10 O O O h20 - n-10 O O O | n00 p00 q00 r00 | n10 O O O n20 - */ - - switch (xFract) - { - case 0: - switch (yFract) - { - case 0: - // A << shift3 - interpolatedSample = ApplyVerticalSubSampleLumaFilter(xFull, yFull, - refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[0]) * 64; - break; - case 1: - // d00 := (-A(0,-3) + 4*A(0,-2) - 10*A(0,-1) + 58*A(0,0) + 17*A(0,1) - 5*A(0,2) + A(0,3)) >> shift1 - interpolatedSample = ApplyVerticalSubSampleLumaFilter(xFull, yFull, - refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[1]); - break; - case 2: - // h00 := (-A(0,-3) + 4*A(0,-2) - 11*A(0,-1) + 40*A(0,0) + 40*A(0,1) - 11*A(0,2) + 4*A(0,3) - A(0,4)) >> shift1 - interpolatedSample = ApplyVerticalSubSampleLumaFilter(xFull, yFull, - refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[2]); - break; - case 3: - // n00 := (A(0,-2) - 5*A(0,-1) + 17*A(0,0) + 58*A(0,1) - 10*A(0,2) + 4*A(0,3) - A(0,4)) >> shift1 - interpolatedSample = ApplyVerticalSubSampleLumaFilter(xFull, yFull, - refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[3]); - break; - default: - break; - } - break; - case 1: - { - // a0i, where i = -3..4 - // a0i = [a(0,-3) a(0,-2) a(0,-1) a(0,0) a(0,1) a(0,2) a(0,3) a(0,4)] - std::vector fractUtilSamples; - fractUtilSamples.reserve(LUMA_TAPS_NUMBER); - - for (mfxI32 i = 0; i < LUMA_TAPS_NUMBER; i++) - { - // a0i := (-A(-3,i) + 4*A(-2,i) - 10*A(-1,i) + 58*A(0,i) + 17*A(1,i) - 5*A(2,i) + A(3,i) >> shift1) - fractUtilSamples.push_back(ApplyHorizontalSubSampleLumaFilter(xFull, - yFull + (i - 3), refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[1])); - } - - switch (yFract) - { - case 0: - // a00 := a(0,0) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[0], 0); - break; - case 1: - // e00 := (-a(0,-3) + 4*a(0,-2) - 10*a(0,-1) + 58*a(0,0) + 17*a(0,1) - 5*a(0,2) + a(0,3) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), - fractUtilSamples.end(), LUMA_SUBSAMPLE_FILTER_COEFF[1], 0) / 64; - break; - case 2: - // i00 := (-a(0,-3) + 4*a(0,-2) - 11*a(0,-1) + 40*a(0,0) + 40*a(0,1) - 11*a(0,2) + 4*a(0,3) - a(0,4) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), - fractUtilSamples.end(), LUMA_SUBSAMPLE_FILTER_COEFF[2], 0) / 64; - break; - case 3: - // p00 := (a(0,-2) - 5*a(0,-1) + 17*a(0,0) + 58*a(0,1) - 10*a(0,2) + 4*a(0,3) - a(0,4) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[3], 0) / 64; - break; - default: - break; - } - break; - } - case 2: - { - // b0i, where i = -3..4 - // b0i = [b(0,-3) b(0,-2) b(0,-1) b(0,0) b(0,1) b(0,2) b(0,3) b(0,4)] - std::vector fractUtilSamples; - fractUtilSamples.reserve(LUMA_TAPS_NUMBER); - - for (mfxI32 i = 0; i < LUMA_TAPS_NUMBER; i++) - { - // b0i := (-A(-3,i) + 4*A(-2,i) - 11*A(-1,i) + 40*A(0,i) + 40*A(1,i) - 11*A(2,i) + 4*A(3,i) - A(4,i) >> shift1) - fractUtilSamples.push_back(ApplyHorizontalSubSampleLumaFilter(xFull, yFull + (i - 3), - refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[2])); - } - - switch (yFract) - { - case 0: - // b00 := (-A(-3,0) + 4*A(-2,0) - 11*A(-1,0) + 40*A(0,0) + 40*A(1,0) - 11*A(2,0) + 4*A(3,0) - A(4,0) >> shift1) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[0], 0); - break; - case 1: - // f00 := (-b(0,-3) + 4*b(0,-2) - 10*b(0,-1) + 58*b(0,0) + 17*b(0,1) - 5*b(0,2) + b(0,3) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[1], 0) / 64; - break; - case 2: - // j00 := (-b(0,-3) + 4*b(0,-2) - 11*b(0,-1) + 40*b(0,0) + 40*b(0,1) - 11*b(0,2) + 4*b(0,3) - b(0,4) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[2], 0) / 64; - break; - case 3: - // q00 := (b(0,-2) - 5*b(0,-1) + 17*b(0,0) + 58*b(0,1) - 10*b(0,2) + 4*b(0,3) - b(0,4) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[3], 0) / 64; - break; - default: - break; - } - break; - } - case 3: - { - // c0i, where i = -3..4 - // c0i = [c(0,-3) c(0,-2) c(0,-1) c(0,0) c(0,1) c(0,2) c(0,3) c(0,4)] - std::vector fractUtilSamples; - fractUtilSamples.reserve(LUMA_TAPS_NUMBER); - - for (mfxI32 i = 0; i < LUMA_TAPS_NUMBER; i++) - { - // c0i := (A(-2,i) - 5*A(-1,i) + 17*A(0,i) + 58*A(1,i) - 10*A(2,i) + 4*A(3,i) - A(4,i) >> shift1) - fractUtilSamples.push_back(ApplyHorizontalSubSampleLumaFilter(xFull, yFull + (i - 3), - refSurface, LUMA_SUBSAMPLE_FILTER_COEFF[3])); - } - - switch (yFract) - { - case 0: - // c00 := c(0,0) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[0], 0); - break; - case 1: - // g00 := (-c(0,-3) + 4*c(0,-2) - 10*c(0,-1) + 58*c(0,0) + 17*c(0,1) - 5*c(0,2) + c(0,3) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[1], 0) / 64; - break; - case 2: - // k00 := (-c(0,-3) + 4*c(0,-2) - 11*c(0,-1) + 40*c(0,0) + 40*c(0,1) - 11*c(0,2) + 4*c(0,3) - c(0,4) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[2], 0) / 64; - break; - case 3: - // r00 := (c(0,-2) - 5*c(0,-1) + 17*c(0,0) + 58*c(0,1) - 10*c(0,2) + 4*c(0,3) - c(0,4) >> shift2) - interpolatedSample = std::inner_product(fractUtilSamples.begin(), fractUtilSamples.end(), - LUMA_SUBSAMPLE_FILTER_COEFF[3], 0) / 64; - break; - default: - break; - } - break; - } - default: - break; - } - - return interpolatedSample; -} - -mfxI32 FrameProcessor::ApplyVerticalSubSampleLumaFilter(mfxU32 x, mfxU32 y, mfxFrameSurface1 * refSurface, const mfxI32 * coeff) -{ - mfxI32 sum = 0; - - for (mfxI32 i = -3; i <= 4; i++) - { - sum += coeff[i + 3] * GetClippedSample(COLOR_COMPONENT::LUMA_Y, (mfxI32)x, (mfxI32)y + i, refSurface); - } - - return sum; -} - -mfxI32 FrameProcessor::ApplyHorizontalSubSampleLumaFilter(mfxU32 x, mfxU32 y, mfxFrameSurface1 * refSurface, const mfxI32 * coeff) -{ - mfxI32 sum = 0; - - for (mfxI32 i = -3; i <= 4; i++) - { - sum += coeff[i + 3] * GetClippedSample(COLOR_COMPONENT::LUMA_Y, (mfxI32)x + i, (mfxI32)y, refSurface); - } - - return sum; -} - -// Release processed surfaces - -void FrameProcessor::UnlockSurfaces(FrameChangeDescriptor & frame_descr) -{ - frame_descr.m_frame->Data.Locked = 0; - - // Unlock all reference GEN frames recursively - if (frame_descr.m_refDescrList0.empty() && frame_descr.m_refDescrList1.empty()) return; - else - { - for (auto & ref_descr : frame_descr.m_refDescrList0) - { - UnlockSurfaces(ref_descr); - } - for (auto & ref_descr : frame_descr.m_refDescrList1) - { - UnlockSurfaces(ref_descr); - } - } - - return; -} - -//this function has the same behavior for any color component -//it is more convenient to have input in the coordinates of colorComp component space -void FrameProcessor::FillIntraRefSamples(mfxU32 cSize, mfxU32 cAdrX, mfxU32 cAdrY, const PatchBlock& frame, COLOR_COMPONENT colorComp, std::vector& refSamples) -{ - refSamples.clear(); - const mfxU32 NO_SAMPLES_AVAILABLE = 0xffffffff; - mfxU8 prevSampleAvail = 128; //default ref sample value is 128 if no real ref samples are available - mfxU32 firstSampleAvailPos = NO_SAMPLES_AVAILABLE; //position of the first available ref sample in refSamples - - //fill vertical part - mfxU32 currCAdrX = cAdrX - 1; - mfxU32 currCAdrY = cAdrY + 2 * cSize - 1; - - for (mfxU32 i = 0; i < 2 * cSize + 1; i++, currCAdrY--) - { - if (IsSampleAvailable(currCAdrX, currCAdrY)) - { - prevSampleAvail = frame.GetSampleI420(colorComp, currCAdrX, currCAdrY); - refSamples.push_back(prevSampleAvail); - if (firstSampleAvailPos == NO_SAMPLES_AVAILABLE) - { - firstSampleAvailPos = i; - } - } - else - { - refSamples.push_back(prevSampleAvail); - } - } - currCAdrX = cAdrX; - currCAdrY = cAdrY - 1; - - //fill horizontal part - for (mfxU32 i = 2 * cSize + 1; i < 4 * cSize + 1; i++, currCAdrX++) - { - if (IsSampleAvailable(currCAdrX, currCAdrY)) - { - prevSampleAvail = frame.GetSampleI420(colorComp, currCAdrX, currCAdrY); - refSamples.push_back(prevSampleAvail); - if (firstSampleAvailPos == NO_SAMPLES_AVAILABLE) - { - firstSampleAvailPos = i; - } - } - else - { - refSamples.push_back(prevSampleAvail); - } - } - //fill initial part with with first available ref sample value - if (firstSampleAvailPos != NO_SAMPLES_AVAILABLE) - { - std::fill(refSamples.begin(), refSamples.begin() + firstSampleAvailPos, refSamples[firstSampleAvailPos]); - } -} - -FILTER_TYPE FrameProcessor::ChooseFilter(std::vector& RefSamples, mfxU8 size, INTRA_MODE mode) { - FILTER_TYPE filter = NO_FILTER; - if (mode == DC || size == 4) - return filter; - switch (size) { - case 8: - if (mode == 2 || mode == 18 || mode == 34) - filter = THREE_TAP_FILTER; - break; - case 16: - filter = THREE_TAP_FILTER; - if ((mode > 8 && mode < 12) || (mode > 24 && mode < 28)) - filter = NO_FILTER; - break; - case 32: - filter = THREE_TAP_FILTER; - if (mode == ANG10_HOR || mode == ANG26_VER) - filter = NO_FILTER; - else if (std::abs(RefSamples[0] + RefSamples[2 * size] - 2 * RefSamples[size]) < 8 && - std::abs(RefSamples[2 * size] + RefSamples[4 * size] - 2 * RefSamples[3 * size]) < 8) - filter = STRONG_INTRA_SMOOTHING_FILTER; - break; - default: - break; - } - return filter; -} - -void FrameProcessor::ThreeTapFilter(std::vector& RefSamples, mfxU8 size) { - for (mfxU8 i = 1; i < (size << 2); i++) - RefSamples[i] = (RefSamples[i - 1] + 2 * RefSamples[i] + RefSamples[i + 1] + 2) >> 2; -} - -void FrameProcessor::StrongFilter(std::vector& RefSamples, mfxU8 size) { - for (mfxU8 i = 1; i < 2 * size; i++) - RefSamples[i] = (i * RefSamples[2 * size] + (2 * size - i) * RefSamples[0] + 32) >> 6; - for (mfxU8 i = 1; i < 2 * size; i++) - RefSamples[2 * size + i] = ((2 * size - i) * RefSamples[2 * size] + i * RefSamples[4 * size] + 32) >> 6; -} - -FILTER_TYPE FrameProcessor::MakeFilter(std::vector& RefSamples, mfxU8 size, INTRA_MODE mode) { - FILTER_TYPE filter = ChooseFilter(RefSamples, size, mode); - switch (filter) { - case NO_FILTER: - break; - case THREE_TAP_FILTER: - ThreeTapFilter(RefSamples, size); - break; - case STRONG_INTRA_SMOOTHING_FILTER: - StrongFilter(RefSamples, size); - break; - default: - break; - } - return filter; -} - -mfxU8 FrameProcessor::MakeProjRefArray(const std::vector& RefSamples, mfxU8 size, const IntraParams& IntraMode, std::vector& ProjRefSamples) -{ - mfxU8 NumProj = 0; - - if (IntraMode.direction == HORIZONTAL) - { - ProjRefSamples.insert(ProjRefSamples.end(), RefSamples.begin(), RefSamples.begin() + 2 * size + 1); - if (IntraMode.intraPredAngle < 0) - { - if (IntraMode.invAngle == 0) - { - throw std::string("ERROR: MakeProjRefArray: invAngle == 0 for angular mode with intraPredAngle < 0"); - } - mfxI8 y = -1; - mfxI32 sampleForProjectionPos = 2 * size + ((y * IntraMode.invAngle + 128) >> 8); - while (sampleForProjectionPos < 4 * size + 1) - { - ProjRefSamples.push_back(RefSamples[sampleForProjectionPos]); - sampleForProjectionPos = 2 * size + ((--y * IntraMode.invAngle + 128) >> 8); - } - } - std::reverse(ProjRefSamples.begin(), ProjRefSamples.end()); - NumProj = (mfxU8)(ProjRefSamples.size() - 2 * size - 1); - } - else if (IntraMode.direction == VERTICAL) - { - if (IntraMode.intraPredAngle < 0) - { - if (IntraMode.invAngle == 0) - { - throw std::string("ERROR: MakeProjRefArray: invAngle == 0 for angular mode with intraPredAngle < 0"); - } - mfxI8 x = -1; - mfxI32 sampleForProjectionPos = 2 * size - ((x * IntraMode.invAngle + 128) >> 8); - - while (sampleForProjectionPos > -1) - { - ProjRefSamples.push_back(RefSamples[sampleForProjectionPos]); - sampleForProjectionPos = 2 * size - ((--x * IntraMode.invAngle + 128) >> 8); - } - - std::reverse(ProjRefSamples.begin(), ProjRefSamples.end()); - } - - NumProj = (mfxU8)ProjRefSamples.size(); - ProjRefSamples.insert(ProjRefSamples.end(), RefSamples.begin() + 2 * size, RefSamples.end()); - } - return NumProj; -} - -void FrameProcessor::PlanarPrediction(const std::vector& RefSamples, mfxU8 size, mfxU8 * patch) -{ - if (patch == nullptr) - { - throw std::string("ERROR: PlanarPrediction: pointer to buffer is null\n"); - } - - for (mfxI32 y = 0; y < size; y++) - { - for (mfxI32 x = 0; x < size; x++) - { - patch[y * size + x] = ( - (size - 1 - x) * RefSamples[2 * size - 1 - y] - + (x + 1) * RefSamples[3 * size + 1] - + (size - 1 - y) * RefSamples[2 * size + 1 + x] - + (y + 1) * RefSamples[size - 1] - + size) / (size * 2); - } - } - -} - -void FrameProcessor::DCPrediction(const std::vector& RefSamples, mfxU8 size, mfxU8 * patch) -{ - if (patch == nullptr) - { - throw std::string("ERROR: DCPrediction: pointer to buffer is null\n"); - } - - mfxU32 DCValue = size; - for (mfxI32 i = 0; i < size; i++) - { - DCValue += RefSamples[2 * size - 1 - i] + RefSamples[i + 2 * size + 1]; - } - DCValue /= 2 * size; - memset(patch, DCValue, size*size); -} - -void FrameProcessor::AngularPrediction(const std::vector& RefSamples, mfxU8 size, IntraParams& params, mfxU8 * patch) { - if (patch == nullptr) - { - throw std::string("ERROR: AngularPrediction: pointer to buffer is null\n"); - } - - std::vector ProjRefSamples; - mfxU8 NumProj = MakeProjRefArray(RefSamples, size, params, ProjRefSamples); - if (params.direction == HORIZONTAL) - for (mfxI32 y = 0; y < size; y++) - for (mfxI32 x = 0; x < size; x++) { - mfxI32 f = ((x + 1) * params.intraPredAngle) & 31; - mfxI32 i = ((x + 1) * params.intraPredAngle) >> 5; - if (f != 0) - patch[y * size + x] = ((32 - f) * ProjRefSamples[y + i + 1 + NumProj] + f * ProjRefSamples[y + i + 2 + NumProj] + 16) >> 5; - else - patch[y * size + x] = ProjRefSamples[y + i + 1 + NumProj]; - } - else - for (mfxI32 y = 0; y < size; y++) - for (mfxI32 x = 0; x < size; x++) { - mfxI32 f = ((y + 1) * params.intraPredAngle) & 31; - mfxI32 i = ((y + 1) * params.intraPredAngle) >> 5; - if (f != 0) - patch[y * size + x] = ((32 - f) * ProjRefSamples[x + i + 1 + NumProj] + f * ProjRefSamples[x + i + 2 + NumProj] + 16) >> 5; - else - patch[y * size + x] = ProjRefSamples[x + i + 1 + NumProj]; - } - - return; -} - -void FrameProcessor::GenerateIntraPrediction(const std::vector& RefSamples, mfxU8 blockSize, INTRA_MODE currMode, mfxU8* currPlane) -{ - if (currPlane == nullptr) - { - throw std::string("ERROR: GenerateIntraPrediction: pointer to buffer is null\n"); - } - - IntraParams params(currMode); - - switch (params.intraMode) - { - case PLANAR: - PlanarPrediction(RefSamples, blockSize, currPlane); - break; - case DC: - DCPrediction(RefSamples, blockSize, currPlane); - break; - default: - AngularPrediction(RefSamples, blockSize, params, currPlane); - break; - } - return; -} - -void FrameProcessor::MakePostFilter(const std::vector& RefSamples, mfxU8 size, INTRA_MODE currMode, mfxU8* lumaPlane) -{ - mfxU32 DCValue = lumaPlane[0]; - - switch (currMode) - { - case DC: - lumaPlane[0] = (RefSamples[2 * size - 1] + 2 * DCValue + RefSamples[2 * size + 1] + 2) >> 2; - for (mfxI32 x = 1; x < size; x++) - { - lumaPlane[x] = (RefSamples[2 * size + 1 + x] + 3 * DCValue + 2) >> 2; - } - for (mfxI32 y = 1; y < size; y++) - { - lumaPlane[y * size] = (RefSamples[2 * size - 1 - y] + 3 * DCValue + 2) >> 2; - } - break; - case ANG10_HOR: - for (mfxI32 x = 0; x < size; x++) - { - lumaPlane[x] = ClipIntToChar(lumaPlane[x] + ((RefSamples[2 * size + 1 + x] - RefSamples[2 * size]) >> 1)); - } - break; - case ANG26_VER: - for (mfxI32 y = 0; y < size; y++) - { - lumaPlane[y * size] = ClipIntToChar(lumaPlane[y * size] + ((RefSamples[2 * size - 1 - y] - RefSamples[2 * size]) >> 1)); - } - break; - default: - return; - } -} - -void FrameProcessor::PutPatchIntoFrame(const PatchBlock & Patch, mfxFrameSurface1& surf) { - //luma - for (mfxU32 i = 0; i < Patch.m_BHeight; i++) - memcpy(surf.Data.Y + (Patch.m_AdrY + i) * surf.Data.Pitch + Patch.m_AdrX, Patch.m_YPlane + i * Patch.m_BWidth, Patch.m_BWidth); - //chroma U - for (mfxU32 i = 0; i < Patch.m_BHeight / 2; ++i) - memcpy(surf.Data.U + (Patch.m_AdrY / 2 + i) * surf.Data.Pitch / 2 + Patch.m_AdrX / 2, Patch.m_UPlane + i * (Patch.m_BWidth / 2), Patch.m_BWidth / 2); - //chroma V - for (mfxU32 i = 0; i < Patch.m_BHeight / 2; ++i) - memcpy(surf.Data.V + (Patch.m_AdrY / 2 + i) * surf.Data.Pitch / 2 + Patch.m_AdrX / 2, Patch.m_VPlane + i * (Patch.m_BWidth / 2), Patch.m_BWidth / 2); -} - -void FrameProcessor::GetIntraPredPlane(const BaseBlock& refBlock, INTRA_MODE currMode, const PatchBlock& frame, COLOR_COMPONENT colorComp, mfxU8* currPlane) -{ - if (currPlane == nullptr) - { - throw std::string("ERROR: GetIntraPredPlane: pointer to buffer is null\n"); - } - //here refBlock parameters are measured in samples of corresponding colorComp - //get reference samples for current TU - std::vector RefSamples; - //size and coords of block in current color component - mfxU32 cSize = (colorComp == LUMA_Y) ? refBlock.m_BHeight : (refBlock.m_BHeight / 2); - mfxU32 cAdrX = (colorComp == LUMA_Y) ? refBlock.m_AdrX : (refBlock.m_AdrX / 2); - mfxU32 cAdrY = (colorComp == LUMA_Y) ? refBlock.m_AdrY : (refBlock.m_AdrY / 2); - - FillIntraRefSamples(cSize, cAdrX, cAdrY, frame, colorComp, RefSamples); - - // get filter, write it into buffer and make it - MakeFilter(RefSamples, cSize, currMode); - - //generate Prediction and return the output patch - GenerateIntraPrediction(RefSamples, cSize, currMode, currPlane); - - if (colorComp == LUMA_Y && cSize < 32) - { - MakePostFilter(RefSamples, cSize, currMode, currPlane); - } -} - - -PatchBlock FrameProcessor::GetIntraPatchBlock(const TUBlock& refBlock, const PatchBlock& frame) -{ - PatchBlock patch(refBlock); - //get intra prediction for Luma plane - GetIntraPredPlane(refBlock, refBlock.m_IntraModeLuma, frame, LUMA_Y, patch.m_YPlane); - //if luma TB size > 4, fill chroma TBs of size / 2 - if (refBlock.m_BHeight != 4) - { - GetIntraPredPlane(refBlock, refBlock.m_IntraModeChroma, frame, CHROMA_U, patch.m_UPlane); - GetIntraPredPlane(refBlock, refBlock.m_IntraModeChroma, frame, CHROMA_V, patch.m_VPlane); - return patch; - } - - // else luma TB has size = 4, we have one chroma TB corresponding to four 4x4 luma TBs - //if refBlock is the lower-right block among four brothers in the RQT, - //fill extendedPatch of size 8x8 in luma samples with: - //see last paragraph before new chapter, p. 65(76) in HEVC Algorithms and Architectures - if (refBlock.m_AdrX % 8 == 4 && refBlock.m_AdrY % 8 == 4) - { - //three luma blocks 4x4 already put into targetBlock - PatchBlock extendedPatch = PatchBlock(BaseBlock(refBlock.m_AdrX - 4, refBlock.m_AdrY - 4, 8, 8), frame); - //luma component of size 4x4 taken from patch - extendedPatch.InsertAnotherPatch(patch); - //chroma components of size 4x4 corresponding to the union of four luma blocks mentioned above - GetIntraPredPlane(extendedPatch, refBlock.m_IntraModeChroma, frame, CHROMA_U, extendedPatch.m_UPlane); - GetIntraPredPlane(extendedPatch, refBlock.m_IntraModeChroma, frame, CHROMA_V, extendedPatch.m_VPlane); - return extendedPatch; - } - - //else return only luma prediction - return patch; -} - -void FrameProcessor::MakeTUIntraPrediction(const TUBlock& refBlock, PatchBlock& targetPatch) -{ - PatchBlock patch(refBlock); - //now the most contrast mode is determined only for luma component, chroma mode is set equal to luma mode - GetIntraPredPlane(refBlock, refBlock.m_IntraModeLuma, targetPatch, LUMA_Y, patch.m_YPlane); - //write Patch into targetPatch - targetPatch.InsertAnotherPatch(patch); -} - -void FrameProcessor::ApplyTUIntraPrediction(const TUBlock & block, ExtendedSurface& surf) -{ - PatchBlock framePatchBlock(BaseBlock(0, 0, surf.Info.CropW, surf.Info.CropH), surf); - PatchBlock patch = GetIntraPatchBlock(block, framePatchBlock); - //write Patch into frame - PutPatchIntoFrame(patch, surf); -} - -//Iterates over CUs in CTU and applies intra prediction for intra CUs inside it -void FrameProcessor::ApplyIntraPredInCTU(const CTUDescriptor & CTU, FrameChangeDescriptor & frame_descr) -{ - for (auto& CU : CTU.m_CUVec) - { - if (CU.m_PredType == INTRA_PRED) - { - for (auto& TU : CU.m_TUVec) - { - ApplyTUIntraPrediction(TU, *frame_descr.m_frame); - } - } - } -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_reorder.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_reorder.cpp deleted file mode 100644 index e1ea32d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/frame_reorder.cpp +++ /dev/null @@ -1,465 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "frame_reorder.h" - -mfxI32 GetFrameNum(bool bField, mfxI32 Poc, bool bSecondField) -{ - return bField ? (Poc + (!bSecondField)) / 2 : Poc; -} - -mfxU8 GetFrameType( - mfxVideoParam const & video, - mfxU32 pictureOrder, // Picture order after last IDR - bool isPictureOfLastFrame) -{ - mfxU32 gopOptFlag = video.mfx.GopOptFlag; - mfxU32 gopPicSize = video.mfx.GopPicSize; - mfxU32 gopRefDist = video.mfx.GopRefDist; - mfxU32 idrPicDist = gopPicSize * (video.mfx.IdrInterval); - - if (gopPicSize == 0xffff) - idrPicDist = gopPicSize = 0xffffffff; - - bool bFields = !!(video.mfx.FrameInfo.PicStruct & MFX_PICSTRUCT_FIELD_SINGLE); - - mfxU32 frameOrder = bFields ? pictureOrder / 2 : pictureOrder; - - bool bSecondField = bFields && (pictureOrder & 1); - bool bIdr = (idrPicDist ? frameOrder % idrPicDist : frameOrder) == 0; - - if (bIdr) - return bSecondField ? (MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF) : (MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF | MFX_FRAMETYPE_IDR); - - if (frameOrder % gopPicSize == 0) - return (mfxU8)(bSecondField ? MFX_FRAMETYPE_P : MFX_FRAMETYPE_I) | MFX_FRAMETYPE_REF; - - if (frameOrder % gopPicSize % gopRefDist == 0) - return (MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF); - - if ((gopOptFlag & MFX_GOP_STRICT) == 0) - { - if (((frameOrder + 1) % gopPicSize == 0 && (gopOptFlag & MFX_GOP_CLOSED)) || - (idrPicDist && (frameOrder + 1) % idrPicDist == 0) || - isPictureOfLastFrame) - { - return (MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF); - } - } - - return MFX_FRAMETYPE_B; -} - -ExternalFrame FrameReorder::CreateExternalFrame(mfxI32 order, const mfxVideoParam& param) -{ - mfxI32 poc = -1; - ExternalFrame out = { 0xffffffff, 0, 0, poc, false, false }; - FrameIterator itOut = m_queue.end(); - - bool bIsFieldCoding = !!(param.mfx.FrameInfo.PicStruct & MFX_PICSTRUCT_FIELD_SINGLE); - - //=================1. Get type, poc, put frame in the queue===================== - - if (order >= 0) - { - - bool isPictureOfLastFrameInGOP = ((mfxU32)order >> (mfxU32)bIsFieldCoding) == ((m_nMaxFrames - 1) >> (mfxU32)bIsFieldCoding); // EOS - - Frame frame; - - frame.DisplayOrder = (mfxU32)order; - - frame.Type = GetFrameType(param, order - m_lastIdr, isPictureOfLastFrameInGOP); // If we will use IDR not only for first field - // We need to change this logic - - if(frame.Type & MFX_FRAMETYPE_IDR && (order & 1)) - throw std::string("ERROR: FrameReorder::CreateExternalFrame: Idr isn't first field"); - - if (frame.Type & MFX_FRAMETYPE_IDR) - m_lastIdr = order; - - frame.Poc = order - m_lastIdr; - frame.bSecondField = bIsFieldCoding && (order & 1); - frame.bBottomField = false; - if (bIsFieldCoding) - { - frame.bBottomField = isBFF(param) != frame.bSecondField; - } - - if (frame.Type & MFX_FRAMETYPE_I) - { - m_anchorPOC = frame.Poc; - } - - m_queue.emplace_back(frame); - } - - //=================2. Reorder frames, fill output frame poc, type, etc===================== - itOut = Reorder(order < 0, bIsFieldCoding); - if (itOut == m_queue.end()) - return out; - - out.DisplayOrder = itOut->DisplayOrder; - - bool isIdr = !!(itOut->Type & MFX_FRAMETYPE_IDR); - bool isRef = !!(itOut->Type & MFX_FRAMETYPE_REF); - bool isI = !!(itOut->Type & MFX_FRAMETYPE_I); - bool isB = !!(itOut->Type & MFX_FRAMETYPE_B); - - itOut->LastRAP = m_lastFrame.LastRAP; - - if (isI) - { - itOut->IPoc = itOut->Poc; - itOut->PrevIPoc = m_lastFrame.IPoc; - itOut->NextIPoc = -1; - } - else - { - if (itOut->Poc >= m_lastFrame.IPoc) - { - itOut->IPoc = m_lastFrame.IPoc; - itOut->PrevIPoc = m_lastFrame.PrevIPoc; - itOut->NextIPoc = m_lastFrame.NextIPoc; - } - else - { - itOut->IPoc = m_lastFrame.PrevIPoc; - itOut->PrevIPoc = -1; - itOut->NextIPoc = m_lastFrame.IPoc; - } - } - - out.Poc = itOut->Poc; - out.Type = itOut->Type; - out.bSecondField = itOut->bSecondField; - out.bBottomField = itOut->bBottomField; - - //=================3. Update DPB===================== - if (isIdr) - m_dpb.clear(); - - if (itOut->Poc > itOut->LastRAP && - m_lastFrame.Poc <= m_lastFrame.LastRAP) - { - const mfxI32 & lastRAP = itOut->LastRAP; - // On the 1st TRAIL remove all except IRAP - m_dpb.erase(std::remove_if(m_dpb.begin(), m_dpb.end(), - [&lastRAP](Frame const & entry) { return entry.Poc != lastRAP; }), - m_dpb.end()); - } - - //=================4. Construct RPL===================== - std::sort(m_dpb.begin(), m_dpb.end(), [](const Frame & lhs_frame, const Frame & rhs_frame) - { - return lhs_frame.Poc < rhs_frame.Poc; - }); - - std::vector & L0 = out.ListX[0]; - std::vector & L1 = out.ListX[1]; - - L0.clear(); - L1.clear(); - - if (!isI) - { - // Fill L0/L1 - for (auto it = m_dpb.begin(); it != m_dpb.end(); it++) - { - bool list = it->Poc > out.Poc; - out.ListX[list].push_back(*it); - } - - auto preferSamePolarity = [&out](const Frame & lhs_frame, const Frame & rhs_frame) - { - mfxI32 currFrameNum = GetFrameNum(true, out.Poc, out.bSecondField); - - mfxU32 lhs_distance = std::abs(GetFrameNum(true, lhs_frame.Poc, lhs_frame.bSecondField) - currFrameNum) * 2 + ((lhs_frame.bBottomField == out.bBottomField) ? 0 : 1); - - mfxU32 rhs_distance = std::abs(GetFrameNum(true, rhs_frame.Poc, rhs_frame.bSecondField) - currFrameNum) * 2 + ((rhs_frame.bBottomField == out.bBottomField) ? 0 : 1); - - return lhs_distance <= rhs_distance; - }; - - auto distance = [&out](const Frame & lhs_frame, const Frame & rhs_frame) - { - mfxU32 lhs_distance = std::abs(lhs_frame.Poc - out.Poc); - mfxU32 rhs_distance = std::abs(rhs_frame.Poc - out.Poc); - - return lhs_distance < rhs_distance; - }; - - if (bIsFieldCoding) - { - std::sort(L0.begin(), L0.end(), preferSamePolarity); - std::sort(L1.begin(), L1.end(), preferSamePolarity); - } - else - { - std::sort(L0.begin(), L0.end(), distance); - std::sort(L1.begin(), L1.end(), distance); - } - - if ((param.mfx.GopOptFlag & MFX_GOP_CLOSED)) - { - const mfxI32 & IPoc = itOut->IPoc; - { - // Remove L0 refs beyond GOP - L0.erase(std::remove_if(L0.begin(), L0.end(), - [&IPoc](const Frame & frame) { return frame.Poc < IPoc; }), - L0.end()); - } - - const mfxI32 & nextIPoc = itOut->NextIPoc; - if (nextIPoc != -1) - { - // Remove L1 refs beyond GOP - L1.erase(std::remove_if(L1.begin(), L1.end(), - [&nextIPoc](const Frame & frame) { return frame.Poc >= nextIPoc; }), - L1.end()); - } - } - - // if B's L1 is zero (e.g. in case of closed gop) - if (isB && !L1.size() && L0.size()) - L1.push_back(L0[0]); - - if (!isB && m_UseGPB) - { - L1 = L0; - std::sort(L1.begin(), L1.end(), distance); - } - - // Remove extra entries - if (L0.size() > (isB ? m_NumRefActiveBL0 : m_NumRefActiveP)) - L0.resize(isB ? m_NumRefActiveBL0 : m_NumRefActiveP); - - if (L1.size() > m_NumRefActiveBL1) - L1.resize(m_NumRefActiveBL1); - - std::sort(L0.begin(), L0.end(), distance); - std::sort(L1.begin(), L1.end(), distance); - } - - //=================5. Save current frame in DPB===================== - if (isRef) - { - if (m_dpb.size() == m_NumRef) - { - auto toRemove = m_dpb.begin(); - - m_dpb.erase(toRemove); - } - m_dpb.push_back(*itOut); - } - - itOut->NalType = GetNALUType(*itOut, !bIsFieldCoding); - - if (itOut->NalType == CRA_NUT || itOut->NalType == IDR_W_RADL) - itOut->LastRAP = itOut->Poc; - - m_lastFrame = *itOut; - - m_queue.erase(itOut); - - return out; -} - -mfxU8 FrameReorder::GetNALUType(Frame const & frame, bool isRAPIntra) -{ - const bool isI = !!(frame.Type & MFX_FRAMETYPE_I); - const bool isRef = !!(frame.Type & MFX_FRAMETYPE_REF); - const bool isIDR = !!(frame.Type & MFX_FRAMETYPE_IDR); - - if (isIDR) - return IDR_W_RADL; - - if (isI && isRAPIntra) - { - return CRA_NUT; - } - - if (frame.Poc > frame.LastRAP) - { - return isRef ? TRAIL_R : TRAIL_N; - } - - if (isRef) - return RASL_R; - return RASL_N; -} - -bool FrameReorder::HasL1(mfxI32 poc) -{ - for (auto it = m_dpb.begin(); it < m_dpb.end(); it++) - if (it->Poc > poc) - return true; - return false; -} - -mfxU32 FrameReorder::BRefOrder(mfxU32 displayOrder, mfxU32 begin, mfxU32 end, mfxU32 counter, bool & ref) -{ - ref = (end - begin > 1); - - mfxU32 pivot = (begin + end) / 2; - if (displayOrder == pivot) - return counter; - else if (displayOrder < pivot) - return BRefOrder(displayOrder, begin, pivot, counter + 1, ref); - else - return BRefOrder(displayOrder, pivot + 1, end, counter + 1 + pivot - begin, ref); -} - -mfxU32 FrameReorder::GetBiFrameLocation(mfxU32 displayOrder, mfxU32 num, bool &ref) -{ - ref = false; - return BRefOrder(displayOrder, 0, num, 0, ref); -} - -mfxU32 FrameReorder::BPyrReorder(const std::vector & bframes) -{ - mfxU32 num = (mfxU32)bframes.size(); - if (bframes[0]->Bpo == (mfxU32)MFX_FRAMEORDER_UNKNOWN) - { - bool bRef = false; - - for (mfxU32 i = 0; i < (mfxU32)bframes.size(); i++) - { - bframes[i]->Bpo = GetBiFrameLocation(i, num, bRef); - if (bRef) - bframes[i]->Type |= MFX_FRAMETYPE_REF; - } - } - mfxU32 minBPO = (mfxU32)MFX_FRAMEORDER_UNKNOWN; - mfxU32 ind = 0; - for (mfxU32 i = 0; i < (mfxU32)bframes.size(); i++) - { - if (bframes[i]->Bpo < minBPO) - { - ind = i; - minBPO = bframes[i]->Bpo; - } - } - return ind; -} - -FrameReorder::FrameIterator FrameReorder::Reorder(bool flush, bool bFields) -{ - FrameIterator begin = m_queue.begin(); - FrameIterator end = m_queue.begin(); - - while (end != m_queue.end()) - { - if ((end != begin) && (end->Type & MFX_FRAMETYPE_IDR)) - { - flush = true; - break; - } - end++; - } - - if (bFields && m_lastFieldInfo.bFirstField()) - { - while (begin != end && !m_lastFieldInfo.isCorrespondSecondField(*begin)) - begin++; - - if (begin != end) - { - m_lastFieldInfo.CorrectFrameInfo(*begin); - return begin; - } - else - begin = m_queue.begin(); - } - - FrameIterator top = Reorder(begin, end, flush, bFields); - - if (top == end) - { - return top; - } - - if (bFields) - { - m_lastFieldInfo.SaveInfo(*top); - } - - return top; -} - -FrameReorder::FrameIterator FrameReorder::Reorder(FrameIterator begin, FrameIterator end, bool flush, bool bFields) -{ - FrameIterator top = begin; - FrameIterator b0 = end; // 1st non-ref B with L1 > 0 - std::vector bframes; - - bool isBPyramid = !!(m_BRefType == MFX_B_REF_PYRAMID); - - while (top != end && (top->Type & MFX_FRAMETYPE_B)) - { - if (HasL1(top->Poc) && (!top->bSecondField)) - { - if (isBPyramid) - bframes.push_back(top); - else if (top->Type & MFX_FRAMETYPE_REF) - { - if (b0 == end || (top->Poc - b0->Poc < bFields + 2)) - return top; - } - else if (b0 == end) - b0 = top; - } - top++; - } - - if (!bframes.empty()) - { - return bframes[BPyrReorder(bframes)]; - } - - if (b0 != end) - return b0; - - bool strict = !!(m_GopOptFlag & MFX_GOP_STRICT); - if (flush && top == end && begin != end) - { - top--; - if (strict) - top = begin; - else - top->Type = MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF; - - if (top->bSecondField && top != begin) - { - top--; - if (strict) - top = begin; - else - top->Type = MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF; - } - } - - return top; -} -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/generator.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/generator.cpp deleted file mode 100644 index 5387cf8..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/generator.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "generator.h" - -// Processor for generation mode -void Generator::Init() -{ - try - { - mfxStatus sts = m_FileReader.Init(std::list{m_InputParams.m_InputFileName}, MFX_FOURCC_I420); - CHECK_THROW_ERR(sts, "Generator::Init::m_FileReader.Init"); - - sts = m_FileWriter.Init(m_InputParams.m_OutputFileName.c_str(), 1); - CHECK_THROW_ERR(sts, "Generator::Init::m_FileWriter.Init"); - - // Add a buffer to bufferWriter - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - m_BufferWriter.AddBuffer(MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED, m_InputParams.m_PredBufferFileName); - } - catch (std::string& e) { - std::cout << e << std::endl; - throw std::string("ERROR: Couldn't initialize Generator"); - } - return; -} - -// Get surface and load new YUV frame from file to it -ExtendedSurface* Generator::PrepareSurface() -{ - ExtendedSurface* surf = GetFreeSurf(); - if (!surf) - { - throw std::string("ERROR: Generator::PrepareSurface: Undefined reference to surface"); - } - ++surf->Data.Locked; - - mfxStatus sts = m_FileReader.LoadNextFrame(surf); - CHECK_THROW_ERR(sts, "Generator::PrepareSurface::FileReader.LoadNextFrame"); - - return surf; -} - -void Generator::DropBuffers(ExtendedSurface& frame) -{ - for (mfxU32 i = 0; i < frame.Data.NumExtParam; ++i) - { - CHECK_THROW_ERR_BOOL(frame.Data.ExtParam[i], "Generator::DropFrames: surf.Data.ExtParam[i] == NULL"); - - // Drop data on disk - m_BufferWriter.WriteBuffer(frame.Data.ExtParam[i]); - // Zero data of written buffer - m_BufferWriter.ResetBuffer(frame.Data.ExtParam[i]); - } - - return; -} - -// Save all data -// -// Iterate through all unlocked frames and dump frame + buffers. When Locked frame met, iteration stops. -void Generator::DropFrames() -{ - // Sort data by frame order and drop in DisplayOrder - - // TODO / FIXME: Add EncodedOrder processing, it might be required for HEVC FEI PAK - m_Surfaces.sort([](ExtendedSurface& left, ExtendedSurface& right) { return left.Data.FrameOrder < right.Data.FrameOrder; }); - - for (ExtendedSurface& surf : m_Surfaces) - { - // If Locked surface met - stop dumping - if (surf.Data.Locked) break; - - // If the surface has already been output, move on to the next one in frame order - if (surf.isWritten) continue; - - // Write surface on disk - mfxStatus sts = m_FileWriter.WriteNextFrameI420(&surf); - surf.isWritten = true; - CHECK_THROW_ERR(sts, "Generator::DropFrames::m_FileWriter.WriteNextFrameI420"); - } -} - -void Generator::SavePSData() -{ - if (fpPicStruct.is_open()) - { - // sort by coding order - std::sort(m_RefControl.RefLogInfo.begin(), m_RefControl.RefLogInfo.end(), IsInCodingOrder); - - for (auto stat : m_RefControl.RefLogInfo) - stat.Dump(fpPicStruct); - } -} - -#endif // MFX_VERSION \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/inputparameters.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/inputparameters.cpp deleted file mode 100644 index b78431d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/inputparameters.cpp +++ /dev/null @@ -1,551 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - - -#include "inputparameters.h" - -using namespace std; - -void PrintHelp() -{ - printf("Usage:"); - printf(" -i InputYUVFile -o OutputYUVFile -w width -h height -n number_of_frames_to_process\n"); - printf(" The above params are required. If -pic_file or repack parameters are enabled, next parameters:-i InputYUVFile -o OutputYUVFile -w width -h height\n"); - printf(" Can be removed\n"); - //i/o/log - printf(" [-g num] - GOP size\n"); - printf(" [-r num] - number of B frames plus 1\n"); - printf(" [-x num] - DPB size in frames\n"); - printf(" [-idr_interval num] - IDR interval in frames\n"); - printf(" [-num_active_P num] - number of active references for P frames\n"); - printf(" [-num_active_BL0 num] - number of active List 0 references for B frames\n"); - printf(" [-num_active_BL1 num] - number of active List 1 references for B frames\n"); - printf(" [-generate] - run ASG in test stream generation mode\n"); // required - printf(" [-verify] - run ASG in test results verification mode\n"); // required - printf(" [-gen_split] - enable CTU splitting\n"); - printf(" [-no_cu_to_pu_split] - disable CU splitting into PUs\n"); - printf(" [-force_extbuf_mvp_block_size num] - force mfxFeiHevcEncMVPredictors::BlockSize field\n"); - printf(" in MVP output buffer to a specified value. *ALL* output \n"); - printf(" mfxFeiHevcEncMVPredictors structs will be affected.\n"); - printf(" Supported values are 0, 1, 2 and 3\n"); - printf(" See MVPredictor description in HEVC FEI manual for details\n"); - printf(" [-mvp_block_size num] - actual MVP block size used in actual generation algorithm.\n"); - printf(" If -force_extbuf_mvp_block_size is not specified,\n"); - printf(" this value is used in output mfxFeiHevcEncMVPredictors::BlockSize\n"); - printf(" only for the structures for which MVPs were actually generated\n"); - printf(" When -force_extbuf_mvp_block_size is specified and -mvp_block_size is not\n"); - printf(" default algorithm for MVP generation is used : MVP block size equals to CTU size.\n"); - printf(" When both -force_extbuf_mvp_block_size and -mvp_block_size are specified : the 1st one\n"); - printf(" value is used in the output ExtBuffer regardless to actual MVP block size\n"); - printf(" Supported values are 0, 1, 2 and 3\n"); - printf(" [-force_symm_cu_part] - forces using only symmetric CU into PU partioning modes\n"); - printf(" for inter prediction test\n"); - printf(" [-gen_inter] - generate inter CUs (inter prediction test)\n"); - printf(" [-gen_intra] - generate intra CUs (intra prediction test)\n"); - printf(" [-gen_pred] - generate MV predictors (inter prediction test)\n"); - printf(" [-gen_mv] - generate motion vectors inside search window (inter prediction test)\n"); // name != sense - printf(" If -gen_mv is not specified,\n"); - printf(" then resulting MVs for PUs will be generated outside\n"); - printf(" the search window only\n"); - printf(" [-gen_repack_ctrl] - generate/verify repack control data\n"); - printf(" [-pred_file File] - output file for MV predictors\n"); - printf(" [-pic_file File] - output file for pictures' structure\n"); - printf(" [-log2_ctu_size num] - log2 CTU size to be used for CU quad-tree structure\n"); - printf(" Default is 4"); - printf(" Cannot be less than min_log2_tu_size (described below)\n"); - printf(" [-min_log2_tu_size num] - minimum log2 TU size to be used for quad-tree structure\n"); - printf(" Must be less than min_log2_cu_size (described below), default is 2\n"); - printf(" [-max_log2_tu_size num] - maximum log2 TU size to be used for quad-tree structure\n"); - printf(" Must be less than or equal to Min(log2_ctu_size, 5), default is 4\n"); - printf(" [-max_tu_qt_depth num] - maximum TU quad-tree depth inside CU\n"); - printf(" Overrrides min_log2_tu_size, default is 4\n"); - printf(" [-min_log2_cu_size num] - minimum log2 CU size to be used for quad-tree structure.\n"); - printf(" Cannot be less than max_log2_tu_size, default is 3\n"); - printf(" [-max_log2_cu_size num] - maximum log2 CU size to be used for quad-tree structure.\n"); - printf(" Cannot be larger than log2_ctu_size, default is 4\n"); - printf(" [-block_size_mask num] - bit mask specifying possible partition sizes\n"); - printf(" [-ctu_distance num] - minimum distance between generated CTUs\n"); - printf(" (in units of CTU), default is 3\n"); - printf(" [-gpb_off] - specifies that regular P frames should be used, not GPB frames\n"); - printf(" [-bref] - arrange B frames in B pyramid reference structure\n"); - printf(" [-nobref] - do not use B-pyramid\n"); - printf(" [-pak_ctu_file File] - input file with per CTU information\n"); - printf(" [-pak_cu_file File] - input file with per CU information\n"); - printf(" [-repack_ctrl_file File]- output/input file with repack control data for repack control generation/verify\n"); - printf(" [-repack_stat_file File]- input file with repack stat data for repack control verify\n"); - printf(" [-repack_str_file File] - input file with multiPakStr data for repack control generation/verify\n"); - printf(" [-log File] - log output file\n"); - printf(" [-csv File] - file to output statistics in CSV format\n"); // ignored - printf(" [-config ConfigFile] - input configuration file\n"); // ignored - printf(" [-sub_pel_mode num] - specifies sub pixel precision for motion vectors. 0 - integer, 1 - half, 3 - quarter (0 is default)\n"); - printf(" [-mv_thres num] - threshold for motion vectors in percents (0 is default)\n"); - printf(" [-numpredictors num] - number of MV predictors enabled. Used in verification mode to check NumMvPredictors FEI control works correctly\n"); - printf(" - Valid values are in range [1; 4] (4 is default)\n"); - printf(" [-split_thres num] - thresholds for partitions in percents (0 is default)\n"); - printf(" [-DeltaQP value(s)] - array of delta QP values for repack ctrl generation, separated by a space (8 values at max)\n"); - printf(" [-InitialQP value] - the initial QP value for repack ctrl verify (26 is default)\n"); -} - -void InputParams::ParseInputString(msdk_char **strInput, mfxU8 nArgNum) -{ - try { - - //parse command line parameters - for (mfxU8 i = 1; i < nArgNum; ++i) - { - //Verbose mode, output to command line. Missed in Help - if (msdk_strcmp(strInput[i], MSDK_STRING("-verbose")) == 0 - || msdk_strcmp(strInput[i], MSDK_STRING("-v")) == 0) - m_bVerbose = true; - - //I/O YUV files - else if (msdk_strcmp(strInput[i], MSDK_STRING("-i")) == 0) - m_InputFileName = GetStringArgument(strInput, ++i, nArgNum); - else if (msdk_strcmp(strInput[i], MSDK_STRING("-o")) == 0) - m_OutputFileName = GetStringArgument(strInput, ++i, nArgNum); - - //width - else if (msdk_strcmp(strInput[i], MSDK_STRING("-w")) == 0) - m_width = GetIntArgument(strInput, ++i, nArgNum); - - //height - else if (msdk_strcmp(strInput[i], MSDK_STRING("-h")) == 0) - m_height = GetIntArgument(strInput, ++i, nArgNum); - - //frame number - else if (msdk_strcmp(strInput[i], MSDK_STRING("-n")) == 0) - m_numFrames = GetIntArgument(strInput, ++i, nArgNum); - - // Encoding structure - - // GOP size - else if (msdk_strcmp(strInput[i], MSDK_STRING("-g")) == 0) - m_GopSize = GetIntArgument(strInput, ++i, nArgNum); - - // Number of B frames + 1 - else if (msdk_strcmp(strInput[i], MSDK_STRING("-r")) == 0) - m_RefDist = GetIntArgument(strInput, ++i, nArgNum); - - // DPB size - else if (msdk_strcmp(strInput[i], MSDK_STRING("-x")) == 0) - { - m_NumRef = GetIntArgument(strInput, ++i, nArgNum); - if (m_NumRef > 16) throw std::string("ERROR: Invalid DPB size"); - } - - else if (msdk_strcmp(strInput[i], MSDK_STRING("-idr_interval")) == 0) - m_nIdrInterval = GetIntArgument(strInput, ++i, nArgNum); - - // Number active references for P frames - else if (msdk_strcmp(strInput[i], MSDK_STRING("-num_active_P")) == 0) - { - m_NumRefActiveP = GetIntArgument(strInput, ++i, nArgNum); - if (m_NumRefActiveP > 4) throw std::string("ERROR: Invalid num_active_P"); - } - - // Number of backward references for B frames - else if (msdk_strcmp(strInput[i], MSDK_STRING("-num_active_BL0")) == 0) - { - m_NumRefActiveBL0 = GetIntArgument(strInput, ++i, nArgNum); - if (m_NumRefActiveBL0 > 4) throw std::string("ERROR: Invalid num_active_BL0"); - } - - // Number of forward references for B frames - else if (msdk_strcmp(strInput[i], MSDK_STRING("-num_active_BL1")) == 0) - { - m_NumRefActiveBL1 = GetIntArgument(strInput, ++i, nArgNum); - if (m_NumRefActiveBL1 > 1) throw std::string("ERROR: Invalid num_active_BL1"); - } - - // Set parameters for b-pyramid - else if (msdk_strcmp(strInput[i], MSDK_STRING("-bref")) == 0) - { - m_BRefType = MFX_B_REF_PYRAMID; - } - else if (msdk_strcmp(strInput[i], MSDK_STRING("-nobref")) == 0) - { - m_BRefType = MFX_B_REF_OFF; - } - - // processing mode - else if (msdk_strcmp(strInput[i], MSDK_STRING("-generate")) == 0) - m_ProcMode = GENERATE; - else if (msdk_strcmp(strInput[i], MSDK_STRING("-verify")) == 0) - m_ProcMode = VERIFY; - - // test type - - // Enable split of CTU - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gen_split")) == 0) - m_TestType |= GENERATE_SPLIT; - - // Generate MVs, Inter-prediction test - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gen_mv")) == 0) - m_TestType |= GENERATE_MV; - - // Generate Intra CUs, Intra-prediction test - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gen_intra")) == 0) - m_TestType |= GENERATE_INTRA; - - // Generate Inter CUs, Inter-prediction test - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gen_inter")) == 0) - m_TestType |= GENERATE_INTER; - - // Generate long MVs which are outside of SW, Inter-prediction test - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gen_pred")) == 0) - m_TestType |= GENERATE_PREDICTION; - - // Generate or verify multi-repack control data - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gen_repack_ctrl")) == 0) - m_TestType |= GENERATE_REPACK_CTRL; - - // Drop data to file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-pred_file")) == 0) - m_PredBufferFileName = GetStringArgument(strInput, ++i, nArgNum); - - // Drop pictures structure to file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-pic_file")) == 0) { - m_PicStructFileName = GetStringArgument(strInput, ++i, nArgNum); - m_TestType |= GENERATE_PICSTRUCT; - } - - // Minimum log CU size to be used for quad-tree structure - else if (msdk_strcmp(strInput[i], MSDK_STRING("-min_log2_cu_size")) == 0) - m_CTUStr.minLog2CUSize = GetIntArgument(strInput, ++i, nArgNum); - - // Maximum log CU size to be used for quad-tree structure - else if (msdk_strcmp(strInput[i], MSDK_STRING("-max_log2_cu_size")) == 0) - m_CTUStr.maxLog2CUSize = GetIntArgument(strInput, ++i, nArgNum); - - // Disable CU splitting into PUs - else if (msdk_strcmp(strInput[i], MSDK_STRING("-no_cu_to_pu_split")) == 0) - m_CTUStr.bCUToPUSplit = false; - - // Force per-MVP block size in the MVP output file to a supported value - else if (msdk_strcmp(strInput[i], MSDK_STRING("-force_extbuf_mvp_block_size")) == 0) - { - m_ForcedExtMVPBlockSize = GetIntArgument(strInput, ++i, nArgNum); - m_bIsForceExtMVPBlockSize = true; - } - - // Actual per-MVP block size used in generation algorithm - else if (msdk_strcmp(strInput[i], MSDK_STRING("-mvp_block_size")) == 0) - { - m_GenMVPBlockSize = GetIntArgument(strInput, ++i, nArgNum); - } - - // Force only symmetric CU into PU partioning - else if (msdk_strcmp(strInput[i], MSDK_STRING("-force_symm_cu_part")) == 0) - { - m_CTUStr.bForceSymmetricPU = true; - } - - // Log2 CTU size to be used for quad-tree structure. Also the maximum - // possible CU size - else if (msdk_strcmp(strInput[i], MSDK_STRING("-log2_ctu_size")) == 0) - { - m_CTUStr.log2CTUSize = GetIntArgument(strInput, ++i, nArgNum); - m_CTUStr.CTUSize = (mfxU32)(1 << m_CTUStr.log2CTUSize); - } - - // Minimum log TU size to be used for quad-tree structure - else if (msdk_strcmp(strInput[i], MSDK_STRING("-min_log2_tu_size")) == 0) - m_CTUStr.minLog2TUSize = GetIntArgument(strInput, ++i, nArgNum); - - // Maximum log TU size to be used for quad-tree structure - else if (msdk_strcmp(strInput[i], MSDK_STRING("-max_log2_tu_size")) == 0) - m_CTUStr.maxLog2TUSize = GetIntArgument(strInput, ++i, nArgNum); - - // Maximum TU quad-tree depth inside CU - else if (msdk_strcmp(strInput[i], MSDK_STRING("-max_tu_qt_depth")) == 0) - m_CTUStr.maxTUQTDepth = GetIntArgument(strInput, ++i, nArgNum); - - // which blocks to use in partitions (bitmask) - else if (msdk_strcmp(strInput[i], MSDK_STRING("-block_size_mask")) == 0) - m_block_size_mask = GetIntArgument(strInput, ++i, nArgNum); - - // Minimum distance between generated CTUs in terms of CTU - else if (msdk_strcmp(strInput[i], MSDK_STRING("-ctu_distance")) == 0) - m_CTUStr.CTUDist = GetIntArgument(strInput, ++i, nArgNum); - - // Read CTU data from file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-pak_ctu_file")) == 0) - m_PakCtuBufferFileName = GetStringArgument(strInput, ++i, nArgNum); - - // Read CU data from file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-pak_cu_file")) == 0) - m_PakCuBufferFileName = GetStringArgument(strInput, ++i, nArgNum); - - // Whether GPB frames should be used instead of regular P frames - else if (msdk_strcmp(strInput[i], MSDK_STRING("-gpb_off")) == 0) - m_UseGPB = false; - - // Thresholds - else if (msdk_strcmp(strInput[i], MSDK_STRING("-mv_thres")) == 0) - m_Thresholds.mvThres = GetIntArgument(strInput, ++i, nArgNum); - else if (msdk_strcmp(strInput[i], MSDK_STRING("-split_thres")) == 0) - m_Thresholds.splitThres = GetIntArgument(strInput, ++i, nArgNum); - // Number of enabled MV predictors. For disabled predictors upper MV-threshold is ON - else if (msdk_strcmp(strInput[i], MSDK_STRING("-numpredictors")) == 0) - m_NumMVPredictors = GetIntArgument(strInput, ++i, nArgNum); - - // Motion prediction precision mode - else if (msdk_strcmp(strInput[i], MSDK_STRING("-sub_pel_mode")) == 0) - { - if (++i < nArgNum) - { - m_SubPixelMode = ParseSubPixelMode(strInput[i]); - } - else - { - throw std::string("ERROR: sub_pel_mode require an argument"); - } - } - - // The multi-repack control data file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-repack_ctrl_file")) == 0) - m_RepackCtrlFileName = GetStringArgument(strInput, ++i, nArgNum); - - // The multiPakStr data file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-repack_str_file")) == 0) - m_RepackStrFileName = GetStringArgument(strInput, ++i, nArgNum); - - // The multi-repack stat data file - else if (msdk_strcmp(strInput[i], MSDK_STRING("-repack_stat_file")) == 0) - m_RepackStatFileName = GetStringArgument(strInput, ++i, nArgNum); - - //Repack control num passes and delta QP - else if((msdk_strcmp(strInput[i], MSDK_STRING("-DeltaQP")) == 0)) - { - mfxU32 idxQP; - for(idxQP = 0; idxQP < m_NumAddPasses; idxQP++) - { - if(msdk_strncmp(strInput[i+1], MSDK_STRING("-"), 1) == 0) - break; - - m_DeltaQP[idxQP] = (mfxU8)GetIntArgument(strInput, ++i, nArgNum); - } - m_NumAddPasses = idxQP; - } - - //Repack control initial QP - else if((msdk_strcmp(strInput[i], MSDK_STRING("-InitialQP")) == 0)) - m_InitialQP = GetIntArgument(strInput, ++i, nArgNum); - - else if (msdk_strcmp(strInput[i], MSDK_STRING("-log")) == 0) - { - m_bUseLog = true; - m_LogFileName = GetStringArgument(strInput, ++i, nArgNum); - } - //help - else if (msdk_strcmp(strInput[i], MSDK_STRING("-help")) == 0 - || msdk_strcmp(strInput[i], MSDK_STRING("--help")) == 0) - { - m_bPrintHelp = true; - } - else - throw std::string("ERROR: Unknown input argument"); - } - - if (m_bPrintHelp) - { - PrintHelp(); - return; - } - - if (m_TestType == UNDEFINED_TYPE) - throw std::string("ERROR: Undefined test type"); - - if (m_ProcMode == UNDEFINED_MODE) - throw std::string("ERROR: Undefined mode"); - - if (m_numFrames == 0) - throw std::string("ERROR: Invalid number of frames"); - - if ((m_TestType & GENERATE_PICSTRUCT) && m_TestType != GENERATE_PICSTRUCT) - throw std::string("ERROR: Improper arguments mix with pic_struct"); - - if (m_TestType == GENERATE_PICSTRUCT) - return; - - //Repack control generation checking - if (m_TestType & GENERATE_REPACK_CTRL) - { - if (m_TestType != GENERATE_REPACK_CTRL) - throw std::string("ERROR: Improper arguments mix with gen_repack_ctrl"); - - if (m_ProcMode == GENERATE) - { - if (m_NumAddPasses == 0 || m_NumAddPasses > HEVC_MAX_NUMPASSES) - throw std::string("ERROR: Wrong NumAddPasses value"); - - if (!m_RepackCtrlFileName.empty() && !m_RepackStrFileName.empty()) - return; - else - throw std::string("ERROR: repack ctrl and str files required"); - } - else if (m_ProcMode == VERIFY) - { - if (!m_RepackCtrlFileName.empty() - && !m_RepackStrFileName.empty() - && !m_RepackStatFileName.empty()) - return; - else - throw std::string("ERROR: repack ctrl, str and stat files required"); - } - else - { - throw std::string("ERROR: Wrong proc mode"); - } - } - - if (m_ProcMode == GENERATE && (m_TestType & (GENERATE_INTER | GENERATE_INTRA)) && (m_InputFileName.length() == 0 || m_OutputFileName.length() == 0)) - throw std::string("ERROR: input and output YUV files required"); - - if (m_ProcMode == GENERATE && (m_TestType & GENERATE_PREDICTION) - && m_PredBufferFileName.length() == 0) - throw std::string("ERROR: To generate predictors output file is required"); - - if ((m_ProcMode & VERIFY) && (m_TestType & (GENERATE_INTER | GENERATE_INTRA)) && m_PakCtuBufferFileName.length() == 0) - throw std::string("ERROR: PAK CTU input file is required"); - - if ((m_ProcMode & VERIFY) && (m_TestType & (GENERATE_INTER | GENERATE_INTRA)) && m_PakCuBufferFileName.length() == 0) - throw std::string("ERROR: PAK CU input file is required"); - - if (m_width == 0 || m_height == 0) - throw std::string("ERROR: Invalid width or/and height values"); - - if (m_CTUStr.CTUSize != 16 && m_CTUStr.CTUSize != 32 && m_CTUStr.CTUSize != 64) - throw std::string("ERROR: Invalid CTU size specified"); - - if (m_block_size_mask > 3 || m_block_size_mask == 0) - // 64x64 blocks are unsupported on SKL - throw std::string("ERROR: Incorrect block_size_mask"); - - if (m_bIsForceExtMVPBlockSize && m_ForcedExtMVPBlockSize > 3) - throw std::string("ERROR: Invalid forced MVP block size specified"); - - if (m_GenMVPBlockSize > 3) - throw std::string("ERROR: Invalid actual MVP block size specified"); - - //Checking actual MVP block size and CTU size compatibily - if (m_GenMVPBlockSize != 0) - { - if ((m_CTUStr.CTUSize == 16 && m_GenMVPBlockSize > 1)) - { - throw std::string("ERROR: For 16x16 CTU actual buffer MVP block size should be less or equal than CTU size"); - } - else if (m_CTUStr.CTUSize == 32 && m_GenMVPBlockSize > 2) - { - throw std::string("ERROR: For 32x32 CTU actual buffer MVP block size should be less or equal than CTU size"); - } - } - - if ((m_TestType & (GENERATE_MV | GENERATE_PREDICTION)) && !(m_TestType & GENERATE_INTER)) - throw std::string("ERROR: MVs can't be generated w/o -gen_inter option"); - - if ((m_TestType & GENERATE_SPLIT) && !(m_TestType & (GENERATE_INTER | GENERATE_INTRA))) - throw std::string("ERROR: Splits can't be generated w/o -gen_inter or -gen_intra option"); - - - if ((m_ProcMode & VERIFY) && (m_TestType & GENERATE_INTER) && m_Thresholds.mvThres > 100) - throw std::string("ERROR: Incorrect threshold for MVs in the verification mode"); - - if ((m_ProcMode & VERIFY) && (m_TestType & (GENERATE_INTER | GENERATE_INTRA)) && m_Thresholds.splitThres > 100) - throw std::string("ERROR: Incorrect threshold for splits in the verification mode"); - - if ((m_ProcMode & VERIFY) && (m_TestType & (GENERATE_INTER | GENERATE_PREDICTION)) && m_NumMVPredictors > 4) - throw std::string("ERROR: Incorrect number of enabled MV predictors in the verification mode"); - - if (m_CTUStr.maxLog2CUSize < m_CTUStr.minLog2CUSize) - throw std::string("ERROR: max_log2_cu_size should be greater than or equal to min_log2_tu_size"); - - if ((mfxU32) 1 << m_CTUStr.maxLog2CUSize > m_CTUStr.CTUSize) - throw std::string("ERROR: max_log2_cu_size should be less than or equal to log2_ctu_size"); - - if (m_CTUStr.maxLog2TUSize < m_CTUStr.minLog2TUSize) - throw std::string("ERROR: max_log2_tu_size should be greater than or equal to min_log2_tu_size"); - - if (m_CTUStr.minLog2CUSize <= m_CTUStr.minLog2TUSize) - throw std::string("ERROR: min_log2_cu_size should be greater than min_log2_tu_size"); - - if (m_CTUStr.maxLog2TUSize > (std::min)(m_CTUStr.maxLog2CUSize, (mfxU32) 5)) - throw std::string("ERROR: max_log2_tu_size should be less than or equal to Min( log2_ctu_size, 5)"); - } - catch (std::string& e) { - cout << e << endl; - throw std::string("ERROR: InputParams::ParseInputString"); - } - - return; -} - -mfxU16 InputParams::ParseSubPixelMode(msdk_char * strRawSubPelMode) -{ - mfxU16 pelMode = msdk_atoi(strRawSubPelMode); - - switch (pelMode) - { - case 0: - case 1: - case 3: - return pelMode; - default: - throw std::string("ERROR: Incorrect sub_pel_mode value"); - } -} - -int InputParams::GetIntArgument(msdk_char **strInput, mfxU8 index, mfxU8 nArgNum) -{ - if (strInput == nullptr || *strInput == nullptr) - { - throw std::string("ERROR: GetIntArgument: null pointer reference"); - } - if (index < nArgNum) - { - return msdk_atoi(strInput[index]); - } - else - { - throw std::string("ERROR: missing secondary integer argument"); - } -} - -msdk_string InputParams::GetStringArgument(msdk_char **strInput, mfxU8 index, mfxU8 nArgNum) -{ - if (strInput == nullptr || *strInput == nullptr) - { - throw std::string("ERROR: GetStringArgument: null pointer reference"); - } - if (index < nArgNum) - { - return msdk_string(strInput[index]); - } - else - { - throw std::string("ERROR: missing secondary string argument"); - } -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/mvmvp_processor.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/mvmvp_processor.cpp deleted file mode 100644 index 144b0f8..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/mvmvp_processor.cpp +++ /dev/null @@ -1,734 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "mvmvp_processor.h" - -// Generates MVP pool groups according to PU positioning in CTU and constructed MVP blocks grid -void MVMVPProcessor::InitMVPGridData(const CTUDescriptor& CTU, const FrameChangeDescriptor & frameDescr) -{ - mfxU32 gridSizeIn32x32Blocks = CTU.m_BWidth / (2 * MVP_BLOCK_SIZE); - - // 16x16 MVP blocks in frame; numbers denote order in file: - // ++++++++++++++++++++ - // + 0 + 1 + 4 + 5 + - // +++++++++++++++++ ... - // + 2 + 3 + 6 + 7 + - // +++++++++++++++++ - // + ... - // Each quarter of 16x16 blocks with sequent indecies are forming a 32x32 block group - - m_mvpBlockGrid.reserve(gridSizeIn32x32Blocks * gridSizeIn32x32Blocks); - - if (!gridSizeIn32x32Blocks) // only one 16x16 block - { - m_mvpBlockGrid.emplace_back(CTU.m_AdrX, CTU.m_AdrY, MVP_BLOCK_SIZE, MVP_BLOCK_SIZE); - } - else - { - // Pushing MVP blocks onto the grid in zig-zag order described above - for (mfxU32 gridIdx = 0; gridIdx < gridSizeIn32x32Blocks * gridSizeIn32x32Blocks; ++gridIdx) - { - for (mfxU32 elemIdx = 0; elemIdx < 4; ++elemIdx) - { - m_mvpBlockGrid.emplace_back( - CTU.m_AdrX + (2 * (gridIdx % gridSizeIn32x32Blocks) + (elemIdx % 2)) * MVP_BLOCK_SIZE, - CTU.m_AdrY + (2 * (gridIdx / gridSizeIn32x32Blocks) + (elemIdx / 2)) * MVP_BLOCK_SIZE, - MVP_BLOCK_SIZE, MVP_BLOCK_SIZE); - } - } - } - - mfxI32 mvpGroupsNum = ConstructMVPPoolGroups(CTU); - - // All PUs are processed - constructing actual MVP pools per each group - - m_mvpPools.resize(mvpGroupsNum); - - for (mfxI32 groupNo = 0; groupNo < mvpGroupsNum; ++groupNo) - { - m_mvpPools[groupNo].reserve(MVP_PER_16x16_BLOCK); - - for (mfxU32 mvpCount = 0; mvpCount < MVP_PER_16x16_BLOCK; ++mvpCount) - { - m_mvpPools[groupNo].emplace_back(GenerateMVP(CTU, frameDescr)); - } - } -} - -mfxI32 MVMVPProcessor::ConstructMVPPoolGroups(const CTUDescriptor& CTU) -{ - switch (m_GenMVPBlockSize) - { - case 1: - if (CTU.m_BWidth == 32 || CTU.m_BWidth == 64) - { - return PutPUAndMVPBlocksIn16x16MVPPoolGroups(CTU); - } - case 2: - if (CTU.m_BWidth == 64) - { - return PutPUAndMVPBlocksIn32x32MVPPoolGroups(CTU); - } - case 3: - return PutPUAndMVPBlocksInSingleMVPPoolGroup(CTU); - - default: - throw std::string("ERROR: MVMVPProcessor: ConstructMVPPoolGroups: Incorrect m_GenMVPBlockSize used"); - } -} - -mfxI32 MVMVPProcessor::PutPUAndMVPBlocksIn16x16MVPPoolGroups(const CTUDescriptor & CTU) -{ - mfxI32 extMVPGroupNo = 0; - - for (const auto& CU : CTU.m_CUVec) - { - if (CU.m_PredType == INTER_PRED) - { - // For all the inter PUs constructing a MVP block list which this PU has intersections with - for (const auto& PU : CU.m_PUVec) - { - // Construct a list with all MVP blocks which have intersections with current PU - - std::list intersectedMVPBlocks; - - for (const auto& mvpBlock : m_mvpBlockGrid) - { - if (PU.CheckForIntersect(mvpBlock)) - { - intersectedMVPBlocks.push_back(mvpBlock); - } - } - - // Checking the list validity. It should have at least 1 element - if (intersectedMVPBlocks.empty()) - { - throw std::string("ERROR: MVMVPProcessor: PutPUAndMVPBlocksIn16x16MVPPoolGroups: Found a PU which doesn't intersect the MVP grid"); - } - - // Check if there is at least one block which is included in some group - // MVP blocks should have no group or be included in the one group - auto validGroupMVPBlock = std::find_if(intersectedMVPBlocks.begin(), intersectedMVPBlocks.end(), - [](const MVPBlock& block) { return block.IsAlreadyInGroup(); }); - - // If it exists, put all MVP blocks intersected with current PU in this group - if (validGroupMVPBlock != intersectedMVPBlocks.end()) - { - mfxI32 firstValidGroupNo = validGroupMVPBlock->GetGroupNo(); - - if (std::any_of(intersectedMVPBlocks.begin(), intersectedMVPBlocks.end(), - [firstValidGroupNo](const MVPBlock& block) - { return (block.IsAlreadyInGroup() && !block.IsInGroup(firstValidGroupNo)); })) - { - throw std::string("ERROR: PutPUAndMVPBlocksIn16x16MVPPoolGroups : Found a pair of MVP blocks intersecting with current PU which are in the different MVP groups"); - } - else // include all intersecting MVP blocks in the single group - { - for (MVPBlock& block : m_mvpBlockGrid) - { - if (std::find(intersectedMVPBlocks.begin(), intersectedMVPBlocks.end(), block) - != intersectedMVPBlocks.end()) - { - block.SetGroup(firstValidGroupNo); - } - } - // The list is valid - set PU pool group no. with the value for MVP blocks - m_PUtoMVPPoolGroupMap[PU] = firstValidGroupNo; - } - } - else // Otherwise, put all MVP blocks in the new group - { - for (MVPBlock& block : m_mvpBlockGrid) - { - if (std::find(intersectedMVPBlocks.begin(), intersectedMVPBlocks.end(), block) - != intersectedMVPBlocks.end()) - { - block.SetGroup(extMVPGroupNo); - } - } - // The list is valid - set PU pool group no. with the value for MVPs - m_PUtoMVPPoolGroupMap[PU] = extMVPGroupNo; - - ++extMVPGroupNo; - } - } - } - } - return extMVPGroupNo; -} - -mfxI32 MVMVPProcessor::PutPUAndMVPBlocksIn32x32MVPPoolGroups(const CTUDescriptor & CTU) -{ - // Special case for 64x64 CTUs and 32x32 MVP block size - mfxI32 extMVPGroupNo = 0; - - // Construct FOUR 32x32 block groups from the 16x16 block grid - std::vector mvp32x32BlockGroups; - mvp32x32BlockGroups.reserve(4); - - for (mfxU32 gridIdx = 0; gridIdx < m_mvpBlockGrid.size(); gridIdx += 4) - { - mvp32x32BlockGroups.emplace_back(BaseBlock(m_mvpBlockGrid[gridIdx].m_AdrX, - m_mvpBlockGrid[gridIdx].m_AdrY, - MVP_BLOCK_SIZE * 2, MVP_BLOCK_SIZE * 2), gridIdx); - } - - for (const auto& CU : CTU.m_CUVec) - { - if (CU.m_PredType == INTER_PRED) - { - // For all the inter PUs constructing a list of 32x32 MVP block groups - // that this PU has intersections with - for (const auto& PU : CU.m_PUVec) - { - // Construct a list with all 32x32 MVP block groups which have intersections with current PU - std::list intersected32x32MVPBlocks; - - for (const auto& mvp32x32Block : mvp32x32BlockGroups) - { - if (PU.CheckForIntersect(mvp32x32Block.first)) - { - intersected32x32MVPBlocks.push_back(mvp32x32Block); - } - } - - // Checking the list validity. It should have at least 1 element - if (intersected32x32MVPBlocks.empty()) - { - throw std::string("ERROR: MVMVPProcessor: PutPUAndMVPBlocksIn32x32MVPPoolGroups: Found a PU which doesn't intersect the 32x32 MVP groups grid"); - } - - // Check if there is at least one block which is included in some group - // MVP blocks should have no group or be included in a single group - auto validGroupMVPBlock = std::find_if(intersected32x32MVPBlocks.begin(), - intersected32x32MVPBlocks.end(), [this](const MVP32x32BlockGroup& block32x32) - { return m_mvpBlockGrid[block32x32.second].IsAlreadyInGroup(); }); - - // If it exists, put all MVP blocks intersecting the current PU in this group - if (validGroupMVPBlock != intersected32x32MVPBlocks.end()) - { - mfxI32 firstValidGroupNo = m_mvpBlockGrid[validGroupMVPBlock->second].GetGroupNo(); - - if (std::any_of(intersected32x32MVPBlocks.begin(), - intersected32x32MVPBlocks.end(), [this, firstValidGroupNo](const MVP32x32BlockGroup& block32x32) - { return (m_mvpBlockGrid[block32x32.second].IsAlreadyInGroup() && !m_mvpBlockGrid[block32x32.second].IsInGroup(firstValidGroupNo)); })) - { - throw std::string("ERROR: PutPUAndMVPBlocksIn32x32MVPPoolGroups : Found a pair of MVP blocks intersecting with current PU which are in the different MVP groups"); - } - else // include all intersecting MVP blocks in the single group - { - for (MVPBlock& block : m_mvpBlockGrid) - { - if (std::find_if(intersected32x32MVPBlocks.begin(), intersected32x32MVPBlocks.end(), - [this, &block](const MVP32x32BlockGroup& block32x32) - { return m_mvpBlockGrid[block32x32.second] == block; }) != intersected32x32MVPBlocks.end()) - { - block.SetGroup(firstValidGroupNo); - } - } - // The list is valid - set PU pool group no. with the value for MVP blocks - m_PUtoMVPPoolGroupMap[PU] = firstValidGroupNo; - } - } - else // Otherwise, put all MVP blocks in the new group - { - for (MVPBlock& block : m_mvpBlockGrid) - { - if (std::find_if(intersected32x32MVPBlocks.begin(), intersected32x32MVPBlocks.end(), - [this, &block](const MVP32x32BlockGroup& block32x32) - { return m_mvpBlockGrid[block32x32.second] == block; }) != intersected32x32MVPBlocks.end()) - { - block.SetGroup(extMVPGroupNo); - } - } - - // The list is valid - set PU pool group no. with the value for MVPs - m_PUtoMVPPoolGroupMap[PU] = extMVPGroupNo; - - ++extMVPGroupNo; - } - } - } - } - return extMVPGroupNo; -} - -mfxI32 MVMVPProcessor::PutPUAndMVPBlocksInSingleMVPPoolGroup(const CTUDescriptor & CTU) -{ - const mfxI32 extGroupNo = 0; - - for (MVPBlock& block : m_mvpBlockGrid) - { - block.SetGroup(extGroupNo); - } - - for (const auto& CU : CTU.m_CUVec) - { - if (CU.m_PredType == INTER_PRED) - { - for (const auto& PU : CU.m_PUVec) - { - m_PUtoMVPPoolGroupMap[PU] = extGroupNo; - } - } - } - - return 1; -} - -// Fills output mfxExtFeiHevcEncMVPredictors::Data with generated MVP Grid data depending on the m_GenMVPBlockSize value -// -// frameDescr - MOD frame descriptor. It holds ext buffers -void MVMVPProcessor::FillFrameMVPExtBuffer(FrameChangeDescriptor& frameDescr) -{ - ExtendedSurface& surf = *frameDescr.m_frame; - - mfxExtFeiHevcEncMVPredictors* mvpBuf = - reinterpret_cast(surf.GetBuffer(MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED)); - - m_DoUseIntra = !!(frameDescr.m_testType & GENERATE_INTRA); - - switch (m_GenMVPBlockSize) - { - case 0: - // No MVP specified. Left buffer unchanged - break; - case 1: - // MVP for 16x16 blocks - // Iterating over all generated blocks - for (const auto& block : m_mvpBlockGrid) - { - PutMVPIntoExtBuffer(block, mvpBuf); - } - break; - case 2: - // MVP for 32x32 blocks - // Iterating over each upper-left block in the 32x32 group - // | 0* 1 | 4* 5 | - // | 2 3 | 6 7 | - for (std::size_t gridIdx = 0; gridIdx < m_mvpBlockGrid.size(); gridIdx += 4) - { - PutMVPIntoExtBuffer(m_mvpBlockGrid[gridIdx], mvpBuf); - } - break; - case 3: - // MVP for 64x64 blocks - // 16x16 blocks marked with X should be the same in the output predictors buffer - // ++++++++++++++++++++ - // + X + + X + + - // +++++++++++++++++ ... - // + + + + + - // +++++++++++++++++ - // + X + + X + + ... - // +++++++++++++++++ - // + + + + + - // +++++++++++++++++ - // + ... - PutMVPIntoExtBuffer(m_mvpBlockGrid[0], mvpBuf); - break; - default: - break; - } -} - - -bool MVMVPProcessor::GenValidMVMVPForPU(PUBlock & PU, const FrameChangeDescriptor & frameDescr) -{ - const auto mvpGroupNo = m_PUtoMVPPoolGroupMap.find(PU); - - if (mvpGroupNo != m_PUtoMVPPoolGroupMap.end()) - { - if (mvpGroupNo->second < 0) - { - throw std::string("ERROR: MVMVPProcessor: GenValidMVMVPForPU: Some PU has invalid MVP pool no."); - } - } - else - { - throw std::string("ERROR: MVMVPProcessor: GenValidMVMVPForPU: Some PU hasn't been included in MVP pool group map"); - } - - // Inter prediction test - // Try 100 times max to generate valid references - for (mfxU32 i = 0; i < MAX_GEN_MV_ATTEMPTS; ++i) - { - PUMotionVector mvSW; - if (frameDescr.m_testType & GENERATE_MV) - { - // If GENERATE_MV is specified, generate a vector inside SW; else, leave mvSW a zero vector - // Always create mv inside SW; mvp - outside SW - mvSW = GenerateMV(frameDescr); - } - - std::vector mvpPoolForPU(m_mvpPools[mvpGroupNo->second]); - - while (!mvpPoolForPU.empty()) - { - mfxU32 localMvpIndex = GetRandomGen().GetRandomNumber(0, (mfxI32)mvpPoolForPU.size() - 1); - - PU.m_MVP = mvpPoolForPU[localMvpIndex]; - - // Final MV; operator + used here - // Important: m_MV inherits refIdx from m_MVP. It is done so because MVP would be written to file if required. - // MV is never reported outside. - PU.m_MV = PU.m_MVP + mvSW; - - if (frameDescr.IsNewPUValid(PU)) - { - // Get index of the MVP applied to this PU from the original MVP generation pool - for (mfxU32 originalMvpIndex = 0; originalMvpIndex < MVP_PER_16x16_BLOCK; ++originalMvpIndex) - { - if (m_mvpPools[mvpGroupNo->second][originalMvpIndex] == PU.m_MVP) - { - PU.usedMVPPoolNo = mvpGroupNo->second; - PU.usedMVPIndex = originalMvpIndex; - } - } - return true; // MV generation for current PU succeeded - } - else - { - mvpPoolForPU.erase(mvpPoolForPU.begin() + localMvpIndex); - } - } - } - return false; //MV generation for current PU failed -} - -//Attempts to generate MVs for PUs inside the CU and store the information about the blocks occupied -//by newly generated PUs in corresponding reference frame descriptors -bool MVMVPProcessor::GenValidMVForPU(PUBlock & PU, const FrameChangeDescriptor & frameDescr) -{ - if (!(frameDescr.m_testType & GENERATE_MV)) - { - return true; //No MVs requested - } - - // Inter prediction test - // Try 100 times max to generate valid references - for (mfxU32 i = 0; i < MAX_GEN_MV_ATTEMPTS; ++i) - { - // Always create mv inside SW; mvp - outside SW (if predictors are not required, mvp is zero vector) - PUMotionVector mvSW = GenerateMV(frameDescr); - - PU.m_MVP = PUMotionVector( - mfxU8(GetRandomGen().GetRandomNumber(0, std::max(0, mfxU8(frameDescr.m_refDescrList0.size()) - 1))), - mfxU8(GetRandomGen().GetRandomNumber(0, std::max(0, mfxU8(frameDescr.m_refDescrList1.size()) - 1))), - mfxI16(0), mfxI16(0), mfxI16(0), mfxI16(0)); - - // Final MV; operator + used here - // Important: m_MV inherits refIdx from m_MVP. It is done so because MVP would be written to file if required. - // MV is never reported outside. - PU.m_MV = PU.m_MVP + mvSW; - - // Check whether the generated PU is located inside frame boundaries - // Check generated PU for intersection with previous PUs pointing to other frames - if (frameDescr.IsNewPUValid(PU)) - { - return true; //MV generation for current PU succeeded - } - } - - return false; //MV generation for current PU failed -} - -// Generate Motion Vector Predictor, i.e such a vector that all HW_SEARCH_ELEMENT_SIZE-sized square blocks -// inside the CTU shifted by this vector will be located outside their own search windows (which have same -// size but are centered each on its own search element block), and the CTU itself is still located -// inside the frame -// If the frame size is smaller than the search window size, generate MVP with zero spatial coordinates. -// Function generates predictors for list 1 only on B frames (not on GPB) -// -// const CTUDescriptor & CTU - current CTU which should be located inside the frame with predictor applied as MV -// const FrameChangeDescriptor & frameChangeDescr - descriptor which contains these fields: -// mfxU8 numl0_refs / numl1_refs - current limits on number of active references -// mfxU32 surf_width / surf_height - size of current surface -PUMotionVector MVMVPProcessor::GenerateMVP(const CTUDescriptor & CTU, const FrameChangeDescriptor & frameChangeDescr) -{ - const auto& numl0_refs = frameChangeDescr.m_refDescrList0; - const auto& numl1_refs = frameChangeDescr.m_refDescrList1; - - bool hasList1 = !numl1_refs.empty(); - - if (hasList1 && !frameChangeDescr.m_bUseBiDirSW) - { - throw std::string("ERROR: GenerateMVP: attempted to generate MVPs for a B-frame/GPB using unidirectional search window"); - } - - bool isB = !!(frameChangeDescr.m_frameType & MFX_FRAMETYPE_B); - - const mfxU32* current_lim = frameChangeDescr.m_bUseBiDirSW ? SKL_SW_LIM_BD : SKL_SW_LIM_OD; - - mfxU32 x_lim_SW = current_lim[0] / 2; - mfxU32 y_lim_SW = current_lim[1] / 2; - - mfxI32 x_coord[2] = { 0 }; - mfxI32 y_coord[2] = { 0 }; - - // Precomputing min and max possible MVP coordinates so that the MVP points outside SW but inside - // the frame (i.e. the CTU with applied MVP should be located outside SW and inside the frame, - // if possible) - mfxU32 x_min = x_lim_SW + HW_SEARCH_ELEMENT_SIZE / 2; //When determining min absolute shift, one should use - //the search element size, not the CTU size. With max - //CTU size is still used so that it stays inside the frame - - mfxU32 x_max_pos = frameChangeDescr.GetFrameCropW() - - (CTU.m_BWidth + CTU.m_AdrX); //Max absolute value of MVP coord for positive - mfxU32 x_max_neg = CTU.m_AdrX; //and negative coordinates respectively. - - mfxU32 y_min = y_lim_SW + HW_SEARCH_ELEMENT_SIZE / 2; - - mfxU32 y_max_pos = frameChangeDescr.GetFrameCropH() - (CTU.m_BWidth + CTU.m_AdrY); - mfxU32 y_max_neg = CTU.m_AdrY; - - //Crop the max coords due to hardware limitations - x_max_pos = std::min(x_max_pos, ((mfxU32)((MVMVP_SIZE_LIMIT >> 2) - x_lim_SW))); - x_max_neg = std::min(x_max_neg, ((mfxU32)((MVMVP_SIZE_LIMIT >> 2) - x_lim_SW))); - y_max_pos = std::min(y_max_pos, ((mfxU32)((MVMVP_SIZE_LIMIT >> 2) - y_lim_SW))); - y_max_neg = std::min(y_max_neg, ((mfxU32)((MVMVP_SIZE_LIMIT >> 2) - y_lim_SW))); - - enum SHIFT { X_POS, X_NEG, Y_POS, Y_NEG }; - - std::vector availShifts; - availShifts.reserve(4); - - if (x_min < x_max_pos) availShifts.push_back(X_POS); - if (x_min < x_max_neg) availShifts.push_back(X_NEG); - if (y_min < y_max_pos) availShifts.push_back(Y_POS); - if (y_min < y_max_neg) availShifts.push_back(Y_NEG); - - if (!availShifts.empty()) - { - for (mfxI32 i = 0; i < (isB ? 2 : 1); i++) - { - SHIFT shift = availShifts[GetRandomGen().GetRandomNumber(0, (mfxI32)(availShifts.size() - 1))]; - switch (shift) - { - case X_POS: - x_coord[i] = GetRandomMVComponent(x_min, x_max_pos); - break; - case X_NEG: - x_coord[i] = -GetRandomMVComponent(x_min, x_max_neg); - break; - case Y_POS: - y_coord[i] = GetRandomMVComponent(y_min, y_max_pos); - break; - case Y_NEG: - y_coord[i] = -GetRandomMVComponent(y_min, y_max_neg); - break; - } - - //The complementary MVP coordinate should be subjected to the HW limit as well - if (shift == X_POS || shift == X_NEG) - { - mfxU32 max_pos_shift_y = std::min(frameChangeDescr.GetFrameCropH() - CTU.m_BHeight - CTU.m_AdrY, - (mfxU32)MVMVP_SIZE_LIMIT >> 2); - mfxU32 max_neg_shift_y = std::min(CTU.m_AdrY, (mfxU32)MVMVP_SIZE_LIMIT >> 2); - y_coord[i] = GetRandomMVComponent(-(mfxI32)max_neg_shift_y, max_pos_shift_y); - } - else - { - mfxU32 max_pos_shift_x = std::min(frameChangeDescr.GetFrameCropW() - CTU.m_BWidth - CTU.m_AdrX, - (mfxU32)MVMVP_SIZE_LIMIT >> 2); - mfxU32 max_neg_shift_x = std::min(CTU.m_AdrX, (mfxU32)MVMVP_SIZE_LIMIT >> 2); - x_coord[i] = GetRandomMVComponent(-(mfxI32)max_neg_shift_x, max_pos_shift_x); - } - } - } - - return PUMotionVector( - (mfxI32)!numl0_refs.empty() ? mfxU8(GetRandomGen().GetRandomNumber(0, (mfxI32)numl0_refs.size() - 1)) : 0, - (mfxI32)!numl1_refs.empty() ? mfxU8(GetRandomGen().GetRandomNumber(0, (mfxI32)numl1_refs.size() - 1)) : 0, // RefIdx struct - x_coord[0], // MV[0].x - y_coord[0], // MV[0].y - isB ? x_coord[1] : 0, // MV[1].x - isB ? y_coord[1] : 0 // MV[1].y - ); -} - -// Generates an MV so that a PU_width x PU_height-sized block shifted by this MV -// will be located inside(sic!) SW. It doesn't generate refIdx. refIdx is generated in GenerateMVP -// Function generates MVs for list 1 only on B frames (not on GPB) -// -// mfxU32 PU_width/PU_height - size of current PU -PUMotionVector MVMVPProcessor::GenerateMV(const FrameChangeDescriptor & frameChangeDescr) -{ - const auto& numl1_refs = frameChangeDescr.m_refDescrList1; - - bool hasList1 = !numl1_refs.empty(); - - if (hasList1 && !frameChangeDescr.m_bUseBiDirSW) - { - throw std::string("ERROR: GenerateMV: attempted to generate MVs for a B-frame/GPB using unidirectional search window"); - } - - bool isB = !!(frameChangeDescr.m_frameType & MFX_FRAMETYPE_B); - - const mfxU32* current_lim = frameChangeDescr.m_bUseBiDirSW ? SKL_SW_LIM_BD : SKL_SW_LIM_OD; - - // Just half of current SW width / height - mfxI32 x_lim = 0, y_lim = 0; - - constexpr mfxU32 searchElementWidth = HW_SEARCH_ELEMENT_SIZE; - constexpr mfxU32 searchElementHeight = HW_SEARCH_ELEMENT_SIZE; - - //Leave limits at zero if PU size exceeds the search window - if (current_lim[0] >= searchElementWidth && current_lim[1] >= searchElementHeight) - { - x_lim = (current_lim[0] - searchElementWidth) / 2; - y_lim = (current_lim[1] - searchElementHeight) / 2; - } - - // Using RVO here - return PUMotionVector( - 0, - 0, // RefIdx struct - GetRandomMVComponent(-x_lim, x_lim), // MV[0].x - GetRandomMVComponent(-y_lim, y_lim), // MV[0].y - isB ? GetRandomMVComponent(-x_lim, x_lim) : 0, // MV[1].x - isB ? GetRandomMVComponent(-y_lim, y_lim) : 0 // MV[1].y - ); -} - -// Randomly generates single MV-component within [lower; upper] accordigly to the sub pixel precision mode -// Where lower and upper given in full-pixel units. -// Output component is in quarter-pixel units. -// -// { a = lower * 4 } -// { b = upper * 4 } -// -// [a * # * a+1 * # * a+2 ... b-2 * # * b-1 * # * b] -// For mode 0: only full-pixels a, a+1, ... b-2, b-1, b are allowed -// For mode 1: full and half-pixels # are allowed -// For mode 3: every quarter-pixel value is allowed -mfxI32 MVMVPProcessor::GetRandomMVComponent(mfxI32 lower, mfxI32 upper) -{ - ASGRandomGenerator& randomGen = GetRandomGen(); - switch (m_SubPelMode) - { - case 0: - return 4 * lower + randomGen.GetRandomNumber(0, upper - lower) * 4; - case 1: - return 4 * lower + randomGen.GetRandomNumber(0, 2 * (upper - lower)) * 2; - case 3: - return randomGen.GetRandomNumber(4 * lower, 4 * upper); - default: - throw std::string("ERROR: MVMVPProcessor: GetRandomMVComponent: Incorrect m_SubPelMode used"); - } -} - -mfxU32 MVMVPProcessor::CalculateOffsetInMVPredictorsBuffer(mfxU32 bufferPitch, const MVPBlock & mvpBlock) -{ - // Calculating a no. of 32x32 block corresponding to left upper pixel of the CTU MVP grid - // In sum below: first addendum is offset by vertical axis, second addendum is offset by horizontal axis - mfxU32 offsetBig = (bufferPitch / 2) * (mvpBlock.m_AdrY / (2 * MVP_BLOCK_SIZE)) - + (mvpBlock.m_AdrX / (2 * MVP_BLOCK_SIZE)); - - // Calculating a postion for 16x16 block inside parent 32x32 block - mfxU32 offsetSmall = 2 * ((mvpBlock.m_AdrY % (2 * MVP_BLOCK_SIZE)) / MVP_BLOCK_SIZE) - + ((mvpBlock.m_AdrX % (2 * MVP_BLOCK_SIZE)) / MVP_BLOCK_SIZE); - - return 4 * offsetBig + offsetSmall; -} - -void MVMVPProcessor::PutMVPIntoExtBuffer(const MVPBlock& mvpBlock, mfxExtFeiHevcEncMVPredictors* outputMVPBuf) -{ - if (!outputMVPBuf) - { - throw std::string("ERROR: MVMVPProcessor: PutMVPIntoExtBuffer: Output mfxExtFeiHevcEncMVPredictors buffer is null"); - } - - mfxU32 offset = CalculateOffsetInMVPredictorsBuffer(outputMVPBuf->Pitch, mvpBlock); - - mfxFeiHevcEncMVPredictors& actualPredictor = outputMVPBuf->Data[offset]; - - mfxI32 mvpGroupNo = mvpBlock.GetGroupNo(); - - // In case of INTRAxINTER test some MVP blocks - // may not intersect with PUs inside CTU - // Otherwise, all MVP blocks should be assigned with a valid group no. - if (mvpGroupNo < 0) - { - if (m_DoUseIntra) - { - // For such intra MVP block filling corresponding element in the buffer with ignored values - for (mfxU32 mvpIdx = 0; mvpIdx < MVP_PER_16x16_BLOCK; mvpIdx++) - { - actualPredictor.MV[mvpIdx][0].x = actualPredictor.MV[mvpIdx][0].y = (mfxI16)0x8000; - actualPredictor.MV[mvpIdx][1].x = actualPredictor.MV[mvpIdx][1].y = (mfxI16)0x8000; - - actualPredictor.RefIdx[mvpIdx].RefL0 = (mfxU8)0xf; - actualPredictor.RefIdx[mvpIdx].RefL1 = (mfxU8)0xf; - } - - // Nevertheless, setting BlockSize appropriately - actualPredictor.BlockSize = m_GenMVPBlockSize; - - return; - } - - // Otherwise, something definitely went wrong - throw std::string("ERROR: PutMVPIntoExtBuffer: Some MVP block has invalid MVP pool no."); - } - - for (mfxU32 mvpIdx = 0; mvpIdx < MVP_PER_16x16_BLOCK; mvpIdx++) - { - const auto& genMVPred = m_mvpPools[mvpGroupNo][mvpIdx]; - - if (genMVPred.CheckMVPExceedsSizeLimits()) - { - throw std::string("ERROR: PutMVPIntoExtBuffer: generated MVP size exceeds hardware limit"); - } - - actualPredictor.RefIdx[mvpIdx].RefL0 = genMVPred.RefIdx.RefL0; - actualPredictor.RefIdx[mvpIdx].RefL1 = genMVPred.RefIdx.RefL1; - actualPredictor.MV[mvpIdx][0] = genMVPred.MV[0]; - actualPredictor.MV[mvpIdx][1] = genMVPred.MV[1]; - } - - // Assuming that, m_GenMVPBlockSize has correct value - actualPredictor.BlockSize = m_GenMVPBlockSize; - - // Special case for 64x64 blocks - copying initialized data to the neighbour blocks - if (m_GenMVPBlockSize == 3) - { - if (outputMVPBuf->Pitch > 0) - { - outputMVPBuf->Data[offset + 4] = actualPredictor; - outputMVPBuf->Data[offset + outputMVPBuf->Pitch] = actualPredictor; - outputMVPBuf->Data[offset + outputMVPBuf->Pitch + 4] = actualPredictor; - } - else - { - throw std::string("ERROR: PutMVPIntoExtBuffer: mfxExtFeiHevcEncMVPredictors have zero pitch"); - } - } -} - -void MVMVPProcessor::GetMVPPools(std::vector>& outMVPPools) -{ - outMVPPools = m_mvpPools; -} - -#endif // MFX_VERSION \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/random_generator.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/random_generator.cpp deleted file mode 100644 index c6295ff..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/random_generator.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "random_generator.h" - -ASGRandomGenerator& ASGRandomGenerator::GetInstance() -{ - static ASGRandomGenerator instance; - - return instance; -} - -// Returns random number in range [min, max] -mfxI32 ASGRandomGenerator::GetRandomNumber(mfxI32 min, mfxI32 max) -{ - std::uniform_int_distribution<> distr(min, max); - return distr(m_Gen); -} - -// Returns +1 or -1 with probability 0.5 -mfxI32 ASGRandomGenerator::GetRandomSign() -{ - return GetRandomBit() ? -1 : 1; -} - -// Generates 0 or 1 with probability 0.5 -bool ASGRandomGenerator::GetRandomBit() -{ - std::bernoulli_distribution distr(0.5); - return distr(m_Gen); -} - -// Returns TF or BF with probability 0.5 -mfxI32 ASGRandomGenerator::GetRandomPicField() -{ - static const mfxI32 cases[] = { MFX_PICSTRUCT_FIELD_TOP, MFX_PICSTRUCT_FIELD_BOTTOM }; - std::uniform_int_distribution<> distr{ 0, sizeof(cases) / sizeof(cases[0]) - 1 }; - return cases[distr(m_Gen)]; -} - -void ASGRandomGenerator::SeedGenerator(mfxU32 extSeed) -{ - m_Gen.seed(extSeed); -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/refcontrol.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/refcontrol.cpp deleted file mode 100644 index 5d30f73..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/refcontrol.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "refcontrol.h" - -using namespace std; - -void RefState::Dump(fstream& ofs) const -{ - const char separator = '|'; - - ofs << setw(3) << picture.orderCount << ' ' - << hex << showbase << setw(3 + 2) << picture.frameType << ' ' - << setw(3 + 2) << picture.picStruct << dec; - if (ofs.fail()) - throw std::string("ERROR: PicStruct buffer writing failed"); - for (mfxU32 list = 0; list < 2; list++) - { - ofs << ' ' << separator; - for (mfxU32 i = 0; i < 8; i++) - ofs << ' ' << setw(3) << (i < RefListActive[list].size() ? RefListActive[list][i] : -1); - } - ofs << ' ' << separator; - for (mfxU32 i = 0; i < 16; i++) - ofs << ' ' << setw(3) << (i < DPB.size() ? DPB[i] : -1); - ofs << endl; -} - -bool RefState::Load(fstream& ifs) -{ - const char separator_char = '|'; - char separator; - RefState state; - - ifs >> state.picture.orderCount >> hex >> state.picture.frameType >> state.picture.picStruct >> dec; - if (ifs.fail()) - return false; - - for (mfxU32 list = 0; list < 2; list++) - { - ifs >> separator; - if (ifs.fail() || separator != separator_char) - return false; - state.RefListActive[list].clear(); - for (mfxI32 poc, i = 0; i < 8 && !(ifs >> poc).fail(); i++) { - if (poc >= 0) - state.RefListActive[list].push_back(poc); - } - } - - ifs >> separator; - if (ifs.fail() || separator != separator_char) - return false; - state.DPB.clear(); - for (mfxI32 poc, i = 0; i < 16 && !(ifs >> poc).fail(); i++) { - if (poc >= 0) - state.DPB.push_back(poc); - } - - *this = state; - return true; -} - -void RefControl::SetParams(const InputParams& params) -{ - m_params = params; - maxDelay = params.m_RefDist * 2 + 1; // 2 for fields, 1 from asyncDepth - maxDPBSize = params.m_NumRef + 1; // +1 to align with common msdk rules, that current frame is not counted in DPB -} - -void RefControl::Encode(mfxI32 codingOrder) -{ - if (RPB.empty()) - throw std::string("ERROR: PicStruct buffer frame is lost"); - - // select next frame to encode (no reordering for I and P) - mfxI32 RPBidx = 0; - if (RPB[0].frameType & MFX_FRAMETYPE_B) - { - mfxI32 cnt, i; - for (cnt = 1; cnt < static_cast(RPB.size()) && - (RPB[cnt].frameType & MFX_FRAMETYPE_B) && - RPB[0].orderCount + cnt == RPB[cnt].orderCount; - cnt++); // consequent B count - if (cnt < static_cast(RPB.size()) && RPB[0].orderCount + cnt == RPB[cnt].orderCount) - RPBidx = cnt; // consequent not B is pyramid's right base - else - { - for (i = 1; i < cnt; i++) - if ((RPB[i].frameType & MFX_FRAMETYPE_REF) && std::abs(i - cnt / 2) < std::abs(RPBidx - cnt / 2)) - RPBidx = i; // Bref closest to center of consequent B - } - } - - RefState state; // create state - PictureInfo& picture = state.picture; - - picture = RPB[RPBidx]; // take from reordered - RPB.erase(RPB.begin() + RPBidx); // and remove - picture.codingOrder = codingOrder; - - if (picture.frameType & MFX_FRAMETYPE_IDR) - DPB.clear(); - // current frame occupies DPB by spec, free one place - if (DPB.size() == maxDPBSize) - DPB.erase(std::min_element(DPB.begin(), DPB.end(), IsOlder)); - - // fill list randomly from DPB - mfxU32 RefListNum[2] = { 0, 0 }; - if (!DPB.empty()) - { - if (picture.frameType & MFX_FRAMETYPE_P) - RefListNum[0] = m_params.m_NumRefActiveP; - else if (picture.frameType & MFX_FRAMETYPE_B) - { - RefListNum[0] = m_params.m_NumRefActiveBL0; - RefListNum[1] = m_params.m_NumRefActiveBL1; - } - if (picture.frameType & MFX_FRAMETYPE_P && m_params.m_UseGPB) - { - picture.frameType &= ~MFX_FRAMETYPE_P; - picture.frameType |= MFX_FRAMETYPE_B; - RefListNum[1] = std::min(m_params.m_NumRefActiveP, m_params.m_NumRefActiveBL1); - } - } - - for (mfxU32 list = 0; list < 2; list++) - { - state.RefListActive[list].clear(); - for (mfxU32 pic = 0; pic < RefListNum[list]; pic++) - { - state.RefListActive[list].push_back(DPB[GetRandomGen().GetRandomNumber(0, (mfxI32)DPB.size() - 1)].orderCount); - } - } - - state.DPB.clear(); - for (auto pic : DPB) - state.DPB.push_back(pic.orderCount); - std::sort(state.DPB.begin(), state.DPB.end()); // to simplify matching - - // store state and put reference picture into DPB - RefLogInfo.emplace_back(state); - if (picture.frameType & MFX_FRAMETYPE_REF) - DPB.emplace_back(picture); -} - -// assign types in display order -// don't care about fields - must work -void RefControl::Add(mfxI32 frameOrder) -{ - PictureInfo picture; - picture.codingOrder = -1; // randomly decided later - picture.orderCount = frameOrder; - picture.picStruct = GetRandomGen().GetRandomPicField(); - - mfxU16 type = 0; - mfxI32 poc = frameOrder - m_lastIDR; - mfxI32 nextIDRpoc = m_params.m_nIdrInterval*m_params.m_GopSize; - mfxI32 pocEnd = std::min(nextIDRpoc, static_cast(m_params.m_numFrames) - m_lastIDR); // last before IDR or last picture - - if (poc == 0 || poc == nextIDRpoc) - { - type = MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF | MFX_FRAMETYPE_I; - m_lastIDR = frameOrder; - } - else if (poc % m_params.m_GopSize == 0) - type = MFX_FRAMETYPE_REF | MFX_FRAMETYPE_I; - else if (poc % m_params.m_GopSize % m_params.m_RefDist == 0 || poc + 1 == pocEnd) // also last before IDR or last picture - type = MFX_FRAMETYPE_REF | MFX_FRAMETYPE_P; - else - { - type = MFX_FRAMETYPE_B; - if (m_params.m_BRefType != MFX_B_REF_OFF) - { - mfxI32 bord = poc % m_params.m_GopSize % m_params.m_RefDist; // pos in consequent B [1; dist-1] - mfxI32 s = (pocEnd - (poc - bord) > m_params.m_RefDist) ? m_params.m_RefDist : pocEnd - (poc - bord) - 1; // real num B - for (; bord > 1 && s > 2; ) // 1: next to refpoint, 2: max span w/o ref - { - mfxI32 nexts = (s + 1) / 2; // middle (ref) point; left span is bigger for odds - if (bord == nexts) // if in the middle - mark as ref - { - type |= MFX_FRAMETYPE_REF; - break; - } - else if (bord > nexts) // shift to right span - { - bord -= nexts; - s -= nexts; - } - else { - s = nexts; - } - } - } - } - - picture.frameType = type; - - RPB.emplace_back(picture); -} - -bool IsOlder(const PictureInfo& a, const PictureInfo& b) { return a.orderCount < b.orderCount; } - -bool IsInCodingOrder(const RefState& a, const RefState& b) { return a.picture.codingOrder < b.picture.codingOrder; } - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/test_processor.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/test_processor.cpp deleted file mode 100644 index ea25460..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/test_processor.cpp +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include - -#include "frame_marker.h" -#include "test_processor.h" - -ASGLog TestProcessor::asgLog; - -//Base -// Entry point for all test which uses TestProcessor -void TestProcessor::RunTest(const InputParams & params) -{ - try { - Init(params); - - switch(params.m_TestType) - { - case GENERATE_PICSTRUCT: - RunPSTest(params); - return; - case GENERATE_REPACK_CTRL: - if (params.m_ProcMode == GENERATE) - RunRepackGenerate(); - else //VERIFY - RunRepackVerify(); - return; - default: - break; - } - - //Check that processing parameters have correct number of elements - if (m_vProcessingParams.size() != m_InputParams.m_numFrames) - throw std::string("ERROR: Incorrect elements number in the m_vProcessingParams"); - - // Sort processing params into the encoded order - std::sort(m_vProcessingParams.begin(), m_vProcessingParams.end(), - [](const FrameProcessingParam& left, const FrameProcessingParam& right) { return left.EncodedOrder < right.EncodedOrder; }); - - auto itProcessingParam = m_vProcessingParams.begin(); - - // Iterate through frames - for (mfxU32 i = 0; i < m_InputParams.m_numFrames; ++i) - { - // Load picture and obtain a surface - ExtendedSurface* frame = PrepareSurface(); - - // Set display order for the surface - frame->Data.FrameOrder = i; - - // Find surface with the next encoded order in the surface pool - auto itSurf = std::find_if(m_Surfaces.begin(), m_Surfaces.end(), - [&itProcessingParam](const ExtendedSurface& ext_surf) { return ext_surf.Data.FrameOrder == itProcessingParam->DisplayOrder; }); - - // Do next iteration if surface pool hasn't got the required surface - if (itSurf == m_Surfaces.end()) - continue; - - // Set encoded order for the surface - itSurf->encodedOrder = itProcessingParam->EncodedOrder; - - // Generate all data - ChangePicture(*itSurf); - - // Write next available frames in the display order - DropFrames(); - - if (m_InputParams.m_bIsForceExtMVPBlockSize) - { - itSurf->ForceMVPBlockSizeInOutputBuffer(m_InputParams.m_ForcedExtMVPBlockSize); - } - // Drop buffers in the encoded order - DropBuffers(*itSurf); - - // Go to the next frame in the encoded order - ++itProcessingParam; - } - - // Drain buffered frames - while (itProcessingParam != m_vProcessingParams.end()) - { - // Find surface with the next encoded order in the surface pool - auto itSurf = std::find_if(m_Surfaces.begin(), m_Surfaces.end(), - [&itProcessingParam](const ExtendedSurface& ext_surf) { return ext_surf.Data.FrameOrder == itProcessingParam->DisplayOrder; }); - - // All surfaces must be into the surface pool - if(itSurf == m_Surfaces.end()) - throw std::string("ERROR: Surface pool doesn't have required surface"); - - // Set encoded order for the surface - itSurf->encodedOrder = itProcessingParam->EncodedOrder; - - // Generate all data - ChangePicture(*itSurf); - - // Write next available frames in the display order - DropFrames(); - - if (m_InputParams.m_bIsForceExtMVPBlockSize) - { - itSurf->ForceMVPBlockSizeInOutputBuffer(m_InputParams.m_ForcedExtMVPBlockSize); - } - // Drop buffers in the encoded order - DropBuffers(*itSurf); - - // Go to the next frame in the encoded order - ++itProcessingParam; - } - } - catch (std::string & e) { - std::cout << e << std::endl; - throw std::string("ERROR: TestProcessor::RunTest"); - } - return; -} - -struct sMultiPak -{ - mfxU32 NumBytesInNalUnit; - mfxU8 SliceQP; -}; - -void TestProcessor::RunRepackGenerate() -{ - mfxU32 maxNumBytesInNalUnit = 67104768; //14 bits value with the max unit 4K: 0x3FFF*4*1024 - mfxU32 MaxFrameSize; - - sMultiPak multiPakInBin; - - mfxU32 partFrame = 0; - ASGRandomGenerator& randomGen = GetRandomGen(); - - randomGen.SeedGenerator((mfxU32)time(nullptr)); - - for (mfxU32 countFrame = 0; countFrame < m_InputParams.m_numFrames; countFrame++) - { - partFrame = randomGen.GetRandomNumber(0, 9); - - fpRepackStr.read((mfxI8 *)&multiPakInBin, sizeof(multiPakInBin)); - if (!fpRepackStr.good()) - throw std::string("ERROR: multiPakStr file read failed"); - - if (multiPakInBin.NumBytesInNalUnit > maxNumBytesInNalUnit) - throw std::string("ERROR: NumBytesInNalUnit more than HW limitation"); - - MaxFrameSize = multiPakInBin.NumBytesInNalUnit - - (multiPakInBin.NumBytesInNalUnit*partFrame)/10; - MaxFrameSize += 512; //Add a 512B window for headers. - - //If max frame size exceeds 14 bits, the unit is 4KB, otherwise 32B. - if (MaxFrameSize >= (0x1 << 14) * 32) - MaxFrameSize = (MaxFrameSize + 0xFFF) & ~0xFFF; //Rounding to 4KB. - else - MaxFrameSize = (MaxFrameSize + 0x1F) & ~0x1F;//Rounding to 32B. - - fpRepackCtrl.write((mfxI8 *)&MaxFrameSize, sizeof(MaxFrameSize)); - if (!fpRepackCtrl.good()) - throw std::string("ERROR: Repack ctrl file write failed"); - - fpRepackCtrl.write((mfxI8 *)&m_InputParams.m_NumAddPasses, sizeof(m_InputParams.m_NumAddPasses)); - if (!fpRepackCtrl.good()) - throw std::string("ERROR: Repack ctrl file write failed"); - - fpRepackCtrl.write((mfxI8 *)m_InputParams.m_DeltaQP, sizeof(m_InputParams.m_DeltaQP)); - if (!fpRepackCtrl.good()) - throw std::string("ERROR: Repack ctrl file write failed"); - } -} - -void TestProcessor::RunRepackVerify() -{ - sMultiPak multiPakInBin; - mfxExtFeiHevcRepackCtrl repackCtrl; - mfxI8 repackStat[64]; - mfxU32 activeNumPasses; - mfxU32 activeNumPassesMinus1; - - for (mfxU32 countFrame = 0; countFrame < m_InputParams.m_numFrames; countFrame++) - { - // Read repack data from files - activeNumPasses = -1; - - fpRepackCtrl.read((mfxI8 *)&repackCtrl.MaxFrameSize, sizeof(repackCtrl.MaxFrameSize)); - if (!fpRepackCtrl.good()) - throw std::string("ERROR: Repack ctrl file read failed"); - - fpRepackCtrl.read((mfxI8 *)&repackCtrl.NumPasses, sizeof(repackCtrl.NumPasses)); - if (!fpRepackCtrl.good()) - throw std::string("ERROR: Repack ctrl file read failed"); - - fpRepackCtrl.read((mfxI8 *)&repackCtrl.DeltaQP, sizeof(repackCtrl.DeltaQP)); - if (!fpRepackCtrl.good()) - throw std::string("ERROR: Repack ctrl file read failed"); - - fpRepackStr.read((mfxI8 *)&multiPakInBin, sizeof(multiPakInBin)); - if (!fpRepackStr.good()) - throw std::string("ERROR: Repack str file read failed"); - - fpRepackStat.getline(repackStat, sizeof(repackStat)); - if (!fpRepackStat.good()) - throw std::string("ERROR: Repack stat file read failed"); - std::istringstream repackStatStream(std::string(repackStat, strlen(repackStat))); - repackStatStream >> activeNumPasses; - - // Check read repack data - - if (0xFF == multiPakInBin.SliceQP) - { - // 0xFF indicates skipping - std::cout << "INFO: Frame " << countFrame << " in coded order skipped" << std::endl; - continue; - } - - if (repackCtrl.MaxFrameSize == 0) - throw std::string("ERROR: Incorrect MaxFrameSize value in repack ctrl"); - - if ((repackCtrl.NumPasses < 1) || (repackCtrl.NumPasses > HEVC_MAX_NUMPASSES)) - throw std::string("ERROR: Incorrect NumPasses value in repack ctrl"); - - if ((activeNumPasses > 0) && (activeNumPasses <= (repackCtrl.NumPasses + 1))) - activeNumPassesMinus1 = activeNumPasses - 1; - else - throw std::string("ERROR: Incorrect output NumPasses value in repack stat"); - - if ((multiPakInBin.SliceQP < m_InputParams.m_InitialQP) - || (multiPakInBin.SliceQP > HEVC_MAX_QP)) - throw std::string("ERROR: Incorrect parsed QP value in repack str"); - - // Verify repack control result - std::vector validQP(repackCtrl.NumPasses + 1); - - validQP[0] = m_InputParams.m_InitialQP; - for (mfxU32 idxPass = 0; idxPass < repackCtrl.NumPasses; ++idxPass) - validQP[idxPass+1] = std::min((validQP[idxPass] + repackCtrl.DeltaQP[idxPass]), HEVC_MAX_QP); - - mfxU8 sliceQPParser = multiPakInBin.SliceQP; - - auto it = std::find_if(validQP.begin(), validQP.end(), - [sliceQPParser](const mfxU8 curQP) { return curQP == sliceQPParser; }); - - if (it == validQP.end() || (distance(validQP.begin(), it) != activeNumPassesMinus1)) - { - std::cout << "ERROR: parsed " << (mfxU32)multiPakInBin.SliceQP - << ", expected " << (mfxU32)*it << " for Frame " - << countFrame << " in coded order" << std::endl; - throw std::string("ERROR: QP mismatched"); - } - - if ((multiPakInBin.NumBytesInNalUnit > repackCtrl.MaxFrameSize) - && (multiPakInBin.SliceQP < validQP[repackCtrl.NumPasses]/*The max */)) - { - std::cout << "ERROR: NumBytesInNalUnit " << multiPakInBin.NumBytesInNalUnit - << " MaxFrameSize " << repackCtrl.MaxFrameSize << " for Frame " - << countFrame << " in coded order" << std::endl; - throw std::string("ERROR: Max exceeded"); - } - } -} - -void TestProcessor::RunPSTest(const InputParams & params) -{ - m_RefControl.SetParams(params); - - // Iterate through frames, store with random PS - for (mfxU32 i = 0; i < m_InputParams.m_numFrames; ++i) - { - m_RefControl.Add(i); - } - - // Iterate through frames, encode in random order - for (mfxU32 i = 0; i < m_InputParams.m_numFrames; ++i) - { - m_RefControl.Encode(i); - } - - // Dump or Load + Compare - SavePSData(); -} - -void TestProcessor::Init(const InputParams ¶ms) -{ - try - { - // TODO: try to use move constructor for such initialization (InputParams &&) - m_InputParams = params; - - asgLog.Init(params); - - if (params.m_TestType == GENERATE_PICSTRUCT) - { - fpPicStruct.open(params.m_PicStructFileName.c_str(), (params.m_ProcMode == VERIFY) ? std::fstream::in : std::fstream::out); - if (!fpPicStruct.is_open()) - throw std::string("ERROR: PicStruct buffer open failed"); - } - else if (params.m_TestType == GENERATE_REPACK_CTRL) - { - if (params.m_ProcMode == GENERATE) - { - fpRepackStr.open(params.m_RepackStrFileName.c_str(), std::fstream::in | std::fstream::binary); - if(!fpRepackStr.is_open()) - throw std::string("ERROR: multiPakStr file open failed"); - - fpRepackCtrl.open(params.m_RepackCtrlFileName.c_str(), std::fstream::out | std::fstream::binary); - if (!fpRepackCtrl.is_open()) - throw std::string("ERROR: Repack ctrl file open failed"); - } - else //VERIFY - { - fpRepackStr.open(params.m_RepackStrFileName.c_str(), std::fstream::in | std::fstream::binary); - if(!fpRepackStr.is_open()) - throw std::string("ERROR: multiPakStr file open failed"); - - fpRepackCtrl.open(params.m_RepackCtrlFileName.c_str(), std::fstream::in | std::fstream::binary); - if (!fpRepackCtrl.is_open()) - throw std::string("ERROR: Repack ctrl file open failed"); - - fpRepackStat.open(params.m_RepackStatFileName.c_str(), std::fstream::in); - if (!fpRepackStat.is_open()) - throw std::string("ERROR: Repack stat file open failed"); - } - } - else - { - // Processing parameters creation - // TODO work directly to m_vProcessingParams - FrameMarker frameMarker; - frameMarker.PreProcessStreamConfig(m_InputParams); - m_vProcessingParams = m_InputParams.m_vProcessingParams; - - m_FrameProcessor.Init(params); - - Init(); // calls derived classes initialization - } - } - catch (std::string& e) { - std::cout << e << std::endl; - throw std::string("ERROR: Couldn't initialize TestProcessor"); - } -} - -void TestProcessor::ChangePicture(ExtendedSurface & frame) -{ - try { - FrameChangeDescriptor descr; - PrepareDescriptor(descr, frame.encodedOrder); - descr.m_frame = &frame; - - m_FrameProcessor.ProcessFrame(descr); - - // Verification mode - VerifyDesc(descr); - - switch (descr.m_changeType) - { - case GEN: - // Current GEN frame will be used as reference for MOD frame - m_ProcessedFramesDescr.push_back(std::move(descr)); - break; - - case SKIP: - break; - - case MOD: - // After processing of MOD frame all previously saved GEN frames could be released - m_ProcessedFramesDescr.clear(); - break; - default: - break; - } - - } - catch (std::string & e) { - std::cout << e << std::endl; - throw std::string("ERROR: TestProcessor::ChangePicture"); - } - return; -} - -ExtendedSurface* TestProcessor::GetFreeSurf() -{ - // Find unlocked frame in pool - auto it = std::find_if(m_Surfaces.begin(), m_Surfaces.end(), - [](const ExtendedSurface& ext_surf) { return (ext_surf.Data.Locked == 0 && ext_surf.isWritten); }); - - if (it == m_Surfaces.end()) - { - // Create new surface if not found - - m_Surfaces.emplace_back(ExtendedSurface()); - - // Allocate data for pixels - m_Surfaces.back().AllocData(m_InputParams.m_width, m_InputParams.m_height); - - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - /* Data granularity is always in 16x16 blocks. However, width/height alignment - should be 32 because of HW requirements */ - mfxU32 alignedWidth = 0; - mfxU32 alignedHeight = 0; - - if (m_InputParams.m_CTUStr.CTUSize == 16 || m_InputParams.m_CTUStr.CTUSize == 32) - { - alignedWidth = MSDK_ALIGN32(m_InputParams.m_width); - alignedHeight = MSDK_ALIGN32(m_InputParams.m_height); - } - else if (m_InputParams.m_CTUStr.CTUSize == 64) - { - //For future 64x64 CTU applications - alignedWidth = MSDK_ALIGN(m_InputParams.m_width, 64); - alignedHeight = MSDK_ALIGN(m_InputParams.m_height, 64); - } - - ExtendedBuffer buff(MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED, alignedWidth / MVP_BLOCK_SIZE, alignedHeight / MVP_BLOCK_SIZE); - // Attach buffer to new frame if required - m_Surfaces.back().AttachBuffer(buff); - } - - return &m_Surfaces.back(); - } - else - { - //Reset the isWritten flag upon surface reuse - it->encodedOrder = 0xffffffff; - it->isWritten = false; - return &(*it); - } -} - -void TestProcessor::PrepareDescriptor(FrameChangeDescriptor & descr, const mfxU32 frameNum) -{ - descr.m_testType = m_InputParams.m_TestType; - descr.m_procMode = m_InputParams.m_ProcMode; - descr.m_changeType = m_vProcessingParams[frameNum].Mark; - descr.m_frameNumber = m_vProcessingParams[frameNum].DisplayOrder; - descr.m_frameType = m_vProcessingParams[frameNum].Type; - descr.m_refDescrList0 = GetReferences(m_ProcessedFramesDescr, m_vProcessingParams[frameNum].ReferencesL0); - descr.m_refDescrList1 = GetReferences(m_ProcessedFramesDescr, m_vProcessingParams[frameNum].ReferencesL1); - - // TODO: add support for full reference lists - // m_refDescrList0 contains active reference frames with lower display order in descending order - descr.m_refDescrList0.sort([](FrameChangeDescriptor const & lhs, FrameChangeDescriptor const & rhs) { return lhs.m_frameNumber > rhs.m_frameNumber; }); - - // m_refDescrList1 contains active reference frames with higher display order in ascending order - descr.m_refDescrList1.sort([](FrameChangeDescriptor const & lhs, FrameChangeDescriptor const & rhs) { return lhs.m_frameNumber < rhs.m_frameNumber; }); - - //TODO: disable for I frames? - - descr.m_bUseBiDirSW = (m_vProcessingParams[frameNum].Type & MFX_FRAMETYPE_B) || - ((m_vProcessingParams[frameNum].Type & MFX_FRAMETYPE_P) && m_InputParams.m_UseGPB); - - return; -} - -// Select references from list -// Most recently processed frames are at the end of the return list -std::list TestProcessor::GetReferences(const std::list & RecentProcessed, const std::vector& ref_idx) -{ - std::list refs_for_frame; - - for (auto & frm_descr : RecentProcessed) - { - if (std::find(ref_idx.begin(), ref_idx.end(), frm_descr.m_frameNumber) != ref_idx.end()) - refs_for_frame.emplace_back(frm_descr); - } - - return refs_for_frame; -} - -std::list TestProcessor::GetSkips(const std::list & RecentProcessed) -{ - std::list skips; - - for (auto & frm_descr : RecentProcessed) - { - if (frm_descr.m_changeType == SKIP) - skips.emplace_back(frm_descr); - } - - return skips; -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/util_defs.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/util_defs.cpp deleted file mode 100644 index e12b238..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/util_defs.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "util_defs.h" - -std::string ConvertMfxStatusToString(mfxStatus sts) -{ - switch (sts) - { - - case MFX_ERR_NONE: /* no error */ - return std::string("MFX_ERR_NONE"); - - /* error codes <0 */ - case MFX_ERR_NULL_PTR: /* null pointer */ - return std::string("MFX_ERR_NULL_PTR"); - case MFX_ERR_UNSUPPORTED: /* undeveloped feature */ - return std::string("MFX_ERR_UNSUPPORTED"); - case MFX_ERR_MEMORY_ALLOC: /* failed to allocate memory */ - return std::string("MFX_ERR_MEMORY_ALLOC"); - case MFX_ERR_NOT_ENOUGH_BUFFER: /* insufficient buffer at input/output */ - return std::string("MFX_ERR_NOT_ENOUGH_BUFFER"); - case MFX_ERR_INVALID_HANDLE: /* invalid handle */ - return std::string("MFX_ERR_INVALID_HANDLE"); - case MFX_ERR_LOCK_MEMORY: /* failed to lock the memory block */ - return std::string("MFX_ERR_LOCK_MEMORY"); - case MFX_ERR_NOT_INITIALIZED: /* member function called before initialization */ - return std::string("MFX_ERR_NOT_INITIALIZED"); - case MFX_ERR_NOT_FOUND: /* the specified object is not found */ - return std::string("MFX_ERR_NOT_FOUND"); - case MFX_ERR_MORE_DATA: /* expect more data at input */ - return std::string("MFX_ERR_MORE_DATA"); - case MFX_ERR_MORE_SURFACE: /* expect more surface at output */ - return std::string("MFX_ERR_MORE_SURFACE"); - case MFX_ERR_ABORTED: /* operation aborted */ - return std::string("MFX_ERR_ABORTED"); - case MFX_ERR_DEVICE_LOST: /* lose the HW acceleration device */ - return std::string("MFX_ERR_DEVICE_LOST"); - case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM: /* incompatible video parameters */ - return std::string("MFX_ERR_INCOMPATIBLE_VIDEO_PARAM"); - case MFX_ERR_INVALID_VIDEO_PARAM: /* invalid video parameters */ - return std::string("MFX_ERR_INVALID_VIDEO_PARAM"); - case MFX_ERR_UNDEFINED_BEHAVIOR: /* undefined behavior */ - return std::string("MFX_ERR_UNDEFINED_BEHAVIOR"); - case MFX_ERR_DEVICE_FAILED: /* device operation failure */ - return std::string("MFX_ERR_DEVICE_FAILED"); - case MFX_ERR_MORE_BITSTREAM: /* expect more bitstream buffers at output */ - return std::string("MFX_ERR_MORE_BITSTREAM"); - case MFX_ERR_INCOMPATIBLE_AUDIO_PARAM: /* incompatible audio parameters */ - return std::string("MFX_ERR_INCOMPATIBLE_AUDIO_PARAM"); - case MFX_ERR_INVALID_AUDIO_PARAM: /* invalid audio parameters */ - return std::string("MFX_ERR_INVALID_AUDIO_PARAM"); - case MFX_ERR_GPU_HANG: /* device operation failure caused by GPU hang */ - return std::string("MFX_ERR_GPU_HANG"); - case MFX_ERR_REALLOC_SURFACE: /* bigger output surface required */ - return std::string("MFX_ERR_REALLOC_SURFACE"); - - /* warnings >0 */ - case MFX_WRN_IN_EXECUTION: /* the previous asynchronous operation is in execution */ - return std::string("MFX_WRN_IN_EXECUTION"); - case MFX_WRN_DEVICE_BUSY: /* the HW acceleration device is busy */ - return std::string("MFX_WRN_DEVICE_BUSY"); - case MFX_WRN_VIDEO_PARAM_CHANGED: /* the video parameters are changed during decoding */ - return std::string("MFX_WRN_VIDEO_PARAM_CHANGED"); - case MFX_WRN_PARTIAL_ACCELERATION: /* SW is used */ - return std::string("MFX_WRN_PARTIAL_ACCELERATION"); - case MFX_WRN_INCOMPATIBLE_VIDEO_PARAM: /* incompatible video parameters */ - return std::string("MFX_WRN_INCOMPATIBLE_VIDEO_PARAM"); - case MFX_WRN_VALUE_NOT_CHANGED: /* the value is saturated based on its valid range */ - return std::string("MFX_WRN_VALUE_NOT_CHANGED"); - case MFX_WRN_OUT_OF_RANGE: /* the value is out of valid range */ - return std::string("MFX_WRN_OUT_OF_RANGE"); - case MFX_WRN_FILTER_SKIPPED: /* one of requested filters has been skipped */ - return std::string("MFX_WRN_FILTER_SKIPPED"); - case MFX_WRN_INCOMPATIBLE_AUDIO_PARAM: /* incompatible audio parameters */ - return std::string("MFX_WRN_INCOMPATIBLE_AUDIO_PARAM"); - - /* threading statuses */ - //case MFX_TASK_DONE: == ERR_NONE /* task has been completed */ - case MFX_TASK_WORKING: /* there is some more work to do */ - return std::string("MFX_TASK_WORKING"); - case MFX_TASK_BUSY: /* task is waiting for resources */ - return std::string("MFX_TASK_BUSY"); - - /* plug-in statuses */ - case MFX_ERR_MORE_DATA_SUBMIT_TASK: /* return MFX_ERR_MORE_DATA but submit internal asynchronous task */ - return std::string("MFX_ERR_MORE_DATA_SUBMIT_TASK"); - - case MFX_ERR_UNKNOWN: /* unknown error. */ - default: - return std::string("MFX_ERR_UNKNOWN"); - } -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/verifier.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/verifier.cpp deleted file mode 100644 index 604c1f3..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/asg-hevc/src/verifier.cpp +++ /dev/null @@ -1,1055 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include "verifier.h" - -// Processor for verification mode -void Verifier::Init() -{ - try - { // Add buffers to bufferReader - if (m_InputParams.m_TestType & (GENERATE_INTER | GENERATE_INTRA)) - { - m_BufferReader.AddBuffer(MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC, m_InputParams.m_PakCtuBufferFileName); - m_BufferReader.AddBuffer(MFX_EXTBUFF_HEVCFEI_PAK_CU_REC, m_InputParams.m_PakCuBufferFileName); - } - } - catch (std::string& e) { - std::cout << e << std::endl; - throw std::string("ERROR: Couldn't initialize Verifier"); - } -} - -// Get surface -ExtendedSurface* Verifier::PrepareSurface() -{ - ExtendedSurface* surf = GetFreeSurf(); - if (!surf) - { - throw std::string("ERROR: Verifier::PrepareSurface: Undefined reference to surface"); - } - ++surf->Data.Locked; - return surf; -} - -// Save all data -void Verifier::DropFrames() -{ - // Sort data by frame order and drop in DisplayOrder - - // TODO / FIXME: Add EncodedOrder processing, it might be required for HEVC FEI PAK - m_Surfaces.sort([](ExtendedSurface& left, ExtendedSurface& right) { return left.Data.FrameOrder < right.Data.FrameOrder; }); - - for (ExtendedSurface& surf : m_Surfaces) - { - // If Locked surface met - stop dumping - if (surf.Data.Locked) break; - - // If the surface has already been output, move on to the next one in frame order - if (surf.isWritten) continue; - - surf.isWritten = true; - } -} - -void Verifier::SavePSData() -{ - if (fpPicStruct.is_open()) - { - // sort by coding order - std::sort(m_RefControl.RefLogInfo.begin(), m_RefControl.RefLogInfo.end(), IsInCodingOrder); - - //vector RefLogInfo; - - while (!fpPicStruct.eof()) { - RefState stateLd; - if (!stateLd.Load(fpPicStruct)) - break; - stateLd.picture.codingOrder = m_Counters.m_totalPics; // i.e. line number - auto istate = m_RefControl.RefLogInfo.cbegin() + m_Counters.m_totalPics; - m_Counters.m_totalPics++; - m_Counters.m_correctRecords += (stateLd == *istate); - - //RefLogInfo.emplace_back(stateLd); - } - } -} - -void Verifier::VerifyDesc(FrameChangeDescriptor & frameDescr) -{ - try - { - if (m_InputParams.m_TestType & (GENERATE_INTER | GENERATE_INTRA)) - { - // Width/Height alignment should set as CTU size, because now we are working with bs_parser output data w/o HW requirements - mfxU32 alignedWidth = MSDK_ALIGN(m_InputParams.m_width, m_InputParams.m_CTUStr.CTUSize); - mfxU32 alignedHeight = MSDK_ALIGN(m_InputParams.m_height, m_InputParams.m_CTUStr.CTUSize); - - mfxU32 heightInCTU = alignedHeight / m_InputParams.m_CTUStr.CTUSize; - mfxU32 widthInCTU = alignedWidth / m_InputParams.m_CTUStr.CTUSize; - - // For FEI compatibility - mfxU32 maxNumCuInCtu = m_InputParams.m_CTUStr.GetMaxNumCuInCtu(); - - // Buffers creations - ExtendedBuffer tmpCtuBuff(MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC, widthInCTU, heightInCTU); - - // This one has to be (maxNumCuInCtu) times larger than the CTU record buffer. For the time - // being, implemented this via pitch adjustment - ExtendedBuffer tmpCuBuff(MFX_EXTBUFF_HEVCFEI_PAK_CU_REC, widthInCTU*maxNumCuInCtu, heightInCTU); - - // Reading statistics from data storage - m_BufferReader.ReadBuffer(&tmpCtuBuff.m_pakCtuRecord.Header); - m_BufferReader.ReadBuffer(&tmpCuBuff.m_pakCuRecord.Header); - // Structure will be in encoded order - if (frameDescr.m_changeType == MOD) - { - for (auto& asgCTUDescr : frameDescr.m_vCTUdescr) - { - m_Counters.m_testCTUs++; - mfxU32 idxYInCTU = asgCTUDescr.m_AdrYInCTU; - mfxU32 idxXInCTU = asgCTUDescr.m_AdrXInCTU; - - mfxFeiHevcPakCtuRecordV0 ctuPakFromFEI = tmpCtuBuff.m_pakCtuRecord.Data[idxYInCTU * widthInCTU + idxXInCTU]; - - mfxU32 startCuOffset = maxNumCuInCtu * (idxYInCTU * widthInCTU + idxXInCTU); - - // Prerare CTU descriptor from FEI output - CTUDescriptor feiCTUDescr = ConvertFeiOutInLocalStr(ctuPakFromFEI, tmpCuBuff, startCuOffset); - - asgLog << std::endl << "Frame " << frameDescr.m_frameNumber << std::endl; - asgLog << "ASG " << asgCTUDescr << std::endl << "FEI " << feiCTUDescr << std::endl; - - CompareSplits(asgCTUDescr, feiCTUDescr); - CompareMVs(asgCTUDescr, feiCTUDescr); - CountExactMatches(asgCTUDescr, feiCTUDescr); - } - } - } - } - catch (std::string& e) { - std::cout << e << std::endl; - throw std::string("ERROR: Verifier::VerifyDesc"); - } -} - -void Verifier::ExtractMVs(const CTUDescriptor& ctuDescr, std::vector& mvCmpBlocks) -{ - mfxU32 diffMaxBaseBlockLuma = m_InputParams.m_CTUStr.log2CTUSize - LOG2_MV_COMPARE_BASE_BLOCK_SIZE; - mfxU32 widthInCompareBlocks = 1 << diffMaxBaseBlockLuma; - constexpr mfxU32 baseBlockSize = 1 << LOG2_MV_COMPARE_BASE_BLOCK_SIZE; - - for (auto& CU : ctuDescr.m_CUVec) - { - switch (CU.m_PredType) - { - case INTER_PRED: - for (auto& PU : CU.m_PUVec) - { - mfxU32 firstYBlock = (PU.m_AdrY - ctuDescr.m_AdrY) / baseBlockSize; - mfxU32 firstXBlock = (PU.m_AdrX - ctuDescr.m_AdrX) / baseBlockSize; - mfxU32 lastYBlock = firstYBlock + (PU.m_BHeight / baseBlockSize); - mfxU32 lastXBlock = firstXBlock + (PU.m_BWidth / baseBlockSize); - - for (mfxU32 idxMVCBY = firstYBlock; idxMVCBY < lastYBlock; ++idxMVCBY) - { - for (mfxU32 idxMVCBX = firstXBlock; idxMVCBX < lastXBlock; ++idxMVCBX) - { - MVCompareBlock& block = mvCmpBlocks.at(idxMVCBY * widthInCompareBlocks + idxMVCBX); - block.m_AdrX = ctuDescr.m_AdrX + baseBlockSize * idxMVCBX; - block.m_AdrY = ctuDescr.m_AdrY + baseBlockSize * idxMVCBY; - block.m_BHeight = block.m_BWidth = baseBlockSize; - - block.MV = PU.m_MV; - block.usedMVPPoolNo = PU.usedMVPPoolNo; - block.usedMVPIndex = PU.usedMVPIndex; - - block.bIsIntra = false; - - block.predFlagL0 = PU.predFlagL0; - block.predFlagL1 = PU.predFlagL1; - } - } - } - break; - case INTRA_PRED: - { - mfxU32 firstYBlock = (CU.m_AdrY - ctuDescr.m_AdrY) / baseBlockSize; - mfxU32 firstXBlock = (CU.m_AdrX - ctuDescr.m_AdrX) / baseBlockSize; - mfxU32 lastYBlock = firstYBlock + (CU.m_BHeight / baseBlockSize); - mfxU32 lastXBlock = firstXBlock + (CU.m_BWidth / baseBlockSize); - - for (mfxU32 idxMVCBY = firstYBlock; idxMVCBY < lastYBlock; ++idxMVCBY) - { - for (mfxU32 idxMVCBX = firstXBlock; idxMVCBX < lastXBlock; ++idxMVCBX) - { - MVCompareBlock& block = mvCmpBlocks.at(idxMVCBY * widthInCompareBlocks + idxMVCBX); - block.m_AdrX = ctuDescr.m_AdrX + baseBlockSize * idxMVCBX; - block.m_AdrY = ctuDescr.m_AdrY + baseBlockSize * idxMVCBY; - block.m_BHeight = block.m_BWidth = baseBlockSize; - - block.bIsIntra = true; - } - } - break; - } - default: - throw std::string("ERROR: ExtractMVs: unknown CU prediction type\n"); - } - } -} - -void Verifier::CompareSplits(const CTUDescriptor& ctuDescrASG, const CTUDescriptor& ctuDescrFEI) -{ - //First, count total number of split partitions (PUs and CUs) by their size - for (const auto& CU : ctuDescrASG.m_CUVec) - { - m_Counters.m_testCUSizeMapASG.AddBlockTotal(CU.m_BWidth, CU.m_BHeight); - for (const auto& PU : CU.m_PUVec) - { - m_Counters.m_testPUSizeMapASG.AddBlockTotal(PU.m_BWidth, PU.m_BHeight); - } - } - - for (const auto& CU : ctuDescrFEI.m_CUVec) - { - m_Counters.m_testCUSizeMapFEI.AddBlockTotal(CU.m_BWidth, CU.m_BHeight); - for (const auto& PU : CU.m_PUVec) - { - m_Counters.m_testPUSizeMapFEI.AddBlockTotal(PU.m_BWidth, PU.m_BHeight); - } - } - - asgLog << std::endl << "Comparing splits:" << std::endl; - asgLog << "FEI CUs: " << ctuDescrFEI.m_CUVec.size() << ", ASG CUs: " << ctuDescrASG.m_CUVec.size() << std::endl; - for (const auto& asgCU : ctuDescrASG.m_CUVec) - { - // Verificator finds equal CU - asgLog << "Searching for CU " << asgCU; - const auto itFeiCU = std::find_if(ctuDescrFEI.m_CUVec.begin(), ctuDescrFEI.m_CUVec.end(), - [&asgCU](const CUBlock& cu) { return (cu.m_AdrX == asgCU.m_AdrX && cu.m_AdrY == asgCU.m_AdrY && - cu.m_BWidth == asgCU.m_BWidth && cu.m_BHeight == asgCU.m_BHeight); }); - if (itFeiCU != ctuDescrFEI.m_CUVec.end()) - { - asgLog << " -- FOUND, FEI PUs: " << asgCU.m_PUVec.size() - << ", ASG PUs: " << itFeiCU->m_PUVec.size() << std::endl; - m_Counters.m_testCUSizeMapASG.AddBlockCorrect(itFeiCU->m_BWidth, itFeiCU->m_BHeight); - for (auto& asgPU : asgCU.m_PUVec) - { - //Verificator finds equal PUs and calculates their number, while incrementing the correct count - //for the respective PU size in the block size map - m_Counters.m_correctPUs += (mfxU32)std::count_if(itFeiCU->m_PUVec.begin(), itFeiCU->m_PUVec.end(), - [&asgPU, this](const PUBlock& pu) { - if (pu.m_AdrX == asgPU.m_AdrX && pu.m_AdrY == asgPU.m_AdrY - && pu.m_BHeight == asgPU.m_BHeight && pu.m_BWidth == asgPU.m_BWidth) - { - asgLog << "\t Found matching PU: " << asgPU << std::endl; - m_Counters.m_testPUSizeMapASG.AddBlockCorrect(pu.m_BWidth, pu.m_BHeight); - return true; - } - else - { - asgLog << "\t PU mismatch -- FEI " << asgPU << ", ASG " << pu << std::endl; - return false; - } - }); - } - } - else - { - asgLog << " -- NOT FOUND" << std::endl; - } - } -} - -void Verifier::CompareMVs(const CTUDescriptor& asgCTUDescr, const CTUDescriptor& feiCTUDescr) -{ - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - mfxU32 poolNo = 0; - asgLog << "\nGenerated MVP pools:\n"; - for (const auto& genMVPPool : asgCTUDescr.m_MVPGenPools) - { - asgLog << "MVP pool no. : "<< poolNo++ << "\n"; - for (mfxU32 mvpIndex = 0; mvpIndex < MVP_PER_16x16_BLOCK; ++mvpIndex) - { - asgLog << mvpIndex << ": " << "L0:"; - std::stringstream sstreamL0; - sstreamL0 << " (" << genMVPPool[mvpIndex].MV[0].x << "; " << - genMVPPool[mvpIndex].MV[0].y << ")"; - asgLog << std::setw(14) << sstreamL0.str(); - - asgLog << ", L1:"; - std::stringstream sstreamL1; - sstreamL1 << " (" << genMVPPool[mvpIndex].MV[1].x << "; " << - genMVPPool[mvpIndex].MV[1].y << ")"; - asgLog << std::setw(14) << sstreamL1.str(); - asgLog << "\n"; - } - } - } - asgLog << "\nComparing MVs:\n"; - - // Tool mapping MVs on 4x4 compare blocks for checking [numCompareBlocksInCtu][List] - mfxU32 diffMaxBaseBlockLuma = m_InputParams.m_CTUStr.log2CTUSize - LOG2_MV_COMPARE_BASE_BLOCK_SIZE; - mfxU32 numCompareBlocksInCtu = (1 << (2 * diffMaxBaseBlockLuma)); - - std::vector MVCmpBlocksASG(numCompareBlocksInCtu); - std::vector MVCmpBlocksFEI(numCompareBlocksInCtu); - - // Extract information from FEI output - ExtractMVs(feiCTUDescr, MVCmpBlocksFEI); - - // Extract information from ASG tree structure - ExtractMVs(asgCTUDescr, MVCmpBlocksASG); - - for (mfxU32 idxMVCmpBlock = 0; idxMVCmpBlock < numCompareBlocksInCtu; ++idxMVCmpBlock) - { - const MVCompareBlock& asgMVBlock = MVCmpBlocksASG[idxMVCmpBlock]; - const MVCompareBlock& feiMVBlock = MVCmpBlocksFEI[idxMVCmpBlock]; - - asgLog << std::endl << "Block " << idxMVCmpBlock + 1 << "/" << numCompareBlocksInCtu << "; " - << BaseBlock(asgMVBlock) << std::endl; - - CompareMVBlocks(asgMVBlock, feiMVBlock); - } - - CalculateTotalMVCmpBlocksInCTU(MVCmpBlocksASG); -} - -void Verifier::CompareMVBlocks(const MVCompareBlock& asgMVCmpBlock, const MVCompareBlock& feiMVCmpBlock) -{ - const auto feiMVL0 = feiMVCmpBlock.MV.GetL0MVTuple(); - const auto feiMVL1 = feiMVCmpBlock.MV.GetL1MVTuple(); - - const auto asgMVL0 = asgMVCmpBlock.MV.GetL0MVTuple(); - const auto asgMVL1 = asgMVCmpBlock.MV.GetL1MVTuple(); - - if (!asgMVCmpBlock.bIsIntra) - { - if ((m_InputParams.m_TestType & GENERATE_PREDICTION) && asgMVCmpBlock.usedMVPIndex < 0) - { - throw std::string("Verifier::CompareMVs: Some PU has invalid used MVP index"); - } - - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - asgLog << "MVP index used in ASG: " << asgMVCmpBlock.usedMVPIndex << " "; - } - - if (asgMVCmpBlock.predFlagL0 && !asgMVCmpBlock.predFlagL1) - { - asgLog << "Uni-predicted MV compare block\n"; - asgLog << "L0 MV: " << "FEI " << std::setw(14) << feiMVL0 << ", ASG " << std::setw(14) << asgMVL0 - << ", MVP pool no. : " << asgMVCmpBlock.usedMVPPoolNo << ", MVP index : " << asgMVCmpBlock.usedMVPIndex; - - if (feiMVL0 == asgMVL0) - { - m_Counters.m_correctMVCmpBlocksL0++; - - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - m_Counters.m_correctMVCmpBlocksL0PerMVPIndex[asgMVCmpBlock.usedMVPIndex]++; - } - - asgLog << " -- OK\n"; - } - else - { - asgLog << " -- MISMATCH\n"; - } - } - else if (!asgMVCmpBlock.predFlagL0 && asgMVCmpBlock.predFlagL1) - { - asgLog << "Uni-predicted MV compare block\n"; - asgLog << "L1 MV: " << "FEI " << std::setw(14) << feiMVL1 << ", ASG " << std::setw(14) << asgMVL1 - << ", MVP pool no. : " << asgMVCmpBlock.usedMVPPoolNo << ", MVP index : " << asgMVCmpBlock.usedMVPIndex; - - if (feiMVL1 == asgMVL1) - { - m_Counters.m_correctMVCmpBlocksL1++; - - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - m_Counters.m_correctMVCmpBlocksL1PerMVPIndex[asgMVCmpBlock.usedMVPIndex]++; - } - - asgLog << " -- OK\n"; - } - else - { - asgLog << " -- MISMATCH\n"; - } - } - else if (asgMVCmpBlock.predFlagL0 && asgMVCmpBlock.predFlagL1) - { - asgLog << "Bi-predicted MV compare block\n"; - asgLog << "L0 MV: " << "FEI " << std::setw(14) << feiMVL0 << ", ASG " - << std::setw(14) << asgMVL0 << "\n"; - asgLog << "L1 MV: " << "FEI " << std::setw(14) << feiMVL1 << ", ASG " - << std::setw(14) << asgMVL1 << ", MVP pool no. : " << asgMVCmpBlock.usedMVPPoolNo - << ", MVP index : " << asgMVCmpBlock.usedMVPIndex; - - if ((feiMVL0 == asgMVL0) && (feiMVL1 == asgMVL1)) - { - m_Counters.m_correctMVCmpBlocksBi++; - - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - m_Counters.m_correctMVCmpBlocksBiPerMVPIndex[asgMVCmpBlock.usedMVPIndex]++; - } - - asgLog << " -- OK\n"; - } - else - { - asgLog << " -- MISMATCH\n"; - } - - // Won't affect test result - if ((feiMVL0 == asgMVL0) && (feiMVL1 != asgMVL1)) - { - m_Counters.m_correctMVsL0FromBiMVCmpBlocks++; - } - else if ((feiMVL0 != asgMVL0) && (feiMVL1 == asgMVL1)) - { - m_Counters.m_correctMVsL1FromBiMVCmpBlocks++; - } - } - } - else - { - asgLog << " -- skipped due to being intra in ASG" << std::endl; - } -} - -void Verifier::CalculateTotalMVCmpBlocksInCTU(std::vector& mvCmpBlocks) -{ - mfxU32 testMVCmpBlocksCountL0 = (mfxU32)std::count_if(mvCmpBlocks.begin(), mvCmpBlocks.end(), - [](const MVCompareBlock& block) { return !block.bIsIntra && block.predFlagL0 && !block.predFlagL1; }); - - mfxU32 testMVCmpBlocksCountL1 = (mfxU32)std::count_if(mvCmpBlocks.begin(), mvCmpBlocks.end(), - [](const MVCompareBlock& block) { return !block.bIsIntra && !block.predFlagL0 && block.predFlagL1; }); - - mfxU32 testMVCmpBlocksCountBi = (mfxU32)std::count_if(mvCmpBlocks.begin(), mvCmpBlocks.end(), - [](const MVCompareBlock& block) { return !block.bIsIntra && block.predFlagL0 && block.predFlagL1; }); - - m_Counters.m_totalMVCmpBlocksL0 += testMVCmpBlocksCountL0; - m_Counters.m_totalMVCmpBlocksL1 += testMVCmpBlocksCountL1; - m_Counters.m_totalMVCmpBlocksBi += testMVCmpBlocksCountBi; - - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - for (mfxI32 mvpIndex = 0; mvpIndex < MVP_PER_16x16_BLOCK; mvpIndex++) - { - mfxU32 testMVCmpBlocksCountL0 = (mfxU32)std::count_if(mvCmpBlocks.begin(), mvCmpBlocks.end(), - [mvpIndex](const MVCompareBlock& block) { return !block.bIsIntra && block.predFlagL0 - && !block.predFlagL1 && block.usedMVPIndex == mvpIndex; }); - - mfxU32 testMVCmpBlocksCountL1 = (mfxU32)std::count_if(mvCmpBlocks.begin(), mvCmpBlocks.end(), - [mvpIndex](const MVCompareBlock& block) { return !block.bIsIntra && !block.predFlagL0 - && block.predFlagL1 && block.usedMVPIndex == mvpIndex; }); - - mfxU32 testMVCmpBlocksCountBi = (mfxU32)std::count_if(mvCmpBlocks.begin(), mvCmpBlocks.end(), - [mvpIndex](const MVCompareBlock& block) { return !block.bIsIntra && block.predFlagL0 - && block.predFlagL1 && block.usedMVPIndex == mvpIndex; }); - - m_Counters.m_totalMVCmpBlocksL0PerMVPIndex[mvpIndex] += testMVCmpBlocksCountL0; - m_Counters.m_totalMVCmpBlocksL1PerMVPIndex[mvpIndex] += testMVCmpBlocksCountL1; - m_Counters.m_totalMVCmpBlocksBiPerMVPIndex[mvpIndex] += testMVCmpBlocksCountBi; - } - } -} - -void Verifier::CountExactMatches(const CTUDescriptor& asgCTUDescr, const CTUDescriptor& feiCTUDescr) -{ - std::vector asgPUBlocksOfCTU = asgCTUDescr.GetTotalPUsVec(); - std::vector feiPUBlocksOfCTU = feiCTUDescr.GetTotalPUsVec(); - - mfxU32 exactPUMatches = 0; - - for (const auto& asgPU : asgPUBlocksOfCTU) - { - exactPUMatches += (mfxU32)std::count(feiPUBlocksOfCTU.begin(), feiPUBlocksOfCTU.end(), asgPU); - } - - mfxU32 exactCUMatches = 0; - //TODO: optimize so that PUs don't get compared twice - for (const auto& asgCU : asgCTUDescr.m_CUVec) - { - exactCUMatches += (mfxU32)std::count(feiCTUDescr.m_CUVec.begin(), feiCTUDescr.m_CUVec.end(), asgCU); - } - - if (exactCUMatches == asgCTUDescr.m_CUVec.size() && exactCUMatches == feiCTUDescr.m_CUVec.size() && - exactPUMatches == asgPUBlocksOfCTU.size() && - exactPUMatches == feiPUBlocksOfCTU.size()) - { - asgLog << std::endl << "CTUs are exactly matching" << std::endl; - m_Counters.m_exactCTUs++; - } - else - { - asgLog << std::endl << "CTUs are not exactly matching" << std::endl; - asgLog << "CUs (exact/ASG total): " << exactCUMatches << '/' << asgPUBlocksOfCTU.size() << std::endl; - asgLog << "PUs (exact/ASG total): " << exactPUMatches << '/' << asgPUBlocksOfCTU.size() << std::endl; - } - m_Counters.m_exactCUs += exactCUMatches; - m_Counters.m_exactPUs += exactPUMatches; -} - -CTUDescriptor Verifier::ConvertFeiOutInLocalStr(const mfxFeiHevcPakCtuRecordV0& ctuPakFromFEI, const ExtendedBuffer& tmpCuBuff, const mfxU32 startCuOffset) -{ - try - { - CTUDescriptor tmpDescr(ctuPakFromFEI.CtuAddrX, ctuPakFromFEI.CtuAddrY, - ctuPakFromFEI.CtuAddrX * m_InputParams.m_CTUStr.CTUSize, ctuPakFromFEI.CtuAddrY * m_InputParams.m_CTUStr.CTUSize, - m_InputParams.m_CTUStr.CTUSize, m_InputParams.m_CTUStr.CTUSize); - - mfxU32 bitMask = 0; - mfxU32 baseSplitLevel2Shift = 4; - bitMask |= ctuPakFromFEI.SplitLevel0; - bitMask |= ctuPakFromFEI.SplitLevel1 << 1; - bitMask |= ctuPakFromFEI.SplitLevel2Part0 << (baseSplitLevel2Shift + 1); - bitMask |= ctuPakFromFEI.SplitLevel2Part1 << (2 * baseSplitLevel2Shift + 1); - bitMask |= ctuPakFromFEI.SplitLevel2Part2 << (3 * baseSplitLevel2Shift + 1); - bitMask |= ctuPakFromFEI.SplitLevel2Part3 << (4 * baseSplitLevel2Shift + 1); - - m_FrameProcessor.GenQuadTreeInCTUWithBitMask(tmpDescr, bitMask); - std::vector tmpVec; - tmpDescr.m_CUQuadTree.GetQuadTreeBlocksRecur(tmpDescr.m_CUQuadTree.root, tmpDescr.m_AdrX, tmpDescr.m_AdrY, tmpDescr.m_BHeight, tmpVec); - - if (tmpVec.size() != mfxU32(ctuPakFromFEI.CuCountMinus1 + 1)) - throw std::string("ERROR: Verifier::ConvertFeiOutInLocalStr. Incorrect number of the CUs into tree"); - - mfxU32 idxCUInCTU = 0; - for (const auto& block : tmpVec) - { - CUBlock cu_block(block); - mfxFeiHevcPakCuRecordV0 cuPakFromFEI = tmpCuBuff.m_pakCuRecord.Data[startCuOffset + idxCUInCTU]; - - if (cuPakFromFEI.PredMode) - { - cu_block.m_PredType = INTER_PRED; - cu_block.BuildPUsVector((INTER_PART_MODE)cuPakFromFEI.PartMode); - - mfxU32 idxPUInCU = 0; - for (auto& PU : cu_block.m_PUVec) - { - mfxU8 interpredIdcPU = (cuPakFromFEI.InterpredIdc >> (2 * idxPUInCU)) & 0x03; - - switch (interpredIdcPU) - { - case 0: - PU.predFlagL0 = true; - PU.predFlagL1 = false; - break; - case 1: - PU.predFlagL0 = false; - PU.predFlagL1 = true; - break; - case 2: - PU.predFlagL0 = true; - PU.predFlagL1 = true; - break; - case 3: - throw std::string("ERROR: Verifier::ConvertFeiOutInLocalStr: incorrect value for InterpredIdc"); - } - - for (mfxU32 idxList = 0; idxList < 2; ++idxList) - { - PU.m_MV.MV[idxList].x = cuPakFromFEI.MVs[idxList].x[idxPUInCU]; - PU.m_MV.MV[idxList].y = cuPakFromFEI.MVs[idxList].y[idxPUInCU]; - } - - switch (idxPUInCU) - { - case 0: - PU.m_MV.RefIdx.RefL0 = cuPakFromFEI.RefIdx[0].Ref0; - PU.m_MV.RefIdx.RefL1 = cuPakFromFEI.RefIdx[1].Ref0; - break; - case 1: - PU.m_MV.RefIdx.RefL0 = cuPakFromFEI.RefIdx[0].Ref1; - PU.m_MV.RefIdx.RefL1 = cuPakFromFEI.RefIdx[1].Ref1; - break; - case 2: - PU.m_MV.RefIdx.RefL0 = cuPakFromFEI.RefIdx[0].Ref2; - PU.m_MV.RefIdx.RefL1 = cuPakFromFEI.RefIdx[1].Ref2; - break; - case 3: - PU.m_MV.RefIdx.RefL0 = cuPakFromFEI.RefIdx[0].Ref3; - PU.m_MV.RefIdx.RefL1 = cuPakFromFEI.RefIdx[1].Ref3; - break; - } - - ++idxPUInCU; - } - } - else - { - cu_block.m_PredType = INTRA_PRED; - } - - tmpDescr.m_CUVec.push_back(cu_block); - ++idxCUInCTU; - } - - return tmpDescr; - } - - catch (std::string& e) { - std::cout << e << std::endl; - throw std::string("ERROR: Verifier::ConvertFeiOutInLocalStr"); - } -} - -void Verifier::CheckStatistics(Thresholds thres) -{ - m_Counters.m_totalCUsASG = m_Counters.m_testCUSizeMapASG.GetTotalCount(); - m_Counters.m_totalPUsASG = m_Counters.m_testPUSizeMapASG.GetTotalCount(); - - m_Counters.m_totalCUsFEI = m_Counters.m_testCUSizeMapFEI.GetTotalCount(); - m_Counters.m_totalPUsFEI = m_Counters.m_testPUSizeMapFEI.GetTotalCount(); - - m_Counters.m_correctCUs = m_Counters.m_testCUSizeMapASG.GetCorrectCount(); - m_Counters.m_correctPUs = m_Counters.m_testPUSizeMapASG.GetCorrectCount(); - - std::cout << "Total CTUs tested: " << m_Counters.m_testCTUs << std::endl; - std::cout << "Exact matches: CTUs " << m_Counters.m_exactCTUs << '/' << m_Counters.m_testCTUs << '('; - CheckLowerThreshold(m_Counters.m_exactCTUs, m_Counters.m_testCTUs); - std::cout << "), CUs " << m_Counters.m_exactCUs << '/' << m_Counters.m_totalCUsASG << '('; - CheckLowerThreshold(m_Counters.m_exactCUs, m_Counters.m_totalCUsASG); - std::cout << "), PUs " << m_Counters.m_exactPUs << '/' << m_Counters.m_totalPUsASG << '('; - CheckLowerThreshold(m_Counters.m_exactPUs, m_Counters.m_totalPUsASG); - std::cout << ")" << std::endl; - - if (m_InputParams.m_TestType & GENERATE_INTER) - { - CheckMVs(thres); - } - - if (m_InputParams.m_TestType & (GENERATE_INTER | GENERATE_INTRA)) - { - CheckSplits(thres); - } - - if (m_InputParams.m_TestType == GENERATE_PICSTRUCT) - { - CheckPicStruct(); - } - - if (!m_errorMsgList.empty()) - { - std::cout << std::endl <<"TEST FAILED" << std::endl; - - //Output errors in order of occurence as the last lines of output - //so that the test system recognizes test failure - for (auto& message : m_errorMsgList) - { - std::cout << message << std::endl; - } - - throw ASG_HEVC_ERR_LOW_PASS_RATE; - } -} - -bool Verifier::CheckLowerThreshold(mfxU32 numerator, mfxU32 denominator, mfxU32 threshold) -{ - if (denominator > 0) - { - std::cout.precision(1); - std::cout.setf(std::ios::fixed); - std::cout << 100 * ((mfxF32)numerator / denominator) << "%"; - return (100 * ((mfxF32)numerator / denominator) >= (mfxF32)threshold); - } - else - { - std::cout << "n/a"; - return true; - } -} - -void Verifier::PrintPercentRatio(mfxU32 numerator, mfxU32 denominator) -{ - if (denominator > 0) - { - std::cout.precision(1); - std::cout.setf(std::ios::fixed); - std::cout << 100 * ((mfxF32)numerator / denominator) << "%"; - } - else - { - std::cout << "n/a"; - } -} - -void Verifier::CheckMVs(Thresholds threshold) -{ - std::cout << std::endl << "MOTION VECTOR TESTING:\n"; - - CheckL0MVs(threshold); - - CheckL1MVs(threshold); - - CheckBiMVs(threshold); -} - -void Verifier::CheckL0MVs(Thresholds threshold) -{ - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - CheckL0MVsPerMVPIndex(threshold); - } - else - { - std::cout << "Correct uni-predicted (L0) MV " << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks: " - << m_Counters.m_correctMVCmpBlocksL0 << '/' << m_Counters.m_totalMVCmpBlocksL0 << " ("; - - bool isOverallCheckPassed = CheckLowerThreshold(m_Counters.m_correctMVCmpBlocksL0, - m_Counters.m_totalMVCmpBlocksL0, threshold.mvThres); - - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (isOverallCheckPassed) - { - std::cout << "MVs[Uni, L0] test passed" << std::endl; - } - else - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for uni-predicted L0 blocks"); - } - } -} - -void Verifier::CheckL0MVsPerMVPIndex(Thresholds threshold) -{ - bool isIncorrectPredCheckPassed = true; - bool isCorrectPredCheckPassed = true; - - mfxU32 expectedCorrectTotal = 0; - mfxU32 expectedCorrectCount = 0; - mfxU32 expectedIncorrectTotal = 0; - mfxU32 expectedIncorrectCount = 0; - - for (mfxU32 mvpIndex = 0; mvpIndex < MVP_PER_16x16_BLOCK; mvpIndex++) - { - std::cout << "MVP index: " << mvpIndex << " Correct uni-predicted (L0) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks: " - << m_Counters.m_correctMVCmpBlocksL0PerMVPIndex[mvpIndex] << '/' - << m_Counters.m_totalMVCmpBlocksL0PerMVPIndex[mvpIndex] << " ("; - PrintPercentRatio(m_Counters.m_correctMVCmpBlocksL0PerMVPIndex[mvpIndex], - m_Counters.m_totalMVCmpBlocksL0PerMVPIndex[mvpIndex]); - std::cout << ")" << std::endl; - - // Calculating incorrectly predicted blocks per disabled MVP indexes - if (mvpIndex / m_InputParams.m_NumMVPredictors) - { - expectedIncorrectTotal += m_Counters.m_totalMVCmpBlocksL0PerMVPIndex[mvpIndex]; - expectedIncorrectCount += (m_Counters.m_totalMVCmpBlocksL0PerMVPIndex[mvpIndex] - - m_Counters.m_correctMVCmpBlocksL0PerMVPIndex[mvpIndex]); - } - else // Calculating correctly predicted blocks per enabled MVP indexes - { - expectedCorrectTotal += m_Counters.m_totalMVCmpBlocksL0PerMVPIndex[mvpIndex]; - expectedCorrectCount += m_Counters.m_correctMVCmpBlocksL0PerMVPIndex[mvpIndex]; - } - } - - std::cout << "Correctly uni-predicted (L0) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks on enabled EMVP: " - << expectedCorrectCount << "/" << expectedCorrectTotal << " ("; - isCorrectPredCheckPassed = CheckLowerThreshold(expectedCorrectCount, expectedCorrectTotal, - threshold.mvThres); - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (!isCorrectPredCheckPassed) - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for correctly uni-predicted L0 blocks"); - } - - std::cout << "Incorrectly uni-predicted (L0) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks on disabled EMVP: " - << expectedIncorrectCount << "/" << expectedIncorrectTotal << " ("; - isIncorrectPredCheckPassed = CheckLowerThreshold(expectedIncorrectCount, expectedIncorrectTotal, - threshold.mvThres); - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (!isIncorrectPredCheckPassed) - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for incorrectly uni-predicted L0 blocks"); - } - - if (isCorrectPredCheckPassed && isIncorrectPredCheckPassed) - { - std::cout << "MVs[Uni, L0] test passed" << std::endl; - } -} - -void Verifier::CheckL1MVs(Thresholds threshold) -{ - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - CheckL1MVsPerMVPIndex(threshold); - } - else - { - std::cout << "Correct uni-predicted (L1) MV " << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE - << " compare blocks: " << m_Counters.m_correctMVCmpBlocksL1 << '/' - << m_Counters.m_totalMVCmpBlocksL1 << " ("; - - bool isOverallPassed = CheckLowerThreshold(m_Counters.m_correctMVCmpBlocksL1, - m_Counters.m_totalMVCmpBlocksL1, threshold.mvThres); - - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (isOverallPassed) - { - std::cout << "MVs[Uni, L1] test passed" << std::endl; - } - else - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for uni-predicted L1 blocks"); - } - } -} - -void Verifier::CheckL1MVsPerMVPIndex(Thresholds threshold) -{ - bool isIncorrectPredCheckPassed = true; - bool isCorrectPredCheckPassed = true; - - mfxU32 expectedCorrectTotal = 0; - mfxU32 expectedCorrectCount = 0; - mfxU32 expectedIncorrectTotal = 0; - mfxU32 expectedIncorrectCount = 0; - - std::cout << std::endl; - - for (mfxU32 mvpIndex = 0; mvpIndex < MVP_PER_16x16_BLOCK; mvpIndex++) - { - std::cout << "MVP index: " << mvpIndex << " Correct uni-predicted (L1) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks: " - << m_Counters.m_correctMVCmpBlocksL1PerMVPIndex[mvpIndex] << '/' - << m_Counters.m_totalMVCmpBlocksL1PerMVPIndex[mvpIndex] << " ("; - PrintPercentRatio(m_Counters.m_correctMVCmpBlocksL1PerMVPIndex[mvpIndex], - m_Counters.m_totalMVCmpBlocksL1PerMVPIndex[mvpIndex]); - std::cout << ")" << std::endl; - - // Calculating incorrectly predicted blocks per disabled MVP indexes - if (mvpIndex / m_InputParams.m_NumMVPredictors) - { - expectedIncorrectTotal += m_Counters.m_totalMVCmpBlocksL1PerMVPIndex[mvpIndex]; - expectedIncorrectCount += (m_Counters.m_totalMVCmpBlocksL1PerMVPIndex[mvpIndex] - - m_Counters.m_correctMVCmpBlocksL1PerMVPIndex[mvpIndex]); - } - else // Calculating correctly predicted blocks per enabled MVP indexes - { - expectedCorrectTotal += m_Counters.m_totalMVCmpBlocksL1PerMVPIndex[mvpIndex]; - expectedCorrectCount += m_Counters.m_correctMVCmpBlocksL1PerMVPIndex[mvpIndex]; - } - } - - std::cout << "Correctly uni-predicted (L1) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks on enabled EMVP: " - << expectedCorrectCount << "/" << expectedCorrectTotal << " ("; - isCorrectPredCheckPassed = CheckLowerThreshold(expectedCorrectCount, - expectedCorrectTotal, threshold.mvThres); - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (!isCorrectPredCheckPassed) - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for correctly uni-predicted L1 blocks"); - } - - std::cout << "Incorrectly uni-predicted (L1) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks on disabled EMVP: " - << expectedIncorrectCount << "/" << expectedIncorrectTotal << " ("; - isIncorrectPredCheckPassed = CheckLowerThreshold(expectedIncorrectCount, - expectedIncorrectTotal, threshold.mvThres); - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (!isIncorrectPredCheckPassed) - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for incorrectly uni-predicted L1 blocks"); - } - - if (isCorrectPredCheckPassed && isIncorrectPredCheckPassed) - { - std::cout << "MVs[Uni, L1] test passed" << std::endl; - } -} - -void Verifier::CheckBiMVs(Thresholds threshold) -{ - if (m_InputParams.m_TestType & GENERATE_PREDICTION) - { - CheckBiMVsPerMVPIndex(threshold); - } - else - { - std::cout << "Correct bi-predicted (Bi) MVs " << MV_CMP_BLOCK_SIZE << "x" - << MV_CMP_BLOCK_SIZE << " compare blocks: " - << m_Counters.m_correctMVCmpBlocksBi << '/' << m_Counters.m_totalMVCmpBlocksBi << " ("; - - bool isOverallPassed = CheckLowerThreshold(m_Counters.m_correctMVCmpBlocksBi, - m_Counters.m_totalMVCmpBlocksBi, threshold.mvThres); - - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (isOverallPassed) - { - std::cout << "MVs[Bi] test passed" << std::endl; - } - else - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for bi-predicted blocks"); - } - } - - // Won't affect test result - std::cout << std::endl << "Bi MVs with correct L0 and incorrect L1: " - << m_Counters.m_correctMVsL0FromBiMVCmpBlocks << std::endl; - std::cout << "Bi MVs with correct L1 and incorrect L0: " - << m_Counters.m_correctMVsL1FromBiMVCmpBlocks << std::endl; -} - -void Verifier::CheckBiMVsPerMVPIndex(Thresholds threshold) -{ - bool isIncorrectPredCheckPassed = true; - bool isCorrectPredCheckPassed = true; - - mfxU32 expectedCorrectTotal = 0; - mfxU32 expectedCorrectCount = 0; - mfxU32 expectedIncorrectTotal = 0; - mfxU32 expectedIncorrectCount = 0; - - std::cout << std::endl; - - for (mfxU32 mvpIndex = 0; mvpIndex < MVP_PER_16x16_BLOCK; mvpIndex++) - { - std::cout << "MVP index: " << mvpIndex << " Correct bi-predicted (Bi) MVs " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks: " - << m_Counters.m_correctMVCmpBlocksBiPerMVPIndex[mvpIndex] << '/' - << m_Counters.m_totalMVCmpBlocksBiPerMVPIndex[mvpIndex] << " ("; - PrintPercentRatio(m_Counters.m_correctMVCmpBlocksBiPerMVPIndex[mvpIndex], - m_Counters.m_totalMVCmpBlocksBiPerMVPIndex[mvpIndex]); - std::cout << ")" << std::endl; - - if (mvpIndex / m_InputParams.m_NumMVPredictors) - { - expectedIncorrectTotal += m_Counters.m_totalMVCmpBlocksBiPerMVPIndex[mvpIndex]; - expectedIncorrectCount += (m_Counters.m_totalMVCmpBlocksBiPerMVPIndex[mvpIndex] - - m_Counters.m_correctMVCmpBlocksBiPerMVPIndex[mvpIndex]); - } - else - { - expectedCorrectTotal += m_Counters.m_totalMVCmpBlocksBiPerMVPIndex[mvpIndex]; - expectedCorrectCount += m_Counters.m_correctMVCmpBlocksBiPerMVPIndex[mvpIndex]; - } - } - - std::cout << "Correctly bi-predicted (Bi) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks on enabled EMVP: " - << expectedCorrectCount << "/" << expectedCorrectTotal << " ("; - isCorrectPredCheckPassed = CheckLowerThreshold(expectedCorrectCount, - expectedCorrectTotal, threshold.mvThres); - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (!isCorrectPredCheckPassed) - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for correctly bi-predicted blocks"); - } - - std::cout << "Incorrectly bi-predicted (Bi) MV " - << MV_CMP_BLOCK_SIZE << "x" << MV_CMP_BLOCK_SIZE << " compare blocks on disabled EMVP: " - << expectedIncorrectCount << "/" << expectedIncorrectTotal << " ("; - isIncorrectPredCheckPassed = CheckLowerThreshold(expectedIncorrectCount, - expectedIncorrectTotal, threshold.mvThres); - std::cout << "); threshold: " << threshold.mvThres << '%' << std::endl; - - if (!isIncorrectPredCheckPassed) - { - m_errorMsgList.emplace_back("ERROR: Low MV pass-rate for incorrect bi-predicted blocks"); - } - - if (isCorrectPredCheckPassed && isIncorrectPredCheckPassed) - { - std::cout << "MVs[Bi] test passed" << std::endl; - } -} - -void Verifier::CheckSplits(Thresholds threshold) -{ - bool isStagePassed = true; - - std::cout << std::endl << "SPLIT TESTING (PU-based):"; - - std::cout << std::endl << "Total FEI CU partitions by size (for test CTUs):\n"; - m_Counters.m_testCUSizeMapFEI.PrintTable(); - std::cout << "Total FEI PU partitions by size (for test CTUs):\n"; - m_Counters.m_testPUSizeMapFEI.PrintTable(); - - std::cout << "Correct FEI CU partitions by size (actual/maximum):\n"; - m_Counters.m_testCUSizeMapASG.PrintTable(); - std::cout << "Correct FEI PU partitions by size (actual/maximum):\n"; - m_Counters.m_testPUSizeMapASG.PrintTable(); - - std::cout << "\nTotal partition counts: FEI CUs -- " << m_Counters.m_totalCUsFEI - << ", FEI PUs -- " << m_Counters.m_totalPUsFEI << ", ASG CUs -- " << m_Counters.m_totalCUsASG - << ", ASG PUs -- " << m_Counters.m_totalPUsASG << std::endl; - - std::cout << "Correct partition counts: CUs -- " << m_Counters.m_correctCUs - << '/' << m_Counters.m_totalCUsASG << "("; - - CheckLowerThreshold(m_Counters.m_correctCUs, m_Counters.m_totalCUsASG); - - std::cout << "), PUs -- " << m_Counters.m_correctPUs << '/' << m_Counters.m_totalPUsASG - << "("; - - isStagePassed = CheckLowerThreshold(m_Counters.m_correctPUs, m_Counters.m_totalPUsASG, threshold.splitThres); - - std::cout << "); PU threshold: " << threshold.splitThres << '%' << std::endl; - - if (isStagePassed) - { - std::cout << "Split test passed" << std::endl; - } - else - { - m_errorMsgList.emplace_back("ERROR: Low pass-rate for splits"); - } -} - -void Verifier::CheckPicStruct() -{ - if (m_Counters.m_totalPics == m_Counters.m_correctRecords) - { - std::cout << "Picture Structure test passed" << std::endl; - } - else - { - m_errorMsgList.emplace_back("ERROR: Picture Structure test failed"); - } -} - -#endif // MFX_VERSION diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/CMakeLists.txt b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/CMakeLists.txt deleted file mode 100644 index e082b94..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include_directories ( - ${CMAKE_CURRENT_SOURCE_DIR}/include -) - -file( GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" ) - -set( defs " -DMFX_VERSION_USE_LATEST " ) - -make_library( bs_parser_hevc_static none static ) -set( defs "" ) diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.def b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.def deleted file mode 100644 index 270a163..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.def +++ /dev/null @@ -1,13 +0,0 @@ -LIBRARY "bs_parser_hevc" -EXPORTS - BS_HEVC2_Init - BS_HEVC2_OpenFile - BS_HEVC2_SetBuffer - BS_HEVC2_ParseNextAU - BS_HEVC2_Close - BS_HEVC2_SetTraceLevel - BS_HEVC2_Lock - BS_HEVC2_Unlock - BS_HEVC2_GetOffset - BS_HEVC2_Sync - BS_HEVC2_GetAsyncDepth \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj deleted file mode 100644 index 0a13c8d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {6A44B0B8-2D21-4D64-9F0A-D73A2BBB3103} - Win32Proj - 10.0.17134.0 - - - - DynamicLibrary - true - v141 - - - DynamicLibrary - false - v141 - - - DynamicLibrary - true - v141 - - - DynamicLibrary - false - v141 - Unicode - true - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(Configuration)\$(ProjectName)\ - - - true - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(Configuration)\$(ProjectName)\ - - - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(Configuration)\$(ProjectName)\ - .dll - false - false - - - $(ProjectDir)..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(Configuration)\$(ProjectName)\ - .dll - - - - WIN32;_DEBUG;_WINDOWS;_USRDLL;BS_PARSER_HEVC_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - ./include;%(AdditionalIncludeDirectories) - false - Guard - true - - - MachineX86 - true - Windows - bs_parser_hevc.def - $(OutDir)../lib/$(ProjectName).lib - - - - - _WIN32;WIN632;NDEBUG;_WINDOWS;_USRDLL;BS_PARSER_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - Level3 - ProgramDatabase - ./include;%(AdditionalIncludeDirectories) - Speed - true - true - Cdecl - - - MachineX86 - true - Windows - true - true - bs_parser_hevc.def - $(OutDir)../lib/$(ProjectName).lib - - - - - ./include;%(AdditionalIncludeDirectories) - - - - - Level3 - true - Speed - _WIN64;WIN64;NDEBUG;_WINDOWS;_USRDLL;BS_PARSER_EXPORTS;%(PreprocessorDefinitions) - StdCall - - - Windows - true - true - UseFastLinkTimeCodeGeneration - $(OutDir)../lib/$(ProjectName).lib - bs_parser_hevc.def - - - - - ./include;%(AdditionalIncludeDirectories) - - - - - Level3 - ProgramDatabase - false - _WIN64;WIN64;_DEBUG;_WINDOWS;_USRDLL;BS_PARSER_EXPORTS;%(PreprocessorDefinitions) - true - Guard - - - bs_parser_hevc.def - $(OutDir)../lib/$(ProjectName).lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj.filters b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj.filters deleted file mode 100644 index ecd86ea..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/bs_parser_hevc.vcxproj.filters +++ /dev/null @@ -1,102 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_def.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_def.h deleted file mode 100644 index 50e8d28..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_def.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __BS_DEF_H -#define __BS_DEF_H - -//#undef __BS_TRACE__ -//#define __BS_TRACE__ - -typedef unsigned char byte; -typedef unsigned char Bs8u; -typedef unsigned short Bs16u; -typedef unsigned int Bs32u; - -typedef signed char Bs8s; -typedef signed short Bs16s; -typedef signed int Bs32s; - -#ifdef __GNUC__ - typedef unsigned long long Bs64u; - typedef signed long long Bs64s; -#else - typedef unsigned __int64 Bs64u; - typedef signed __int64 Bs64s; -#endif - - #if defined( _WIN32 ) || defined ( _WIN64 ) - #define __STDCALL __stdcall - #define __CDECL __cdecl - #define __INT64 __int64 - #define __UINT64 unsigned __int64 -#else - #define __STDCALL - #define __CDECL - #define __INT64 long long - #define __UINT64 unsigned long long -#endif - -typedef enum { - BS_ERR_NONE = 0, - BS_ERR_UNKNOWN = -1, - BS_ERR_WRONG_UNITS_ORDER = -2, - BS_ERR_MORE_DATA = -3, - BS_ERR_INVALID_PARAMS = -4, - BS_ERR_MEM_ALLOC = -5, - BS_ERR_NOT_IMPLEMENTED = -6, - BS_ERR_NOT_ENOUGH_BUFFER = -7, - BS_ERR_BAD_HANDLE = -8, - BS_ERR_INCOMPLETE_DATA = -9 -} BSErr; - -#define BS_MIN(x, y) ( ((x) < (y)) ? (x) : (y) ) -#define BS_MAX(x, y) ( ((x) > (y)) ? (x) : (y) ) -#define BS_ABS(x) ( ((x) > 0) ? (x) : (-(x)) ) - -#endif //__BS_DEF_H diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_mem+.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_mem+.h deleted file mode 100644 index 470096a..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_mem+.h +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once -#include -#include -#include -#include -#include - -//#define BS_MEM_TRACE - -#ifdef BS_MEM_TRACE -#include -#endif - -namespace BS_MEM -{ - -class MemBase -{ -public: - virtual void* Get() = 0; - virtual ~MemBase(){} -}; - -template class MemObj : public MemBase -{ -public: - T* m_obj; - bool m_del; - - MemObj(unsigned int count, bool zero) - { - if (zero) - m_obj = new T[count]{}; // array value-initialization - else - m_obj = new T[count]; - m_del = true; - } - - MemObj(T* obj) - : m_obj(obj) - , m_del(false) - {} - - MemObj(const MemObj&) = delete; - MemObj& operator=(const MemObj&) = delete; - - virtual ~MemObj() - { - if (m_del) - delete[] m_obj; - } - - void* Get() { return m_obj; } -}; - -class MemD -{ -public: - MemD() - : locked(0) - , to_delete(false) - , mem(nullptr) - { - } - - ~MemD() - { - if (mem) - delete mem; - } - - unsigned int locked; - bool to_delete; - std::set base; - std::set dep; - MemBase* mem; -}; - -class Allocator -{ -private: - std::map m_mem; - std::recursive_mutex m_mtx; - bool m_zero; - - inline bool Touch(void* p) { return !!m_mem.count(p); } - inline void __notrace(const char*, ...) {} - -#ifdef BS_MEM_TRACE -#define BS_MEM_TRACE_F printf -#else -#define BS_MEM_TRACE_F __notrace -#endif - -public: - - Allocator() - : m_zero(false) - { - } - - ~Allocator() - { - } - - void SetZero(bool zero) - { - std::unique_lock _lock(m_mtx); - m_zero = zero; - } - - bool touch(void* p) - { - std::unique_lock _lock(m_mtx); - BS_MEM_TRACE_F("BS_MEM::touch(%p)\n", p); - return Touch(p); - } - - void bound(void* dep, void* base) - { - std::unique_lock _lock(m_mtx); - BS_MEM_TRACE_F("BS_MEM::bound(%p, %p)\n", dep, base); - - if (!Touch(base) || !Touch(dep)) - throw std::bad_alloc(); - - m_mem[base].dep.insert(dep); - m_mem[dep].base.insert(base); - } - - template T* alloc(void* base = nullptr, unsigned int count = 1) - { - if (count == 0) - return nullptr; - - std::unique_lock _lock(m_mtx); - - MemBase* pObj = new MemObj(count, m_zero); - T* p = (T*)pObj->Get(); - - m_mem[p].mem = pObj; - - BS_MEM_TRACE_F("BS_MEM::alloc(%p, %d) = %p\n", base, count, p); - if (base) - bound(p, base); - - return p; - } - - template T* alloc_nozero(void* base = nullptr, unsigned int count = 1) - { - if (count == 0) - return nullptr; - - std::unique_lock _lock(m_mtx); - - MemBase* pObj = new MemObj(count, false); - T* p = (T*)pObj->Get(); - - m_mem[p].mem = pObj; - - BS_MEM_TRACE_F("BS_MEM::alloc_nozero(%p, %d) = %p\n", base, count, p); - if (base) - bound(p, base); - - return p; - } - - void free(void* p) - { - std::unique_lock _lock(m_mtx); - BS_MEM_TRACE_F("BS_MEM::free(%p)", p); - - if (!Touch(p)) - throw std::bad_alloc(); - - auto& d = m_mem[p]; - - if (d.locked) - { - BS_MEM_TRACE_F(" - delayed\n", p); - d.to_delete = true; - return; - } - - if (!d.base.empty()) - { - BS_MEM_TRACE_F(" - delayed\n", p); - return; - } - - BS_MEM_TRACE_F(" - done\n", p); - - for (auto& pdep : d.dep) - { - auto& ddep = m_mem[pdep]; - - ddep.base.erase(p); - - if (ddep.base.empty()) - free(pdep); - } - - m_mem.erase(p); - } - - void lock(void* p) - { - std::unique_lock _lock(m_mtx); - BS_MEM_TRACE_F("BS_MEM::lock(%p)\n", p); - - if (!Touch(p)) - throw std::bad_alloc(); - - m_mem[p].locked++; - } - - void unlock(void* p) - { - BS_MEM_TRACE_F("BS_MEM::unlock(%p)\n", p); - - if (!p) - return; - - std::unique_lock _lock(m_mtx); - - if (!Touch(p)) - throw std::bad_alloc(); - - auto& d = m_mem[p]; - - if (!m_mem[p].locked) - throw std::bad_alloc(); - - d.locked--; - - if (d.to_delete) - free(p); - } -#undef BS_MEM_TRACE_F -}; - -class AutoLock -{ -public: - Allocator* m_pAllocator; - std::list m_ptr; - - AutoLock(Allocator* pAllocator, void* ptr = 0) - : m_pAllocator(pAllocator) - { - if (m_pAllocator && ptr) - { - m_pAllocator->lock(ptr); - m_ptr.push_back(ptr); - } - } - - ~AutoLock() - { - if (m_pAllocator) - { - for (auto p : m_ptr) - m_pAllocator->unlock(p); - } - } - - void Add(void* p) - { - if (m_pAllocator) - { - m_pAllocator->lock(p); - m_ptr.push_back(p); - } - else - throw std::bad_alloc(); - } -}; - -}; diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser++.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser++.h deleted file mode 100644 index 825cf57..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser++.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __BS_PARSER_PP_H -#define __BS_PARSER_PP_H - -#include -#include - -class BS_parser{ -public: - BS_parser(){}; - virtual BSErr open(const char* file) = 0; - virtual BSErr set_buffer(byte* buf, Bs32u buf_size) = 0; - virtual BSErr parse_next_unit() = 0; - virtual BSErr reset() = 0; - virtual BSErr lock (void* p) = 0; - virtual BSErr unlock(void* p) = 0; - virtual void* get_header() = 0; - virtual void* get_handle() = 0; - virtual Bs64u get_offset() = 0; - virtual void set_trace_level(Bs32u level) = 0; - virtual BSErr sync(void* p) { (void) p; return BS_ERR_NONE; }; - virtual Bs16u async_depth() { return 0; } - virtual ~BS_parser(){}; -}; - -class BS_HEVC2_parser : public BS_parser{ -public: - typedef BS_HEVC2::NALU UnitType; - - BS_HEVC2_parser(Bs32u mode = 0) - { - BS_HEVC2_Init(hdl, mode); - hdr = 0; - }; - - BS_HEVC2_parser(BS_HEVC2_parser const&) = delete; - BS_HEVC2_parser& operator=(BS_HEVC2_parser const&) = delete; - - ~BS_HEVC2_parser() { BS_HEVC2_Close(hdl); }; - - BSErr parse_next_au(UnitType*& pAU) { return BS_HEVC2_ParseNextAU(hdl, pAU); }; - BSErr parse_next_unit() { return BS_HEVC2_ParseNextAU(hdl, hdr); }; - BSErr open(const char* file) { return BS_HEVC2_OpenFile(hdl, file); }; - BSErr set_buffer(byte* buf, Bs32u buf_size) { return BS_HEVC2_SetBuffer(hdl, buf, buf_size); }; - BSErr lock(void* p) { return BS_HEVC2_Lock(hdl, p); }; - BSErr unlock(void* p) { return BS_HEVC2_Unlock(hdl, p); }; - BSErr sync(void* p) { return BS_HEVC2_Sync(hdl, (BS_HEVC2::NALU*)p); }; - Bs16u async_depth() { return BS_HEVC2_GetAsyncDepth(hdl); } - - void set_trace_level(Bs32u level) { BS_HEVC2_SetTraceLevel(hdl, level); }; - void* get_header() { return hdr; }; - void* get_handle() { return hdl; }; - Bs64u get_offset() { - Bs64u offset = -1; - BS_HEVC2_GetOffset(hdl, offset); - return offset; - }; - - BSErr reset() - { - BS_HEVC2_Close(hdl); - hdr = 0; - return BS_HEVC2_Init(hdl, 0); - }; -private: - BS_HEVC2::HDL hdl; - UnitType* hdr; -}; - - -#endif //__BS_PARSER_PP_H diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser.h deleted file mode 100644 index a03f599..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_parser.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __BS_PARSER_H -#define __BS_PARSER_H - -#include - -extern "C"{ - - BSErr __STDCALL BS_HEVC2_Init (BS_HEVC2::HDL& hdl, Bs32u mode); - BSErr __STDCALL BS_HEVC2_OpenFile (BS_HEVC2::HDL hdl, const char* file); - BSErr __STDCALL BS_HEVC2_SetBuffer (BS_HEVC2::HDL hdl, byte* buf, Bs32u buf_size); - BSErr __STDCALL BS_HEVC2_ParseNextAU (BS_HEVC2::HDL hdl, BS_HEVC2::NALU*& pAU); - BSErr __STDCALL BS_HEVC2_Close (BS_HEVC2::HDL hdl); - BSErr __STDCALL BS_HEVC2_SetTraceLevel (BS_HEVC2::HDL hdl, Bs32u level); - BSErr __STDCALL BS_HEVC2_Lock (BS_HEVC2::HDL hdl, void* p); - BSErr __STDCALL BS_HEVC2_Unlock (BS_HEVC2::HDL hdl, void* p); - BSErr __STDCALL BS_HEVC2_GetOffset (BS_HEVC2::HDL hdl, Bs64u& offset); - BSErr __STDCALL BS_HEVC2_Sync (BS_HEVC2::HDL hdl, BS_HEVC2::NALU* slice); - Bs16u __STDCALL BS_HEVC2_GetAsyncDepth (BS_HEVC2::HDL hdl); - -} - - -#endif //__BS_PARSER_H diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader.h deleted file mode 100644 index 0054d5e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader.h +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __BS_READER_H -#define __BS_READER_H - -#include -#include -#include -#include -#include - -#define BS_BUF_SIZE 2048 -#if defined(__APPLE__) || defined(LINUX32) || defined(LINUX64) || defined(ANDROID) - #define BS_FILE_MODE 0 /* no fteelo64 on OSX */ -#else - #define BS_FILE_MODE 1 -#endif - -#if (BS_FILE_MODE == 1) - #define BS_FADDR_TYPE Bs64u - #define BS_FOFFSET_TYPE Bs64s - #define BS_TRACE_FORMAT "0x%016I64X[%i]: %s = %i\n" - #define BS_TRACE_OFFSET_FORMAT "0x%016I64X[%i]: " - #ifdef __GNUC__ - #define _FILE_OFFSET_BITS 64 - #define BS_FTELL(fh) ftello64(fh) - #define BS_FSEEK(fh,offset,origin) fseeko64( fh, offset, origin ) - #else - #include - #include - #include - #define BS_FH_TYPE int - #define BS_FOPEN(file, fh) { int tmp_fh = 0; if(!_sopen_s(&tmp_fh, file_name, _O_BINARY|_O_RDONLY, _SH_DENYNO, 0))fh = tmp_fh;} - #define BS_FCLOSE(fh) _close(fh) - #define BS_FTELL(fh) _telli64(fh) - #define BS_FEOF(fh) _eof(fh) - #define BS_FREAD(fh,dst,size) _read(fh, dst, size) - #define BS_FSEEK(fh,offset,origin) _lseeki64( fh, offset, origin ) - #endif -#endif -#if (BS_FILE_MODE == 0) || defined(__GNUC__) - #if (BS_FILE_MODE == 0) - #define BS_FADDR_TYPE Bs32u - #define BS_FOFFSET_TYPE Bs32s - #define BS_TRACE_FORMAT "0x%08X[%i]: %s = %i\n" - #define BS_TRACE_OFFSET_FORMAT "0x%08X[%i]: " - #define BS_FTELL(fh) ftell(fh) - #define BS_FSEEK(fh,offset,origin) fseek( fh, offset, origin ) - #endif - #define BS_FH_TYPE FILE* - #define BS_FOPEN(file, fh) {fh = fopen( file_name, "rb" );} - #define BS_FCLOSE(fh) fclose(fh) - #define BS_FEOF(fh) feof(fh) - #define BS_FREAD(fh,dst,size) fread( dst, 1, size, fh ) -#endif - -#ifdef __BS_TRACE__ - #define BS_TRACE( val, comment ) { \ - if(trace_flag) {printf( BS_TRACE_FORMAT, file_pos+offset, bit, #comment, (int)(val) ); fflush(stdout);}\ - else (val); \ - if(last_err) return last_err; \ - } - #define BS_SET( val, var ) { \ - if(trace_flag){ printf( BS_TRACE_FORMAT, file_pos+offset, bit, #var, (int)((var) = (val)) ); fflush(stdout);} \ - else (var) = (val); \ - if(last_err) return last_err; \ - } - #define BS_GET_BITS( n, var ) { \ - (var) = (tmp_buf)>>(32-(n)); tmp_buf <<= (n);\ - if(trace_flag) printf( BS_TRACE_FORMAT, file_pos+offset, bit, #var, (var) ); \ - } - #define BS_TRACE_BITS( n, var ) { \ - if(trace_flag) printf( BS_TRACE_FORMAT, file_pos+offset, bit, #var, ((tmp_buf)>>(32-(n))) ); \ - tmp_buf <<= n;\ - } - #define BS_TROX( x, b ) if(trace_flag) printf(BS_TRACE_OFFSET_FORMAT, (unsigned int)(x), (b)); - #define BS_TRO if(trace_flag) printf(BS_TRACE_OFFSET_FORMAT,file_pos+offset, bit); - #define BS_SETM( val, var, map ) {\ - if(trace_flag) {BS_TRO; (var) = (val); printf("%s = %s (%d)\n", #var, map[var], var);}\ - else (var) = (val);\ - if(last_err) return last_err; \ - } - #define BS_TRACE_ARR(name, el, sz) \ - if(trace_flag){\ - printf("%s = { ", #name);\ - for(Bs32u _idx = 0; _idx < (Bs32u)(sz); _idx++ ) {\ - printf("%d ", (el));\ - }\ - printf("}\n");\ - } else for(Bs32u _idx = 0; _idx < (Bs32u)(sz); _idx++ ) { (el); } - #define BS_TRACE_NO_OFFSET( val, comment ) { \ - if(trace_flag) printf( "%s = %d\n", #comment, (val) ); \ - else (val); \ - if(last_err) return last_err; \ - } - #define BS_TRACE_STR( str ) { if(trace_flag) printf( "%s\n", str ); } -#else - #define BS_TRACE( val, comment ) { (val); if(last_err) return last_err; } - #define BS_SET( val, var ) { (var) = (val); if(last_err) return last_err; } - #define BS_GET_BITS( n, var ) { (var) = (tmp_buf)>>(32-(n)); tmp_buf <<= (n);} - #define BS_TRACE_BITS( n, var ) { tmp_buf <<= (n); } - #define BS_TROX( x, b ) { (x); (b); }; - #define BS_TRO {} - #define BS_SETM( val, var, map ) BS_SET( val, var ) - #define BS_TRACE_ARR(name, el, sz)for(Bs32u _idx = 0; _idx < (Bs32u)(sz); _idx++ ) { (el); } - #define BS_TRACE_NO_OFFSET( val, comment ) BS_TRACE( val, comment ) - #define BS_TRACE_STR( str ) {} -#endif - -#define BS_STRUCT_ALLOC( type, var ){ \ - var = (type*)malloc( sizeof(type) ); \ - if(var){ \ - memset( var, 0, sizeof(type) ); \ - }else{ \ - return last_err = BS_ERR_MEM_ALLOC; \ - }; \ - /*printf("BS_STRUCT_ALLOC:\t0x%p ( %i ) \t %s : %i\n", var, sizeof(type), __FILE__, __LINE__ );*/\ -} -#define BS_CALLOC( type, size, var ){ \ - var = (type*)calloc( (size), sizeof(type) ); \ - if(!var) return last_err = BS_ERR_MEM_ALLOC; \ - /*printf("BS_CALLOC:\t\t0x%p ( %i * %i ) \t %s : %i\n", var, sizeof(type), (size), __FILE__, __LINE__ );*/\ -} -#define BS_FREE(p) {if(p){ free(p); p = NULL;}} -#define BSCE if(last_err) return last_err; - -class BS_Reader{ -public: - BS_Reader(){ - last_err = BS_ERR_NONE; - bs = NULL; - buf_size = 0; - file_pos = 0; - offset = 0; - bit = 0; - buf = NULL; - ignore_bytes = (BS_FADDR_TYPE*)malloc(sizeof(BS_FADDR_TYPE)); - ignore_bytes_cnt = 0; - next_ignored_byte = NULL; - tmp_buf = 0; - trace_flag = true; - trace_level = 0xFFFFFFFF; - } - - BS_Reader(BS_Reader const&) = delete; - BS_Reader& operator=(BS_Reader const&) = delete; - - virtual ~BS_Reader(){ - if( bs && buf ) free( buf ); - close(); - if( ignore_bytes ) free(ignore_bytes); - } - - BSErr open( const char* file_name ); - void set_buffer( byte* buf, Bs32u buf_size ); - - inline BSErr get_last_err(){ return last_err; }; - inline BS_FADDR_TYPE get_cur_pos() { return file_pos+offset; }; - inline BSErr close(){ - last_err = (bs) ? ( BS_FCLOSE(bs) ? BS_ERR_UNKNOWN : BS_ERR_NONE ) : BS_ERR_NONE; - if(!last_err) bs = 0; - return last_err; - }; - inline void set_trace_level(Bs32u level) {trace_level = level;}; - -protected: - Bs32u buf_size; - Bs32u offset; - byte bit; - BS_FADDR_TYPE file_pos; - BSErr last_err; - - Bs32u tmp_buf; - bool trace_flag; - Bs32u trace_level; - - inline void trace_on(Bs32u level) {trace_flag = !!(trace_level & level);}; - inline void trace_off() {trace_flag = (trace_level == 0xFFFFFFFF);}; - - Bs32u ue_v(); - Bs32s se_v(); - Bs32u read_bits( Bs32u nBits /*1..32*/ ); - Bs32u next_bits( Bs32u nBits /*1..32*/ ); // keep current position - Bs32u next_bytes( byte nBytes /*1..4*/ ); - byte read_1_bit(); - byte read_1_byte(); - BSErr read_arr(byte* arr, Bs32u size); - - void skip_bytes( Bs32u nBytes ); - void ignore_next_byte(); - BSErr shift(long nBytes); - BSErr shift_forward( Bs32u nBytes ); - BSErr shift_back( Bs32u nBytes ); - - inline BSErr shift_forward64(Bs64u nBytes){ - while(nBytes){ - Bs32u n = (Bs32u)BS_MIN(nBytes,0xFFFFFFFF); - shift_forward(n);BSCE; - nBytes -= n; - } - return last_err; - }; - - inline bool byte_aligned() { return bit ? false : true; }; - inline void skip_byte() { shift_forward(1); }; - inline void set_first_ignored_byte() { next_ignored_byte = &ignore_bytes[0]; }; - inline void wipe_ignore_bytes() { ignore_bytes_cnt = 0; next_ignored_byte = NULL; }; - Bs32u get_num_ignored_bytes(BS_FADDR_TYPE end){ - Bs32u n = 0; - BS_FADDR_TYPE* b = next_ignored_byte; - Bs32u c = 0; - - while(c < ignore_bytes_cnt && b[c++] < end++) - n++; - - return n; - } - -private: - BS_FH_TYPE bs; //file handle - byte* buf; - BS_FADDR_TYPE* ignore_bytes; - BS_FADDR_TYPE* next_ignored_byte; - Bs32u ignore_bytes_cnt; - - BSErr read_more_data(); - -}; -#endif //__BS_READER_H diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader2.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader2.h deleted file mode 100644 index 05f16bf..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_reader2.h +++ /dev/null @@ -1,418 +0,0 @@ -// Copyright (c) 2018-2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include "bs_def.h" -#include -#include -#include -#include - -namespace BsReader2 -{ - -class Exception : public std::exception -{ -private: - BSErr m_sts; -public: - Exception(BSErr sts) - : std::exception() - , m_sts(sts) - { /*assert(!"Error in bs_parser!");*/ } - inline BSErr Err() { return m_sts; } -}; - -class EndOfBuffer : public Exception -{ -public: - EndOfBuffer() : Exception(BS_ERR_MORE_DATA) {} -}; - -class InvalidSyntax : public Exception -{ -public: - InvalidSyntax() : Exception(BS_ERR_UNKNOWN) { /*assert(!"invalid syntax!");*/ } -}; - -class BufferUpdater -{ -public: - virtual bool UpdateBuffer(Bs8u*& start, Bs8u*& cur, Bs8u*& end, Bs32u keepBytes) = 0; - virtual ~BufferUpdater() {}; -}; - -class File : public BufferUpdater -{ -private: - FILE* m_f; - std::vector m_b; - static const Bs32u DEFAULT_BUFF_SIZE = 2048; -public: - File(); - ~File(); - - bool Open(const char* file, Bs32u buffSize = DEFAULT_BUFF_SIZE); - void Close(); - bool UpdateBuffer(Bs8u*& start, Bs8u*& cur, Bs8u*& end, Bs32u keepBytes); -}; - -#ifdef __BS_TRACE__ - -#define BS2_TRO { if (TraceOffset()) fprintf(GetLog(), "0x%016llX[%i]: ", GetByteOffset(), GetBitOffset()); } - -#define BS2_SET(val, var) \ -{ \ - if (Trace()) { \ - BS2_TRO; \ - var = (val); \ - fprintf(GetLog(), std::is_same::value ? "%s = %lli\n" : "%s = %i\n", #var, var);\ - fflush(GetLog()); \ - } else { var = (val); } \ -} - -#define BS2_SETM(val, var, map) \ -{ \ - if (Trace()) { \ - BS2_TRO; \ - var = (val); \ - fprintf(GetLog(), "%s = %s(%d)\n", #var, map[var], var); \ - fflush(GetLog()); \ - } else { var = (val); } \ -} - -#define BS2_TRACE(val, var) \ -{ \ - if (Trace()) { \ - BS2_TRO; \ - fprintf(GetLog(), std::is_same::value ? "%s = %lli\n" : "%s = %i\n", #var, (val));\ - fflush(GetLog()); } \ - else { (val); } \ -} - -#define BS2_TRACE_STR(str)\ - { if (Trace()) { BS2_TRO; fprintf(GetLog(), "%s\n", (str)); fflush(GetLog());} } - -#define BS2_SET_ARR_F(val, var, sz, split, format) \ -{ \ - if (Trace()){ \ - BS2_TRO; \ - fprintf(GetLog(), "%s = { ", #var); \ - for (Bs32u _i = 0; _i < Bs32u(sz); _i++){ \ - if ((split) != 0 && _i % (split) == 0) \ - fprintf(GetLog(), "\n"); \ - (var)[_i] = (val); \ - fprintf(GetLog(), format, (var)[_i]); \ - } \ - fprintf(GetLog(), "}\n"); fflush(GetLog()); \ - } else { for (Bs32u _i = 0; _i < (sz); _i++) (var)[_i] = (val); } \ -} - -#define BS2_SET_ARR_M(val, var, sz, split, format, map) \ -{ \ - if (Trace()){ \ - BS2_TRO; \ - fprintf(GetLog(), "%s = { ", #var); \ - for (Bs32u _i = 0; _i < Bs32u(sz); _i++) { \ - if ((split) != 0 && _i % (split) == 0) \ - fprintf(GetLog(), "\n"); \ - (var)[_i] = (val); \ - fprintf(GetLog(), format, map[(var)[_i]], (var)[_i]);\ - } \ - fprintf(GetLog(), "}\n"); fflush(GetLog()); \ - } \ - else { for (Bs32u _i = 0; _i < (sz); _i++) (var)[_i] = (val); } \ -} - -#define BS2_TRACE_ARR_VF(val, var, sz, split, format) \ -{ \ - if (Trace()){ \ - BS2_TRO; \ - fprintf(GetLog(), "%s = { ", #var); \ - for (Bs32u _i = 0; _i < Bs32u(sz); _i++) { \ - if ((split) != 0&& _i % (split) == 0) \ - fprintf(GetLog(), "\n"); \ - fprintf(GetLog(), format, (val)); \ - } \ - fprintf(GetLog(), "}\n"); fflush(GetLog());\ - } \ - else { for (Bs32u _i = 0; _i < (sz); _i++) (val); }\ -} - -#define BS2_TRACE_MDARR(type, arr, dim, split, split2, format)\ -{ \ - if (Trace()){ \ - BS2_TRO; \ - fprintf(GetLog(), "%s = \n", #arr); \ - traceMDArr\ - (arr, dim, split, format, split2); \ - fflush(GetLog()); \ - } \ -} - -#define BS2_TRACE_BIN(pval, off, sz, var) \ -{ \ - if (Trace()) { \ - BS2_TRO; \ - fprintf(GetLog(), "%s = ", #var);\ - traceBin(pval, off, sz); \ - fprintf(GetLog(), "\n"); \ - fflush(GetLog()); \ - } \ - else { (pval); } \ -} - -#else - -#define BS2_TRO -#define BS2_SET(val, var) { var = (val); } -#define BS2_TRACE(val, var) {(void)(val);} -#define BS2_TRACE_STR(str) {(void)(str);} -#define BS2_SET_ARR_F(val, var, sz, split, format) \ - { for (Bs32u _i = 0; _i < (Bs32u)(sz); _i++) (var)[_i] = (val); } -#define BS2_TRACE_ARR_VF(val, var, sz, split, format) \ - { for (Bs32u _i = 0; _i < (Bs32u)(sz); _i++) (void)(val); } -#define BS2_TRACE_MDARR(type, arr, dim, split, split2, format) { (void)(arr);} -#define BS2_SET_ARR_M(val, var, sz, split, format, map) BS2_SET_ARR_F(val, var, sz, split, format) -#define BS2_SETM(val, var, map) BS2_SET(val, var) -#define BS2_TRACE_BIN(pval, off, sz, var) { (void)(pval); } - -#endif - -#define BS2_SET_ARR(val, var, sz, split) BS2_SET_ARR_F(val, var, sz, split, "%i ") -#define BS2_TRACE_ARR_F(var, sz, split, format) BS2_TRACE_ARR_VF(var[_i], var, sz, split, format) -#define BS2_TRACE_ARR(var, sz, split) BS2_TRACE_ARR_F(var, sz, split, "%i ") - -struct State -{ - BufferUpdater* m_updater; - Bs8u* m_bsStart; - Bs8u* m_bsEnd; - Bs8u* m_bs; - Bs8u m_bitStart; - Bs8u m_bitOffset; - bool m_emulation; - Bs32u m_emuBytes; - Bs64u m_startOffset; - bool m_trace; - bool m_traceOffset; - Bs32u m_traceLevel; - FILE* m_log; -}; - -class Reader : private State -{ -public: - Reader(); - ~Reader(); - - Bs32u GetBit(); - Bs32u GetBits(Bs32u n); - void GetBits(void* b, Bs32u o, Bs32u n); - Bs32u GetUE(); - Bs32s GetSE(); - Bs32u GetByte(); // ignore bit offset - Bs32u GetBytes(Bs32u n, bool nothrow = false); // ignore bit offset - - void ReturnByte(); - void ReturnBits(Bs32u n); - - bool NextStartCode(bool stopBefore); - - bool TrailingBits(bool stopBefore = false); - bool NextBytes(Bs8u* b, Bs32u n); - - inline Bs32u NextBits(Bs32u n) - { - Bs32u b = GetBits(n); - ReturnBits(n); - return b; - } - - Bs32u ExtractRBSP(Bs8u* buf, Bs32u size); - Bs32u ExtractData(Bs8u* buf, Bs32u size); - - inline Bs64u GetByteOffset() { return m_startOffset + (m_bs - m_bsStart); } - inline Bs16u GetBitOffset() { return m_bitOffset; } - - inline void SetEmulation(bool f) { m_emulation = f; }; - inline bool GetEmulation() { return m_emulation; }; - - inline void SetEmuBytes(Bs32u f) { m_emuBytes = f; }; - inline Bs32u GetEmuBytes() { return m_emuBytes; }; - - void Reset(Bs8u* bs = 0, Bs32u size = 0, Bs8u bitOffset = 0); - void Reset(BufferUpdater* reader) { m_updater = reader; m_bsEnd = 0; m_startOffset = 0; } - - void SaveState(State& st){ st = *this; }; - void LoadState(State& st){ *(State*)this = st; }; - -#ifdef __BS_TRACE__ - inline bool Trace() { return m_trace; } - inline bool TraceOffset() { return m_traceOffset; } - inline void TLStart(Bs32u level) { m_trace = !!(m_traceLevel & level); m_tln++; m_tla |= (Bs64u(m_trace) << m_tln); }; - inline void TLEnd() { m_tla &= ~(Bs64u(1) << m_tln); m_tln--; m_trace = !!(1 & (m_tla >> m_tln)); }; - inline bool TLTest(Bs32u tl) { return !!(m_traceLevel & tl); } - inline void SetTraceLevel(Bs32u level) { m_traceLevel = level; m_traceOffset = !!(level & 0x80000000); }; -#else - inline bool Trace() { return false; } - inline bool TraceOffset() { return false; } - inline void TLStart(Bs32u /*level*/) { }; - inline void TLEnd() {}; - inline bool TLTest(Bs32u /*tl*/) { return false; } - inline void SetTraceLevel(Bs32u /*level*/) { }; -#endif - - inline FILE* GetLog() { return m_log; } - inline void SetLog(FILE* log) { m_log = log; } - - template void traceMDArr( - const void* arr, - const Bs16u* sz, - Bs16u split, - const char* format, - Bs16u split2 = 0) - { - Bs16u off[depth]; - for (Bs32u i = 0; i < depth; i++) - { - off[i] = 1; - for (Bs32u j = i + 1; j < depth; j++) - off[i] *= sz[j]; - } - for (Bs32u i = 0, j = 0; i < Bs32u(off[0] * sz[0]); i++) - { - while (i % off[j] == 0) - { - fprintf(GetLog(), "{ "); - - if (j < (split)) - { - fprintf(GetLog(), "\n"); - for (Bs32u c = 0; c <= j; c++) - fprintf(GetLog(), " "); - } - if (j == depth - 2) - break; - j++; - } - fprintf(GetLog(), format, ((const T*)arr)[i]); - if (split2 && (i + 1) % split2 == 0 - && (i + 1) / split2 > 0 - && (i + 1) % off[j] != 0) - { - fprintf(GetLog(), "\n"); - for (Bs32u c = 0; c <= j; c++) - fprintf(GetLog(), " "); - } - while ((i + 1) % off[j] == 0) - { - bool f = j ? (i + 1) % off[--j] == 0 : !!j--; - fprintf(GetLog(), "} "); - if (j < (split)) - { - fprintf(GetLog(), "\n"); - for (Bs32u c = 0; c + f <= j; c++) - fprintf(GetLog(), " "); - } - if (!f) - { - j++; - break; - } - } - } - fprintf(GetLog(), "\n"); - } - - template void traceBin(T* p, Bs32u off, Bs32u sz) - { - Bs32u S0 = sizeof(T) * 8; - Bs32u O = off; - T* P0 = p; - - if (off + sz > BS_MAX(S0, 32)) - { - fprintf(GetLog(), "\n"); - - for (Bs32u i = 0; i < off; i++) - fprintf(GetLog(), " "); - } - - while (sz) - { - Bs32u S = S0 - O; - Bs32u S1 = S0 - (O + BS_MIN(sz, S)); - - sz -= (S - S1); - - while (S-- > S1) - fprintf(GetLog(), "%d", !!(*p & (1 << S))); - - p++; - O = 0; - - if (sz) - { - if ((p - P0) * S0 % 32 == 0) - fprintf(GetLog(), "\n"); - else - fprintf(GetLog(), " "); - } - } - } - -private: - Bs64u m_tla; - Bs32u m_tln; - - void MoreData(Bs32u keepBytes = 4); - bool MoreDataNoThrow(Bs32u keepBytes = 4); -}; - -class TLAuto -{ -private: - Reader& m_r; -public: - TLAuto(Reader& r, Bs32u tl) : m_r(r) { m_r.TLStart(tl); } - ~TLAuto() { m_r.TLEnd(); } -}; - -class StateSwitcher -{ -private: - State m_st; - Reader& m_r; -public: - StateSwitcher(Reader& r) - : m_r(r) - { - m_r.SaveState(m_st); - } - - ~StateSwitcher() - { - m_r.LoadState(m_st); - } -}; - -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_thread.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_thread.h deleted file mode 100644 index de1cd75..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/bs_thread.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once -#include -#include -#include -#include -#include -#include - -namespace BsThread -{ - -typedef enum -{ - DONE = 0 - , WORKING - , WAITING - , QUEUED - , LOST - , FAILED -} State; - -typedef State Routine(void*, unsigned int entryCnt); -typedef unsigned int SyncPoint; - -struct Task -{ - Routine* Execute; - void* param; - unsigned int id; - int priority; - unsigned int n; - std::list dependent; - unsigned int blocked; - bool detach; - State state; - std::mutex mtx; - std::condition_variable cv; -}; - -struct Thread -{ - std::mutex mtx; - std::condition_variable cv; - std::thread thread; - Task* task; - bool terminate; - unsigned int id; -}; - -inline bool Ready(State s) -{ - return (s == DONE || s == FAILED || s == LOST); -} - -// sync required -class TaskQueueOverflow : public std::exception -{ -public: - TaskQueueOverflow() {/*printf("TaskQueueOverflow\n"); fflush(stdout);*/} - ~TaskQueueOverflow() {} -}; - -class Scheduler -{ -private: - std::list m_thread; - std::list m_task; - std::recursive_mutex m_mtx; - std::condition_variable_any m_cv; - unsigned int m_id; - size_t m_depth; - unsigned int m_locked; - - static void Execute (Thread& self, Scheduler& sync); - static void Update (Scheduler& self, Thread* thread); - - void _AbortDependent(Task& task); - -public: - Scheduler(); - ~Scheduler(); - - void Init(unsigned int nThreads, unsigned int depth = 128); - void Close(); - - SyncPoint Submit (Routine* routine, void* par, int priority, unsigned int nDep, SyncPoint *dep); - State Sync (SyncPoint sp, unsigned int waitMS, bool keepStat = false); - bool Abort (SyncPoint sp, unsigned int waitMS); - - State AddDependency (SyncPoint task, unsigned int nDep, SyncPoint *dep); - void Detach (SyncPoint task); // no sync for this task - bool WaitForAny (unsigned int waitMS); -}; - -}; \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/common_cabac.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/common_cabac.h deleted file mode 100644 index 7c62a14..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/common_cabac.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include "bs_reader2.h" -#include "hevc_cabac.h" - -#define BS_AVC2_ADE_MODE 1 //0 - literal standard implementation, 1 - optimized(2-byte buffering affects SE offsets in trace) - -namespace COMMON_CABAC -{ - class ADE - { - private: - BsReader2::Reader& m_bs; - Bs64u m_bpos = 0; - bool m_pcm = false; -#if (BS_AVC2_ADE_MODE == 1) - Bs32u m_val = 0; - Bs32u m_range = 0; - Bs32s m_bits = 0; - - inline Bs32u B(Bs16u n) { m_bpos += n * 8; return m_bs.GetBytes(n, true); } -#else - Bs16u m_codIRange; - Bs16u m_codIOffset; - - inline Bs16u b(Bs16u n) { m_bpos += n; return m_bs.GetBits(n); } - inline Bs16u b() { m_bpos++; return m_bs.GetBit(); } -#endif - - public: - ADE(BsReader2::Reader& r) : m_bs(r) {} - ~ADE() {} - - inline void Init() - { - #if (BS_AVC2_ADE_MODE == 1) - m_val = B(3); - m_range = 510; - m_bits = 15; - - if (!m_pcm) - m_bpos = 15; - #else - m_codIRange = 510; - m_codIOffset = b(9); - - if (!m_pcm) - m_bpos = 0; - #endif - m_pcm = false; - } - - Bs8u DecodeDecision(Bs8u& ctxState); - Bs8u DecodeBypass(); - Bs8u DecodeTerminate(); - - #if (BS_AVC2_ADE_MODE == 1) - inline Bs16u GetR() { return Bs16u(m_range); } - inline Bs16u GetV() { return Bs16u((m_val >> (m_bits))); } - inline Bs64u BitCount() { return m_bpos - m_bits; } - inline void InitPCMBlock() { m_bs.ReturnBits(m_bits); m_bpos -= m_bits; m_bits = 0; m_pcm = true; } - #else - inline Bs16u GetR() { return m_codIRange; } - inline Bs16u GetV() { return m_codIOffset; } - inline Bs64u BitCount() { return m_bpos; } - inline void InitPCMBlock() { m_pcm = true; }; - #endif - - }; - -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_parser.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_parser.h deleted file mode 100644 index 3f9944d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_parser.h +++ /dev/null @@ -1,623 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include "bs_reader2.h" -#include "bs_mem+.h" -#include "bs_thread.h" -#include "hevc2_struct.h" -#include "common_cabac.h" -#include "hevc_cabac.h" -#include -#include -#include - -namespace BS_HEVC2 -{ - -template inline bool GetBit(T f, Bs32u i) -{ - return !!(f & (1 << (sizeof(T) * 8 - 1 - i))); -} - -template inline void SetBit(T& f, Bs32u i, bool b) -{ - T mask = (T(1) << (sizeof(T) * 8 - 1 - i)); - if (b) f |= mask; - else f &= ~mask; -} - -template Bs32u CntBits(T f, Bs32u n = 0) -{ - Bs32u c = 0, sz = sizeof(T) * 8; - - if (!n) - n = sz; - - f >>= (sz - n); - - while (n--) - { - c += (f & 1); - f >>= 1; - } - - return c; -} - -inline Bs32u CeilLog2(Bs32u x) { Bs32u l = 0; while (x > (1U << l)) l++; return l; } -#if 0 -inline Bs32u FloorLog2(Bs32u x) { Bs32u l = 0; while (x >>= 1) ++l; return l; } -#else -inline Bs32u CountOnes(Bs32u x) -{ - x -= ((x >> 1) & 0x55555555); - x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); - x = (((x >> 4) + x) & 0x0f0f0f0f); - x += (x >> 8); - x += (x >> 16); - return (x & 0x0000003f); -} -inline Bs32u FloorLog2(Bs32u x) -{ - x |= (x >> 1); - x |= (x >> 2); - x |= (x >> 4); - x |= (x >> 8); - x |= (x >> 16); - return (CountOnes(x) - 1); - //return CountOnes(x >> 1); -} -#endif -template inline T CeilDiv(T x, T y) { return (x + y - 1) / y; } - -inline bool isSlice(NALU& nalu) { - return (nalu.nal_unit_type <= CRA_NUT) - && ((nalu.nal_unit_type < RSV_VCL_N10) - || (nalu.nal_unit_type > RSV_VCL_R15)); -} -inline bool isIRAP(NALU& nalu) { - return ((nalu.nal_unit_type >= BLA_W_LP) && (nalu.nal_unit_type <= RSV_IRAP_VCL23)); -} - -inline bool isIDR(NALU& nalu) { - return ((nalu.nal_unit_type == IDR_W_RADL) || (nalu.nal_unit_type == IDR_N_LP)); -} - -inline bool isCRA(NALU& nalu) { - return (nalu.nal_unit_type == CRA_NUT); -} - -inline bool isRADL(NALU& nalu) { - return ((nalu.nal_unit_type == RADL_R) || (nalu.nal_unit_type == RADL_N)); -} - -inline bool isRASL(NALU& nalu) { - return ((nalu.nal_unit_type == RASL_R) || (nalu.nal_unit_type == RASL_N)); -} - -inline bool isBLA(NALU& nalu) { - return ((nalu.nal_unit_type == BLA_W_LP) - || (nalu.nal_unit_type == BLA_W_RADL) - || (nalu.nal_unit_type == BLA_N_LP)); -} - -class NoActiveSet : public BsReader2::Exception -{ -public: - NoActiveSet() : Exception(BS_ERR_WRONG_UNITS_ORDER) {} -}; - -struct NALUDesc -{ - NALU* p; - Bs32u NuhBytes; - bool complete; - bool prealloc; -}; - -struct PocInfo -{ - Bs32s Lsb; - Bs32s Msb; -}; - -extern const Bs8u ScanOrder1[4][2 * 2][2]; //[Up-right diagonal, Horizontal, Vertical, Traverse] -extern const Bs8u ScanOrder2[4][4 * 4][2]; //[Up-right diagonal, Horizontal, Vertical, Traverse] -extern const Bs8u ScanOrder3[4][8 * 8][2]; //[Up-right diagonal, Horizontal, Vertical, Traverse] -extern const Bs8u ScanTraverse4[16 * 16][2]; //(ScanOrder4[3]) -extern const Bs8u ScanTraverse5[32 * 32][2]; //(ScanOrder5[3]) -extern const Bs8u ScanPos1[4][2][2]; //[Up-right diagonal, Horizontal, Vertical, Traverse] -extern const Bs8u ScanPos2[4][4][4]; //[Up-right diagonal, Horizontal, Vertical, Traverse] -extern const Bs8u ScanPos3[4][8][8]; //[Up-right diagonal, Horizontal, Vertical, Traverse] - -class Info -{ -public: - Info() - { - m_prevPOC.Lsb = 0; - m_prevPOC.Msb = 0; - } - - void decodeSSH (NALU& nalu, bool bNewSequence); - void decodePOC (NALU& nalu); - void decodeRPL (NALU& nalu); - - bool NoRaslOutputFlag = false; - bool NoBackwardPredFlag = false; - bool NewPicture = false; - bool TwoVersionsOfCurrDecPicFlag = false; - Bs32s MaxPicOrderCntLsb = 0; - Bs16u MinCbLog2SizeY = 0; - Bs16u CtbLog2SizeY = 0; - Bs16u CtbSizeY = 0; - Bs16u PicWidthInCtbsY = 0; - Bs16u PicHeightInCtbsY = 0; - Bs16u MinCbSizeY = 0; - Bs16u PicWidthInMinCbsY = 0; - Bs16u PicHeightInMinCbsY = 0; - Bs32u PicSizeInMinCbsY = 0; - Bs32u PicSizeInCtbsY = 0; - Bs32u PicSizeInSamplesY = 0; - Bs16u PicWidthInSamplesC = 0; - Bs16u PicHeightInSamplesC = 0; - Bs16u MinTbLog2SizeY = 0; - Bs16u MaxTbLog2SizeY = 0; - Bs16u Log2MinIpcmCbSizeY = 0; - Bs16u Log2MaxIpcmCbSizeY = 0; - Bs16u Log2MinCuQpDeltaSize = 0; - Bs16u Log2ParMrgLevel = 0; - Bs16s SliceQpY = 0; - Bs16u BitDepthY = 0; - Bs16u BitDepthC = 0; - Bs16u ChromaArrayType = 0; - Bs16u Log2MinCuChromaQpOffsetSize = 0; - Bs16u SubWidthC = 0; - Bs16u SubHeightC = 0; - Bs16u CtbWidthC = 0; - Bs16u CtbHeightC = 0; - Bs32u RawCtuBits = 0; - Bs16s QpBdOffsetY = 0; - Bs16s QpBdOffsetC = 0; - Bs16u PaletteMaxPredictorSize = 0; - - Slice** ColPicSlices = nullptr; - Bs16u NumColSlices = 0; - std::vector colWidth; - std::vector rowHeight; - std::vector colBd; - std::vector rowBd; - std::vector CtbAddrRsToTs; - std::vector CtbAddrTsToRs; - std::vector TileId; - std::vector SliceAddrRsInTs; - std::vector CtuInRs; - - PocInfo m_prevPOC; - Bs32s m_prevSlicePOC = 0; - Slice* m_cSlice = nullptr; - std::map m_DPB; - std::map m_DPBafter; - std::vector m_MinTbAddrZs; - Bs32u m_MinTbAddrZsPitch = 0; - std::vector m_sao[3]; - - std::vector PalettePredictorEntryReuseFlags; - Bs16u PaletteIndexIdc[32 * 32] = {}; - bool CopyAboveIndicesFlag[32][32] = {}; - Bs16u PaletteIndexMap[32][32] = {}; - std::vector CurrentPaletteEntries[3]; - bool m_bRPLDecoded = false; - - inline Bs32s& MinTbAddrZs(Bs32u x, Bs32u y) { return m_MinTbAddrZs[y * m_MinTbAddrZsPitch + x]; } - inline SAO& GetSAO(Bs16u cIdx, Bs16u rx, Bs16u ry) { return m_sao[cIdx][ry * PicWidthInCtbsY + rx]; } - - bool AvailableZs(Bs16s xCurr, Bs16s yCurr, Bs16s xNbY, Bs16s yNbY); - bool AvailablePb(Bs16s xCb, Bs16s yCb, Bs16u nCbS, Bs16s xPb, Bs16s yPb, - Bs16s nPbW, Bs16s nPbH, Bs16u partIdx, Bs16s xNbY, Bs16s yNbY); - CU* GetCU(Bs16s x, Bs16s y); - PU* GetPU(Bs16s x, Bs16s y); - TU* GetTU(CU& cu, Bs16s x, Bs16s y); - Bs16s GetQpCb(Bs16s QpY, Bs16s CuQpOffsetCb); - Bs16s GetQpCr(Bs16s QpY, Bs16s CuQpOffsetCr); - void decodeMvLX(CU& cu, PU&pu, Bs16u X, Bs32s (&MvdLX)[2], Bs16u partIdx); - void decodeMvLX(CU& cu, PU&pu, Bs16u partIdx); - bool decodeMvLXCol(Bs16u xPb, Bs16u yPb, Bs16u nPbW, Bs16u nPbH, Bs16u X, Bs16u refIdxLX, Bs16s (&mvLXCol)[2]); -}; - -struct CabacCtx -{ - CabacCtx() = default; - - Bs8u m_ctxState[BS_HEVC::CtxTblSize]; - Bs16u StatCoeff[4]; - std::vector PredictorPaletteEntries[3]; - Bs16u PredictorPaletteSize; -}; - -class CABAC - : private COMMON_CABAC::ADE - , public virtual Info - , public CabacCtx -{ -private: - Bs16s m_g1I = 0; - Bs16s m_rI = 0; - CabacCtx m_ctxWPP; - CabacCtx m_ctxDS; - Bs16u ctxSet = 0; - Bs16u lastGreater1Ctx = 0; - bool lastGreater1Flag = false; - Bs32u cLastAbsLevel = 0; - Bs16u cLastRiceParam = 0; - Bs16u m_paletteIdxCnt = 0; - - inline Bs8u DecodeBin(Bs16s off, Bs16s inc) - { - BinCount++; - if (off < 0) inc = off; - if (inc == -1) return DecodeBypass(); - if (inc == -2) return DecodeTerminate(); - if (inc < 0) throw BsReader2::InvalidSyntax(); - return DecodeDecision(m_ctxState[off + inc]); - } - Bs32u EGkBypass(Bs32u k); - Bs32u TBBypass(Bs32u cMax); - inline Bs8u& CtxState(Bs16u se, Bs16s inc = 0) { return m_ctxState[BS_HEVC::CtxOffset[se] + inc]; } - inline bool DD(Bs16u se, Bs16s inc = 0) { BinCount++; return !!DecodeDecision(CtxState(se, inc)); } - inline bool DT() { BinCount++; return !!DecodeTerminate(); } - inline bool DB() { BinCount++; return !!DecodeBypass(); } - -public: - Bs64u BinCount = 0; - - CABAC(BsReader2::Reader& r) - : ADE(r) - {} - - void InitCtx(); - inline void InitADE() { ADE::Init(); } - inline void InitPCMBlock() { ADE::InitPCMBlock(); } - - inline void SyncWPP () { (CabacCtx&)(*this) = m_ctxWPP; } - inline void SyncDS () { (CabacCtx&)(*this) = m_ctxDS; } - inline void StoreWPP() { m_ctxWPP = (CabacCtx&)(*this); } - inline void StoreDS () { m_ctxDS = (CabacCtx&)(*this); } - - inline Bs16u GetR() { return ADE::GetR(); } - inline Bs16u GetV() { return ADE::GetV(); } - inline Bs64u BitCount() { return ADE::BitCount(); } - - // slice_segment_data() - inline bool EndOfSliceSegmentFlag() {return DT(); } - inline bool EndOfSubsetOneBit() {return DT(); } - - // sao() - inline bool SaoMergeLeftFlag() { return DD(BS_HEVC::SAO_MERGE_LEFT_FLAG); } - inline bool SaoMergeUpFlag() { return DD(BS_HEVC::SAO_MERGE_UP_FLAG); } - inline Bs8u SaoTypeIdxChroma() { return SaoTypeIdxLuma(); } - Bs8u SaoTypeIdxLuma(); - Bs8u SaoOffsetAbs(Bs16u bitDepth); - inline bool SaoOffsetSign() { return DB(); } - Bs8u SaoBandPosition(); - Bs8u SaoEoClassLuma(); - inline Bs8u SaoEoClassChroma() { return SaoEoClassLuma(); } - - //coding_quadtree() - bool SplitCuFlag(Bs16s x0, Bs16s y0); - - //coding_unit() - inline bool CuTransquantBypassFlag() { return DD(BS_HEVC::CU_TRANSQUANT_BYPASS_FLAG); } - bool CuSkipFlag(Bs16s x0, Bs16s y0); - inline bool PaletteModeFlag() { return DD(BS_HEVC::PALETTE_MODE_FLAG); } - inline bool PredModeFlag() { return DD(BS_HEVC::PRED_MODE_FLAG); } - Bs8u PartMode(bool intra, Bs16u log2CbSize); - inline bool PcmFlag() { return DT(); } - inline bool PrevIntraLumaPredFlag() { return DD(BS_HEVC::PREV_INTRA_LUMA_PRED_FLAG); } - Bs8u MpmIdx(); - inline Bs8u RemIntraLumaPredMode() { return SaoBandPosition(); } - Bs8u IntraChromaPredMode(); - inline bool RqtRootCbf() { return DD(BS_HEVC::RQT_ROOT_CBF); } - - //prediction_unit() - inline bool MergeFlag() { return DD(BS_HEVC::MERGE_FLAG); } - Bs8u MergeIdx(); - Bs8u InterPredIdc(Bs16u nPbW, Bs16u nPbH, Bs16u CtDepth); - Bs8u RefIdxL0(); - Bs8u RefIdxL1(); - inline bool MvpL0Flag() { return DD(BS_HEVC::MVP_LX_FLAG); } - inline bool MvpL1Flag() { return MvpL0Flag(); } - - //transform_tree() - inline bool SplitTransformFlag(Bs16u log2TrafoSize) { return DD(BS_HEVC::SPLIT_TRANSFORM_FLAG, 5 - log2TrafoSize); } - inline bool CbfLuma(Bs16u trafoDepth) { return DD(BS_HEVC::CBF_LUMA, !trafoDepth); } - inline bool CbfCb(Bs16u trafoDepth) { return DD(BS_HEVC::CBF_CX, trafoDepth); } - inline bool CbfCr(Bs16u trafoDepth) { return CbfCb(trafoDepth); } - - //mvd_coding() - inline bool AbsMvdGreater0Flag() { return DD(BS_HEVC::ABS_MVD_GREATER0_FLAG); } - inline bool AbsMvdGreater1Flag() { return DD(BS_HEVC::ABS_MVD_GREATER1_FLAG); } - inline bool MvdSignFlag() { return DB(); } - inline Bs16u AbsMvdMinus2() { return (Bs16u)EGkBypass(1); } - - //transform_unit() - inline bool TuResidualActFlag() { return DD(BS_HEVC::TU_RESIDUAL_ACT_FLAG); } - //delta_qp() - Bs16u CuQpDeltaAbs(); - inline bool CuQpDeltaSignFlag() { return DB(); } - //chroma_qp_offset() - inline bool CuChromaQpOffsetFlag() { return DD(BS_HEVC::CU_CHROMA_QP_OFFSET_FLAG); } - Bs8u CuChromaQpOffsetIdx(); - - //cross_comp_pred() - Bs8u Log2ResScaleAbsPlus1(Bs16u c); - inline bool ResScaleSignFlag(Bs16u c) { return DD(BS_HEVC::RES_SCALE_SIGN_FLAG, c); } - - //residual_coding() - inline bool TransformSkipFlag(Bs16u cIdx) { return DD(BS_HEVC::TRANSFORM_SKIP_FLAG0, !!cIdx); } - inline bool ExplicitRdpcmFlag(Bs16u cIdx) { return DD(BS_HEVC::EXPLICIT_RDPCM_FLAG, !!cIdx); } - inline bool ExplicitRdpcmDirFlag(Bs16u cIdx) { return DD(BS_HEVC::EXPLICIT_RDPCM_DIR_FLAG, !!cIdx); } - Bs8u LastSigCoeffXPrefix(Bs16u cIdx, Bs16u log2TrafoSize); - Bs8u LastSigCoeffYPrefix(Bs16u cIdx, Bs16u log2TrafoSize); - Bs32u LastSigCoeffXSuffix(Bs16u prefix); - inline Bs32u LastSigCoeffYSuffix(Bs16u prefix) { return LastSigCoeffXSuffix(prefix); } - inline bool CodedSubBlockFlag(Bs16u ctxInc) { return DD(BS_HEVC::CODED_SUB_BLOCK_FLAG, ctxInc); } - inline bool SigCoeffFlag(Bs16u ctxInc) { return DD(BS_HEVC::SIG_COEFF_FLAG, ctxInc); } - bool CoeffAbsLevelGreater1Flag(Bs16u cIdx, Bs16u i); - inline bool CoeffAbsLevelGreater2Flag(Bs16u cIdx) { return DD(BS_HEVC::COEFF_ABS_LEVEL_GREATER2_FLAG, ctxSet + 4 * !!cIdx); } - Bs32u CoeffAbsLevelRemaining(Bs16u i, Bs16u baseLevel, Bs16u cIdx, CU& cu, TU& tu); - inline bool CoeffSignFlag() { return DB(); } - - //palette_coding() - inline Bs8u PalettePredictorRun() { return (Bs8u)EGkBypass(0); } - inline Bs8u NumSignalledPaletteEntries() { return (Bs8u)EGkBypass(0); } - Bs16u NewPaletteEntries(Bs16u cIdx); - inline bool PaletteEscapeValPresentFlag() { return DB(); } - Bs16u NumPaletteIndices(Bs16u MaxPaletteIndex); - inline Bs16u PaletteIndexIdc(Bs16u MaxPaletteIndex) { return (Bs16u)TBBypass(MaxPaletteIndex - !!(m_paletteIdxCnt++)); }; - inline bool CopyAboveIndicesForFinalRunFlag() { return DD(BS_HEVC::COPY_ABOVE_INDICES_FOR_FINAL_RUN_FLAG); } - inline bool PaletteTransposeFlag() { return DD(BS_HEVC::PALETTE_TRANSPOSE_FLAG); } - inline bool CopyAbovePaletteIndicesFlag() { return DD(BS_HEVC::COPY_ABOVE_PALETTE_INDICES_FLAG); } - Bs16u PaletteRunPrefix(Bs16u PaletteMaxRun, bool copy_above_palette_indices_flag, Bs16u palette_index_idc); - inline Bs16u PaletteRunSuffix(Bs16u PaletteMaxRun, Bs16u PrefixOffset) - { return (Bs16u)TBBypass((PrefixOffset << 1) > PaletteMaxRun ? (PaletteMaxRun - PrefixOffset) : (PrefixOffset - 1)); } - Bs16u PaletteEscapeVal(Bs16u cIdx, bool cu_transquant_bypass_flag); -}; - -class SDParser //Slice data parser - : public BsReader2::Reader - , private CABAC - , public virtual Info -{ -private: - std::vector m_ctu; - std::vector m_cu; - std::vector m_pu; - std::vector m_tu; - std::vector m_TC_lvl; - - bool IntraSplitFlag = false; - Bs16u MaxTrafoDepth = 0; - Bs16s CuQpDeltaVal = 0; - Bs16s qPY_PREV = 0; - bool IsCuQpDeltaCoded = false; - bool IsCuChromaQpOffsetCoded = false; - Bs8u intra_chroma_pred_mode[2][2] = {}; - - bool report_TCLevels = false; - std::vector TCLevels; - - template T* Alloc(Bs16u n_elem = 1) - { - if (std::is_same::value) - { - assert(m_ctu.capacity() >= m_ctu.size() + 1); - CTU z{}; - m_ctu.push_back(z); - return (T*)&m_ctu.back(); - } - if (std::is_same::value) - { - assert(m_cu.capacity() >= m_cu.size() + 1); - CU z{}; - m_cu.push_back(z); - return (T*)&m_cu.back(); - } - if (std::is_same::value) - { - assert(m_pu.capacity() >= m_pu.size() + 1); - PU z{}; - m_pu.push_back(z); - return (T*)&m_pu.back(); - } - if (std::is_same::value) - { - assert(m_tu.capacity() >= m_tu.size() + 1); - TU z{}; - m_tu.push_back(z); - return (T*)&m_tu.back(); - } - if (std::is_same::value) - { - assert(m_TC_lvl.capacity() >= m_TC_lvl.size() + n_elem); - m_TC_lvl.insert(m_TC_lvl.end(), n_elem, 0); - return (T*)&m_TC_lvl[m_TC_lvl.size() - n_elem]; - } - throw std::bad_alloc(); - return 0; - } - - void parseSAO(CTU& ctu, Bs16u rx, Bs16u ry); - CU* parseCQT(CU& cu, Bs16u log2CbSize, Bs16u cqtDepth); - void parseCU (CU& cu); - void parsePC (CU& cu); - void parsePU (CU& cu, PU& pu, Bs16u CtDepth, Bs16u partIdx); - TU* parseTT (CU& cu, TU& tu, TU& tuBase, Bs16u blkIdx); - void parseTU (CU& cu, TU& tu, TU& tuBase, Bs16u blkIdx); - void parseResidual(CU& cu, TU& tu, Bs16u x0, Bs16u y0, Bs16u log2TrafoSize, Bs16u cIdx); - void parseDQP (CU& cu); - void parseCQPO(CU& cu); - -public: - BS_MEM::Allocator* m_pAllocator; - - SDParser(bool report_TC = false); - - inline Bs32u u(Bs32u n) { return GetBits(n); }; - inline Bs32u u1() { return GetBit(); }; - inline Bs32u u8() { return GetBits(8); }; - inline Bs32u ue() { return GetUE(); }; - inline Bs32s se() { return GetSE(); }; - - bool more_rbsp_data(); - - CTU* parseSSD(NALU& nalu, NALU* pColPic, Bs32u NumCtb = -1); -}; - -struct SDDesc -{ - BsThread::SyncPoint sp; - BsThread::State state; - NALU* Slice; -}; - -struct SDPar -{ - NALU* Slice; - NALU* ColPic; - Bs32u HeaderSize; - Bs32u NumCtb; - bool Emulation; - bool NewPicture; - SDDesc* pTask; -}; - -struct SDThread -{ - SDParser p; - std::vector rbsp; - std::list par; - Bs32u locked; - Bs32u RBSPSize; - Bs32u RBSPOffset; - std::mutex mtx; -}; - -struct SyncPoint -{ - BsThread::SyncPoint AU; // headers parsed, slice tasks submitted - BsThread::SyncPoint AUDone; - BSErr sts; - std::list SD; - BS_MEM::Allocator* pAllocator; -}; - -class Parser - : private BS_MEM::Allocator - , private BsReader2::File - , private SDParser -{ -private: - Bs32u m_mode; - NALUDesc m_lastNALU; - NALU* m_au; - SPS* m_activeSPS; - VPS* m_vps[16]; - SPS* m_sps[16]; - PPS* m_pps[64]; - bool m_bNewSequence; - std::list m_postponedSEI; - std::map m_ColPic; - - void parseNUH(NALU& nalu); - void parseRBSP(NALU& nalu); - - void parseAUD(AUD& aud); - void parseVPS(VPS& vps); - void parseSPS(SPS& sps); - void parsePPS(PPS& pps); - void parseSEI(SEI& sei); - void parseSSH(NALU& nalu); - void parseVUI(VUI& vui, Bs32u maxNumSubLayersMinus1); - void parsePTL(PTL& ptl); - void parsePTL(SubLayers& sl, Bs32u max_sub_layers_minus1); - void parseHRD(HRD& hrd, void* base, bool commonInfPresentFlag, Bs32u maxNumSubLayersMinus1); - void parseSLO(SubLayerOrderingInfo* slo, bool f, Bs32u n); - void parseSLD(QM& qm); - void ParseSTRPS(STRPS* strps, Bs32u num, Bs32u idx); - void parseSEIPL(SEI& sei); - void parseSEIPL(APS_SEI& aps); - void parseSEIPL(BP_SEI& bp); - void parseSEIPL(PT_SEI& pt); - void parseSEIPL(RP_SEI& rp); - - void parseMLE(PPS& pps); - void parse3DE(PPS& pps); - - Bs32u parseEXT(Bs8u*& ExtData); - - NALU* GetColPic(Slice& slice); - void UpdateColPics(NALU* AU, Slice& slice); - -//////////////////////////////////////////////////// - /*static*/ BsThread::Scheduler m_thread; - std::list m_sdt; - std::mutex m_mtx; - std::map m_spAuToId; - std::vector m_rbsp; - NALU* m_prevSP; - BSErr m_auErr; - Bs16u m_asyncAUMax; - Bs16u m_asyncAUCnt; - - static BsThread::State ParallelAU(void* self, unsigned int); - static BsThread::State ParallelSD(void* self, unsigned int); - static BsThread::State AUDone(void* self, unsigned int); - static BsThread::State SDTWait(void* self, unsigned int); - - BSErr ParseNextAuSubmit(NALU*& pAU); - BSErr ParseNextAu(NALU*& pAU); - Bs32u ParseSSDSubmit(SDThread*& pSDT, NALU* AU); - -public: - Parser(Bs32u mode = 0); - - ~Parser(); - - BSErr open(const char* file_name); - void close() { Close(); } - - void set_buffer(Bs8u* buf, Bs32u buf_size) { Reset(buf, buf_size, 0); } - - BSErr parse_next_au(NALU*& pAU); - BSErr sync(NALU* pAU); - - BSErr Lock(void* p); - BSErr Unlock(void* p); - - void set_trace_level(Bs32u level); - inline Bs64u get_cur_pos() { return GetByteOffset(); } - inline Bs16u get_async_depth() { return m_asyncAUMax; } - -}; - -}; diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_struct.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_struct.h deleted file mode 100644 index 5e7039e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_struct.h +++ /dev/null @@ -1,983 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include "bs_def.h" - -namespace BS_HEVC2 -{ - -typedef class Parser* HDL; - -enum INIT_MODE -{ - INIT_MODE_DEFAULT = 0x00, - PARSE_SSD = 0x01, - PARALLEL_AU = 0x02, - PARALLEL_SD = 0x04, - PARALLEL_TILES = 0x08, - PARSE_SSD_TC = 0x10 | PARSE_SSD, - - ASYNC = (PARALLEL_AU | PARALLEL_SD | PARALLEL_TILES) -}; - -enum TRACE_LEVEL -{ - TRACE_NUH = 0x00000001, - TRACE_AUD = 0x00000002, - TRACE_VPS = 0x00000004, - TRACE_SPS = 0x00000008, - TRACE_PPS = 0x00000010, - TRACE_SEI = 0x00000020, - TRACE_SSH = 0x00000040, - TRACE_REF = 0x00000080, - TRACE_CTU = 0x00000100, - TRACE_SAO = 0x00000200, - TRACE_CQT = 0x00000400, - TRACE_CU = 0x00000800, - TRACE_PU = 0x00001000, - TRACE_TT = 0x00002000, - TRACE_TU = 0x00004000, - TRACE_RESIDUAL = 0x00008000, - TRACE_PRED = 0x04000000, - TRACE_QP = 0x08000000, - TRACE_COEF = 0x10000000, - TRACE_SIZE = 0x40000000, - TRACE_OFFSET = 0x80000000, - TRACE_DEFAULT = - TRACE_NUH - | TRACE_AUD - | TRACE_VPS - | TRACE_SPS - | TRACE_PPS - | TRACE_SEI - | TRACE_SSH - | TRACE_REF - | TRACE_SIZE - //| TRACE_OFFSET -}; - -enum NALU_TYPE -{ - TRAIL_N = 0, - TRAIL_R, - TSA_N, - TSA_R, - STSA_N, - STSA_R, - RADL_N, - RADL_R, - RASL_N, - RASL_R, - RSV_VCL_N10, RSV_VCL_R11, RSV_VCL_N12, - RSV_VCL_R13, RSV_VCL_N14, RSV_VCL_R15, - BLA_W_LP, - BLA_W_RADL, - BLA_N_LP, - IDR_W_RADL, - IDR_N_LP, - CRA_NUT, - RSV_IRAP_VCL22, RSV_IRAP_VCL23, - RSV_VCL24, RSV_VCL25, RSV_VCL26, RSV_VCL27, - RSV_VCL28, RSV_VCL29, RSV_VCL30, RSV_VCL31, - VPS_NUT, - SPS_NUT, - PPS_NUT, - AUD_NUT, - EOS_NUT, - EOB_NUT, - FD_NUT, - PREFIX_SEI_NUT, - SUFFIX_SEI_NUT, - RSV_NVCL41, RSV_NVCL42, RSV_NVCL43, RSV_NVCL44, - RSV_NVCL45, RSV_NVCL46, RSV_NVCL47, - UNSPEC48, UNSPEC49, UNSPEC50, UNSPEC51, - UNSPEC52, UNSPEC53, UNSPEC54, UNSPEC55, - UNSPEC56, UNSPEC57, UNSPEC58, UNSPEC59, - UNSPEC60, UNSPEC61, UNSPEC62, UNSPEC63, - num_NALU_TYPE -}; - -enum PROFILE -{ - MAIN = 1, - MAIN_10 = 2, - MAIN_SP = 3, - REXT = 4, - REXT_HT = 5, - MAIN_MV = 6, - MAIN_SC = 7, - MAIN_3D = 8, - SCC = 9, - REXT_SC = 10 -}; - -enum PIC_TYPE -{ - PIC_I = 0, - PIC_PI, - PIC_BPI -}; - -enum CHROMA_FORMAT -{ - CHROMA_400 = 0, - CHROMA_420 = 1, - CHROMA_422 = 2, - CHROMA_444 = 3 -}; - -enum AR_IDC -{ - AR_IDC_1_1 = 1, - AR_IDC_square = 1, - AR_IDC_12_11 = 2, - AR_IDC_10_11 = 3, - AR_IDC_16_11 = 4, - AR_IDC_40_33 = 5, - AR_IDC_24_11 = 6, - AR_IDC_20_11 = 7, - AR_IDC_32_11 = 8, - AR_IDC_80_33 = 9, - AR_IDC_18_11 = 10, - AR_IDC_15_11 = 11, - AR_IDC_64_33 = 12, - AR_IDC_160_99 = 13, - AR_IDC_4_3 = 14, - AR_IDC_3_2 = 15, - AR_IDC_2_1 = 16, - Extended_SAR = 255, -}; - -enum VIDEO_FORMAT -{ - Component = 0, - PAL = 1, - NTSC = 2, - SECAM = 3, - MAC = 4 -}; - -enum SEI_TYPE -{ - SEI_BUFFERING_PERIOD = 0, - SEI_PICTURE_TIMING = 1, - SEI_PAN_SCAN_RECT = 2, - SEI_FILLER_PAYLOAD = 3, - SEI_USER_DATA_REGISTERED_ITU_T_T35 = 4, - SEI_USER_DATA_UNREGISTERED = 5, - SEI_RECOVERY_POINT = 6, - SEI_SCENE_INFO = 9, - SEI_FULL_FRAME_SNAPSHOT = 15, - SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16, - SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END = 17, - SEI_FILM_GRAIN_CHARACTERISTICS = 19, - SEI_POST_FILTER_HINT = 22, - SEI_TONE_MAPPING_INFO = 23, - SEI_FRAME_PACKING = 45, - SEI_DISPLAY_ORIENTATION = 47, - SEI_SOP_DESCRIPTION = 128, - SEI_ACTIVE_PARAMETER_SETS = 129, - SEI_DECODING_UNIT_INFO = 130, - SEI_TEMPORAL_LEVEL0_INDEX = 131, - SEI_DECODED_PICTURE_HASH = 132, - SEI_SCALABLE_NESTING = 133, - SEI_REGION_REFRESH_INFO = 134, - SEI_NO_DISPLAY = 135, - SEI_TIME_CODE = 136, - SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137, - SEI_SEGM_RECT_FRAME_PACKING = 138, - SEI_TEMP_MOTION_CONSTRAINED_TILE_SETS = 139, - SEI_CHROMA_RESAMPLING_FILTER_HINT = 140, - SEI_KNEE_FUNCTION_INFO = 141, - SEI_COLOUR_REMAPPING_INFO = 142, -}; - -enum PIC_STRUCT -{ - FRAME = 0, - TOP, - BOT, - TOP_BOT, - BOT_TOP, - TOP_BOT_TOP, - BOT_TOP_BOT, - FRAME_x2, - FRAME_x3, - TOP_PREVBOT, - BOT_PREVTOP, - TOP_NEXTBOT, - BOT_NEXTTOP -}; - -enum SOURCE_SCAN_TYPE -{ - SCAN_INTERLACED = 0, - SCAN_PROGRESSIVE, - SCAN_UNKNOWN, - SCAN_RESERVED -}; - -enum SLICE_TYPE -{ - B = 0, - P, - I -}; - -enum PRED_MODE -{ - MODE_INTER = 0 - , MODE_INTRA - , MODE_SKIP -}; - -enum PART_MODE -{ - PART_2Nx2N = 0 - , PART_2NxN - , PART_Nx2N - , PART_NxN - , PART_2NxnU - , PART_2NxnD - , PART_nLx2N - , PART_nRx2N -}; - -enum INTER_PRED -{ - PRED_L0 = 0 - , PRED_L1 - , PRED_BI -}; - -enum SAO_TYPE -{ - NOT_APPLIED = 0 - , BAND_OFFSET - , EDGE_OFFSET -}; - -enum SAO_EO_CLASS -{ - EO_0 = 0 - , EO_90 - , EO_135 - , EO_45 -}; - -struct AUD -{ - Bs8u pic_type; -}; - -struct PTL -{ - union - { - struct - { - Bs32u profile_space : 2; - Bs32u tier_flag : 1; - Bs32u profile_idc : 5; - Bs32u progressive_source_flag : 1; - Bs32u interlaced_source_flag : 1; - Bs32u non_packed_constraint_flag : 1; - Bs32u frame_only_constraint_flag : 1; - Bs32u max_12bit_constraint_flag : 1; - Bs32u max_10bit_constraint_flag : 1; - Bs32u max_8bit_constraint_flag : 1; - Bs32u max_422chroma_constraint_flag : 1; - Bs32u max_420chroma_constraint_flag : 1; - Bs32u max_monochrome_constraint_flag : 1; - Bs32u intra_constraint_flag : 1; - Bs32u one_picture_only_constraint_flag : 1; - Bs32u lower_bit_rate_constraint_flag : 1; - Bs32u reserved_zero_34bits_0_10 : 11; - - Bs32u reserved_zero_34bits_11_33 : 23; - Bs32u inbld_flag : 1; - Bs32u level_idc : 8; - }; - struct - { - Bs32u : 21; - Bs32u max_14bit_constraint_flag : 1; - Bs32u reserved_zero_33bits_0_9 : 10; - - Bs32u reserved_zero_33bits_10_32 : 23; - Bs32u : 9; - }; - struct - { - Bs32u : 12; - Bs32u reserved_zero_43bits_0_19 : 20; - - Bs32u reserved_zero_43bits_20_42 : 23; - Bs32u reserved_zero_bit : 1; - Bs32u : 8; - }; - }; - - Bs32u profile_compatibility_flags; - - Bs32u profile_present_flag : 1; - Bs32u level_present_flag : 1; - Bs32u : 30; -}; - -struct SubLayerOrderingInfo -{ - Bs32u max_dec_pic_buffering_minus1 : 4; - Bs32u max_num_reorder_pics : 4; - Bs32u : 24; - Bs32u max_latency_increase_plus1; -}; - -struct HRD -{ - Bs32u nal_hrd_parameters_present_flag : 1; - Bs32u vcl_hrd_parameters_present_flag : 1; - Bs32u sub_pic_hrd_params_present_flag : 1; - Bs32u du_cpb_removal_delay_increment_length_minus1 : 5; - Bs32u dpb_output_delay_du_length_minus1 : 5; - Bs32u bit_rate_scale : 4; - Bs32u initial_cpb_removal_delay_length_minus1 : 5; - Bs32u au_cpb_removal_delay_length_minus1 : 5; - Bs32u dpb_output_delay_length_minus1 : 5; - - Bs32u tick_divisor_minus2 : 8; - Bs32u cpb_size_scale : 4; - Bs32u cpb_size_du_scale : 4; - Bs32u sub_pic_cpb_params_in_pic_timing_sei_flag : 1; - Bs32u : 15; - - struct SubLayer - { - Bs32u fixed_pic_rate_general_flag : 1; - Bs32u fixed_pic_rate_within_cvs_flag : 1; - Bs32u elemental_duration_in_tc_minus1 : 11; - Bs32u low_delay_hrd_flag : 1; - Bs32u cpb_cnt_minus1 : 5; - Bs32u : 14; - - struct CPB - { - Bs32u bit_rate_value_minus1; - Bs32u cpb_size_value_minus1; - Bs32u cpb_size_du_value_minus1; - Bs32u bit_rate_du_value_minus1; - Bs32u cbr_flag : 1; - Bs32u : 31; - } *nal, *vcl; - } sl[8]; -}; - -struct SubLayers -{ - SubLayerOrderingInfo slo[8]; - - union - { - struct - { - PTL general; - PTL sub_layer[7]; - }; - PTL ptl[8]; - }; -}; - -struct VPS : SubLayers -{ - Bs32u video_parameter_set_id : 4; - Bs32u base_layer_internal_flag : 1; - Bs32u base_layer_available_flag : 1; - Bs32u max_layers_minus1 : 6; - Bs32u max_sub_layers_minus1 : 3; - Bs32u temporal_id_nesting_flag : 1; - Bs32u reserved_0xffff_16bits : 16; - - Bs32u num_units_in_tick; - Bs32u time_scale; - - Bs32u timing_info_present_flag : 1; - Bs32u poc_proportional_to_timing_flag : 1; - Bs32u sub_layer_ordering_info_present_flag : 1; - Bs32u extension_flag : 1; - Bs32u num_ticks_poc_diff_one_minus1 : 10; - Bs32u num_hrd_parameters : 10; - Bs32u : 8; - - Bs32u max_layer_id : 6; - Bs32u num_layer_sets_minus1 : 10; - Bs32u : 16; - - Bs32u ExtBits; - - Bs8u* layer_id_included_flags; - - struct VPSHRD : HRD - { - Bs16u hrd_layer_set_idx : 10; - Bs16u cprms_present_flag : 1; - Bs16u : 5; - } *hrd; - - Bs8u* ExtData; -}; - - -struct VUI -{ - Bs32u sar_width : 16; - Bs32u sar_height : 16; - - Bs32u aspect_ratio_info_present_flag : 1; - Bs32u timing_info_present_flag : 1; - Bs32u hrd_parameters_present_flag : 1; - Bs32u poc_proportional_to_timing_flag : 1; - Bs32u bitstream_restriction_flag : 1; - Bs32u tiles_fixed_structure_flag : 1; - Bs32u motion_vectors_over_pic_boundaries_flag : 1; - Bs32u restricted_ref_pic_lists_flag : 1; - Bs32u aspect_ratio_idc : 8; - Bs32u overscan_info_present_flag : 1; - Bs32u overscan_appropriate_flag : 1; - Bs32u video_signal_type_present_flag : 1; - Bs32u video_full_range_flag : 1; - Bs32u colour_description_present_flag : 1; - Bs32u video_format : 3; - Bs32u chroma_loc_info_present_flag : 1; - Bs32u neutral_chroma_indication_flag : 1; - Bs32u chroma_sample_loc_type_top_field : 3; - Bs32u chroma_sample_loc_type_bottom_field : 3; - - Bs32u field_seq_flag : 1; - Bs32u frame_field_info_present_flag : 1; - Bs32u default_display_window_flag : 1; - Bs32u max_bytes_per_pic_denom : 5; - Bs32u colour_primaries : 8; - Bs32u transfer_characteristics : 8; - Bs32u matrix_coeffs : 8; - - Bs32u log2_max_mv_length_horizontal : 4; - Bs32u log2_max_mv_length_vertical : 4; - Bs32u max_bits_per_min_cu_denom : 5; - Bs32u : 7; - Bs32u min_spatial_segmentation_idc : 12; - - Bs32u def_disp_win_left_offset; - Bs32u def_disp_win_right_offset; - Bs32u def_disp_win_top_offset; - Bs32u def_disp_win_bottom_offset; - - Bs32u num_units_in_tick; - Bs32u time_scale; - Bs32u num_ticks_poc_diff_one_minus1; - - HRD* hrd; -}; - -enum QM_IDX -{ - QM_IntraY = 0, - QM_IntraCb, - QM_IntraCr, - QM_InterY, - QM_InterCb, - QM_InterCr, -}; - -struct QM -{ - Bs8u ScalingFactor0[6][4][4]; - Bs8u ScalingFactor1[6][8][8]; - Bs8u ScalingFactor2[6][16][16]; - Bs8u ScalingFactor3[6][32][32]; -}; - -struct STRPS -{ - Bs16u NumDeltaPocs; - Bs16u UsedByCurrPicFlags; - Bs16s DeltaPoc[16]; -}; - -struct SPS : SubLayers -{ - Bs32u seq_parameter_set_id : 4; - Bs32u video_parameter_set_id : 4; - Bs32u temporal_id_nesting_flag : 1; - Bs32u num_short_term_ref_pic_sets : 7; - Bs32u separate_colour_plane_flag : 1; - Bs32u conformance_window_flag : 1; - Bs32u sub_layer_ordering_info_present_flag : 1; - Bs32u chroma_format_idc : 2; - Bs32u max_sub_layers_minus1 : 3; - Bs32u scaling_list_enabled_flag : 1; - Bs32u scaling_list_data_present_flag : 1; - Bs32u amp_enabled_flag : 1; - Bs32u sample_adaptive_offset_enabled_flag : 1; - Bs32u pcm_sample_bit_depth_luma_minus1 : 4; - - Bs32u pcm_enabled_flag : 1; - Bs32u pcm_loop_filter_disabled_flag : 1; - Bs32u long_term_ref_pics_present_flag : 1; - Bs32u temporal_mvp_enabled_flag : 1; - Bs32u pcm_sample_bit_depth_chroma_minus1 : 4; - Bs32u strong_intra_smoothing_enabled_flag : 1; - Bs32u bit_depth_chroma_minus8 : 4; - Bs32u log2_max_pic_order_cnt_lsb_minus4 : 4; - Bs32u vui_parameters_present_flag : 1; - Bs32u bit_depth_luma_minus8 : 4; - Bs32u num_long_term_ref_pics : 7; - Bs32u motion_vector_resolution_control_idc : 2; - Bs32u intra_boundary_filtering_disabled_flag : 1; - - Bs32u extension_present_flag : 1; - Bs32u range_extension_flag : 1; - Bs32u multilayer_extension_flag : 1; - Bs32u extension_3d_flag : 1; - Bs32u scc_extension_flag : 1; - Bs32u extension_xbits : 4; - Bs32u transform_skip_rotation_enabled_flag : 1; - Bs32u transform_skip_context_enabled_flag : 1; - Bs32u implicit_rdpcm_enabled_flag : 1; - Bs32u explicit_rdpcm_enabled_flag : 1; - Bs32u extended_precision_processing_flag : 1; - Bs32u intra_smoothing_disabled_flag : 1; - Bs32u high_precision_offsets_enabled_flag : 1; - Bs32u persistent_rice_adaptation_enabled_flag : 1; - Bs32u cabac_bypass_alignment_enabled_flag : 1; - Bs32u inter_view_mv_vert_constraint_flag : 1; - Bs32u log2_min_luma_transform_block_size_minus2 : 5; - Bs32u log2_diff_max_min_luma_transform_block_size : 5; - Bs32u curr_pic_ref_enabled_flag : 1; - Bs32u palette_mode_enabled_flag : 1; - Bs32u palette_predictor_initializer_present_flag : 1; - - Bs32u log2_min_luma_coding_block_size_minus3 : 5; - Bs32u log2_diff_max_min_luma_coding_block_size : 5; - Bs32u log2_min_pcm_luma_coding_block_size_minus3 : 5; - Bs32u log2_diff_max_min_pcm_luma_coding_block_size : 5; - Bs32u max_transform_hierarchy_depth_inter : 6; - Bs32u max_transform_hierarchy_depth_intra : 6; - - Bs16u pic_width_in_luma_samples; - Bs16u pic_height_in_luma_samples; - - Bs16u conf_win_left_offset; - Bs16u conf_win_right_offset; - - Bs16u conf_win_top_offset; - Bs16u conf_win_bottom_offset; - - Bs32u used_by_curr_pic_lt_flags; - - Bs8u palette_max_size; - Bs8s delta_palette_max_predictor_size; - Bs16u num_palette_predictor_initializer; - - Bs32u ExtBits; - - Bs8u *ExtData; - STRPS *strps; - Bs16u *lt_ref_pic_poc_lsb; - QM *qm; - VUI *vui; - Bs16u *palette_predictor_initializers[3]; -}; - -struct PPS -{ - Bs32u pic_parameter_set_id : 6; - Bs32u seq_parameter_set_id : 4; - Bs32u dependent_slice_segments_enabled_flag : 1; - Bs32u output_flag_present_flag : 1; - Bs32u sign_data_hiding_enabled_flag : 1; - Bs32u cabac_init_present_flag : 1; - Bs32u constrained_intra_pred_flag : 1; - Bs32u transform_skip_enabled_flag : 1; - Bs32u cu_qp_delta_enabled_flag : 1; - Bs32u slice_chroma_qp_offsets_present_flag : 1; - Bs32u weighted_pred_flag : 1; - Bs32u weighted_bipred_flag : 1; - Bs32u transquant_bypass_enabled_flag : 1; - Bs32u tiles_enabled_flag : 1; - Bs32u entropy_coding_sync_enabled_flag : 1; - Bs32u uniform_spacing_flag : 1; - Bs32u loop_filter_across_tiles_enabled_flag : 1; - Bs32u loop_filter_across_slices_enabled_flag : 1; - Bs32u deblocking_filter_control_present_flag : 1; - Bs32u deblocking_filter_override_enabled_flag : 1; - Bs32u deblocking_filter_disabled_flag : 1; - Bs32u scaling_list_data_present_flag : 1; - Bs32u lists_modification_present_flag : 1; - Bs32u slice_segment_header_extension_present_flag : 1; - - Bs32u num_extra_slice_header_bits : 3; - Bs32u num_ref_idx_l0_default_active_minus1 : 4; - Bs32u num_ref_idx_l1_default_active_minus1 : 4; - Bs32u extension_present_flag : 1; - Bs32u range_extension_flag : 1; - Bs32u multilayer_extension_flag : 1; - Bs32u extension_3d_flag : 1; - Bs32u scc_extension_flag : 1; - Bs32u extension_xbits : 4; - Bs32u : 12; - - Bs32u curr_pic_ref_enabled_flag : 1; - Bs32u residual_adaptive_colour_transform_enabled_flag : 1; - Bs32u slice_act_qp_offsets_present_flag : 1; - Bs32u palette_predictor_initializer_present_flag : 1; - Bs32u monochrome_palette_flag : 1; - Bs32u luma_bit_depth_entry_minus8 : 4; - Bs32u chroma_bit_depth_entry_minus8 : 4; - Bs32u num_palette_predictor_initializer : 16; - Bs32u : 3; - Bs32s ActQpOffsetY : 5; //-12 to +12, - Bs32s ActQpOffsetCb : 5; //-12 to +12, - Bs32s ActQpOffsetCr : 5; //-12 to +12, - Bs32s : 17; - - Bs8s init_qp_minus26; - Bs8s cb_qp_offset; - Bs8s cr_qp_offset; - Bs8s beta_offset_div2 : 4; - Bs8s tc_offset_div2 : 4; - - Bs32u cross_component_prediction_enabled_flag : 1; - Bs32u chroma_qp_offset_list_enabled_flag : 1; - Bs32u log2_sao_offset_scale_luma : 3; - Bs32u log2_sao_offset_scale_chroma : 3; - Bs32u chroma_qp_offset_list_len_minus1 : 3; - Bs32u diff_cu_chroma_qp_offset_depth : 5; - Bs32u log2_max_transform_skip_block_size_minus2 : 5; - Bs32u : 11; - - Bs8s cb_qp_offset_list[6]; - Bs8s cr_qp_offset_list[6]; - - Bs16u diff_cu_qp_delta_depth; - Bs16u num_tile_columns_minus1; - Bs16u num_tile_rows_minus1; - Bs16u log2_parallel_merge_level_minus2; - - Bs32u ExtBits; - - Bs8u *ExtData; - Bs16u *column_width_minus1; - Bs16u *row_height_minus1; - Bs16u *CtbAddrRsToTs; - QM *qm; - Bs16u *palette_predictor_initializers[3]; -}; - -struct APS_SEI -{ - Bs32u active_video_parameter_set_id : 4; - Bs32u self_contained_cvs_flag : 1; - Bs32u no_parameter_set_update_flag : 1; - Bs32u num_sps_ids_minus1 : 4; - Bs32u : 22; - Bs8u* active_seq_parameter_set_id; - Bs8u* layer_sps_idx; -}; - -struct BP_SEI -{ - Bs32u seq_parameter_set_id : 4; - Bs32u irap_cpb_params_present_flag : 1; - Bs32u concatenation_flag : 1; - Bs32u use_alt_cpb_params_flag : 1; - Bs32u au_cpb_removal_delay_delta_minus1; - Bs32u cpb_delay_offset; - Bs32u dpb_delay_offset; - - struct CPB - { - Bs32u initial_cpb_removal_delay; - Bs32u initial_cpb_removal_offset; - Bs32u initial_alt_cpb_removal_delay; - Bs32u initial_alt_cpb_removal_offset; - } *nal, *vcl; -}; - -struct PT_SEI -{ - Bs32u pic_struct : 4; - Bs32u source_scan_type : 2; - Bs32u duplicate_flag : 1; - Bs32u du_common_cpb_removal_delay_flag : 1; - - Bs32u au_cpb_removal_delay_minus1; - Bs32u pic_dpb_output_delay; - Bs32u pic_dpb_output_du_delay; - Bs32u num_decoding_units_minus1; - Bs32u du_common_cpb_removal_delay_increment_minus1; - - Bs32u *num_nalus_in_du_minus1; - Bs32u *du_cpb_removal_delay_increment_minus1; - - VUI* vui; -}; - -struct RP_SEI -{ - Bs16s recovery_poc_cnt; - Bs16u exact_match_flag : 1; - Bs16u broken_link_flag : 1; -}; - -struct SEI -{ - Bs32u payloadType; - Bs32u payloadSize; - - Bs8u* rawData; - - union - { - APS_SEI *aps; - BP_SEI *bp; - PT_SEI *pt; - RP_SEI *rp; - }; - - SEI* next; -}; - -typedef Bs16s PWT[16][3][2]; - -struct RefPic -{ - Bs32u long_term : 1; - Bs32u lost : 1; - Bs32u used : 1; - Bs32u : 29; - Bs32s POC; -}; - -struct PU -{ - Bs16u x; - Bs16u y; - Bs16u w : 8; - Bs16u h : 8; - - Bs16u merge_idx : 3; - Bs16u merge_flag : 1; - Bs16u inter_pred_idc : 2; - Bs16u mvp_l0_flag : 1; - Bs16u mvp_l1_flag : 1; - Bs16u ref_idx_l0 : 4; - Bs16u ref_idx_l1 : 4; - - Bs16s MvLX[2][2]; - - PU* Next; -}; - -struct TU -{ - Bs16u x; - Bs16u y; - - Bs32u log2TrafoSize : 8; - Bs32u transform_skip_flag : 3; - Bs32u cbf_cb : 1; - Bs32u cbf_cb1 : 1; - Bs32u cbf_cr : 1; - Bs32u cbf_cr1 : 1; - Bs32u cbf_luma : 1; - - Bs32u log2_res_scale_abs_plus1_0 : 3; - Bs32u res_scale_sign_flag_0 : 1; - Bs32u log2_res_scale_abs_plus1_1 : 3; - Bs32u res_scale_sign_flag_1 : 1; - Bs32u tu_residual_act_flag : 1; - Bs32u : 7; - - Bs16s QP[3]; - - Bs32s* tc_levels_luma; - - TU* Next; -}; - -struct CU -{ - Bs16u x; - Bs16u y; - - Bs32u log2CbSize : 8; - Bs32u transquant_bypass_flag : 1; - Bs32u PredMode : 2; - Bs32u PartMode : 4; - Bs32u pcm_flag : 1; - Bs32u palette_mode_flag : 1; - Bs32u chroma_qp_offset_flag : 1; - Bs32u chroma_qp_offset_idx : 3; - Bs32u : 11; - - Bs8u IntraPredModeY[2][2]; - Bs8u IntraPredModeC[2][2]; - - Bs16s QpY; - Bs16s QpCb; - Bs16s QpCr; - - PU* Pu; - TU* Tu; - CU* Next; -}; - -struct SAO -{ - Bs16u type_idx : 2; - Bs16u band_position : 5; - Bs16u eo_class : 2; - Bs16u : 7; - Bs8s offset[4]; -}; - -struct CTU -{ - Bs16u CtbAddrInRs; - Bs16u CtbAddrInTs; - - Bs16u end_of_slice_segment_flag : 1; - Bs16u sao_merge_left_flag : 1; - Bs16u sao_merge_up_flag : 1; - Bs16u : 13; - - SAO sao[3]; - CU* Cu; - CTU* Next; -}; - -struct Slice -{ - Bs32u first_slice_segment_in_pic_flag : 1; - Bs32u no_output_of_prior_pics_flag : 1; - Bs32u dependent_slice_segment_flag : 1; - Bs32u sao_luma_flag : 1; - Bs32u sao_chroma_flag : 1; - Bs32u colour_plane_id : 2; - Bs32u num_ref_idx_l0_active : 4; - Bs32u num_ref_idx_l1_active : 4; - Bs32u num_long_term_pics : 4; - Bs32u collocated_ref_idx : 4; - Bs32u short_term_ref_pic_set_idx : 6; - Bs32u ref_pic_list_modification_flag_l0 : 1; - Bs32u ref_pic_list_modification_flag_l1 : 1; - Bs32u Split : 1; - - Bs32u temporal_mvp_enabled_flag : 1; - Bs32u num_ref_idx_active_override_flag : 1; - Bs32u mvd_l1_zero_flag : 1; - Bs32u cabac_init_flag : 1; - Bs32u collocated_from_l0_flag : 1; - Bs32u cu_chroma_qp_offset_enabled_flag : 1; - Bs32u deblocking_filter_override_flag : 1; - Bs32u deblocking_filter_disabled_flag : 1; - Bs32u loop_filter_across_slices_enabled_flag : 1; - Bs32u pic_output_flag : 1; - Bs32u short_term_ref_pic_set_sps_flag : 1; - Bs32u type : 2; - Bs32u MaxNumMergeCand : 3; - Bs32u num_long_term_sps : 5; - Bs32u offset_len_minus1 : 5; - Bs32u pic_parameter_set_id : 6; - - Bs32u pic_order_cnt_lsb : 16; - Bs32u reserved_flags : 8; - Bs32u luma_log2_weight_denom : 3; - Bs32u chroma_log2_weight_denom : 3; - Bs32u use_integer_mv_flag : 1; - Bs32u : 1; - - Bs32u slice_segment_address; - - Bs32u num_entry_point_offsets; - Bs32u ExtBits; - - Bs32s qp_delta : 8; - Bs32s cb_qp_offset : 8; - Bs32s cr_qp_offset : 8; - Bs32s beta_offset_div2 : 4; - Bs32s tc_offset_div2 : 4; - - Bs32u used_by_curr_pic_lt_flags; - - Bs32s POC; - Bs32u NumCTU; - - Bs32s act_y_qp_offset : 6; - Bs32s act_cb_qp_offset : 6; - Bs32s act_cr_qp_offset : 6; - Bs32s : 14; - - STRPS strps; - Bs8u list_entry_lx[2][16]; - - Bs8u *ExtData; - Bs16u *poc_lsb_lt; - Bs16u *DeltaPocMsbCycleLt; - PWT *pwt; //[list][entry][Y, Cb, Cr][Weight, Offset] - Bs32u *entry_point_offset_minus1; - - RefPic *DPB; - RefPic *L0; - RefPic *L1; - - PPS *pps; - SPS *sps; - CTU *ctu; -}; - -struct NALU -{ - Bs64u StartOffset; - Bs32u NumBytesInNalUnit; - Bs32u NumBytesInRbsp; - - Bs16u forbidden_zero_bit : 1; - Bs16u nal_unit_type : 6; - Bs16u nuh_layer_id : 6; - Bs16u nuh_temporal_id_plus1 : 3; - - union - { - void *unit; - AUD *aud; - VPS *vps; - SPS *sps; - PPS *pps; - SEI *sei; - Slice *slice; - }; - - NALU* next; -}; - -}; diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_trace.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_trace.h deleted file mode 100644 index b555212..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc2_trace.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#pragma once - -#include "hevc2_struct.h" - -namespace BS_HEVC2 -{ - -extern const char NaluTraceMap[64][16]; -extern const char PicTypeTraceMap[3][4]; -extern const char ChromaFormatTraceMap[4][12]; -extern const char VideoFormatTraceMap[6][12]; -extern const char PicStructTraceMap[13][12]; -extern const char ScanTypeTraceMap[4][12]; -extern const char SliceTypeTraceMap[4][2]; -extern const char PredModeTraceMap[3][6]; -extern const char PartModeTraceMap[8][12]; -extern const char IntraPredModeTraceMap[35][9]; -extern const char SAOTypeTraceMap[3][5]; -extern const char EOClassTraceMap[4][5]; - -struct ProfileTraceMap -{ - static const char map[11][12]; - const char* operator[] (unsigned int i); -}; - -struct ARIdcTraceMap -{ - static const char map[19][16]; - const char* operator[] (unsigned int i); -}; - -struct SEITypeTraceMap -{ - const char* operator[] (unsigned int i); -}; - -struct RPLTraceMap -{ - char m_buf[80]; - const char* operator[] (const RefPic& r); -}; - -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_cabac.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_cabac.h deleted file mode 100644 index 7f3a056..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_cabac.h +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __HEVC_CABAC_H -#define __HEVC_CABAC_H - -#include "bs_reader.h" -#include "hevc_struct.h" -#include -#include -#include -#include - -namespace BS_HEVC{ - -enum SE{ - SAO_MERGE_LEFT_FLAG - , SAO_MERGE_UP_FLAG = SAO_MERGE_LEFT_FLAG - , SAO_TYPE_IDX_LUMA - , SAO_TYPE_IDX_CHROMA = SAO_TYPE_IDX_LUMA - , SPLIT_CU_FLAG - , CU_TRANSQUANT_BYPASS_FLAG - , CU_SKIP_FLAG - , PRED_MODE_FLAG - , PART_MODE - , PREV_INTRA_LUMA_PRED_FLAG - , INTRA_CHROMA_PRED_MODE - , RQT_ROOT_CBF - , MERGE_FLAG - , MERGE_IDX - , INTER_PRED_IDC - , REF_IDX_LX - , MVP_LX_FLAG - , SPLIT_TRANSFORM_FLAG - , CBF_LUMA - , CBF_CX - , ABS_MVD_GREATER0_FLAG - , ABS_MVD_GREATER1_FLAG - , CU_QP_DELTA_ABS - , TRANSFORM_SKIP_FLAG0 - , TRANSFORM_SKIP_FLAG1 - , TRANSFORM_SKIP_FLAG2 = TRANSFORM_SKIP_FLAG1 - , LAST_SIG_COEFF_X_PREFIX - , LAST_SIG_COEFF_Y_PREFIX - , CODED_SUB_BLOCK_FLAG - , SIG_COEFF_FLAG - , COEFF_ABS_LEVEL_GREATER1_FLAG - , COEFF_ABS_LEVEL_GREATER2_FLAG - , CU_CHROMA_QP_OFFSET_FLAG - , CU_CHROMA_QP_OFFSET_IDX - , LOG2_RES_SCALE_ABS_PLUS1 - , RES_SCALE_SIGN_FLAG - , EXPLICIT_RDPCM_FLAG - , EXPLICIT_RDPCM_DIR_FLAG - , PALETTE_MODE_FLAG - , TU_RESIDUAL_ACT_FLAG - , PALETTE_RUN_PREFIX - , COPY_ABOVE_PALETTE_INDICES_FLAG - , COPY_ABOVE_INDICES_FOR_FINAL_RUN_FLAG - , PALETTE_TRANSPOSE_FLAG - , num_SE - , END_OF_SLICE_SEGMENT_FLAG = num_SE - , END_OF_SUB_STREAM_ONE_BIT - , SAO_OFFSET_ABS - , SAO_OFFSET_SIGN - , SAO_BAND_POSITION - , SAO_EO_CLASS_LUMA - , SAO_EO_CLASS_CHROMA = SAO_EO_CLASS_LUMA - , MPM_IDX - , REM_INTRA_LUMA_PRED_MODE - , ABS_MVD_MINUS2 - , MVD_SIGN_FLAG - , CU_QP_DELTA_SIGN_FLAG - , LAST_SIG_COEFF_X_SUFFIX - , LAST_SIG_COEFF_Y_SUFFIX - , COEFF_ABS_LEVEL_REMAINING - , COEFF_SIGN_FLAG - , PCM_FLAG - , num_SE_full -}; - -enum PRED_MODE{ - MODE_INTER = 0 - , MODE_INTRA - , MODE_SKIP - , num_PRED_MODE -}; - -enum PART_MODE{ - PART_2Nx2N - , PART_2NxN - , PART_Nx2N - , PART_NxN - , PART_2NxnU - , PART_2NxnD - , PART_nLx2N - , PART_nRx2N - , num_PART_MODE -}; - -enum PRED_IDC{ - PRED_L0 - , PRED_L1 - , PRED_BI - , num_PRED_IDC -}; - -static const Bs8u SubWidthC[5] = {1,2,2,1,1}; -static const Bs8u SubHeightC[5] = {1,2,1,1,1}; - -inline Bs32u CeilLog2(Bs32s x){ - Bs32s size = 0; - while(x > (1< class _unsafe_array{ -private: - _T arr[_S]; -public: - inline _T& operator[](size_t idx){ - return arr[idx]; - } -}; - -struct SDecCtx{ - void update(Slice& s); - void updateIntraPredModeY(CQT& cqt); - bool zAvailableN(Bs16s xCurr, Bs16s yCurr, Bs16s xNbY, Bs16s yNbY); - CQT* get(Bs16u x, Bs16u y); - TransTree* getTU(Bs16u x, Bs16u y); - Bs8u IntraPredModeY(Bs16u x, Bs16u y, CQT* _cqt = 0); - Bs8u IntraPredModeC(Bs16u x, Bs16u y, CQT* _cqt = 0); - inline Bs16u ColumnWidthInLumaSamples(Bs16u i) { return (colWidth[ i ] << CtbLog2SizeY); } - inline Bs16u RowHeightInLumaSamples (Bs16u j) { return (rowHeight[ j ] << CtbLog2SizeY ); } - inline Bs16u bitDepth (Bs16u cIdx){ return cIdx ? (8+slice->sps->bit_depth_chroma_minus8) : (8+slice->sps->bit_depth_luma_minus8); } - inline Bs16u CuPredMode (CQT& cqt) { return (cqt.cu_skip_flag ? 2 : cqt.pred_mode_flag); } - inline Bs16u PartMode (CQT& cqt) { return ((cqt.pred_mode_flag && cqt.part_mode) ? PART_NxN : cqt.part_mode); } - - Slice* slice; - CTU* ctu; - - Bs16u RawBits; - Bs16u MinCbLog2SizeY; - Bs16u CtbLog2SizeY; - Bs16u CtbSizeY; - Bs16u PicWidthInCtbsY; - Bs16u PicHeightInCtbsY; - Bs16u MinCbSizeY; - Bs16u PicWidthInMinCbsY; - Bs16u PicHeightInMinCbsY; - Bs16u PicSizeInMinCbsY; - Bs16u PicSizeInCtbsY; - Bs16u PicSizeInSamplesY; - Bs16u PicWidthInSamplesC; - Bs16u PicHeightInSamplesC; - Bs16u Log2MinTrafoSize; - Bs16u Log2MaxTrafoSize; - Bs16u Log2MinIpcmCbSizeY; - Bs16u Log2MaxIpcmCbSizeY; - Bs16u Log2MinCuQpDeltaSize; - Bs8u IsCuQpDeltaCoded; - Bs8s CuQpDeltaVal; - Bs8s SliceQpY; - Bs8s QpYprev; - - Bs16u MaxTrafoDepth; - Bs16u MaxNumMergeCand; - bool IntraSplitFlag; - - std::vector colWidth; - std::vector rowHeight; - std::vector colBd; - std::vector rowBd; - std::vector CtbAddrRsToTs; - std::vector CtbAddrTsToRs; - std::vector TileId; - - std::vector vSliceAddrRs; - std::vector > MinTbAddrZs; - std::vector > Sao[3]; - std::vector<_unsafe_array > ScanOrder[4][3]; - std::vector > vIntraPredModeY; -}; - -const Bs16u CtxTblSize = 185; -extern const Bs8u CtxInitTbl[3][CtxTblSize]; -extern const Bs8u CtxOffset[num_SE + 1]; -extern const Bs8u rangeTabLpsT[4][64]; -extern const Bs8u transIdxLps[64]; -extern const Bs8u transIdxMps[64]; - -class HEVC_CABAC : public BS_Reader{ -public: - HEVC_CABAC(); - ~HEVC_CABAC(){ - }; - - - void Init (SDecCtx& ctx, Bs32s CtbAddrInRs); - void Store (bool is2ndCtuInRow, bool endOfSliceSegment); - Bs32u ae (Bs16u se, Bs32s par = 0); - - inline void NewBlock() { m_cSBIdx = -1; }; - inline void PCMEnd () { init_ade(); }; - - inline void ResetLog() { -#ifdef HEVC_CABAC_STATE_TRACE - if(m_cnt > 0x40000){ - char name[256]; - sprintf(name, "%s%d", HEVC_CABAC_STATE_TRACE, ++m_n); - m_cnt = 0; - fclose(flog); - flog = fopen( name, "w" ); - } -#endif //HEVC_CABAC_STATE_TRACE - } - -private: - Bs32s m_decPar; - Bs16u m_lastGreater1Ctx; - Bs16u m_ctxSet; - SDecCtx* m_pCtx; - - inline Bs16u idxStart(Bs16u se) { return CtxOffset[se];} - inline Bs16u idxEnd (Bs16u se) { return CtxOffset[se+1];} - - void init_ctx(); // 9.3.2.2 - void init_ade(); // 9.4.2.5 - - enum CTX_INC{ - ERROR = -4 - , EXTERNAL - , TERMINATE - , BYPASS - }; - Bs8s ctxInc(Bs16u se, Bs16u binIdx); - - Bs32u decCAbsLvlR(Bs32s i, Bs32s baseLevel); - Bs32u decAbsMvdMinus2(); - - /////////////////////////////////////////////////// - struct Bin{ - static const Bs16u capacity = 32; - static const Bs32u ff = 0xFFFFFFFF; - - Bin(Bs32u value, Bs8u size) : - n(size) - , b(value & ( ff >> (capacity-size))) { - } - bool operator () (const Bin &bin) const { - return (bin.n == n && bin.b.to_ulong() == b.to_ulong()); - } - void put (Bs32u bits, Bs8u num = 1) { - if(!num) return; - b <<= num; - b |= std::bitset(bits & ( ff >> (capacity-num))); - n += num; - } - Bs32u get() { - return b.to_ulong(); - } - - Bs8u n; - std::bitset b; - }; - typedef std::list Bins; - static const Bs32u binTRx0Size = 32; - - Bs32s m_cAbsLevel; - Bs32s m_cRiceParam; - Bs32s m_cSBIdx; - - Bins m_binFL1; - Bins m_binFL3; - Bins m_binFL31; - Bins m_binICPM; - Bins m_binIPIDC0; - Bins m_binDefault; - Bins m_binTRx0[binTRx0Size]; - - Bins& GetBinarization(Bs16u se); - - void initBins (); - Bins& PartModeBin (bool isIntra, Bs32u log2CbSize); - Bins& CUQPDAbsBin (); - Bin TR (Bs32s synVal, Bs32u cMax, Bs32u cRiceParam); - Bin EGk (Bs32s synVal, Bs32u k); - Bin FL (Bs32s synVal, Bs32u cMax); - - /////////////////////////////////////////////////// - static const Bs8s CtxIncTbl[num_SE_full][6]; - - Bs8u CtxState [CtxTblSize]; - Bs8u CtxStateWpp[CtxTblSize]; - Bs8u CtxStateDs [CtxTblSize]; - - Bs16u ivlCurrRange; - Bs16u ivlOffset; - - Bs8u DecodeBin (Bs8u* ctxTable, Bs16u ctxIdx, bool bypassFlag); - Bs8u DecodeDecision (Bs8u* ctxTable, Bs16u ctxIdx); - Bs8u DecodeBypass (); - Bs8u DecodeTerminate (); - - inline void sync (Bs8u* t) { memcpy(CtxState, t, CtxTblSize); } - inline void store(Bs8u* t) { memcpy(t, CtxState, CtxTblSize); } - inline void RenormD() { - while(ivlCurrRange < 256){ - ivlCurrRange <<= 1; - ivlOffset = ((ivlOffset << 1) | read_1_bit()); - m_pCtx->RawBits ++; - } - } - - inline void trace(Bs8u b = 7) { -#ifdef HEVC_CABAC_STATE_TRACE - fprintf(flog, "Count: %d \tValue: %d \tRange: %d \tBin: %d\n", m_cnt++, ivlOffset, ivlCurrRange, b); - fflush(flog); -#else - (void)b; -#endif //HEVC_CABAC_STATE_TRACE - }; - -#ifdef HEVC_CABAC_STATE_TRACE - Bs32u m_cnt; - Bs32u m_n; - FILE* flog; -#endif //HEVC_CABAC_STATE_TRACE - -}; -}// namespace BS_HEVC; - -#endif // __HEVC_CABAC_H diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_struct.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_struct.h deleted file mode 100644 index 2d9236b..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/include/hevc_struct.h +++ /dev/null @@ -1,931 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#ifndef __HEVC_STRUCT_H -#define __HEVC_STRUCT_H - -#include - -typedef class HEVC_BitStream* BS_HEVC_hdl; - -namespace BS_HEVC{ - -enum INIT_MODE { - INIT_MODE_DEFAULT = 0, - INIT_MODE_CABAC = 1, - INIT_MODE_STORE_SEI_DATA = 2, -}; - -enum TRACE_LEVEL { - TRACE_LEVEL_NALU = 0x00000001, - TRACE_LEVEL_SPS = 0x00000002, - TRACE_LEVEL_PPS = 0x00000004, - TRACE_LEVEL_SLICE = 0x00000008, - TRACE_LEVEL_SEI = 0x00000010, - TRACE_LEVEL_VPS = 0x00000020, - TRACE_LEVEL_REF_LIST = 0x00000040, - TRACE_LEVEL_AU = 0x00000080, - TRACE_LEVEL_CABAC = 0x00000100, - TRACE_LEVEL_FULL = 0xFFFFFFFF -}; - -enum NALU_TYPE{ - TRAIL_N = 0, - TRAIL_R, - TSA_N, - TSA_R, - STSA_N, - STSA_R, - RADL_N, - RADL_R, - RASL_N, - RASL_R, - RSV_VCL_N10, - RSV_VCL_R11, - RSV_VCL_N12, - RSV_VCL_R13, - RSV_VCL_N14, - RSV_VCL_R15, - BLA_W_LP, - BLA_W_RADL, - BLA_N_LP, - IDR_W_RADL, - IDR_N_LP, - CRA_NUT, - RSV_IRAP_VCL22, - RSV_IRAP_VCL23, - RSV_VCL24, - RSV_VCL25, - RSV_VCL26, - RSV_VCL27, - RSV_VCL28, - RSV_VCL29, - RSV_VCL30, - RSV_VCL31, - VPS_NUT, - SPS_NUT, - PPS_NUT, - AUD_NUT, - EOS_NUT, - EOB_NUT, - FD_NUT, - PREFIX_SEI_NUT, - SUFFIX_SEI_NUT, - RSV_NVCL41, - RSV_NVCL42, - RSV_NVCL43, - RSV_NVCL44, - RSV_NVCL45, - RSV_NVCL46, - RSV_NVCL47, - UNSPEC48, - UNSPEC49, - UNSPEC50, - UNSPEC51, - UNSPEC52, - UNSPEC53, - UNSPEC54, - UNSPEC55, - UNSPEC56, - UNSPEC57, - UNSPEC58, - UNSPEC59, - UNSPEC60, - UNSPEC61, - UNSPEC62, - UNSPEC63, - num_NALU_TYPE -}; - -enum PROFILE { - MAIN = 1, - MAIN_10 = 2, - MAIN_SP = 3, - REXT = 4, - REXT_HT = 5, - MAIN_MV = 6, - MAIN_SC = 7, - MAIN_3D = 8, - SCC = 9, -}; - -enum ASPECT_RATIO{ - AR_Unspecified = 0, - AR_1_1, - AR_SQUARE = AR_1_1, - AR_12_11, - AR_10_11, - AR_16_11, - AR_40_33, - AR_24_11, - AR_20_11, - AR_32_11, - AR_80_33, - AR_18_11, - AR_15_11, - AR_64_33, - AR_160_99, - AR_4_3, - AR_3_2, - AR_2_1, - //Reserved - EXTENDED_SAR = 255, - num_ASPECT_RATIO -}; - -enum HASH_TYPE{ - HASH_MD5 = 0, - HASH_CRC, - HASH_CHECKSUM, - num_HASH_TYPE -}; - -enum SLICE_TYPE{ - B = 0, - P, - I, - num_SLICE_TYPE -}; - -enum PICTURE_MARKING{ - UNUSED_FOR_REFERENCE = 0x00, - USED_FOR_SHORTTERM_REFERENCE = 0x01, - USED_FOR_LONGTERM_REFERENCE = 0x02, - USED_FOR_REFERENCE = 0x03, -}; - -struct PTLEntry{ - Bs8u profile_space : 2; - Bs8u tier_flag : 1; - Bs8u profile_idc : 5; - - union{ - Bs32u profile_compatibility_flags; - struct{ - Bs32u profile_compatibility_flag31 : 1; - Bs32u profile_compatibility_flag30 : 1; - Bs32u profile_compatibility_flag29 : 1; - Bs32u profile_compatibility_flag28 : 1; - Bs32u profile_compatibility_flag27 : 1; - Bs32u profile_compatibility_flag26 : 1; - Bs32u profile_compatibility_flag25 : 1; - Bs32u profile_compatibility_flag24 : 1; - Bs32u profile_compatibility_flag23 : 1; - Bs32u profile_compatibility_flag22 : 1; - Bs32u profile_compatibility_flag21 : 1; - Bs32u profile_compatibility_flag20 : 1; - Bs32u profile_compatibility_flag19 : 1; - Bs32u profile_compatibility_flag18 : 1; - Bs32u profile_compatibility_flag17 : 1; - Bs32u profile_compatibility_flag16 : 1; - Bs32u profile_compatibility_flag15 : 1; - Bs32u profile_compatibility_flag14 : 1; - Bs32u profile_compatibility_flag13 : 1; - Bs32u profile_compatibility_flag12 : 1; - Bs32u profile_compatibility_flag11 : 1; - Bs32u profile_compatibility_flag10 : 1; - Bs32u profile_compatibility_flag9 : 1; - Bs32u profile_compatibility_flag8 : 1; - Bs32u profile_compatibility_flag7 : 1; - Bs32u profile_compatibility_flag6 : 1; - Bs32u profile_compatibility_flag5 : 1; - Bs32u profile_compatibility_flag4 : 1; - Bs32u profile_compatibility_flag3 : 1; - Bs32u profile_compatibility_flag2 : 1; - Bs32u profile_compatibility_flag1 : 1; - Bs32u profile_compatibility_flag0 : 1; - }; - }; - - Bs8u progressive_source_flag : 1; - Bs8u interlaced_source_flag : 1; - Bs8u non_packed_constraint_flag : 1; - Bs8u frame_only_constraint_flag : 1; - Bs8u profile_present_flag : 1; - Bs8u level_present_flag : 1; - Bs8u level_idc; -}; - -struct ProfileTierLevel{ - PTLEntry general; - PTLEntry sub_layer[8]; -}; - -struct sub_layer_ordering_info{ - Bs8u max_dec_pic_buffering_minus1 : 4; - Bs8u max_num_reorder_pics : 4; - Bs32u max_latency_increase_plus1; -}; - -struct SubLayerHRD{ - Bs8u fixed_pic_rate_general_flag : 1; - Bs8u fixed_pic_rate_within_cvs_flag : 1; - Bs8u low_delay_hrd_flag : 1; - Bs16u elemental_duration_in_tc_minus1 : 11; - Bs16u cpb_cnt_minus1 : 5; - - struct{ - Bs32u bit_rate_value_minus1 : 31; - Bs32u cpb_size_value_minus1 : 31; - Bs32u cpb_size_du_value_minus1 : 31; - Bs32u bit_rate_du_value_minus1 : 31; - Bs32u cbr_flag : 1; - }cpb[32]; -}; - -struct HRD{ - Bs8u nal_hrd_parameters_present_flag : 1; - Bs8u vcl_hrd_parameters_present_flag : 1; - Bs8u sub_pic_hrd_params_present_flag : 1; - - Bs8u tick_divisor_minus2; - Bs16u du_cpb_removal_delay_increment_length_minus1 : 5; - Bs16u sub_pic_cpb_params_in_pic_timing_sei_flag : 1; - Bs16u dpb_output_delay_du_length_minus1 : 5; - - Bs16u bit_rate_scale : 4; - Bs8u cpb_size_scale : 4; - - Bs8u cpb_size_du_scale : 4; - Bs16u initial_cpb_removal_delay_length_minus1 : 5; - Bs16u au_cpb_removal_delay_length_minus1 : 5; - Bs16u dpb_output_delay_length_minus1 : 5; - - SubLayerHRD sl[8]; -}; - -struct VPSHRD : HRD{ - Bs16u hrd_layer_set_idx : 10; - Bs16u cprms_present_flag : 1; -}; - -struct VPS{ - Bs16u video_parameter_set_id : 4; - Bs16u reserved_three_2bits : 2; - Bs16u max_layers_minus1 : 6; - Bs16u max_sub_layers_minus1 : 3; - Bs16u temporal_id_nesting_flag : 1; - Bs16u reserved_0xffff_16bits; - - ProfileTierLevel ptl; - - Bs8u sub_layer_ordering_info_present_flag : 1; - - sub_layer_ordering_info sub_layer[8]; - - Bs16u max_layer_id : 6; - Bs16u num_layer_sets_minus1 : 10; - - Bs8u** layer_id_included_flag; // max [1024][64]; - - Bs32u num_units_in_tick; - Bs32u time_scale; - Bs32u timing_info_present_flag : 1; - Bs32u poc_proportional_to_timing_flag : 1; - Bs32u num_ticks_poc_diff_one_minus1 : 10; - Bs32u num_hrd_parameters : 10; - - Bs8u extension_flag : 1; - Bs8u extension_data_flag : 1; - - VPSHRD* hrd; //max 1024 -}; - -struct ScalingListData{ - struct{ - Bs16s pred_mode_flag : 2; - Bs16s pred_matrix_id_delta : 4; - Bs16s dc_coef_minus8 : 10; - Bs8s delta_coef[64]; - }entry[4][6]; - Bs16s ScalingList[4][6][64]; -}; - -struct ShortTermRefPicSet{ - Bs8u inter_ref_pic_set_prediction_flag : 1; - Bs8u delta_idx_minus1 : 6; - Bs8u delta_rps_sign : 1; - - Bs16u abs_delta_rps_minus1; - - Bs8u num_negative_pics : 4; - Bs8u num_positive_pics : 4; - - struct{ - struct{ - Bs8u used_by_curr_pic_flag; - Bs8u use_delta_flag; - }; - union{ - struct { - Bs16u delta_poc_s0_minus1 : 15; - Bs16u used_by_curr_pic_s0_flag : 1; - Bs16s DeltaPocS0; - }; - struct { - Bs16u delta_poc_s1_minus1 : 15; - Bs16u used_by_curr_pic_s1_flag : 1; - Bs16s DeltaPocS1; - }; - }; - }pic[16]; -}; - -struct ShortTermRefPicSets{ - Bs8u num_short_term_ref_pic_sets; //0-64 - ShortTermRefPicSet* set; -}; - -struct VUI{ - Bs8u aspect_ratio_info_present_flag : 1; - Bs8u aspect_ratio_idc; - Bs16u sar_width; - Bs16u sar_height; - - Bs8u overscan_info_present_flag : 1; - Bs8u overscan_appropriate_flag : 1; - Bs8u video_signal_type_present_flag : 1; - Bs8u video_format : 3; - Bs8u video_full_range_flag : 1; - Bs8u colour_description_present_flag : 1; - Bs8u colour_primaries; - Bs8u transfer_characteristics; - Bs8u matrix_coeffs; - - Bs8u chroma_loc_info_present_flag : 1; - Bs8u chroma_sample_loc_type_top_field : 3; - Bs8u chroma_sample_loc_type_bottom_field : 3; - - Bs8u neutral_chroma_indication_flag : 1; - Bs8u field_seq_flag : 1; - Bs8u frame_field_info_present_flag : 1; - Bs8u default_display_window_flag : 1; - - Bs32u def_disp_win_left_offset; - Bs32u def_disp_win_right_offset; - Bs32u def_disp_win_top_offset; - Bs32u def_disp_win_bottom_offset; - - Bs8u timing_info_present_flag : 1; - Bs8u hrd_parameters_present_flag : 1; - Bs8u poc_proportional_to_timing_flag : 1; - - Bs8u bitstream_restriction_flag : 1; - Bs8u tiles_fixed_structure_flag : 1; - Bs8u motion_vectors_over_pic_boundaries_flag : 1; - Bs8u restricted_ref_pic_lists_flag : 1; - - Bs32u num_units_in_tick; - Bs32u time_scale; - Bs32u num_ticks_poc_diff_one_minus1; - - Bs32u min_spatial_segmentation_idc : 12; - Bs32u max_bytes_per_pic_denom : 5; - Bs32u max_bits_per_min_cu_denom : 5; - Bs16u log2_max_mv_length_horizontal : 5; - Bs16u log2_max_mv_length_vertical : 4; - - HRD hrd; -}; - -struct SpsRangeExtension{ - Bs8u transform_skip_rotation_enabled_flag : 1; - Bs8u transform_skip_context_enabled_flag : 1; - Bs8u implicit_residual_dpcm_enabled_flag : 1; - Bs8u explicit_residual_dpcm_enabled_flag : 1; - Bs8u extended_precision_processing_flag : 1; - Bs8u intra_smoothing_disabled_flag : 1; - Bs8u high_precision_offsets_enabled_flag : 1; - Bs8u fast_rice_adaptation_enabled_flag : 1; - Bs8u cabac_bypass_alignment_enabled_flag : 1; -}; - -struct SpsSccExtension{ - Bs8u sps_curr_pic_ref_enabled_flag : 1; - Bs8u palette_mode_enabled_flag : 1; - - Bs32u max_bits_ppalette_max_size; - Bs32u delta_palette_max_predictor_size; - - Bs8u sps_palette_predictor_initializer_present_flag : 1; - - Bs32u sps_num_palette_predictor_initializer_minus1; - - Bs8u motion_vector_resolution_control_idc : 2; - Bs8u intra_boundary_filtering_disabled_flag : 1; - - Bs32u* paletteInitializers; -}; - -struct SPS{ - Bs8u video_parameter_set_id : 4; - Bs8u max_sub_layers_minus1 : 3; - Bs8u temporal_id_nesting_flag : 1; - - ProfileTierLevel ptl; - - Bs8u seq_parameter_set_id : 4; - Bs8u chroma_format_idc : 2; - Bs8u separate_colour_plane_flag : 1; - Bs8u conformance_window_flag : 1; - - Bs32u pic_width_in_luma_samples; - Bs32u pic_height_in_luma_samples; - - Bs32u conf_win_left_offset; - Bs32u conf_win_right_offset; - Bs32u conf_win_top_offset; - Bs32u conf_win_bottom_offset; - - Bs8u bit_depth_luma_minus8 : 3; - Bs8u bit_depth_chroma_minus8 : 3; - Bs8u log2_max_pic_order_cnt_lsb_minus4 : 4; - Bs8u sub_layer_ordering_info_present_flag : 1; - - sub_layer_ordering_info sub_layer[8]; - - Bs32u log2_min_luma_coding_block_size_minus3; - Bs32u log2_diff_max_min_luma_coding_block_size; - Bs32u log2_min_transform_block_size_minus2; - Bs32u log2_diff_max_min_transform_block_size; - Bs32u max_transform_hierarchy_depth_inter; - Bs32u max_transform_hierarchy_depth_intra; - - Bs8u scaling_list_enabled_flag : 1; - Bs8u scaling_list_data_present_flag : 1; - - Bs8u amp_enabled_flag : 1; - Bs8u sample_adaptive_offset_enabled_flag : 1; - - Bs8u pcm_enabled_flag : 1; - Bs8u pcm_loop_filter_disabled_flag : 1; - Bs8u pcm_sample_bit_depth_luma_minus1 : 4; - Bs8u pcm_sample_bit_depth_chroma_minus1 : 4; - Bs32u log2_min_pcm_luma_coding_block_size_minus3; - Bs32u log2_diff_max_min_pcm_luma_coding_block_size; - - ScalingListData* sld; - - ShortTermRefPicSets strps; - - Bs8u long_term_ref_pics_present_flag : 1; - Bs8u num_long_term_ref_pics_sps : 6; - - Bs16u lt_ref_pic_poc_lsb_sps[32]; - Bs8u used_by_curr_pic_lt_sps_flag[32]; - - Bs8u temporal_mvp_enabled_flag : 1; - Bs8u strong_intra_smoothing_enabled_flag : 1; - Bs8u vui_parameters_present_flag : 1; - Bs8u extension_flag : 1; - Bs8u sps_range_extension_flag : 1; - Bs8u sps_scc_extension_flag : 1; - - VUI vui; - SpsRangeExtension range_extension; - SpsSccExtension scc_extension; -}; - -struct PpsRangeExtension{ - Bs32u log2_max_transform_skip_block_size_minus2; - Bs8u cross_component_prediction_enabled_flag; - - Bs8u chroma_qp_offset_list_enabled_flag; - Bs8u diff_cu_chroma_qp_offset_depth; - - Bs32u chroma_qp_offset_list_len_minus1; - Bs32u* cb_qp_offset_list; - Bs32u* cr_qp_offset_list; - - Bs32u log2_sao_offset_scale_luma; - Bs32u log2_sao_offset_scale_chroma; -}; - -struct PpsSccExtension{ - Bs8u pps_curr_pic_ref_enabled_flag; - Bs8u residual_adaptive_colour_transform_enabled_flag; - - Bs8u pps_slice_act_qp_offsets_present_flag; - Bs32u pps_act_y_qp_offset_plus5; - Bs32u pps_act_cb_qp_offset_plus5; - Bs32u pps_act_cr_qp_offset_plus3; - - Bs8u pps_palette_predictor_initializer_present_flag; - - Bs32u pps_num_palette_predictor_initializer; - - Bs8u monochrome_palette_flag; - Bs32u luma_bit_depth_entry_minus8; - Bs32u chroma_bit_depth_entry_minus8; - - Bs32u* paletteInitializers; -}; - -struct PPS{ - Bs16u pic_parameter_set_id : 6; - Bs16u seq_parameter_set_id : 4; - Bs16u dependent_slice_segments_enabled_flag : 1; - Bs16u output_flag_present_flag : 1; - Bs16u num_extra_slice_header_bits : 3; - Bs16u sign_data_hiding_enabled_flag : 1; - Bs16u cabac_init_present_flag : 1; - Bs16u num_ref_idx_l0_default_active_minus1 : 4; - Bs16u num_ref_idx_l1_default_active_minus1 : 4; - Bs16u constrained_intra_pred_flag : 1; - Bs16u transform_skip_enabled_flag : 1; - Bs16u cu_qp_delta_enabled_flag : 1; - Bs16u slice_segment_header_extension_present_flag : 1; - - Bs32u diff_cu_qp_delta_depth; - Bs8s init_qp_minus26 : 6; - Bs16s cb_qp_offset : 6; - Bs16s cr_qp_offset : 6; - - Bs8u slice_chroma_qp_offsets_present_flag : 1; - Bs8u weighted_pred_flag : 1; - Bs8u weighted_bipred_flag : 1; - Bs8u transquant_bypass_enabled_flag : 1; - Bs8u tiles_enabled_flag : 1; - Bs8u entropy_coding_sync_enabled_flag : 1; - Bs8u uniform_spacing_flag : 1; - Bs8u loop_filter_across_tiles_enabled_flag : 1; - - Bs16u num_tile_columns_minus1; - Bs16u num_tile_rows_minus1; - - Bs16u* column_width_minus1; - Bs16u* row_height_minus1; - - Bs8u loop_filter_across_slices_enabled_flag : 1; - Bs8u deblocking_filter_control_present_flag : 1; - Bs8u deblocking_filter_override_enabled_flag : 1; - Bs8u deblocking_filter_disabled_flag : 1; - Bs8u scaling_list_data_present_flag : 1; - Bs8u lists_modification_present_flag : 1; - Bs8u extension_flag : 1; - Bs8u range_extension_flag : 1; - Bs8u pps_scc_extension_flag : 1; - - Bs8s beta_offset_div2 : 4; - Bs8s tc_offset_div2 : 4; - - ScalingListData* sld; - - Bs16u log2_parallel_merge_level_minus2; - - PpsRangeExtension range_extension; - PpsSccExtension scc_extension; -}; - -struct BufferingPeriod{ - Bs8u seq_parameter_set_id : 4; - Bs8u irap_cpb_params_present_flag : 1; - Bs8u concatenation_flag : 1; - - Bs32u cpb_delay_offset; - Bs32u dpb_delay_offset; - Bs32u au_cpb_removal_delay_delta_minus1; - - struct CPB{ - Bs32u initial_cpb_removal_delay; - Bs32u initial_cpb_removal_offset; - Bs32u initial_alt_cpb_removal_delay; - Bs32u initial_alt_cpb_removal_offset; - } nal[32], vcl[32]; -}; - -struct PicTiming{ - Bs8u pic_struct : 4; - Bs8u source_scan_type : 2; - Bs8u duplicate_flag : 1; - Bs8u du_common_cpb_removal_delay_flag : 1; - - Bs32u au_cpb_removal_delay_minus1; - Bs32u pic_dpb_output_delay; - Bs32u pic_dpb_output_du_delay; - Bs32u num_decoding_units_minus1; - Bs32u du_common_cpb_removal_delay_increment_minus1; - - Bs32u *num_nalus_in_du_minus1; - Bs32u *du_cpb_removal_delay_increment_minus1; - - ////////////////////////// - VUI* vui; -}; - -struct ActiveParameterSets{ - Bs16u active_video_parameter_set_id : 4; - Bs16u self_contained_cvs_flag : 1; - Bs16u no_parameter_set_update_flag : 1; - Bs16u num_sps_ids_minus1 : 4; - - Bs8u active_seq_parameter_set_id[16]; -}; - -struct RecoveryPoint{ - Bs32s recovery_poc_cnt; - Bs8u exact_match_flag : 1; - Bs8u broken_link_flag : 1; -}; - -struct DecodedPictureHash{ - Bs8u hash_type; - union ColorPlane{ - Bs8u picture_md5[16]; - Bs16u picture_crc; - Bs32u picture_checksum; - }plane[3]; -}; - -static const Bs16u MaxSEIPayloads = 64; - -struct SEI{ - Bs16u NumMessage; - - struct MSG{ - Bs32u payloadType; - Bs32u payloadSize; - - union { - void *payload; - ActiveParameterSets *aps; - BufferingPeriod *bp; - PicTiming *pt; - RecoveryPoint *rp; - DecodedPictureHash *dph; - Bs8u *rawData; - }; - - } message[MaxSEIPayloads]; -}; - -struct AUD{ - Bs8u pic_type : 3; -}; - -struct LongTerm{ - Bs8u lt_idx_sps : 5; - Bs8u used_by_curr_pic_lt_flag : 1; - Bs8u delta_poc_msb_present_flag : 1; - Bs32u poc_lsb_lt; - Bs32u delta_poc_msb_cycle_lt; -}; - -struct RefPicListsMod{ - Bs8u ref_pic_list_modification_flag_l0 : 1; - Bs8u ref_pic_list_modification_flag_l1 : 1; - Bs16u list_entry_l0[16]; - Bs16u list_entry_l1[16]; -}; - -struct PredWeightTable{ - Bs8u luma_log2_weight_denom : 3; - Bs8s delta_chroma_log2_weight_denom : 4; - - struct { - Bs8u luma_weight_lx_flag : 1; - Bs8u chroma_weight_lx_flag : 1; - Bs8s delta_luma_weight_lx; - Bs8s luma_offset_lx; - Bs8s delta_chroma_weight_lx[2]; - Bs8s delta_chroma_offset_lx[2]; - } l0[16], l1[16]; -}; - -struct SAO{ - Bs8u type_idx: 2; - union{ - Bs8u band_position : 5; - Bs8u eo_class : 2; - }; - Bs8s offset[4]; -}; - -struct Residual{ - Bs8u transform_skip_flag : 1; - - Bs8u last_sig_coeff_x_prefix; - Bs8u last_sig_coeff_y_prefix; - Bs8u last_sig_coeff_x_suffix; - Bs8u last_sig_coeff_y_suffix; - - //rest data skipped for now - //Bs16u coded_sub_block_flags; -}; - -struct PredUnit{ - Bs16u x; - Bs16u y; - - Bs8u merge_idx : 3; - Bs8u merge_flag : 1; - Bs8u inter_pred_idc : 2; - Bs8u mvp_l0_flag : 1; - Bs8u mvp_l1_flag : 1; - Bs8u ref_idx_l0 : 4; - Bs8u ref_idx_l1 : 4; - - Bs16s MvdLX[2][2]; -}; - -struct TransTree{ - Bs16u x; - Bs16u y; - Bs8u QpY; - Bs8u trafoDepth; - Bs8s cu_qp_delta; - Bs8u split_transform_flag : 1; - Bs8u cbf_cb : 1; - Bs8u cbf_cr : 1; - Bs8u cbf_luma : 1; - - //Residual rc[3]; - TransTree* split; -}; - -struct CQT{ - Bs16u x; - Bs16u y; - Bs16u CtDepth; - - Bs8u split_cu_flag : 1; - Bs8u cu_transquant_bypass_flag : 1; - Bs8u cu_skip_flag : 1; - Bs8u pred_mode_flag : 1; - Bs8u part_mode : 3; - Bs8u pcm_flag : 1; - - struct LumaPred{ - Bs8u prev_intra_luma_pred_flag : 1; - Bs8u mpm_idx : 2; - Bs8u rem_intra_luma_pred_mode : 5; - }luma_pred[2][2]; - - Bs8u intra_chroma_pred_mode : 4; - Bs8u rqt_root_cbf : 1; - - TransTree* tu; - PredUnit* pu; - CQT* split; -}; - -struct CTU{ - CQT cqt; - Bs16u CtbAddrInRs; - Bs16u CtbAddrInTs; - Bs16u RawBits; - - Bs8u end_of_slice_segment_flag : 1; - Bs8u sao_merge_left_flag : 1; - Bs8u sao_merge_up_flag : 1; - - SAO sao[3]; -}; - -struct Slice{ - Bs8u no_output_of_prior_pics_flag : 1; - Bs8u pic_parameter_set_id : 6; - Bs8u dependent_slice_segment_flag : 1; - - Bs32u segment_address; - - Bs8u reserved_flags; - Bs8u type : 2; - Bs8u colour_plane_id : 2; - Bs8u short_term_ref_pic_set_idx; - - Bs8u pic_output_flag : 1; - Bs8u short_term_ref_pic_set_sps_flag : 1; - Bs8u num_long_term_sps : 6; - - Bs8u first_slice_segment_in_pic_flag : 1; - Bs8u temporal_mvp_enabled_flag : 1; - Bs8u sao_luma_flag : 1; - Bs8u sao_chroma_flag : 1; - Bs8u num_ref_idx_active_override_flag : 1; - Bs8u mvd_l1_zero_flag : 1; - Bs8u cabac_init_flag : 1; - Bs8u collocated_from_l0_flag : 1; - - Bs8u collocated_ref_idx : 4; - Bs8u five_minus_max_num_merge_cand : 3; - Bs8u use_integer_mv_flag : 1; - - Bs8u num_ref_idx_l0_active_minus1 : 4; - Bs8u num_ref_idx_l1_active_minus1 : 4; - - Bs32u pic_order_cnt_lsb; - Bs16u num_long_term_pics; - - Bs16s slice_qp_delta : 6; - Bs16s slice_cb_qp_offset : 5; - Bs16s slice_cr_qp_offset : 5; - - Bs16s act_y_qp_offset : 5; - Bs16s act_cb_qp_offset : 5; - Bs16s act_cr_qp_offset : 5; - - Bs8u cu_chroma_qp_offset_enabled_flag : 1; - Bs8u deblocking_filter_override_flag : 1; - Bs8u deblocking_filter_disabled_flag : 1; - Bs8u loop_filter_across_slices_enabled_flag : 1; - Bs8u offset_len_minus1 : 5; - - Bs8s beta_offset_div2 : 4; - Bs8s tc_offset_div2 : 4; - - Bs32u num_entry_point_offsets; - - ShortTermRefPicSet strps; - - LongTerm *lt; - RefPicListsMod *rplm; - PredWeightTable *pwt; - Bs32u *entry_point_offset_minus1; - - ////////////////////////// - Bs16u NumPocTotalCurr; - Bs32s PicOrderCntVal; - - SPS *sps; - PPS *pps; - - Bs32u NumCU; - CTU **CuInTs; //coding units in tile scan -}; - -struct NALU{ - Bs64u StartOffset; - Bs32u NumBytesInNalUnit; - Bs32u NumBytesInRbsp; - - Bs16u forbidden_zero_bit : 1; - Bs16u nal_unit_type : 6; - Bs16u nuh_layer_id : 6; - Bs16u nuh_temporal_id_plus1 : 3; - - union{ - void *unit; - VPS *vps; - SPS *sps; - PPS *pps; - SEI *sei; - AUD *aud; - Slice *slice; - }; -}; - -struct Picture{ - union { - Bs8u used; //used for reference - struct{ - Bs8u st : 1; // used for short-term reference - Bs8u lt : 1; // used for long-term reference - Bs8u reserved0 : 1; - Bs8u reserved1 : 1; - Bs8u reserved2 : 1; - Bs8u reserved3 : 1; - Bs8u reserved4 : 1; - Bs8u reserved5 : 1; - }; - }; - Bs8s TId; - Bs32s PicOrderCntVal; - Bs32u pic_order_cnt_lsb; - - Bs32u NumSlice; - NALU** slice; - - Picture* RefPicList0[16]; - Picture* RefPicList1[16]; - - Bs32u NumCU; - CTU* CuInRs; //coding units in raster scan -}; - -struct AU{ - Bs32u NumUnits; - NALU** nalu; //NALU* nalu[NumUnits]; - Picture* pic; -}; - -}; - -#endif //#ifndef __HEVC_STRUCT_H \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader.cpp deleted file mode 100644 index f222795..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader.cpp +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include - -#define BS_SKIP_IGNORED_BYTES() \ - if( ignore_bytes_cnt && next_ignored_byte ) \ - if( *next_ignored_byte == (file_pos+offset) ){ \ - offset++; \ - next_ignored_byte++; \ - ignore_bytes_cnt--; \ - if( buf_size < offset+readBytes+((lastBits)?1:0) ){ \ - if(read_more_data()) return last_err; \ - } \ - } - -Bs32u BS_Reader::ue_v(){ - Bs32s leadingZeroBits = -1; - for( byte b = 0; !b; leadingZeroBits++ ) b = read_1_bit(); - return (1<>1) : -(Bs32s)((val+1)>>1); -} - -BSErr BS_Reader::read_more_data(){ - if( !bs ) return last_err = BS_ERR_MORE_DATA; - if( BS_FEOF(bs) ) return last_err = BS_ERR_MORE_DATA; - Bs32u keep_bytes = buf_size-offset; - if( keep_bytes == buf_size ) return last_err = BS_ERR_NOT_ENOUGH_BUFFER; - if( offset < buf_size ) memcpy( buf, buf+offset, keep_bytes ); - file_pos = BS_FTELL(bs) - keep_bytes; - if( !(buf_size = (Bs32u)BS_FREAD( bs, buf+keep_bytes, offset)) ) /*return*/ last_err = BS_ERR_MORE_DATA; - buf_size += keep_bytes; - offset = 0; - return last_err; -} - -byte BS_Reader::read_1_bit(){ - if(!bit){ - // skip start code emulation prevention byte - if( ignore_bytes_cnt && next_ignored_byte ){ - if( *next_ignored_byte == (file_pos+offset) ){ - if (buf_size == offset) - if (read_more_data()) - return last_err; - offset++; - next_ignored_byte++; - ignore_bytes_cnt--; - } - } - if( buf_size <= offset ){ - if(read_more_data()) return last_err; - } - } - byte res = ((buf[offset] >> (7 - bit)) & 1); - bit = (bit+1)&0x07; - offset += !bit; - - return res; -} - -byte BS_Reader::read_1_byte(){ - if( buf_size == offset ){ - if(read_more_data()) return (byte)last_err; - }; - if( !bit ) return buf[offset++]; - offset++; - return (buf[offset-1]<>(8-bit)); -} - -Bs32u BS_Reader::next_bits( Bs32u nBits /*1..32*/ ){ - byte haveBits = bit ? (8-bit) : 0; // already in buffer - byte lockedByte = bit ? 1 : 0; - Bs32u readBytes = (byte)(nBits - haveBits + 7)>>3; //bytes to read - byte lastBits = (byte)( readBytes ? ((nBits - haveBits)%8) : nBits ); //bits to read in last byte - Bs32u tmp_offset = offset; - Bs32u res = 0; - - if( readBytes ){ - if( buf_size < offset+lockedByte+readBytes ){ - if(read_more_data()) return last_err; - tmp_offset = offset; - }; - - if( lockedByte ){ - res = (byte)( buf[tmp_offset]<>bit; - tmp_offset++; - } - - if( lastBits )readBytes--; - while( readBytes-- ){ - res = (res<<8)|(byte)(buf[tmp_offset]); - tmp_offset++; - } - if( lastBits ){ - res = (res<>(8-lastBits)); - } - }else if( lastBits ){ - res = (byte)( buf[tmp_offset]<>(8-lastBits); - } - return res; -} - -Bs32u BS_Reader::next_bytes(byte nBytes /*1..4*/){ - if(buf_size < offset + nBytes){ - if(read_more_data()) return last_err; - } - - //in order from most often invoked - if(nBytes == 3) return (buf[offset]<<16)|(buf[offset+1]<<8)|buf[offset+2]; - else if(nBytes == 4) return (buf[offset]<<24)|(buf[offset+1]<<16)|(buf[offset+2]<<8)|buf[offset+3]; - else if(nBytes == 1) return buf[offset]; - else if(nBytes == 2) return (buf[offset]<<8)|buf[offset+1]; - - return last_err = BS_ERR_INVALID_PARAMS; -} - - -Bs32u BS_Reader::read_bits( Bs32u nBits /*1..32*/){ - byte haveBits = bit ? (8-bit) : 0; // already in buffer - byte lockedByte = bit ? 1 : 0; - Bs32u readBytes = (byte)(nBits - haveBits + 7)>>3; //bytes to read - byte lastBits = (byte)( readBytes ? ((nBits - haveBits)%8) : nBits ); //bits to read in last byte - Bs32u res = 0; - - if( readBytes ){ - if( buf_size < offset+lockedByte+readBytes ){ - if(read_more_data()) return last_err; - } - - if( lockedByte ){ - res = (byte)( buf[offset]<>bit; - offset++; - } - - if( lastBits )readBytes--; - while( readBytes-- ){ - BS_SKIP_IGNORED_BYTES(); - res = (res<<8)|(byte)(buf[offset]); - offset++; - } - BS_SKIP_IGNORED_BYTES(); - - if( lastBits ){ - res = (res<>(8-lastBits)); - } - - bit = lastBits; - - }else if( lastBits ){ - if( buf_size <= offset ){ - if(read_more_data()) return last_err; - } - res = (byte)( buf[offset]<>(8-lastBits); - if( (lastBits + bit)>>3 ){ - bit = 0; - offset++; - }else bit = (byte)(lastBits + bit ); - } - - return res; -} - -BSErr BS_Reader::shift( long nBytes ){ - if(nBytes > 0) - return shift_forward(nBytes); - else - return shift_back(-nBytes); - - return BS_ERR_UNKNOWN; -} - -BSErr BS_Reader::shift_forward( Bs32u nBytes ){ - bit = 0; - if( nBytes+offset > buf_size){ - if(bs){ - nBytes -= (buf_size-offset); - BS_FSEEK( bs, nBytes, SEEK_CUR ); - buf_size = BS_BUF_SIZE; // set max buf size - offset = buf_size; - last_err = read_more_data(); - file_pos = BS_FTELL(bs) - buf_size; - }else{ - return last_err = BS_ERR_MORE_DATA; - } - }else{ - offset += nBytes; - } - return BS_ERR_NONE; -} - -BSErr BS_Reader::shift_back( Bs32u nBytes ){ - bit = 0; - if( nBytes > offset ){ - if(bs){ - nBytes += (buf_size-offset); - BS_FSEEK( bs, -(BS_FOFFSET_TYPE)nBytes, SEEK_CUR ); - buf_size = BS_BUF_SIZE; // set max buf size - offset = buf_size; - last_err = read_more_data(); - file_pos = BS_FTELL(bs) - buf_size; - }else{ - return last_err = BS_ERR_MORE_DATA; - } - }else{ - offset -= nBytes; - } - return BS_ERR_NONE; -} - -void BS_Reader::ignore_next_byte(){ - ignore_bytes = (BS_FADDR_TYPE*)realloc(ignore_bytes,(ignore_bytes_cnt+1)*sizeof(BS_FADDR_TYPE)); - if (!ignore_bytes) - throw std::bad_alloc(); - ignore_bytes[ignore_bytes_cnt] = file_pos+offset; - ignore_bytes_cnt++; -} - -BSErr BS_Reader::open( const char* file_name ) { - buf_size = BS_BUF_SIZE; - offset = buf_size; - buf = (byte*)malloc( buf_size ); - - if(bs) { - if(close()) return last_err; - } - - BS_FOPEN(file_name, bs); - - return last_err = (bs) ? BS_ERR_NONE : BS_ERR_UNKNOWN; -} - -void BS_Reader::set_buffer(byte *buf, Bs32u buf_size){ - if(bs){ - close(); - bs = NULL; - } - last_err = BS_ERR_NONE; - file_pos = 0; - offset = 0; - bit = 0; - ignore_bytes_cnt = 0; - next_ignored_byte = NULL; - this->buf = buf; - this->buf_size = buf_size; -} - -void BS_Reader::skip_bytes( Bs32u nBytes ){ - while( Bs32u(next_ignored_byte - ignore_bytes) < ignore_bytes_cnt ){ - if( (*next_ignored_byte) > (file_pos+offset+nBytes) ) break; - nBytes++; - next_ignored_byte++; - } - shift_forward(nBytes); -} - -BSErr BS_Reader::read_arr(byte *arr, Bs32u size){ - if(bit) return BS_ERR_UNKNOWN; - while(size){ - Bs32u to_copy = BS_MIN(size, buf_size - offset); - memcpy(arr, buf+offset, to_copy); - size -= to_copy; - offset += to_copy; - if(size && read_more_data()) return last_err; - arr += to_copy; - } - return last_err; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader2.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader2.cpp deleted file mode 100644 index 2877de6..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_reader2.cpp +++ /dev/null @@ -1,523 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "bs_reader2.h" -#include - -namespace BsReader2 -{ -File::File() - : m_f(0) -{} - -File::~File() -{ - Close(); -} - -bool File::Open(const char* file, Bs32u buffSize) -{ - Close(); -#if !defined(__GNUC__) && !defined(__clang__) - #pragma warning(disable:4996) -#endif - - m_f = fopen(file, "rb"); - if (m_f) - m_b.resize(buffSize); - return !!m_f; -} - -void File::Close() -{ - if (m_f) - fclose(m_f); - m_f = 0; -} - -bool File::UpdateBuffer(Bs8u*& start, Bs8u*& cur, Bs8u*& end, Bs32u keepBytes) -{ - if (!m_f || feof(m_f)) - return false; - - keepBytes = BS_MIN(keepBytes, Bs32u(cur - start)); - cur -= keepBytes; - - if (Bs32u(end - cur) >= m_b.size()) - return false; - - memmove(&m_b[0], cur, end - cur); - - start = &m_b[0]; - end = start + (end - cur); - cur = start + keepBytes; - - end += fread(end, 1, m_b.size() - (end - start), m_f); - -#if 0 - printf("\n"); - for (Bs32u i = 0; i < keepBytes; i++) - printf("%02X ", start[i]); - printf("\n"); - - for (Bs32u i = 0; i < (end - cur); i++) - { - if (i%16 == 0) - printf("\n"); - printf("%02X ", cur[i]); - } - printf("\n"); - fflush(stdout); -#endif - - return true; -} - - -Reader::Reader() -{ - m_bsStart = 0; - m_bsEnd = 0; - m_bs = 0; - m_bitOffset = 0; - m_bitStart = 0; - m_emulation = false; - m_updater = 0; - m_trace = true; - m_traceOffset = true; - m_traceLevel = 0xFFFFFFFF; - m_tla = m_trace; - m_tln = 0; - m_log = stdout; -} - -Reader::~Reader() -{ -} - -void Reader::Reset(Bs8u* bs, Bs32u size, Bs8u bitOffset) -{ - if (bs) - { - m_bsStart = bs; - m_bsEnd = bs + size; - m_bs = bs; - m_bitOffset = (bitOffset & 7); - m_bitStart = (bitOffset & 7); - } - else - { - m_bs = m_bsStart; - m_bitOffset = m_bitStart; - } - m_updater = 0; - m_startOffset = 0; -} - -void Reader::MoreData(Bs32u keepBytes) -{ - auto NewOffset = m_startOffset; - keepBytes = BS_MIN(keepBytes, Bs32u(m_bs - m_bsStart)); - - if (m_bsStart && m_bs && m_bsEnd) - NewOffset += (m_bs - m_bsStart) - keepBytes; - - if ( !m_updater - || !m_updater->UpdateBuffer(m_bsStart, m_bs, m_bsEnd, keepBytes)) - throw EndOfBuffer(); - - m_startOffset = NewOffset; -} - -bool Reader::MoreDataNoThrow(Bs32u keepBytes) -{ - auto NewOffset = m_startOffset; - keepBytes = BS_MIN(keepBytes, Bs32u(m_bs - m_bsStart)); - - if (m_bsStart && m_bs && m_bsEnd) - NewOffset += (m_bs - m_bsStart) - keepBytes; - - if ( !m_updater - || !m_updater->UpdateBuffer(m_bsStart, m_bs, m_bsEnd, keepBytes)) - return false; - - m_startOffset = NewOffset; - return true; -} - -bool Reader::NextStartCode(bool stopBefore) -{ - if (m_bitOffset) - ++m_bs; - - m_bitOffset = 0; - - for (;; m_bs++) - { - if (m_bs >= m_bsEnd) - MoreData(); - - if ( m_bs - m_bsStart >= 2 - && m_bs[0] == 0x01 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00) - { - bool LongSC = (m_bs - m_bsStart >= 3) && m_bs[-3] == 0x00; - - if (stopBefore) - m_bs -= (3 + LongSC); - - ++m_bs; - - return LongSC; - } - - if ( m_emulation - && m_bs - m_bsStart >= 2 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00) - { - if (m_bs + 1 >= m_bsEnd) - MoreDataNoThrow(); - - if ( (m_bsEnd - m_bs) >= 1 - && m_bs[0] == 0x03 - && (m_bs[1] & 0xfc) == 0x00) - { - ++m_bs; - ++m_emuBytes; - } - } - } - - return false; -} - -bool Reader::TrailingBits(bool stopBefore) -{ - if (m_bs >= m_bsEnd) - MoreData(); - - if (Bs8u((*m_bs) << m_bitOffset) == 0x80) - { - if (!stopBefore) - { - m_bitOffset = 0; - ++m_bs; - } - return true; - } - - return false; -} - -bool Reader::NextBytes(Bs8u* b, Bs32u n) -{ - if (m_bs + n >= m_bsEnd) - MoreDataNoThrow(); - - if (m_bs + n >= m_bsEnd) - return false; - - if (b != m_bs) - memcpy(b, m_bs, n); - - return true; -} - -Bs32u Reader::GetByte() -{ - if (m_bs >= m_bsEnd) - MoreData(); - - Bs32u b = *m_bs; - - ++m_bs; - - if ( m_emulation - && m_bs - m_bsStart >= 2 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00) - { - if (m_bs+1 >= m_bsEnd) - MoreDataNoThrow(); - - if ( (m_bsEnd - m_bs) >= 1 - && m_bs[0] == 0x03 - && (m_bs[1] & 0xfc) == 0x00) - { - ++m_bs; - ++m_emuBytes; - } - } - - return b; -} - -Bs32u Reader::GetBytes(Bs32u n, bool nothrow) -{ - Bs32u b = 0; - - while (n--) - { - if (m_bs >= m_bsEnd) - { - if (!nothrow) - MoreData(); - else if (!MoreDataNoThrow()) - return (b << (8 * (n + 1))); - } - - b = (b << 8) | *m_bs; - - ++m_bs; - - if ( m_emulation - && m_bs - m_bsStart >= 2 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00) - { - if (m_bs + 1 >= m_bsEnd) - MoreDataNoThrow(); - - if ((m_bsEnd - m_bs) >= 1 - && m_bs[0] == 0x03 - && (m_bs[1] & 0xfc) == 0x00) - { - ++m_bs; - ++m_emuBytes; - } - } - } - - return b; -} - -void Reader::ReturnByte() -{ - if (--m_bs < m_bsStart) - throw Exception(BS_ERR_NOT_ENOUGH_BUFFER); - - if ( m_emulation - && (m_bs - m_bsStart) > 3 - && m_bs[ 0] == 0x03 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00 - && (m_bs[1] >> 2) == 0x00) - { - --m_emuBytes; - - if (--m_bs < m_bsStart) - throw Exception(BS_ERR_NOT_ENOUGH_BUFFER); - } -} - -void Reader::ReturnBits(Bs32u n) -{ - while (n >= 8) - { - ReturnByte(); - n -= 8; - } - - if (n > m_bitOffset) - { - ReturnByte(); - m_bitOffset += 8; - } - - m_bitOffset -= n; -} - -Bs32u Reader::ExtractData(Bs8u* buf, Bs32u size) -{ - assert(!m_bitOffset); // TODO - assert(!m_emulation); // TODO - Bs8u* begin = buf; - Bs8u* end = buf + size; - - while (buf < end) - { - Bs32u S = Bs32u(m_bsEnd - m_bs); - S = BS_MIN(S, size); - - memmove(buf, m_bs, S); - buf += S; - m_bs += S; - - if (m_bsEnd == m_bs) - { - if (MoreDataNoThrow()) - break; - } - } - - return Bs32u(buf - begin); -} - -Bs32u Reader::ExtractRBSP(Bs8u* buf, Bs32u size) -{ - Bs8u* begin = buf; - - m_bitOffset = 0; - - if (size < 4) - throw Exception(BS_ERR_NOT_ENOUGH_BUFFER); - - if (m_bs + 4 >= m_bsEnd) - MoreDataNoThrow(); - - if (m_bs + 3 >= m_bsEnd) - { - while (m_bs < m_bsEnd) - *buf++ = *m_bs++; - - return Bs32u(buf - begin); - } - - *buf++ = *m_bs++; - *buf++ = *m_bs++; - *buf++ = *m_bs++; - - if (m_bs >= m_bsEnd && !MoreDataNoThrow()) - return Bs32u(buf - begin); - - size -= 3; - - for (;;) - { - if ( m_bs[0] == 0x01 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00) - { - bool LongSC = (m_bs - m_bsStart >= 3) && *(m_bs - 3) == 0x00; - m_bs -= (1 + LongSC); - buf -= (1 + LongSC); - - return Bs32u(buf - begin); - } - - if (!size--) - throw Exception(BS_ERR_NOT_ENOUGH_BUFFER); - - *buf++ = *m_bs++; - - if (m_bs >= m_bsEnd && !MoreDataNoThrow()) - return Bs32u(buf - begin); - - if ( m_emulation - && m_bs[-1] == 0x03 - && m_bs[-2] == 0x00 - && m_bs[-3] == 0x00 - && (m_bs[0] >> 2) == 0x00) - { - m_emuBytes++; - buf--; - } - } - - return 0; -} - -Bs32u Reader::GetBit() -{ - if (m_bs >= m_bsEnd) - MoreData(); - - Bs32u b = (*m_bs >> (7 - m_bitOffset)) & 1; - - if (++m_bitOffset == 8) - { - ++m_bs; - m_bitOffset = 0; - - if ( m_emulation - && m_bs - m_bsStart >= 2 - && m_bs[-1] == 0x00 - && m_bs[-2] == 0x00) - { - if (m_bs+1 >= m_bsEnd) - MoreDataNoThrow(); - - if ( (m_bsEnd - m_bs) >= 1 - && m_bs[0] == 0x03 - && (m_bs[1] & 0xfc) == 0x00) - { - ++m_bs; - ++m_emuBytes; - } - } - } - - return b; -} - -Bs32u Reader::GetBits(Bs32u n) -{ - Bs32u b = 0; - - while (n--) - b = (b << 1) | GetBit(); - - return b; -} - -void Reader::GetBits(void* b, Bs32u o, Bs32u n) -{ - Bs8u *p = (Bs8u*)b; - - if (o) - { - p += (o / 8); - o &= 7; - *p = (*p & ~(0xFF >> o)); - } - - o = 7 - o; - - while (n--) - { - *p |= GetBit() << o; - - if (!o--) - { - o = 7; - *++p = 0; - } - } -} - -Bs32u Reader::GetUE() -{ - Bs32u lz = 0; - - while (!GetBit()) - lz++; - - return !lz ? 0 : ((1 << lz) | GetBits(lz)) - 1; -} - -Bs32s Reader::GetSE() -{ - Bs32u ue = GetUE(); - return (ue & 1) ? (Bs32s)((ue + 1) >> 1) : -(Bs32s)((ue + 1) >> 1); -} - -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_thread.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_thread.cpp deleted file mode 100644 index 7cb2263..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/bs_thread.cpp +++ /dev/null @@ -1,602 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "bs_thread.h" - -//#define BS_THREAD_TRACE - -#ifdef BS_THREAD_TRACE -#include -#endif - -inline void __notrace(const char*, ...) {} - -const char State2CS[6][8] = { "DONE", "WORKING", "WAITING", "QUEUED", "LOST", "FAILED" }; - -#ifdef BS_THREAD_TRACE -#define BS_THREAD_TRACE_F printf -#define BS_THREAD_TRACE_FLUSH fflush(stdout); -struct __UIA2CS -{ - static char c_str[256]; - __UIA2CS(unsigned int n, unsigned int *s) - { - char* p = c_str; - p++[0] = '{'; - while (n--) - p += sprintf_s(p, 256, " %d", s++[0]); - p++[0] = ' '; - p++[0] = '}'; - p++[0] = 0; - } -}; -char __UIA2CS::c_str[256]; -#else -struct __UIA2CS -{ - char* c_str = nullptr; - __UIA2CS(unsigned int n, unsigned int *s) - { - (void)n; - (void)s; - } -}; -#define BS_THREAD_TRACE_F __notrace -#define BS_THREAD_TRACE_FLUSH -#endif - -using namespace BsThread; - -Scheduler::Scheduler() -{ - m_locked = 0; - m_id = 0; - m_depth = 0; -} - -Scheduler::~Scheduler() -{ - Close(); -} - -void Scheduler::Init(unsigned int nThreads, unsigned int depth) -{ - std::unique_lock lock(m_mtx); - - BS_THREAD_TRACE_F("Scheduler::Init(%d, %d); //T=%d, D=%d, L=%d\n", - nThreads, depth, m_thread.size() + nThreads, m_depth + depth, m_locked + 1); - BS_THREAD_TRACE_FLUSH; - - if (nThreads > m_thread.size()) - { - unsigned int id = (unsigned int)m_thread.size(); - - m_thread.resize(nThreads); - - auto t = m_thread.begin(); - std::advance(t, id); - - for (; t != m_thread.end(); t++) - { - t->id = id++; - t->task = 0; - t->terminate = false; - t->thread = std::thread(Execute, std::ref(*t), std::ref(*this)); - } - } - - m_depth += depth; - m_locked++; -} - -void Scheduler::Close() -{ - std::unique_lock lock(m_mtx); - BS_THREAD_TRACE_F("Scheduler::Close(); //T=%d, D=%d, L=%d\n", - m_thread.size(), m_depth, m_locked ? m_locked - 1 : 0); - BS_THREAD_TRACE_FLUSH; - - if (!m_locked || !--m_locked) - { - for (auto& t : m_thread) - { - std::unique_lock lockTask(t.mtx); - - while (t.task && t.task->state == WORKING) - t.cv.wait(lockTask); - - t.terminate = true; - t.cv.notify_one(); - } - - for (auto& t : m_thread) - t.thread.join(); - - m_thread.resize(0); - m_task.resize(0); - - m_id = 0; - m_depth = 0; - } -} - -unsigned int Scheduler::Submit(Routine* routine, void* par, int priority, unsigned int nDep, unsigned int *dep) -{ - std::unique_lock lock(m_mtx); - BS_THREAD_TRACE_F("Scheduler::Submit(P=%d, D=%s) ", priority, __UIA2CS(nDep, dep).c_str); - BS_THREAD_TRACE_FLUSH; - - while (m_task.size() >= m_depth) - { - bool flag = false; - - m_task.remove_if( - [&] (Task& t) -> bool - { - if (t.state != DONE || !t.dependent.empty()) - return false; - flag = true; - return true; - } - ); - - if (!flag) - { - BS_THREAD_TRACE_F(" -- TaskQueueOverflow\n"); - BS_THREAD_TRACE_FLUSH; - throw TaskQueueOverflow(); - } - else - { - BS_THREAD_TRACE_F(": TaskDequeued "); - BS_THREAD_TRACE_FLUSH; - } - } - - m_task.resize(m_task.size() + 1); - Task& task = m_task.back(); - - task.id = m_id++; - task.Execute = routine; - task.param = par; - task.priority = priority; - task.blocked = 0; - task.n = 0; - task.detach = false; - - for (unsigned int i = 0; i < nDep; i++) - { - auto it = std::find_if(m_task.begin(), m_task.end(), - [&] (Task& t) -> bool { return t.id == dep[i]; }); - - if (it != m_task.end()) - { - if (it->state == FAILED || it->state == LOST) - { - BS_THREAD_TRACE_F(": ID=%d BL=0 -- LOST on %d\n", task.id, it->id); - BS_THREAD_TRACE_FLUSH; - - task.blocked = 0; - task.state = LOST; - return task.id; - } - - if (it->state != DONE) - { - it->dependent.push_back(&task); - task.blocked++; - } - } - } - - task.state = task.blocked ? WAITING : QUEUED; - - BS_THREAD_TRACE_F(": ID=%d BL=%d -- QUEUED\n", task.id, task.blocked); - BS_THREAD_TRACE_FLUSH; - - Update(*this, 0); - - return task.id; -} - -State Scheduler::Sync(unsigned int id, unsigned int waitMS, bool keepStat) -{ - std::unique_lock lock(m_mtx); - State st = LOST; - BS_THREAD_TRACE_F("Scheduler::Sync(ID=%d, Wait=%d, Keep=%d) ", id, waitMS, keepStat); - BS_THREAD_TRACE_FLUSH; - - auto it = std::find_if(m_task.begin(), m_task.end(), - [&] (Task& t) -> bool { return t.id == id; }); - - if (it == m_task.end() || it->detach) - { - BS_THREAD_TRACE_F("-- LOST(DEQUEUED)\n"); - BS_THREAD_TRACE_FLUSH; - return LOST; - } - Task* pTask = &*it; - st = pTask->state; - - if (waitMS) - { - BS_THREAD_TRACE_F(": wait\n"); - BS_THREAD_TRACE_FLUSH; - - lock.unlock(); - - { - std::unique_lock lockTask(pTask->mtx); - - pTask->cv.wait_for(lockTask, std::chrono::milliseconds(waitMS), - [&]() -> bool { return Ready(pTask->state); } ); - - st = pTask->state; - } - - lock.lock(); - - BS_THREAD_TRACE_F("Scheduler::Sync(ID=%d, Wait=%d, Keep=%d) : return ", id, waitMS, keepStat); - BS_THREAD_TRACE_FLUSH; - } - - if (Ready(st) && !keepStat) - { - m_task.remove_if([&] (Task& t) -> bool { return t.id == id; }); - } - - BS_THREAD_TRACE_F("-- %s\n", State2CS[st]); - BS_THREAD_TRACE_FLUSH; - - return st; -} - -void Scheduler::Detach(SyncPoint id) -{ - std::unique_lock lock(m_mtx); - BS_THREAD_TRACE_F("Scheduler::Detach(ID=%d) ", id); - BS_THREAD_TRACE_FLUSH; - - auto itT = std::find_if(m_task.begin(), m_task.end(), - [&] (Task& t) -> bool { return t.id == id; }); - - if (itT == m_task.end()) - { - BS_THREAD_TRACE_F("-- LOST(DEQUEUED)\n"); - BS_THREAD_TRACE_FLUSH; - return; - } - - BS_THREAD_TRACE_F(" -- %s\n", State2CS[itT->state]); - - itT->detach = true; - - if (Ready(itT->state)) - { - m_task.remove_if([&] (Task& t) -> bool { return t.id == id; }); - } -} - -bool Scheduler::WaitForAny(unsigned int waitMS) -{ - std::unique_lock lock(m_mtx); - - return (std::cv_status::timeout == m_cv.wait_for(lock, std::chrono::milliseconds(waitMS))); -} - -State Scheduler::AddDependency(SyncPoint id, unsigned int nDep, SyncPoint *dep) -{ - std::unique_lock lock(m_mtx); - BS_THREAD_TRACE_F("Scheduler::AddDependency(ID=%d, D=%s) ", id, __UIA2CS(nDep, dep).c_str); - BS_THREAD_TRACE_FLUSH; - - auto itT = std::find_if(m_task.begin(), m_task.end(), - [&] (Task& t) -> bool { return t.id == id; }); - - if (itT == m_task.end()) - { - BS_THREAD_TRACE_F("-- LOST(DEQUEUED)\n"); - BS_THREAD_TRACE_FLUSH; - return LOST; - } - Task& task = *itT; - - if (Ready(task.state) || task.state == WORKING) - { - BS_THREAD_TRACE_F("-- %s\n", State2CS[task.state]); - BS_THREAD_TRACE_FLUSH; - return task.state; - } - - for (unsigned int i = 0; i < nDep; i++) - { - auto it = std::find_if(m_task.begin(), m_task.end(), - [&] (Task& t) -> bool { return t.id == dep[i]; }); - - if (it != m_task.end()) - { - auto& base = *it; - std::unique_lock lockTask(task.mtx); - - if (base.state == FAILED || base.state == LOST) - { - BS_THREAD_TRACE_F(" -- LOST on %d\n", base.id); - BS_THREAD_TRACE_FLUSH; - - task.blocked = 0; - task.state = LOST; - return LOST; - } - - if (base.state != DONE) - { - //std::unique_lock lockBase(task.mtx); - base.dependent.push_back(&task); - task.blocked++; - } - } - } - - if (task.blocked) - { - std::unique_lock lockTask(task.mtx); - task.state = WAITING; - } - - BS_THREAD_TRACE_F("-- %s\n", State2CS[task.state]); - BS_THREAD_TRACE_FLUSH; - - return task.state; -} - -bool Scheduler::Abort(SyncPoint id, unsigned int waitMS) -{ - std::unique_lock lock(m_mtx); - BS_THREAD_TRACE_F("Scheduler::Abort(ID=%d, Wait=%d) ", id, waitMS); - BS_THREAD_TRACE_FLUSH; - - auto it = std::find_if(m_task.begin(), m_task.end(), - [&] (Task& t) -> bool { return t.id == id; }); - - if (it == m_task.end()) - { - BS_THREAD_TRACE_F("-- LOST(DEQUEUED)\n"); - BS_THREAD_TRACE_FLUSH; - return true; - } - - Task* pTask = &*it; - BS_THREAD_TRACE_F(": wait\n"); - BS_THREAD_TRACE_FLUSH; - - lock.unlock(); - - { - std::unique_lock lockTask(pTask->mtx); - - pTask->cv.wait_for(lockTask, std::chrono::milliseconds(waitMS), - [&]() -> bool { return pTask->state != WORKING; } ); - } - - lock.lock(); - - if (pTask->state != WORKING) - { - BS_THREAD_TRACE_F("Scheduler::Abort(ID=%d, Wait=%d) : DONE\n", id, waitMS); - BS_THREAD_TRACE_FLUSH; - pTask->state = LOST; - - if (!pTask->dependent.empty()) - _AbortDependent(*pTask); - - if (pTask->blocked) - { - for (auto& t : m_task) - t.dependent.remove(pTask); - } - - m_task.remove_if([&] (Task& t) -> bool { return t.id == id; }); - - return true; - } - - BS_THREAD_TRACE_F("Scheduler::Abort(ID=%d, Wait=%d) : WORKING\n", id, waitMS); - BS_THREAD_TRACE_FLUSH; - - return false; -} - -void Scheduler::_AbortDependent(Task& task) -{ - BS_THREAD_TRACE_F(" Abort:"); - - for (auto& dep : task.dependent) - { - std::unique_lock lockDep(dep->mtx); - dep->blocked = 0; - dep->state = LOST; - BS_THREAD_TRACE_F(" %d", dep->id); - dep->cv.notify_one(); - } - task.dependent.resize(0); - - BS_THREAD_TRACE_F("\n"); - BS_THREAD_TRACE_FLUSH; -} - -void Scheduler::Execute(Thread& self, Scheduler& sync) -{ - std::unique_lock lockThread(self.mtx); - - while (!self.terminate) - { - while (self.task) - { - auto st = self.task->Execute(self.task->param, self.task->n); - - { - std::unique_lock lock(sync.m_mtx); - self.task->state = st; - self.task->n++; - Update(sync, &self); - } - - } - - while (!self.task && !self.terminate) - self.cv.wait(lockThread); - } -} - -void Scheduler::Update(Scheduler& self, Thread* thread) -{ - std::unique_lock lock(self.m_mtx); - auto FindThread = [&] () -> Thread* - { - auto it = std::find_if(self.m_thread.begin(), self.m_thread.end(), - [] (Thread& t) -> bool { return !t.task; }); - - if (it == self.m_thread.end()) - return 0; - - return &*it; - }; - std::list queued; - std::list detached; - - BS_THREAD_TRACE_F("Scheduler::Update()\n"); - BS_THREAD_TRACE_FLUSH; - - if (thread && thread->task) - { - BS_THREAD_TRACE_F(" : TH=%d ID=%d N=%d -- %s\n", - thread->id, thread->task->id, thread->task->n, State2CS[thread->task->state]); - BS_THREAD_TRACE_FLUSH; - - if (thread->task->state == WORKING) - thread->task->state = QUEUED; - - if ( thread->task->state == DONE - || thread->task->state == FAILED) - { - std::unique_lock lockTask(thread->task->mtx); - - if (thread->task->state == DONE) - { - BS_THREAD_TRACE_F(" Unlock:"); - - for (auto& dep : thread->task->dependent) - { - if (dep->blocked) - { - dep->blocked--; - - if (!dep->blocked) - dep->state = QUEUED; - - BS_THREAD_TRACE_F(" %d(%d)", dep->id, dep->blocked); - } - } - BS_THREAD_TRACE_F("\n"); - BS_THREAD_TRACE_FLUSH; - } - else if (!thread->task->dependent.empty()) - self._AbortDependent(*thread->task); - - thread->task->cv.notify_one(); - } - - if (Ready(thread->task->state)) - { - for (auto& task : self.m_task) - { - if ( task.state == WAITING - && !task.blocked - && task.id != thread->task->id) - { - task.state = QUEUED; - } - task.dependent.remove(thread->task); - } - - if (thread->task->detach) - detached.push_back(thread->task->id); - - self.m_cv.notify_one(); - } - - thread->task = 0; - } - - for (auto& task : self.m_task) - { - if (task.state == LOST) - { - if (task.dependent.size()) - self._AbortDependent(task); - if (task.detach) - detached.push_back(task.id); - else - { - std::unique_lock lockTask(task.mtx); - task.cv.notify_one(); - } - } - else if (task.state == QUEUED) - queued.push_back(&task); - - BS_THREAD_TRACE_F(" : ID=%d BL=%d P=%d N=%d -- %s\n", - task.id, task.blocked, task.priority, task.n, State2CS[task.state]); - BS_THREAD_TRACE_FLUSH; - } - - for (auto& id : detached) - { - self.m_task.remove_if([&id] (Task& t) -> bool { return t.id == id; }); - } - - queued.sort([](Task* l, Task* r) { return (l->priority > r->priority); }); - - for (Task* pTask : queued) - { - Thread* pThread = FindThread(); - - if (!pThread) - break; - - std::unique_lock lockThread(pThread->mtx, std::defer_lock); - - if (pThread != thread) - lockThread.lock(); - - pThread->task = pTask; - pTask->state = WORKING; - - BS_THREAD_TRACE_F(" : TH=%d ID=%d P=%d N=%d -- EXECUTE\n", - pThread->id, pTask->id, pTask->priority, pTask->n); - BS_THREAD_TRACE_FLUSH; - - if (pThread != thread) - { - pThread->cv.notify_one(); - lockThread.unlock(); - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/common_cabac.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/common_cabac.cpp deleted file mode 100644 index ece880c..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/common_cabac.cpp +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "common_cabac.h" - -using namespace COMMON_CABAC; -using namespace BS_HEVC; - -// ADE //////////////////////////////////////////////////////////////////////// -static const Bs8u renormTab[32] = -{ - 6, 5, 4, 4, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1 -}; - -Bs8u ADE::DecodeDecision(Bs8u& ctxState) -{ -#if (BS_AVC2_ADE_MODE == 1) - Bs32u vMPS = (ctxState & 1); - Bs32u bin = vMPS; - Bs32u state = (ctxState >> 1); - Bs32u rLPS = rangeTabLpsT[(m_range >> 6) & 3][state]; - - m_range -= rLPS; - - if (m_val < (m_range << m_bits)) - { - ctxState = (transIdxMps[state] << 1) | vMPS; - - if (m_range >= 256) - return bin; - - m_range <<= 1; - m_bits--; - } - else - { - Bs8u renorm = renormTab[(rLPS >> 3) & 0x1F]; - m_val -= (m_range << m_bits); - m_range = (rLPS << renorm); - m_bits -= renorm; - - bin ^= 1; - if (!state) - vMPS ^= 1; - - ctxState = (transIdxLps[state] << 1) | vMPS; - } - - if (m_bits > 0) - return bin; - - m_val = (m_val << 16) | B(2); - m_bits += 16; - - return bin; -#else - Bs8u binVal = 0; - Bs8u valMPS = (ctxState & 1); - Bs8u pStateIdx = (ctxState >> 1); - Bs16u codIRangeLPS = rangeTabLpsT[(m_codIRange >> 6) & 3][pStateIdx]; - - m_codIRange -= codIRangeLPS; - - if (m_codIOffset >= m_codIRange) - { - binVal = !valMPS; - m_codIOffset -= m_codIRange; - m_codIRange = codIRangeLPS; - - if (pStateIdx == 0) - valMPS = !valMPS; - - pStateIdx = transIdxLps[pStateIdx]; - - } - else - { - binVal = valMPS; - pStateIdx = transIdxMps[pStateIdx]; - } - - ctxState = (pStateIdx << 1) | valMPS; - - while (m_codIRange < 256) - { - m_codIRange <<= 1; - m_codIOffset = (m_codIOffset << 1) | b(); - } - - return binVal; -#endif -} -Bs8u ADE::DecodeBypass() -{ -#if (BS_AVC2_ADE_MODE == 1) - if (!--m_bits) - { - m_val = (m_val << 16) | B(2); - m_bits = 16; - } - - Bs32s val = m_val - (m_range << m_bits); - - if (val < 0) - return 0; - - m_val = Bs32u(val); - return 1; -#else - m_codIOffset = (m_codIOffset << 1) | b(); - //nBits++; - - if (m_codIOffset >= m_codIRange) - { - m_codIOffset -= m_codIRange; - return 1; - } - return 0; -#endif -} -Bs8u ADE::DecodeTerminate() -{ -#if (BS_AVC2_ADE_MODE == 1) - Bs32u range = m_range - 2; - Bs32s val = m_val - (range << m_bits); - - if (val < 0) - { - if (range >= 256) - { - m_range = range; - return 0; - } - - m_range = (range << 1); - - if (--m_bits) - return 0; - - m_val = (m_val << 16) | B(2); - m_bits = 16; - - return 0; - } - - m_range = range; - - return 1; -#else - m_codIRange -= 2; - - if (m_codIOffset >= m_codIRange) - return 1; - - while (m_codIRange < 256) - { - m_codIRange <<= 1; - m_codIOffset = (m_codIOffset << 1) | b(); - } - - return 0; -#endif -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/dll_main.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/dll_main.cpp deleted file mode 100644 index 40c6d00..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/dll_main.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include - -extern "C" { - -// For Perl compatibility only: -Bs32u BS_GetVal( void* hdr, Bs32u* element_idx ){ - if( !hdr ) return (Bs32u)BS_ERR_WRONG_UNITS_ORDER; - if( !element_idx ) return (Bs32u)BS_ERR_INVALID_PARAMS; - - Bs32u val = 0; - void* addr = hdr; - Bs32s nesting_level = *element_idx; - while( nesting_level-- ){ - addr = *(void**)((Bs64s)addr + *(++element_idx)); - } - addr = (void*)((Bs64s)addr + *(++element_idx)); - for( Bs32u i = 0; i<(*(element_idx+1));i++ ){ - val += ((*((byte*)addr+i))<<(i<<3)); - } - return val; -} - - -BSErr __STDCALL BS_HEVC2_Init(BS_HEVC2::HDL& hdl, Bs32u mode){ - hdl = NULL; - hdl = new BS_HEVC2::Parser(mode); - if (hdl) - return BS_ERR_NONE; - return BS_ERR_UNKNOWN; -} - -BSErr __STDCALL BS_HEVC2_OpenFile(BS_HEVC2::HDL hdl, const char* file){ - if (!hdl) return BS_ERR_BAD_HANDLE; - return hdl->open(file); -} - -BSErr __STDCALL BS_HEVC2_SetBuffer(BS_HEVC2::HDL hdl, byte* buf, Bs32u buf_size){ - if (!hdl) return BS_ERR_BAD_HANDLE; - hdl->set_buffer(buf, buf_size); - return BS_ERR_NONE; -} - -BSErr __STDCALL BS_HEVC2_ParseNextAU(BS_HEVC2::HDL hdl, BS_HEVC2::NALU*& header){ - if (!hdl) return BS_ERR_BAD_HANDLE; - return hdl->parse_next_au(header); -} - -BSErr __STDCALL BS_HEVC2_Close(BS_HEVC2::HDL hdl){ - if (!hdl) return BS_ERR_BAD_HANDLE; - delete (hdl); - hdl = NULL; - return BS_ERR_NONE; -} - -BSErr __STDCALL BS_HEVC2_SetTraceLevel(BS_HEVC2::HDL hdl, Bs32u level){ - if (!hdl) return BS_ERR_BAD_HANDLE; - hdl->set_trace_level(level); - return BS_ERR_NONE; -} - -BSErr __STDCALL BS_HEVC2_Lock(BS_HEVC2::HDL hdl, void* p){ - if (!hdl) return BS_ERR_BAD_HANDLE; - return hdl->Lock(p); -} - -BSErr __STDCALL BS_HEVC2_Unlock(BS_HEVC2::HDL hdl, void* p){ - if (!hdl) return BS_ERR_BAD_HANDLE; - return hdl->Unlock(p); -} - -BSErr __STDCALL BS_HEVC2_GetOffset(BS_HEVC2::HDL hdl, Bs64u& offset){ - if (!hdl) return BS_ERR_BAD_HANDLE; - offset = hdl->get_cur_pos(); - return BS_ERR_NONE; -} - -BSErr __STDCALL BS_HEVC2_Sync(BS_HEVC2::HDL hdl, BS_HEVC2::NALU* slice){ - if (!hdl) return BS_ERR_BAD_HANDLE; - return hdl->sync(slice); -} - -Bs16u __STDCALL BS_HEVC2_GetAsyncDepth(BS_HEVC2::HDL hdl){ - if (!hdl) return 0; - return hdl->get_async_depth(); -} - -} // extern "C" diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_cabac.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_cabac.cpp deleted file mode 100644 index 3d7f8c6..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_cabac.cpp +++ /dev/null @@ -1,898 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc2_parser.h" - -using namespace BS_HEVC2; -using namespace BsReader2; - -#define Clip3(_min, _max, _x) BS_MIN(BS_MAX(_min, _x), _max) - -void CABAC::InitCtx() -{ - Slice& slice = *m_cSlice; - auto& pps = *slice.pps; - auto& sps = *slice.sps; - Bs16u initType = 0; - Bs16s Clip3_0_51_SliceQpY = 26 + slice.pps->init_qp_minus26 + slice.qp_delta; - Bs8u* state = m_ctxState; - Bs16s preCtxState; - Bs16u numComps = (ChromaArrayType == 0) ? 1 : 3; - - Clip3_0_51_SliceQpY = Clip3(0, 51, Clip3_0_51_SliceQpY); - - memset(StatCoeff, 0, sizeof(StatCoeff)); - - if (slice.type == I) - initType = 0; - else if (slice.type == P) - initType = slice.cabac_init_flag ? 2 : 1; - else - initType = slice.cabac_init_flag ? 1 : 2; - - for (Bs16s initValue : BS_HEVC::CtxInitTbl[initType]) - { - preCtxState = ((((initValue >> 4) * 5 - 45) * Clip3_0_51_SliceQpY) >> 4) + ((initValue & 15) << 3) - 16; - preCtxState = Clip3(1, 126, preCtxState); - - if (preCtxState <= 63) - *state = ((63 - preCtxState) << 1); - else - *state = (((preCtxState - 64) << 1) | 1); - state++; - } - - Bs32u sz = (sps.palette_max_size + PaletteMaxPredictorSize); - PredictorPaletteEntries[0].resize(sz); - PredictorPaletteEntries[1].resize(sz); - PredictorPaletteEntries[2].resize(sz); - PredictorPaletteSize = 0; - - if (pps.palette_predictor_initializer_present_flag ) - { - for (Bs16u cIdx = 0; cIdx < numComps && pps.num_palette_predictor_initializer; cIdx++) - { - PredictorPaletteSize = pps.num_palette_predictor_initializer; - memmove(&PredictorPaletteEntries[cIdx][0] - , pps.palette_predictor_initializers[cIdx] - , pps.num_palette_predictor_initializer * sizeof(pps.palette_predictor_initializers[cIdx][0])); - } - } - else if (sps.palette_predictor_initializer_present_flag) - { - for (Bs16u cIdx = 0; cIdx < numComps && sps.num_palette_predictor_initializer; cIdx++) - { - PredictorPaletteSize = sps.num_palette_predictor_initializer; - memmove(&PredictorPaletteEntries[cIdx][0] - , sps.palette_predictor_initializers[cIdx] - , sps.num_palette_predictor_initializer * sizeof(sps.palette_predictor_initializers[cIdx][0])); - } - } - -} - -Bs8u CABAC::SaoTypeIdxLuma() -{ - //TR cMax = 2, cRiceParam = 0 - //1+0, bypass - - if (!DD(BS_HEVC::SAO_TYPE_IDX_LUMA)) - return 0; - - BinCount++; - return DecodeBypass() + 1; -} - -Bs8u CABAC::SaoOffsetAbs(Bs16u bitDepth) -{ - //TR cMax = (1 << (Min(bitDepth, 10) - 5)) - 1, cRiceParam = 0 - //bypass bypass bypass bypass bypass na - Bs16u cMax = (1 << (BS_MIN(bitDepth, 10) - 5)) - 1; - Bs8u binIdx = 0; - - while (binIdx < cMax) - { - if (!DecodeBypass()) - { - BinCount += binIdx + 1; - return binIdx; - } - - binIdx++; - } - - BinCount += binIdx; - - return binIdx; -} - -Bs8u CABAC::SaoBandPosition() -{ - //FL cMax = 31 - //bypass bypass bypass bypass bypass bypass - Bs8u b; - - b = (DecodeBypass() << 4); - b |= (DecodeBypass() << 3); - b |= (DecodeBypass() << 2); - b |= (DecodeBypass() << 1); - b |= DecodeBypass(); - - BinCount += 5; - - return b; -} - -Bs8u CABAC::SaoEoClassLuma() -{ - //FL cMax = 3 - //bypass bypass bypass na na na - Bs8u b; - - b = (DecodeBypass() << 1); - b |= DecodeBypass(); - - BinCount += 2; - - return b; -} - -bool CABAC::SplitCuFlag(Bs16s x0, Bs16s y0) -{ - //FL cMax = 1 - //9.3.4.2.2 - Bs16u ctxInc = 0; - bool availableL = AvailableZs(x0, y0, x0 - 1, y0); - bool availableA = AvailableZs(x0, y0, x0, y0 - 1); - - if (availableL || availableA) - { - CU* c0 = GetCU(x0, y0); - if (!c0) - throw InvalidSyntax(); - - CU* c1 = nullptr; - if (availableL) - { - c1 = GetCU(x0 - 1, y0); - if (!c1) - throw InvalidSyntax(); - } - - CU* c2 = nullptr; - if (availableA) - { - c2 = GetCU(x0, y0 - 1); - if (!c2) - throw InvalidSyntax(); - } - - ctxInc = - (availableL && (c1->log2CbSize < c0->log2CbSize)) - + (availableA && (c2->log2CbSize < c0->log2CbSize)); - } - - return DD(BS_HEVC::SPLIT_CU_FLAG, ctxInc); -} - -bool CABAC::CuSkipFlag(Bs16s x0, Bs16s y0) -{ - //FL cMax = 1 - //9.3.4.2.2 - bool availableL = AvailableZs(x0, y0, x0 - 1, y0); - bool availableA = AvailableZs(x0, y0, x0, y0 - 1); - - CU* c1 = nullptr; - if (availableL) - { - c1 = GetCU(x0 - 1, y0); - if (!c1) - throw InvalidSyntax(); - } - - CU* c2 = nullptr; - if (availableA) - { - c2 = GetCU(x0, y0 - 1); - if (!c2) - throw InvalidSyntax(); - } - - Bs16u ctxInc = - (availableL && (c1->PredMode == MODE_SKIP)) - + (availableA && (c2->PredMode == MODE_SKIP)); - - return DD(BS_HEVC::CU_SKIP_FLAG, ctxInc); -} - -Bs8u CABAC::PartMode(bool intra, Bs16u log2CbSize) -{ - //9.3.3.6 (xCb, yCb ) = (x0, y0), log2CbSize - // 0 1 (3 - (log2CbSize == MinCbLog2SizeY)) bypass - bool b = DD(BS_HEVC::PART_MODE); - - if (intra) - return b ? PART_2Nx2N : PART_NxN; - - if (b) - return PART_2Nx2N; - - b = DD(BS_HEVC::PART_MODE, 1); - - if (log2CbSize == MinCbLog2SizeY) - { - if (b) - return PART_2NxN; - - if (log2CbSize == 3) - return PART_Nx2N; - - b = DD(BS_HEVC::PART_MODE, 2); - - return b ? PART_Nx2N : PART_NxN; - } - - if (!m_cSlice->sps->amp_enabled_flag) - return b ? PART_2NxN : PART_Nx2N; - - bool v = b; - - b = DD(BS_HEVC::PART_MODE, 3); - - if (b) - return v ? PART_2NxN : PART_Nx2N; - - b = DB(); - - if (v) - return b ? PART_2NxnD : PART_2NxnU; - - return b ? PART_nRx2N : PART_nLx2N; -} - -Bs8u CABAC::MpmIdx() -{ - //TR cMax = 2, cRiceParam = 0 - //bypass, bypass - BinCount++; - if (!DecodeBypass()) - return 0; - - BinCount++; - return DecodeBypass() + 1; -} - -Bs8u CABAC::IntraChromaPredMode() -{ - //9.3.3.7 - //0 bypass bypass na na na - if (!DD(BS_HEVC::INTRA_CHROMA_PRED_MODE)) - return 4; - - BinCount += 2; - Bs8u b = (DecodeBypass() << 1); - - return b | DecodeBypass(); -} - -Bs8u CABAC::MergeIdx() -{ - //TR cMax = MaxNumMergeCand - 1, cRiceParam = 0 - //0 bypass bypass bypass na na - Bs32s cMax = m_cSlice->MaxNumMergeCand - 1; - Bs8u binIdx = 0; - - if (cMax > 0) - { - if (!DD(BS_HEVC::MERGE_IDX)) - return 0; - binIdx++; - } - - while (binIdx < cMax) - { - if (!DecodeBypass()) - { - BinCount += binIdx + 1; - return binIdx; - } - - binIdx++; - } - - BinCount += binIdx; - - return binIdx; -} - -Bs8u CABAC::InterPredIdc(Bs16u nPbW, Bs16u nPbH, Bs16u CtDepth) -{ - //9.3.3.8 nPbW, nPbH - //( nPbW + nPbH ) != 12 ? CtDepth[x0][y0] : 4 4 na na na na - - if (nPbW + nPbH != 12) - { - if (DD(BS_HEVC::INTER_PRED_IDC, CtDepth)) - return PRED_BI; - } - - if (DD(BS_HEVC::INTER_PRED_IDC, 4)) - return PRED_L1; - - return PRED_L0; -} - -Bs8u CABAC::RefIdxL0() -{ - //TR cMax = num_ref_idx_l0_active_minus1, cRiceParam = 0 - //0 1 bypass bypass bypass bypass - Bs32s cMax = m_cSlice->num_ref_idx_l0_active - 1; - Bs8u binIdx = 0; - - if (cMax > 0) - { - if (!DD(BS_HEVC::REF_IDX_LX)) - return 0; - binIdx++; - } - - if (binIdx < cMax) - { - if (!DD(BS_HEVC::REF_IDX_LX, 1)) - return binIdx; - binIdx++; - } - - while (binIdx < cMax) - { - if (!DecodeBypass()) - { - BinCount += binIdx; - return binIdx; - } - binIdx++; - } - - BinCount += binIdx - 1; - - return binIdx; -} - -Bs8u CABAC::RefIdxL1() -{ - //TR cMax = num_ref_idx_l1_active_minus1, cRiceParam = 0 - //0 1 bypass bypass bypass bypass - Bs32s cMax = m_cSlice->num_ref_idx_l1_active - 1; - Bs8u binIdx = 0; - - if (cMax > 0) - { - if (!DD(BS_HEVC::REF_IDX_LX)) - return 0; - binIdx++; - } - - if (binIdx < cMax) - { - if (!DD(BS_HEVC::REF_IDX_LX, 1)) - return binIdx; - binIdx++; - } - - while (binIdx < cMax) - { - if (!DecodeBypass()) - { - BinCount += binIdx; - return binIdx; - } - binIdx++; - } - - BinCount += binIdx - 1; - - return binIdx; -} - -Bs16u CABAC::CuQpDeltaAbs() -{ - //9.3.3.9 - //0 1 1 1 1 bypass - Bs16u k = 0, v0 = 0, v1 = 0, b; - - while (v0 < 5) - { - if (!DecodeDecision(CtxState(BS_HEVC::CU_QP_DELTA_ABS, !!v0))) - { - BinCount += v0; - return v0; - } - v0++; - } - - while (DecodeBypass()) - { - v0 += (1 << k); - k++; - } - - BinCount += k * 2 + 1; - - while (k--) - { - b = DecodeBypass(); - v1 |= (b << k); - } - - return (v0 + v1); -} - -Bs8u CABAC::CuChromaQpOffsetIdx() -{ - //TR cMax = chroma_qp_offset_list_len_minus1, cRiceParam = 0 - //0 0 0 0 0 na - Bs32s cMax = m_cSlice->pps->chroma_qp_offset_list_len_minus1; - Bs8u binIdx = 0; - - while (binIdx < cMax) - { - if (!DecodeDecision(CtxState(BS_HEVC::CU_CHROMA_QP_OFFSET_IDX))) - { - BinCount += binIdx + 1; - return binIdx; - } - - binIdx++; - } - - BinCount += binIdx; - - return binIdx; -} - -Bs8u CABAC::Log2ResScaleAbsPlus1(Bs16u c) -{ - //TR cMax = 4, cRiceParam = 0 - //4 * c + 0, 4 * c + 1, 4 * c + 2, 4 * c + 3, na, na - Bs8u binIdx = 0; - - while (binIdx < 4) - { - if (!DecodeDecision(CtxState(BS_HEVC::LOG2_RES_SCALE_ABS_PLUS1, 4 * c + binIdx))) - { - BinCount += binIdx + 1; - return binIdx; - } - binIdx++; - } - - BinCount += binIdx; - - return binIdx; -} - -Bs8u CABAC::LastSigCoeffXPrefix(Bs16u cIdx, Bs16u log2TrafoSize) -{ - //TR cMax = ( log2TrafoSize << 1 ) - 1, cRiceParam = 0 - //0..17 (clause 9.3.4.2.3) - Bs32u cMax = (log2TrafoSize << 1) - 1; - Bs32u binIdx = 0; - Bs16u ctxOffset; - Bs16u ctxShift; - - m_g1I = -1; - m_rI = -1; - - if (cIdx == 0) - { - ctxOffset = 3 * (log2TrafoSize - 2) + ((log2TrafoSize - 1) >> 2); - ctxShift = ((log2TrafoSize + 1) >> 2); - } - else - { - ctxOffset = 15; - ctxShift = log2TrafoSize - 2; - } - - while (binIdx < cMax) - { - if (!DecodeDecision(CtxState(BS_HEVC::LAST_SIG_COEFF_X_PREFIX, (binIdx >> ctxShift) + ctxOffset))) - { - BinCount += binIdx + 1; - return binIdx; - } - - binIdx++; - } - - BinCount += binIdx; - - return binIdx; -} - -Bs8u CABAC::LastSigCoeffYPrefix(Bs16u cIdx, Bs16u log2TrafoSize) -{ - //TR cMax = ( log2TrafoSize << 1 ) - 1, cRiceParam = 0 - //0..17 (clause 9.3.4.2.3) - Bs32u cMax = (log2TrafoSize << 1) - 1; - Bs32u binIdx = 0; - Bs16u ctxOffset; - Bs16u ctxShift; - - if (cIdx == 0) - { - ctxOffset = 3 * (log2TrafoSize - 2) + ((log2TrafoSize - 1) >> 2); - ctxShift = ((log2TrafoSize + 1) >> 2); - } - else - { - ctxOffset = 15; - ctxShift = log2TrafoSize - 2; - } - - while (binIdx < cMax) - { - if (!DecodeDecision(CtxState(BS_HEVC::LAST_SIG_COEFF_Y_PREFIX, (binIdx >> ctxShift) + ctxOffset))) - { - BinCount += binIdx + 1; - return binIdx; - } - - binIdx++; - } - - BinCount += binIdx; - - return binIdx; -} - -Bs32u CABAC::LastSigCoeffXSuffix(Bs16u prefix) -{ - //FL cMax = ( 1 << ( ( last_sig_coeff_x_prefix >> 1 ) - 1 ) - 1 ) - //bypass bypass bypass bypass bypass bypass - Bs32u b = 0; - - prefix = CeilLog2(1 << ((prefix >> 1) - 1)); - - BinCount += prefix; - - while (prefix--) - b = (b << 1) | DecodeBypass(); - - return b; -} - -bool CABAC::CoeffAbsLevelGreater1Flag(Bs16u cIdx, Bs16u i) -{ - //FL cMax = 1 - //9.3.4.2.6 - auto& greater1Ctx = lastGreater1Ctx; - Bs16s ctxInc; - - if (m_g1I != i) - { - if (i == 0 || cIdx > 0) - ctxSet = 0; - else - ctxSet = 2; - - if (m_g1I < 0) - { - lastGreater1Ctx = 1; - } - else if (lastGreater1Ctx > 0) - { - if (lastGreater1Flag) - lastGreater1Ctx = 0; - else - lastGreater1Ctx++; - } - - if (lastGreater1Ctx == 0) - ctxSet++; - - greater1Ctx = 1; - } - else - { - if (greater1Ctx > 0) - { - if (lastGreater1Flag) - greater1Ctx = 0; - else - greater1Ctx++; - } - } - - m_g1I = i; - ctxInc = (ctxSet * 4) + BS_MIN(3, greater1Ctx); - - if (cIdx > 0) - ctxInc += 16; - - lastGreater1Flag = DD(BS_HEVC::COEFF_ABS_LEVEL_GREATER1_FLAG, ctxInc); - - return lastGreater1Flag; -} - -Bs32u CABAC::CoeffAbsLevelRemaining(Bs16u i, Bs16u baseLevel, Bs16u cIdx, CU& cu, TU& tu) -{ - //9.3.3.10 current sub-block scan index i, baseLevel - //bypass bypass bypass bypass bypass bypass - auto& sps = *m_cSlice->sps; - auto& cAbsLevel = cLastAbsLevel; - auto& cRiceParam = cLastRiceParam; - Bs16u initRiceValue, sbType = 0; - Bs32u b = 0, cMax, k, v0, v1; - - if (sps.persistent_rice_adaptation_enabled_flag) - { - if ( (tu.transform_skip_flag & (1 << cIdx)) == 0 - && cu.transquant_bypass_flag == 0) - { - sbType = 2 * !cIdx; - } - else - { - sbType = 2 * !cIdx + 1; - } - - initRiceValue = StatCoeff[sbType] / 4; - } - else - { - initRiceValue = 0; - } - - if (i != m_rI) - { - cLastAbsLevel = 0; - cLastRiceParam = initRiceValue; - } - - cRiceParam = cLastRiceParam + (cLastAbsLevel > (3u * (1u << cLastRiceParam))); - - if (sps.persistent_rice_adaptation_enabled_flag == 0) - cRiceParam = BS_MIN(cRiceParam, 4); - - cMax = 4 << cRiceParam; - - while (b < 4) - { - if (!DecodeBypass()) - { - BinCount++; - break; - } - - b++; - } - - BinCount += b; - - if (b < 4) - { - for (Bs16u c = 0; c < cRiceParam; c++) - b = ((b << 1) | DecodeBypass()); - - BinCount += cRiceParam; - } - else if (sps.persistent_rice_adaptation_enabled_flag == 0) - { - b = EGkBypass(cRiceParam + 1) + cMax; - } - else - { - //Limited EGk - Bs16u log2TransformRange = (cIdx == 0) ? BS_MAX(15, BitDepthY + 6) : BS_MAX(15, BitDepthC + 6); - Bs16u maxPrefixExtensionLength = 28 - log2TransformRange; - - k = cRiceParam + 1; - b = 0; - v0 = 0; - v1 = 0; - - while (b < maxPrefixExtensionLength && DecodeBypass()) - b++; - - v0 = (((1 << b) - 1) << k); - - if (b == maxPrefixExtensionLength) - { - k = log2TransformRange; - BinCount += b + k; - } - else - { - k += b; - BinCount += b + k + 1; - } - - while (k--) - { - b = DecodeBypass(); - v1 |= (b << k); - } - - b = v0 + v1 + cMax; - } - - if (sps.persistent_rice_adaptation_enabled_flag && i != m_rI) - { - if (b >= (3u << (StatCoeff[sbType] / 4))) - StatCoeff[sbType]++; - else if (2 * b < (1u << (StatCoeff[sbType] / 4)) && StatCoeff[sbType] > 0) - StatCoeff[sbType]--; - } - - m_rI = i; - cAbsLevel = baseLevel + b; - - return b; -} - -Bs32u CABAC::EGkBypass(Bs32u k) -{ - //EGk - //bypass bypass bypass bypass bypass bypass - Bs32u v0 = 0, v1 = 0, b; - - while (DecodeBypass()) - { - v0 |= (1 << k); - k++; - BinCount++; - } - - BinCount += k; - - while (k--) - { - b = DecodeBypass(); - v1 |= (b << k); - } - - return (v0 + v1); -} - -Bs16u CABAC::NewPaletteEntries(Bs16u cIdx) -{ - //FL cMax = cIdx == 0 ? ((1 << BitDepthY) - 1) : ((1 << BitDepthC) - 1) - //bypass bypass bypass bypass bypass bypass - Bs16u b = 0; - Bs32u n = (cIdx == 0) ? BitDepthY : BitDepthC; - - BinCount += n; - - while (n--) - b = (b << 1) | DecodeBypass(); - - return b; -} - -Bs16u CABAC::NumPaletteIndices(Bs16u MaxPaletteIndex) -{ - //9.3.3.14 - //bypass bypass bypass bypass bypass bypass - Bs16u cRiceParam = 3 + ((MaxPaletteIndex + 1) >> 3); - Bs16u cMax = 4 << cRiceParam; - Bs16u prefixVal = 0; - - m_paletteIdxCnt = 0; - - while (prefixVal < 4 && DecodeBypass()) - { - prefixVal++; - BinCount++; - } - - if (prefixVal == 4) - return EGkBypass(cRiceParam + 1) + cMax + 1; - - BinCount += cRiceParam; - - while (cRiceParam--) - prefixVal = (prefixVal << 1) | DecodeBypass(); - - return prefixVal + 1; -} - -Bs32u CABAC::TBBypass(Bs32u cMax) -{ - //TB - //bypass bypass bypass bypass bypass bypass - Bs32u n = cMax + 1; - Bs32u k = (Bs16u)FloorLog2(n); - Bs32u u = (1 << (k + 1)) - n; - Bs32u v = 0; - - BinCount += k; - - while (k--) - v = (v << 1) | DecodeBypass(); - - if (v < u) - return v; - - BinCount++; - v = (v << 1) | DecodeBypass(); - - return (v - u); -} - -Bs16u CABAC::PaletteRunPrefix(Bs16u PaletteMaxRun, bool copy_above_palette_indices_flag, Bs16u palette_index_idc) -{ - //TR cMax = Floor(Log2(PaletteMaxRun)) + 1, cRiceParam = 0 - //0..7 (clause 9.3.4.2.8) - Bs16u cMax = FloorLog2(PaletteMaxRun) + 1; - Bs16u v = 0; - auto NextBin = [&](Bs16u ctxInc) -> bool - { - if (!DD(BS_HEVC::PALETTE_RUN_PREFIX, ctxInc)) - return false; - return (++v < cMax); - }; - - if (copy_above_palette_indices_flag) - { - //5 6 6 7 7 bypass - if (!NextBin(5)) return v; - if (!NextBin(6)) return v; - if (!NextBin(6)) return v; - if (!NextBin(7)) return v; - if (!NextBin(7)) return v; - } - else - { - //(0,1,2) 3 3 4 4 bypass - if (!NextBin((palette_index_idc < 1) ? 0 : ((palette_index_idc < 3) ? 1 : 2))) - return v; - if (!NextBin(3)) return v; - if (!NextBin(3)) return v; - if (!NextBin(4)) return v; - if (!NextBin(4)) return v; - } - - while (DecodeBypass() && (++v < cMax)); - - return v; -} - -Bs16u CABAC::PaletteEscapeVal(Bs16u cIdx, bool cu_transquant_bypass_flag) -{ - //9.3.3.12 cIdx, cu_transquant_bypass_flag - //bypass bypass bypass bypass bypass bypass - - if (cu_transquant_bypass_flag) - { - //FL ( 1 << bitdepth ) - 1 - Bs16u bd = (cIdx == 0) ? BitDepthY : BitDepthC; - Bs16u v = 0; - - BinCount += bd; - - while (bd--) - v = (v << 1) | DecodeBypass(); - - return v; - } - - return (Bs16u)EGkBypass(3); -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_dec.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_dec.cpp deleted file mode 100644 index 42bb981..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_dec.cpp +++ /dev/null @@ -1,1677 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc2_parser.h" - -using namespace BsReader2; - -namespace BS_HEVC2 -{ -const Bs8u ScanOrder1[4][2 * 2][2] = -{ - { - { 0, 0},{ 0, 1}, - { 1, 0},{ 1, 1}, - }, - { - { 0, 0},{ 1, 0}, - { 0, 1},{ 1, 1}, - }, - { - { 0, 0},{ 0, 1}, - { 1, 0},{ 1, 1}, - }, - { - { 0, 0},{ 1, 0}, - { 1, 1},{ 0, 1}, - }, -}; -const Bs8u ScanPos1[4][2][2] = -{ - { - { 0, 1,}, - { 2, 3,}, - }, - { - { 0, 2,}, - { 1, 3,}, - }, - { - { 0, 1,}, - { 2, 3,}, - }, - { - { 0, 3,}, - { 1, 2,}, - }, -}; -const Bs8u ScanOrder2[4][4 * 4][2] = -{ - { - { 0, 0},{ 0, 1},{ 1, 0},{ 0, 2}, - { 1, 1},{ 2, 0},{ 0, 3},{ 1, 2}, - { 2, 1},{ 3, 0},{ 1, 3},{ 2, 2}, - { 3, 1},{ 2, 3},{ 3, 2},{ 3, 3}, - }, - { - { 0, 0},{ 1, 0},{ 2, 0},{ 3, 0}, - { 0, 1},{ 1, 1},{ 2, 1},{ 3, 1}, - { 0, 2},{ 1, 2},{ 2, 2},{ 3, 2}, - { 0, 3},{ 1, 3},{ 2, 3},{ 3, 3}, - }, - { - { 0, 0},{ 0, 1},{ 0, 2},{ 0, 3}, - { 1, 0},{ 1, 1},{ 1, 2},{ 1, 3}, - { 2, 0},{ 2, 1},{ 2, 2},{ 2, 3}, - { 3, 0},{ 3, 1},{ 3, 2},{ 3, 3}, - }, - { - { 0, 0},{ 1, 0},{ 2, 0},{ 3, 0}, - { 3, 1},{ 2, 1},{ 1, 1},{ 0, 1}, - { 0, 2},{ 1, 2},{ 2, 2},{ 3, 2}, - { 3, 3},{ 2, 3},{ 1, 3},{ 0, 3}, - }, -}; -const Bs8u ScanPos2[4][4][4] = -{ - { - { 0, 1, 3, 6,}, - { 2, 4, 7, 10,}, - { 5, 8, 11, 13,}, - { 9, 12, 14, 15,}, - }, - { - { 0, 4, 8, 12,}, - { 1, 5, 9, 13,}, - { 2, 6, 10, 14,}, - { 3, 7, 11, 15,}, - }, - { - { 0, 1, 2, 3,}, - { 4, 5, 6, 7,}, - { 8, 9, 10, 11,}, - { 12, 13, 14, 15,}, - }, - { - { 0, 7, 8, 15,}, - { 1, 6, 9, 14,}, - { 2, 5, 10, 13,}, - { 3, 4, 11, 12,}, - }, -}; -const Bs8u ScanOrder3[4][8 * 8][2] = -{ - { - { 0, 0},{ 0, 1},{ 1, 0},{ 0, 2},{ 1, 1},{ 2, 0},{ 0, 3},{ 1, 2}, - { 2, 1},{ 3, 0},{ 0, 4},{ 1, 3},{ 2, 2},{ 3, 1},{ 4, 0},{ 0, 5}, - { 1, 4},{ 2, 3},{ 3, 2},{ 4, 1},{ 5, 0},{ 0, 6},{ 1, 5},{ 2, 4}, - { 3, 3},{ 4, 2},{ 5, 1},{ 6, 0},{ 0, 7},{ 1, 6},{ 2, 5},{ 3, 4}, - { 4, 3},{ 5, 2},{ 6, 1},{ 7, 0},{ 1, 7},{ 2, 6},{ 3, 5},{ 4, 4}, - { 5, 3},{ 6, 2},{ 7, 1},{ 2, 7},{ 3, 6},{ 4, 5},{ 5, 4},{ 6, 3}, - { 7, 2},{ 3, 7},{ 4, 6},{ 5, 5},{ 6, 4},{ 7, 3},{ 4, 7},{ 5, 6}, - { 6, 5},{ 7, 4},{ 5, 7},{ 6, 6},{ 7, 5},{ 6, 7},{ 7, 6},{ 7, 7}, - }, - { - { 0, 0},{ 1, 0},{ 2, 0},{ 3, 0},{ 4, 0},{ 5, 0},{ 6, 0},{ 7, 0}, - { 0, 1},{ 1, 1},{ 2, 1},{ 3, 1},{ 4, 1},{ 5, 1},{ 6, 1},{ 7, 1}, - { 0, 2},{ 1, 2},{ 2, 2},{ 3, 2},{ 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 1, 2},{ 2, 2},{ 3, 2},{ 4, 2},{ 5, 2},{ 6, 2},{ 7, 2}, - { 7, 3},{ 6, 3},{ 5, 3},{ 4, 3},{ 3, 3},{ 2, 3},{ 1, 3},{ 0, 3}, - { 0, 4},{ 1, 4},{ 2, 4},{ 3, 4},{ 4, 4},{ 5, 4},{ 6, 4},{ 7, 4}, - { 7, 5},{ 6, 5},{ 5, 5},{ 4, 5},{ 3, 5},{ 2, 5},{ 1, 5},{ 0, 5}, - { 0, 6},{ 1, 6},{ 2, 6},{ 3, 6},{ 4, 6},{ 5, 6},{ 6, 6},{ 7, 6}, - { 7, 7},{ 6, 7},{ 5, 7},{ 4, 7},{ 3, 7},{ 2, 7},{ 1, 7},{ 0, 7}, - }, -}; -const Bs8u ScanPos3[4][8][8] = -{ - { - { 0, 1, 3, 6, 10, 15, 21, 28,}, - { 2, 4, 7, 11, 16, 22, 29, 36,}, - { 5, 8, 12, 17, 23, 30, 37, 43,}, - { 9, 13, 18, 24, 31, 38, 44, 49,}, - { 14, 19, 25, 32, 39, 45, 50, 54,}, - { 20, 26, 33, 40, 46, 51, 55, 58,}, - { 27, 34, 41, 47, 52, 56, 59, 61,}, - { 35, 42, 48, 53, 57, 60, 62, 63,}, - }, - { - { 0, 8, 16, 24, 32, 40, 48, 56,}, - { 1, 9, 17, 25, 33, 41, 49, 57,}, - { 2, 10, 18, 26, 34, 42, 50, 58,}, - { 3, 11, 19, 27, 35, 43, 51, 59,}, - { 4, 12, 20, 28, 36, 44, 52, 60,}, - { 5, 13, 21, 29, 37, 45, 53, 61,}, - { 6, 14, 22, 30, 38, 46, 54, 62,}, - { 7, 15, 23, 31, 39, 47, 55, 63,}, - }, - { - { 0, 1, 2, 3, 4, 5, 6, 7,}, - { 8, 9, 10, 11, 12, 13, 14, 15,}, - { 16, 17, 18, 19, 20, 21, 22, 23,}, - { 24, 25, 26, 27, 28, 29, 30, 31,}, - { 32, 33, 34, 35, 36, 37, 38, 39,}, - { 40, 41, 42, 43, 44, 45, 46, 47,}, - { 48, 49, 50, 51, 52, 53, 54, 55,}, - { 56, 57, 58, 59, 60, 61, 62, 63,}, - }, - { - { 0, 15, 16, 31, 32, 47, 48, 63,}, - { 1, 14, 17, 30, 33, 46, 49, 62,}, - { 2, 13, 18, 29, 34, 45, 50, 61,}, - { 3, 12, 19, 28, 35, 44, 51, 60,}, - { 4, 11, 20, 27, 36, 43, 52, 59,}, - { 5, 10, 21, 26, 37, 42, 53, 58,}, - { 6, 9, 22, 25, 38, 41, 54, 57,}, - { 7, 8, 23, 24, 39, 40, 55, 56,}, - }, -}; -const Bs8u ScanTraverse4[16 * 16][2] = -{ - { 0, 0},{ 1, 0},{ 2, 0},{ 3, 0},{ 4, 0},{ 5, 0},{ 6, 0},{ 7, 0},{ 8, 0},{ 9, 0},{10, 0},{11, 0},{12, 0},{13, 0},{14, 0},{15, 0}, - {15, 1},{14, 1},{13, 1},{12, 1},{11, 1},{10, 1},{ 9, 1},{ 8, 1},{ 7, 1},{ 6, 1},{ 5, 1},{ 4, 1},{ 3, 1},{ 2, 1},{ 1, 1},{ 0, 1}, - { 0, 2},{ 1, 2},{ 2, 2},{ 3, 2},{ 4, 2},{ 5, 2},{ 6, 2},{ 7, 2},{ 8, 2},{ 9, 2},{10, 2},{11, 2},{12, 2},{13, 2},{14, 2},{15, 2}, - {15, 3},{14, 3},{13, 3},{12, 3},{11, 3},{10, 3},{ 9, 3},{ 8, 3},{ 7, 3},{ 6, 3},{ 5, 3},{ 4, 3},{ 3, 3},{ 2, 3},{ 1, 3},{ 0, 3}, - { 0, 4},{ 1, 4},{ 2, 4},{ 3, 4},{ 4, 4},{ 5, 4},{ 6, 4},{ 7, 4},{ 8, 4},{ 9, 4},{10, 4},{11, 4},{12, 4},{13, 4},{14, 4},{15, 4}, - {15, 5},{14, 5},{13, 5},{12, 5},{11, 5},{10, 5},{ 9, 5},{ 8, 5},{ 7, 5},{ 6, 5},{ 5, 5},{ 4, 5},{ 3, 5},{ 2, 5},{ 1, 5},{ 0, 5}, - { 0, 6},{ 1, 6},{ 2, 6},{ 3, 6},{ 4, 6},{ 5, 6},{ 6, 6},{ 7, 6},{ 8, 6},{ 9, 6},{10, 6},{11, 6},{12, 6},{13, 6},{14, 6},{15, 6}, - {15, 7},{14, 7},{13, 7},{12, 7},{11, 7},{10, 7},{ 9, 7},{ 8, 7},{ 7, 7},{ 6, 7},{ 5, 7},{ 4, 7},{ 3, 7},{ 2, 7},{ 1, 7},{ 0, 7}, - { 0, 8},{ 1, 8},{ 2, 8},{ 3, 8},{ 4, 8},{ 5, 8},{ 6, 8},{ 7, 8},{ 8, 8},{ 9, 8},{10, 8},{11, 8},{12, 8},{13, 8},{14, 8},{15, 8}, - {15, 9},{14, 9},{13, 9},{12, 9},{11, 9},{10, 9},{ 9, 9},{ 8, 9},{ 7, 9},{ 6, 9},{ 5, 9},{ 4, 9},{ 3, 9},{ 2, 9},{ 1, 9},{ 0, 9}, - { 0,10},{ 1,10},{ 2,10},{ 3,10},{ 4,10},{ 5,10},{ 6,10},{ 7,10},{ 8,10},{ 9,10},{10,10},{11,10},{12,10},{13,10},{14,10},{15,10}, - {15,11},{14,11},{13,11},{12,11},{11,11},{10,11},{ 9,11},{ 8,11},{ 7,11},{ 6,11},{ 5,11},{ 4,11},{ 3,11},{ 2,11},{ 1,11},{ 0,11}, - { 0,12},{ 1,12},{ 2,12},{ 3,12},{ 4,12},{ 5,12},{ 6,12},{ 7,12},{ 8,12},{ 9,12},{10,12},{11,12},{12,12},{13,12},{14,12},{15,12}, - {15,13},{14,13},{13,13},{12,13},{11,13},{10,13},{ 9,13},{ 8,13},{ 7,13},{ 6,13},{ 5,13},{ 4,13},{ 3,13},{ 2,13},{ 1,13},{ 0,13}, - { 0,14},{ 1,14},{ 2,14},{ 3,14},{ 4,14},{ 5,14},{ 6,14},{ 7,14},{ 8,14},{ 9,14},{10,14},{11,14},{12,14},{13,14},{14,14},{15,14}, - {15,15},{14,15},{13,15},{12,15},{11,15},{10,15},{ 9,15},{ 8,15},{ 7,15},{ 6,15},{ 5,15},{ 4,15},{ 3,15},{ 2,15},{ 1,15},{ 0,15}, -}; -const Bs8u ScanTraverse5[32 * 32][2] = -{ - { 0, 0},{ 1, 0},{ 2, 0},{ 3, 0},{ 4, 0},{ 5, 0},{ 6, 0},{ 7, 0},{ 8, 0},{ 9, 0},{10, 0},{11, 0},{12, 0},{13, 0},{14, 0},{15, 0},{16, 0},{17, 0},{18, 0},{19, 0},{20, 0},{21, 0},{22, 0},{23, 0},{24, 0},{25, 0},{26, 0},{27, 0},{28, 0},{29, 0},{30, 0},{31, 0}, - {31, 1},{30, 1},{29, 1},{28, 1},{27, 1},{26, 1},{25, 1},{24, 1},{23, 1},{22, 1},{21, 1},{20, 1},{19, 1},{18, 1},{17, 1},{16, 1},{15, 1},{14, 1},{13, 1},{12, 1},{11, 1},{10, 1},{ 9, 1},{ 8, 1},{ 7, 1},{ 6, 1},{ 5, 1},{ 4, 1},{ 3, 1},{ 2, 1},{ 1, 1},{ 0, 1}, - { 0, 2},{ 1, 2},{ 2, 2},{ 3, 2},{ 4, 2},{ 5, 2},{ 6, 2},{ 7, 2},{ 8, 2},{ 9, 2},{10, 2},{11, 2},{12, 2},{13, 2},{14, 2},{15, 2},{16, 2},{17, 2},{18, 2},{19, 2},{20, 2},{21, 2},{22, 2},{23, 2},{24, 2},{25, 2},{26, 2},{27, 2},{28, 2},{29, 2},{30, 2},{31, 2}, - {31, 3},{30, 3},{29, 3},{28, 3},{27, 3},{26, 3},{25, 3},{24, 3},{23, 3},{22, 3},{21, 3},{20, 3},{19, 3},{18, 3},{17, 3},{16, 3},{15, 3},{14, 3},{13, 3},{12, 3},{11, 3},{10, 3},{ 9, 3},{ 8, 3},{ 7, 3},{ 6, 3},{ 5, 3},{ 4, 3},{ 3, 3},{ 2, 3},{ 1, 3},{ 0, 3}, - { 0, 4},{ 1, 4},{ 2, 4},{ 3, 4},{ 4, 4},{ 5, 4},{ 6, 4},{ 7, 4},{ 8, 4},{ 9, 4},{10, 4},{11, 4},{12, 4},{13, 4},{14, 4},{15, 4},{16, 4},{17, 4},{18, 4},{19, 4},{20, 4},{21, 4},{22, 4},{23, 4},{24, 4},{25, 4},{26, 4},{27, 4},{28, 4},{29, 4},{30, 4},{31, 4}, - {31, 5},{30, 5},{29, 5},{28, 5},{27, 5},{26, 5},{25, 5},{24, 5},{23, 5},{22, 5},{21, 5},{20, 5},{19, 5},{18, 5},{17, 5},{16, 5},{15, 5},{14, 5},{13, 5},{12, 5},{11, 5},{10, 5},{ 9, 5},{ 8, 5},{ 7, 5},{ 6, 5},{ 5, 5},{ 4, 5},{ 3, 5},{ 2, 5},{ 1, 5},{ 0, 5}, - { 0, 6},{ 1, 6},{ 2, 6},{ 3, 6},{ 4, 6},{ 5, 6},{ 6, 6},{ 7, 6},{ 8, 6},{ 9, 6},{10, 6},{11, 6},{12, 6},{13, 6},{14, 6},{15, 6},{16, 6},{17, 6},{18, 6},{19, 6},{20, 6},{21, 6},{22, 6},{23, 6},{24, 6},{25, 6},{26, 6},{27, 6},{28, 6},{29, 6},{30, 6},{31, 6}, - {31, 7},{30, 7},{29, 7},{28, 7},{27, 7},{26, 7},{25, 7},{24, 7},{23, 7},{22, 7},{21, 7},{20, 7},{19, 7},{18, 7},{17, 7},{16, 7},{15, 7},{14, 7},{13, 7},{12, 7},{11, 7},{10, 7},{ 9, 7},{ 8, 7},{ 7, 7},{ 6, 7},{ 5, 7},{ 4, 7},{ 3, 7},{ 2, 7},{ 1, 7},{ 0, 7}, - { 0, 8},{ 1, 8},{ 2, 8},{ 3, 8},{ 4, 8},{ 5, 8},{ 6, 8},{ 7, 8},{ 8, 8},{ 9, 8},{10, 8},{11, 8},{12, 8},{13, 8},{14, 8},{15, 8},{16, 8},{17, 8},{18, 8},{19, 8},{20, 8},{21, 8},{22, 8},{23, 8},{24, 8},{25, 8},{26, 8},{27, 8},{28, 8},{29, 8},{30, 8},{31, 8}, - {31, 9},{30, 9},{29, 9},{28, 9},{27, 9},{26, 9},{25, 9},{24, 9},{23, 9},{22, 9},{21, 9},{20, 9},{19, 9},{18, 9},{17, 9},{16, 9},{15, 9},{14, 9},{13, 9},{12, 9},{11, 9},{10, 9},{ 9, 9},{ 8, 9},{ 7, 9},{ 6, 9},{ 5, 9},{ 4, 9},{ 3, 9},{ 2, 9},{ 1, 9},{ 0, 9}, - { 0,10},{ 1,10},{ 2,10},{ 3,10},{ 4,10},{ 5,10},{ 6,10},{ 7,10},{ 8,10},{ 9,10},{10,10},{11,10},{12,10},{13,10},{14,10},{15,10},{16,10},{17,10},{18,10},{19,10},{20,10},{21,10},{22,10},{23,10},{24,10},{25,10},{26,10},{27,10},{28,10},{29,10},{30,10},{31,10}, - {31,11},{30,11},{29,11},{28,11},{27,11},{26,11},{25,11},{24,11},{23,11},{22,11},{21,11},{20,11},{19,11},{18,11},{17,11},{16,11},{15,11},{14,11},{13,11},{12,11},{11,11},{10,11},{ 9,11},{ 8,11},{ 7,11},{ 6,11},{ 5,11},{ 4,11},{ 3,11},{ 2,11},{ 1,11},{ 0,11}, - { 0,12},{ 1,12},{ 2,12},{ 3,12},{ 4,12},{ 5,12},{ 6,12},{ 7,12},{ 8,12},{ 9,12},{10,12},{11,12},{12,12},{13,12},{14,12},{15,12},{16,12},{17,12},{18,12},{19,12},{20,12},{21,12},{22,12},{23,12},{24,12},{25,12},{26,12},{27,12},{28,12},{29,12},{30,12},{31,12}, - {31,13},{30,13},{29,13},{28,13},{27,13},{26,13},{25,13},{24,13},{23,13},{22,13},{21,13},{20,13},{19,13},{18,13},{17,13},{16,13},{15,13},{14,13},{13,13},{12,13},{11,13},{10,13},{ 9,13},{ 8,13},{ 7,13},{ 6,13},{ 5,13},{ 4,13},{ 3,13},{ 2,13},{ 1,13},{ 0,13}, - { 0,14},{ 1,14},{ 2,14},{ 3,14},{ 4,14},{ 5,14},{ 6,14},{ 7,14},{ 8,14},{ 9,14},{10,14},{11,14},{12,14},{13,14},{14,14},{15,14},{16,14},{17,14},{18,14},{19,14},{20,14},{21,14},{22,14},{23,14},{24,14},{25,14},{26,14},{27,14},{28,14},{29,14},{30,14},{31,14}, - {31,15},{30,15},{29,15},{28,15},{27,15},{26,15},{25,15},{24,15},{23,15},{22,15},{21,15},{20,15},{19,15},{18,15},{17,15},{16,15},{15,15},{14,15},{13,15},{12,15},{11,15},{10,15},{ 9,15},{ 8,15},{ 7,15},{ 6,15},{ 5,15},{ 4,15},{ 3,15},{ 2,15},{ 1,15},{ 0,15}, - { 0,16},{ 1,16},{ 2,16},{ 3,16},{ 4,16},{ 5,16},{ 6,16},{ 7,16},{ 8,16},{ 9,16},{10,16},{11,16},{12,16},{13,16},{14,16},{15,16},{16,16},{17,16},{18,16},{19,16},{20,16},{21,16},{22,16},{23,16},{24,16},{25,16},{26,16},{27,16},{28,16},{29,16},{30,16},{31,16}, - {31,17},{30,17},{29,17},{28,17},{27,17},{26,17},{25,17},{24,17},{23,17},{22,17},{21,17},{20,17},{19,17},{18,17},{17,17},{16,17},{15,17},{14,17},{13,17},{12,17},{11,17},{10,17},{ 9,17},{ 8,17},{ 7,17},{ 6,17},{ 5,17},{ 4,17},{ 3,17},{ 2,17},{ 1,17},{ 0,17}, - { 0,18},{ 1,18},{ 2,18},{ 3,18},{ 4,18},{ 5,18},{ 6,18},{ 7,18},{ 8,18},{ 9,18},{10,18},{11,18},{12,18},{13,18},{14,18},{15,18},{16,18},{17,18},{18,18},{19,18},{20,18},{21,18},{22,18},{23,18},{24,18},{25,18},{26,18},{27,18},{28,18},{29,18},{30,18},{31,18}, - {31,19},{30,19},{29,19},{28,19},{27,19},{26,19},{25,19},{24,19},{23,19},{22,19},{21,19},{20,19},{19,19},{18,19},{17,19},{16,19},{15,19},{14,19},{13,19},{12,19},{11,19},{10,19},{ 9,19},{ 8,19},{ 7,19},{ 6,19},{ 5,19},{ 4,19},{ 3,19},{ 2,19},{ 1,19},{ 0,19}, - { 0,20},{ 1,20},{ 2,20},{ 3,20},{ 4,20},{ 5,20},{ 6,20},{ 7,20},{ 8,20},{ 9,20},{10,20},{11,20},{12,20},{13,20},{14,20},{15,20},{16,20},{17,20},{18,20},{19,20},{20,20},{21,20},{22,20},{23,20},{24,20},{25,20},{26,20},{27,20},{28,20},{29,20},{30,20},{31,20}, - {31,21},{30,21},{29,21},{28,21},{27,21},{26,21},{25,21},{24,21},{23,21},{22,21},{21,21},{20,21},{19,21},{18,21},{17,21},{16,21},{15,21},{14,21},{13,21},{12,21},{11,21},{10,21},{ 9,21},{ 8,21},{ 7,21},{ 6,21},{ 5,21},{ 4,21},{ 3,21},{ 2,21},{ 1,21},{ 0,21}, - { 0,22},{ 1,22},{ 2,22},{ 3,22},{ 4,22},{ 5,22},{ 6,22},{ 7,22},{ 8,22},{ 9,22},{10,22},{11,22},{12,22},{13,22},{14,22},{15,22},{16,22},{17,22},{18,22},{19,22},{20,22},{21,22},{22,22},{23,22},{24,22},{25,22},{26,22},{27,22},{28,22},{29,22},{30,22},{31,22}, - {31,23},{30,23},{29,23},{28,23},{27,23},{26,23},{25,23},{24,23},{23,23},{22,23},{21,23},{20,23},{19,23},{18,23},{17,23},{16,23},{15,23},{14,23},{13,23},{12,23},{11,23},{10,23},{ 9,23},{ 8,23},{ 7,23},{ 6,23},{ 5,23},{ 4,23},{ 3,23},{ 2,23},{ 1,23},{ 0,23}, - { 0,24},{ 1,24},{ 2,24},{ 3,24},{ 4,24},{ 5,24},{ 6,24},{ 7,24},{ 8,24},{ 9,24},{10,24},{11,24},{12,24},{13,24},{14,24},{15,24},{16,24},{17,24},{18,24},{19,24},{20,24},{21,24},{22,24},{23,24},{24,24},{25,24},{26,24},{27,24},{28,24},{29,24},{30,24},{31,24}, - {31,25},{30,25},{29,25},{28,25},{27,25},{26,25},{25,25},{24,25},{23,25},{22,25},{21,25},{20,25},{19,25},{18,25},{17,25},{16,25},{15,25},{14,25},{13,25},{12,25},{11,25},{10,25},{ 9,25},{ 8,25},{ 7,25},{ 6,25},{ 5,25},{ 4,25},{ 3,25},{ 2,25},{ 1,25},{ 0,25}, - { 0,26},{ 1,26},{ 2,26},{ 3,26},{ 4,26},{ 5,26},{ 6,26},{ 7,26},{ 8,26},{ 9,26},{10,26},{11,26},{12,26},{13,26},{14,26},{15,26},{16,26},{17,26},{18,26},{19,26},{20,26},{21,26},{22,26},{23,26},{24,26},{25,26},{26,26},{27,26},{28,26},{29,26},{30,26},{31,26}, - {31,27},{30,27},{29,27},{28,27},{27,27},{26,27},{25,27},{24,27},{23,27},{22,27},{21,27},{20,27},{19,27},{18,27},{17,27},{16,27},{15,27},{14,27},{13,27},{12,27},{11,27},{10,27},{ 9,27},{ 8,27},{ 7,27},{ 6,27},{ 5,27},{ 4,27},{ 3,27},{ 2,27},{ 1,27},{ 0,27}, - { 0,28},{ 1,28},{ 2,28},{ 3,28},{ 4,28},{ 5,28},{ 6,28},{ 7,28},{ 8,28},{ 9,28},{10,28},{11,28},{12,28},{13,28},{14,28},{15,28},{16,28},{17,28},{18,28},{19,28},{20,28},{21,28},{22,28},{23,28},{24,28},{25,28},{26,28},{27,28},{28,28},{29,28},{30,28},{31,28}, - {31,29},{30,29},{29,29},{28,29},{27,29},{26,29},{25,29},{24,29},{23,29},{22,29},{21,29},{20,29},{19,29},{18,29},{17,29},{16,29},{15,29},{14,29},{13,29},{12,29},{11,29},{10,29},{ 9,29},{ 8,29},{ 7,29},{ 6,29},{ 5,29},{ 4,29},{ 3,29},{ 2,29},{ 1,29},{ 0,29}, - { 0,30},{ 1,30},{ 2,30},{ 3,30},{ 4,30},{ 5,30},{ 6,30},{ 7,30},{ 8,30},{ 9,30},{10,30},{11,30},{12,30},{13,30},{14,30},{15,30},{16,30},{17,30},{18,30},{19,30},{20,30},{21,30},{22,30},{23,30},{24,30},{25,30},{26,30},{27,30},{28,30},{29,30},{30,30},{31,30}, - {31,31},{30,31},{29,31},{28,31},{27,31},{26,31},{25,31},{24,31},{23,31},{22,31},{21,31},{20,31},{19,31},{18,31},{17,31},{16,31},{15,31},{14,31},{13,31},{12,31},{11,31},{10,31},{ 9,31},{ 8,31},{ 7,31},{ 6,31},{ 5,31},{ 4,31},{ 3,31},{ 2,31},{ 1,31},{ 0,31}, -}; - - -inline bool isSLNonRefPic(NALU& nalu){ - switch(nalu.nal_unit_type){ - case TRAIL_N: - case TSA_N: - case STSA_N: - case RADL_N: - case RASL_N: - case RSV_VCL_N10: - case RSV_VCL_N12: - case RSV_VCL_N14: - return true; - default: - return false; - } -} - -void Info::decodeSSH(NALU& nalu, bool bNewSequence) -{ - Bs32s i = 0, j = 0, x = 0, y = 0, p = 0, m = 0, tileIdx = 0; - auto& slice = *nalu.slice; - auto& sps = *slice.sps; - auto& pps = *slice.pps; - - const Bs8u _SubWidthC[5] = {1,2,2,1,1}; - const Bs8u _SubHeightC[5] = {1,2,1,1,1}; - - auto prevPicWidthInCtbsY = PicWidthInCtbsY; - auto prevPicHeightInCtbsY = PicHeightInCtbsY; - auto prevMinTbLog2SizeY = MinTbLog2SizeY; - auto prevCtbLog2SizeY = CtbLog2SizeY; - - NoRaslOutputFlag = bNewSequence || isIDR(nalu) || isBLA(nalu); - NoBackwardPredFlag = true; - ColPicSlices = 0; - NumColSlices = 0; - MaxPicOrderCntLsb = (1 << (sps.log2_max_pic_order_cnt_lsb_minus4+4)); - - SubWidthC = _SubWidthC[sps.chroma_format_idc + sps.separate_colour_plane_flag]; - SubHeightC = _SubHeightC[sps.chroma_format_idc + sps.separate_colour_plane_flag]; - MinCbLog2SizeY = sps.log2_min_luma_coding_block_size_minus3 + 3; - CtbLog2SizeY = MinCbLog2SizeY + sps.log2_diff_max_min_luma_coding_block_size; - CtbSizeY = (1 << CtbLog2SizeY); - PicWidthInCtbsY = (sps.pic_width_in_luma_samples + CtbSizeY - 1) / CtbSizeY; - PicHeightInCtbsY = (sps.pic_height_in_luma_samples + CtbSizeY - 1) / CtbSizeY; - MinCbSizeY = (1 << MinCbLog2SizeY); - PicWidthInMinCbsY = (sps.pic_width_in_luma_samples + MinCbSizeY - 1) / MinCbSizeY; - PicHeightInMinCbsY = (sps.pic_height_in_luma_samples + MinCbSizeY - 1) / MinCbSizeY; - PicSizeInMinCbsY = PicWidthInMinCbsY * PicHeightInMinCbsY; - PicSizeInCtbsY = PicWidthInCtbsY * PicHeightInCtbsY; - PicSizeInSamplesY = sps.pic_width_in_luma_samples * sps.pic_height_in_luma_samples; - PicWidthInSamplesC = sps.pic_width_in_luma_samples / SubWidthC; - PicHeightInSamplesC = sps.pic_height_in_luma_samples / SubHeightC; - MinTbLog2SizeY = sps.log2_min_luma_transform_block_size_minus2 + 2; - MaxTbLog2SizeY = MinTbLog2SizeY + sps.log2_diff_max_min_luma_transform_block_size; - Log2MinIpcmCbSizeY = sps.log2_min_pcm_luma_coding_block_size_minus3 + 3; - Log2MaxIpcmCbSizeY = Log2MinIpcmCbSizeY + sps.log2_diff_max_min_pcm_luma_coding_block_size; - Log2MinCuQpDeltaSize = CtbLog2SizeY - pps.diff_cu_qp_delta_depth; - Log2ParMrgLevel = pps.log2_parallel_merge_level_minus2 + 2; - SliceQpY = 26 + pps.init_qp_minus26 + slice.qp_delta; - BitDepthY = sps.bit_depth_luma_minus8 + 8; - BitDepthC = sps.bit_depth_chroma_minus8 + 8; - QpBdOffsetY = 6 * sps.bit_depth_luma_minus8; - QpBdOffsetC = 6 * sps.bit_depth_chroma_minus8; - ChromaArrayType = sps.separate_colour_plane_flag ? 0 : sps.chroma_format_idc; - Log2MinCuChromaQpOffsetSize = CtbLog2SizeY - pps.diff_cu_chroma_qp_offset_depth; - CtbWidthC = CtbSizeY / SubWidthC; - CtbHeightC = CtbSizeY / SubHeightC; - RawCtuBits = (Bs32u)CtbSizeY * CtbSizeY * BitDepthY + 2ul * CtbWidthC * CtbHeightC * BitDepthC; - PaletteMaxPredictorSize = sps.palette_max_size + sps.delta_palette_max_predictor_size; - TwoVersionsOfCurrDecPicFlag = - pps.curr_pic_ref_enabled_flag - && (sps.sample_adaptive_offset_enabled_flag - || !pps.deblocking_filter_disabled_flag - || pps.deblocking_filter_override_enabled_flag); - - if (bNewSequence) - { - Bs32u sz = (sps.palette_max_size + PaletteMaxPredictorSize); - PalettePredictorEntryReuseFlags.resize(sz); - CurrentPaletteEntries[0].resize(sz); - CurrentPaletteEntries[1].resize(sz); - CurrentPaletteEntries[2].resize(sz); - } - - if (m_cSlice && slice.dependent_slice_segment_flag) - { - Slice tmp = *m_cSlice; - tmp.first_slice_segment_in_pic_flag = slice.first_slice_segment_in_pic_flag; - tmp.no_output_of_prior_pics_flag = slice.no_output_of_prior_pics_flag; - tmp.dependent_slice_segment_flag = 1; - tmp.slice_segment_address = slice.slice_segment_address; - tmp.num_entry_point_offsets = slice.num_entry_point_offsets; - tmp.offset_len_minus1 = slice.offset_len_minus1; - tmp.entry_point_offset_minus1 = slice.entry_point_offset_minus1; - - slice = tmp; - } - - if (!m_bRPLDecoded) - decodePOC(nalu); - - NewPicture = (bNewSequence || !m_cSlice || (m_cSlice->POC != slice.POC) - || (m_cSlice->POC == slice.POC && CtuInRs[slice.slice_segment_address])); - - if (NewPicture) - { - if (!m_bRPLDecoded) - m_DPB.swap(m_DPBafter); - - SliceAddrRsInTs.resize(PicSizeInCtbsY); - std::fill(SliceAddrRsInTs.begin(), SliceAddrRsInTs.end(), -1); - - CtuInRs.resize(PicSizeInCtbsY); - std::fill(CtuInRs.begin(), CtuInRs.end(), nullptr); - } - - for (auto& sao : m_sao) - sao.resize(PicSizeInCtbsY); - - if (!m_bRPLDecoded) - { - m_prevSlicePOC = slice.POC; - decodeRPL(nalu); - } - - m_bRPLDecoded = false; - - i = 0; - while (NoBackwardPredFlag && i < (Bs32s)slice.num_ref_idx_l0_active) - NoBackwardPredFlag = (slice.L0[i++].POC <= slice.POC); - i = 0; - while (NoBackwardPredFlag && i < (Bs32s)slice.num_ref_idx_l1_active) - NoBackwardPredFlag = (slice.L1[i++].POC <= slice.POC); - - bool updateAddr = !m_cSlice || bNewSequence; - - if (!updateAddr) - { - auto& prevPPS = *m_cSlice->pps; - - updateAddr = - (prevPicWidthInCtbsY != PicWidthInCtbsY) - || (prevPicHeightInCtbsY != PicHeightInCtbsY) - || (prevPPS.tiles_enabled_flag != pps.tiles_enabled_flag) - || (prevPPS.num_tile_columns_minus1 != pps.num_tile_columns_minus1) - || (prevPPS.num_tile_rows_minus1 != pps.num_tile_rows_minus1) - || (prevPPS.uniform_spacing_flag != pps.uniform_spacing_flag); - - if (!updateAddr && pps.tiles_enabled_flag && !pps.uniform_spacing_flag) - { - updateAddr |= !!memcmp(pps.column_width_minus1, prevPPS.column_width_minus1, sizeof(pps.column_width_minus1[0]) * pps.num_tile_columns_minus1); - updateAddr |= !!memcmp(pps.row_height_minus1, prevPPS.row_height_minus1, sizeof(pps.column_width_minus1[0]) * pps.num_tile_rows_minus1); - } - } - - if (updateAddr) - { - colWidth.resize(pps.num_tile_columns_minus1+1); - if (pps.uniform_spacing_flag) - { - for (i = 0; i <= pps.num_tile_columns_minus1; i++) - { - colWidth[i] = ((i + 1) * PicWidthInCtbsY) / (pps.num_tile_columns_minus1 + 1) - - (i * PicWidthInCtbsY) / (pps.num_tile_columns_minus1 + 1); - } - } - else - { - colWidth[pps.num_tile_columns_minus1] = PicWidthInCtbsY; - - for (i = 0; i < pps.num_tile_columns_minus1; i++) - { - colWidth[i] = pps.column_width_minus1[i] + 1; - colWidth[pps.num_tile_columns_minus1] -= colWidth[i]; - } - } - - rowHeight.resize(pps.num_tile_rows_minus1+1); - if (pps.uniform_spacing_flag) - { - for (j = 0; j <= pps.num_tile_rows_minus1; j++) - { - rowHeight[j] = ((j + 1) * PicHeightInCtbsY) / (pps.num_tile_rows_minus1 + 1) - - (j * PicHeightInCtbsY) / (pps.num_tile_rows_minus1 + 1); - } - } - else - { - rowHeight[pps.num_tile_rows_minus1] = PicHeightInCtbsY; - for (j = 0; j < pps.num_tile_rows_minus1; j++) - { - rowHeight[j] = pps.row_height_minus1[j] + 1; - rowHeight[pps.num_tile_rows_minus1] -= rowHeight[j]; - } - } - - colBd.resize(pps.num_tile_columns_minus1+2); - for (colBd[0] = 0, i = 0; i <= pps.num_tile_columns_minus1; i++) - colBd[i + 1] = colBd[i] + colWidth[i]; - - rowBd.resize(pps.num_tile_rows_minus1+2); - for (rowBd[0] = 0, j = 0; j <= pps.num_tile_rows_minus1; j++) - rowBd[j + 1] = rowBd[j] + rowHeight[j]; - - CtbAddrRsToTs.resize(PicSizeInCtbsY); - for (Bs16u ctbAddrRs = 0; ctbAddrRs < PicSizeInCtbsY; ctbAddrRs++) - { - Bs16u tbX = ctbAddrRs % PicWidthInCtbsY; - Bs16u tbY = ctbAddrRs / PicWidthInCtbsY; - Bs16u tileX = 0; - Bs16u tileY = 0; - - for (i = 0; i <= pps.num_tile_columns_minus1; i++) - if (tbX >= colBd[ i ]) - tileX = i; - - for (j = 0; j <= pps.num_tile_rows_minus1; j++) - if (tbY >= rowBd[ j ]) - tileY = j; - - CtbAddrRsToTs[ctbAddrRs] = 0; - - for (i = 0; i < tileX; i++) - CtbAddrRsToTs[ctbAddrRs] += rowHeight[tileY] * colWidth[i]; - - for (j = 0; j < tileY; j++) - CtbAddrRsToTs[ctbAddrRs] += PicWidthInCtbsY * rowHeight[j]; - - CtbAddrRsToTs[ctbAddrRs] += (tbY - rowBd[tileY]) * colWidth[tileX] + tbX - colBd[tileX]; - } - - CtbAddrTsToRs.resize(PicSizeInCtbsY); - for (Bs16u ctbAddrRs = 0; ctbAddrRs < PicSizeInCtbsY; ctbAddrRs++) - CtbAddrTsToRs[CtbAddrRsToTs[ctbAddrRs]] = ctbAddrRs; - - - TileId.resize(PicSizeInCtbsY); - for (j = 0, tileIdx = 0; j <= pps.num_tile_rows_minus1; j++ ) - for (i = 0; i <= pps.num_tile_columns_minus1; i++, tileIdx++) - for (y = rowBd[ j ]; y < rowBd[ j + 1 ]; y++) - for (x = colBd[ i ]; x < colBd[ i + 1 ]; x++) - TileId[CtbAddrRsToTs[y * PicWidthInCtbsY + x]] = tileIdx; - } - - if ( updateAddr - || prevMinTbLog2SizeY != MinTbLog2SizeY - || prevCtbLog2SizeY != CtbLog2SizeY) - { - m_MinTbAddrZsPitch = (PicWidthInCtbsY << (CtbLog2SizeY - MinTbLog2SizeY)); - j = (PicHeightInCtbsY << ( CtbLog2SizeY - MinTbLog2SizeY)); - m_MinTbAddrZs.resize(m_MinTbAddrZsPitch * j); - - for (y = 0; y < j; y++) - { - for (x = 0; x < (Bs32s)m_MinTbAddrZsPitch; x++) - { - Bs32u ctbAddrRs = PicWidthInCtbsY * ((y << MinTbLog2SizeY) >> CtbLog2SizeY) - + ((x << MinTbLog2SizeY) >> CtbLog2SizeY); - - MinTbAddrZs(x, y) = (CtbAddrRsToTs[ctbAddrRs] << ((CtbLog2SizeY - MinTbLog2SizeY) * 2)); - - for (i = 0, p = 0; i < (CtbLog2SizeY - MinTbLog2SizeY); i++) - { - m = (1 << i); - p += ((m & x) ? (m * m) : 0) + ((m & y) ? (2 * m * m) : 0); - } - - MinTbAddrZs(x, y) += p; - } - } - } - - m_cSlice = &slice; -} - -void Info::decodePOC(NALU& nalu) -{ - auto& slice = *nalu.slice; - PocInfo POC = {(Bs32s)slice.pic_order_cnt_lsb, 0}; - - if (!(isIRAP(nalu) && NoRaslOutputFlag)) - { - if ((POC.Lsb < m_prevPOC.Lsb) && ((m_prevPOC.Lsb - POC.Lsb) >= (MaxPicOrderCntLsb / 2))) - POC.Msb = m_prevPOC.Msb + MaxPicOrderCntLsb; - else if ((POC.Lsb > m_prevPOC.Lsb) && ((POC.Lsb - m_prevPOC.Lsb) > (MaxPicOrderCntLsb / 2))) - POC.Msb = m_prevPOC.Msb - MaxPicOrderCntLsb; - else - POC.Msb = m_prevPOC.Msb; - } - - slice.POC = POC.Msb + POC.Lsb; - - if( nalu.nuh_temporal_id_plus1 == 1 - && !(isRASL(nalu) || isRADL(nalu) || isSLNonRefPic(nalu))) - { - m_prevPOC = POC; - } -} - -struct FindLt -{ - Bs32s m_max; - Bs32s m_poc; - - FindLt(Bs32s poc, Bs32s max) - { - m_poc = poc; - m_max = max; - } - - inline bool operator () (const std::pair& v) - { - return ((v.first & (m_max - 1)) == m_poc) && v.second; - } -}; - -void Info::decodeRPL(NALU& nalu) -{ - auto& slice = *nalu.slice; - auto& pps = *slice.pps; - std::vector RPS, TmpL0, TmpL1, CurrBefore, CurrAfter, CurrLt; - size_t NumPicTotalCurr = 0, TmpL0Sz, TmpL1Sz; - RefPic currPic = {}; - - currPic.POC = slice.POC; - currPic.used = pps.curr_pic_ref_enabled_flag; - currPic.lost = !pps.curr_pic_ref_enabled_flag; - currPic.long_term = true; - - for (Bs32u i = 0; i < slice.strps.NumDeltaPocs; i++) - { - RefPic ref = {}; - - ref.POC = slice.POC + slice.strps.DeltaPoc[i]; - ref.used = GetBit(slice.strps.UsedByCurrPicFlags, i); - ref.lost = !m_DPB[ref.POC]; - - RPS.push_back(ref); - - if (ref.used) - { - NumPicTotalCurr++; - - if (ref.POC < slice.POC) - CurrBefore.push_back(ref); - else - CurrAfter.push_back(ref); - } - } - - for (Bs32u i = 0; i < (Bs32u)(slice.num_long_term_sps + slice.num_long_term_pics); i++) - { - RefPic ref = {1, 0, 0, 0}; - - ref.POC = slice.poc_lsb_lt[i]; - - if (slice.DeltaPocMsbCycleLt[i]) - { - ref.POC += slice.POC - slice.DeltaPocMsbCycleLt[ i ] * MaxPicOrderCntLsb - (slice.POC & (MaxPicOrderCntLsb - 1)); - ref.lost = !m_DPB[ref.POC]; - } - else - { - auto picX = std::find_if(m_DPB.begin(), m_DPB.end(), FindLt(ref.POC, MaxPicOrderCntLsb)); - - ref.lost = (m_DPB.end() == picX); - - if (!ref.lost) - ref.POC = picX->first; - } - - ref.used = GetBit(slice.used_by_curr_pic_lt_flags, i); - - RPS.push_back(ref); - - if (ref.used) - { - NumPicTotalCurr++; - CurrLt.push_back(ref); - } - } - - if (pps.curr_pic_ref_enabled_flag) - NumPicTotalCurr++; - - if (RPS.size()) - memcpy(slice.DPB, &RPS[0], RPS.size() * sizeof(RefPic)); - - TmpL0Sz = BS_MAX(NumPicTotalCurr, slice.num_ref_idx_l0_active); - TmpL1Sz = BS_MAX(NumPicTotalCurr, slice.num_ref_idx_l1_active); - - m_DPBafter.erase(m_DPBafter.begin(), m_DPBafter.end()); - - for (auto& ref : RPS) - m_DPBafter[ref.POC] = !ref.lost; - - m_DPBafter[slice.POC] = 1;//!isSLNonRefPic(nalu); - -#define _ADD_REFS(DST, SRC, MAX) \ -{ \ - size_t _N = BS_MIN(MAX, SRC.size()); \ - if (_N > 0) \ - { \ - auto end = SRC.begin(); \ - std::advance(end, _N); \ - DST.insert(DST.end(), SRC.begin(), end); \ - MAX -= _N; \ - } \ -} - - while (TmpL0Sz > 0) - { - _ADD_REFS(TmpL0, CurrBefore, TmpL0Sz); - _ADD_REFS(TmpL0, CurrAfter, TmpL0Sz); - _ADD_REFS(TmpL0, CurrLt, TmpL0Sz); - - if (pps.curr_pic_ref_enabled_flag && TmpL0Sz) - { - TmpL0.push_back(currPic); - TmpL0Sz--; - } - } - - while (TmpL1Sz > 0) - { - _ADD_REFS(TmpL1, CurrAfter, TmpL1Sz); - _ADD_REFS(TmpL1, CurrBefore, TmpL1Sz); - _ADD_REFS(TmpL1, CurrLt, TmpL1Sz); - - if (pps.curr_pic_ref_enabled_flag && TmpL1Sz) - { - TmpL1.push_back(currPic); - TmpL1Sz--; - } - } - -#undef _ADD_REFS - - if (slice.num_ref_idx_l0_active > 0) - { - if (slice.ref_pic_list_modification_flag_l0) - { - for (Bs32u i = 0; i < slice.num_ref_idx_l0_active; i++) - slice.L0[i] = TmpL0[slice.list_entry_lx[0][i]]; - } - else - { - memcpy(slice.L0, &TmpL0[0], slice.num_ref_idx_l0_active * sizeof(RefPic)); - } - } - - if ( pps.curr_pic_ref_enabled_flag - && slice.type != SLICE_TYPE::I - && !slice.ref_pic_list_modification_flag_l0 - && TmpL0.size() > slice.num_ref_idx_l0_active) - slice.L0[slice.num_ref_idx_l0_active - 1] = currPic; - - if (slice.num_ref_idx_l1_active > 0) - { - if (slice.ref_pic_list_modification_flag_l1) - { - for (Bs32u i = 0; i < slice.num_ref_idx_l1_active; i++) - slice.L1[i] = TmpL1[slice.list_entry_lx[1][i]]; - } - else - { - memcpy(slice.L1, &TmpL1[0], slice.num_ref_idx_l1_active * sizeof(RefPic)); - } - } -} - -bool Info::AvailableZs(Bs16s xCurr, Bs16s yCurr, Bs16s xNbY, Bs16s yNbY) -{ - auto& sps = *m_cSlice->sps; - Bs32s minBlockAddrCurr = MinTbAddrZs(xCurr >> MinTbLog2SizeY, yCurr >> MinTbLog2SizeY); - Bs32s minBlockAddrN = -1; - Bs32u CtbAddrInRsCurr = (yCurr >> CtbLog2SizeY) * PicWidthInCtbsY + (xCurr >> CtbLog2SizeY); - Bs32u CtbAddrInRsN = 0; - Bs32u CtbAddrInTsCurr = CtbAddrRsToTs[CtbAddrInRsCurr]; - Bs32u CtbAddrInTsN = CtbAddrRsToTs[CtbAddrInRsN]; - - if ( xNbY >= 0 - && yNbY >= 0 - && xNbY < sps.pic_width_in_luma_samples - && yNbY < sps.pic_height_in_luma_samples) - { - minBlockAddrN = MinTbAddrZs(xNbY >> MinTbLog2SizeY, yNbY >> MinTbLog2SizeY); - CtbAddrInRsN = (yNbY>>CtbLog2SizeY) * PicWidthInCtbsY + (xNbY>>CtbLog2SizeY); - CtbAddrInTsN = CtbAddrRsToTs[CtbAddrInRsN]; - } - - if ( minBlockAddrN < 0 - || minBlockAddrN > minBlockAddrCurr - || SliceAddrRsInTs[CtbAddrInTsN] != SliceAddrRsInTs[CtbAddrInTsCurr] - || TileId[CtbAddrInTsN] != TileId[CtbAddrInTsCurr]) - { - return false; - } - - return true; -} - -bool Info::AvailablePb(Bs16s xCb, Bs16s yCb, Bs16u nCbS, Bs16s xPb, Bs16s yPb, - Bs16s nPbW, Bs16s nPbH, Bs16u partIdx, Bs16s xNbY, Bs16s yNbY) -{ - bool sameCb = - xCb <= xNbY - && yCb <= yNbY - && (xCb + nCbS) > xNbY - && (yCb + nCbS) > yNbY; - - if (!sameCb) - { - if (AvailableZs(xPb, yPb, xNbY, yNbY)) - { - CU* p = GetCU(xNbY, yNbY); - - if (!p) - throw InvalidSyntax(); - - return (p->PredMode != MODE_INTRA); - } - return false; - } - - if ( (nPbW << 1) == nCbS - && (nPbH << 1) == nCbS - && partIdx == 1 - && (yCb + nPbH) <= yNbY - && (xCb + nPbW) > xNbY) - return false; - - CU* p = GetCU(xNbY, yNbY); - - if (!p) - throw InvalidSyntax(); - - return (p->PredMode != MODE_INTRA); -} - -CU* GetUnit(CU& cu, Bs16s x, Bs16s y) -{ - for (CU* p = &cu; p; p = p->Next) - { - if ( x >= p->x - && y >= p->y - && x < (p->x + (1 << p->log2CbSize)) - && y < (p->y + (1 << p->log2CbSize))) - return p; - } - return 0; -} - -PU* GetUnit(PU& pu, Bs16s x, Bs16s y) -{ - for (PU* p = &pu; p; p = p->Next) - { - if ( x >= p->x - && y >= p->y - && x < (p->x + p->w) - && y < (p->y + p->h)) - return p; - } - return 0; -} - -TU* GetUnit(TU& cu, Bs16s x, Bs16s y) -{ - for (TU* p = &cu; p; p = p->Next) - { - if ( x >= p->x - && y >= p->y - && x < (p->x + (1 << p->log2TrafoSize)) - && y < (p->y + (1 << p->log2TrafoSize))) - return p; - } - return 0; -} - -CU* Info::GetCU(Bs16s x, Bs16s y) -{ - CTU* p = CtuInRs[(y >> CtbLog2SizeY) * PicWidthInCtbsY + (x >> CtbLog2SizeY)]; - if (p) - return GetUnit(*p->Cu, x, y); - return 0; -} - -TU* Info::GetTU(CU& cu, Bs16s x, Bs16s y) -{ - if (!cu.Tu) - return 0; - return GetUnit(*cu.Tu, x, y); -} - -PU* Info::GetPU(Bs16s x, Bs16s y) -{ - CU* cu = GetCU(x, y); - if (!cu || !cu->Pu) - return 0; - return GetUnit(*cu->Pu, x, y); -} - -#define Clip3(_min, _max, _x) std::min(std::max(_min, _x), _max) -const Bs16s QpC_trans[14] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37}; - -Bs16s Info::GetQpCb(Bs16s QpY, Bs16s CuQpOffsetCb) -{ - Bs16s QpCb = Clip3(-QpBdOffsetC, 57, QpY + m_cSlice->pps->cb_qp_offset + m_cSlice->cb_qp_offset + CuQpOffsetCb); - - if (ChromaArrayType == 1) - { - if (QpCb > 43) - return QpCb - 6; - - if (QpCb >= 30) - return QpC_trans[QpCb - 30]; - - return QpCb; - } - - return BS_MIN(51, QpCb); -} - -Bs16s Info::GetQpCr(Bs16s QpY, Bs16s CuQpOffsetCr) -{ - Bs16s QpCr = Clip3(-QpBdOffsetC, 57, QpY + m_cSlice->pps->cr_qp_offset + m_cSlice->cr_qp_offset + CuQpOffsetCr); - - if (ChromaArrayType == 1) - { - if (QpCr > 43) - return QpCr - 6; - - if (QpCr >= 30) - return QpC_trans[QpCr - 30]; - - return QpCr; - } - - return BS_MIN(51, QpCr); -} - -inline bool PredFlagLX(PU&pu, Bs16u X) { return pu.inter_pred_idc == PRED_BI || pu.inter_pred_idc == X; } -template inline T Sign(T x) { return (x > 0) ? 1 : (x < 0) ? -1 : 0; } -template inline bool EQ(const T& l, const T& r) { return !memcmp(&l, &r, sizeof(T)); } -template inline bool CP(T& d, const T& s) { return !memmove(&d, &s, sizeof(T)); } - -const Bs8u lXCandIdx[12][2] = -{ - { 0, 1 }, { 1, 0 }, { 0, 2 }, { 2, 0 }, - { 1, 2 }, { 2, 1 }, { 0, 3 }, { 3, 0 }, - { 1, 3 }, { 3, 1 }, { 2, 3 }, { 3, 2 } -}; - -void Info::decodeMvLX(CU& cu, PU&pu, Bs16u partIdx) -{ - if (!pu.merge_flag) - throw InvalidSyntax(); - - //8.5.3.2.2 - const Bs16u A0 = 0, A1 = 1, B0 = 2, B1 = 3, B2 = 4, Col = 5; - const Bs16u MaxCand = 6 * 3; - Bs16s xPb = pu.x; - Bs16s yPb = pu.y; - Bs16s nPbW = pu.w; - Bs16s nPbH = pu.h; - Bs16u nCbS = (1 << cu.log2CbSize); - bool availableFlag[MaxCand] = {}; - bool predFlagLX[MaxCand][2] = {}; - Bs16s mvLX[MaxCand][2][2] = {}; - Bs16s refIdxLX[MaxCand][2]; - Bs16u mergeCandList[MaxCand] = {}; - Bs16u numCurrMergeCand = 0 - , numOrigMergeCand = 0 - , MaxNumMergeCand; - auto& slice = *m_cSlice; - - memset(refIdxLX, -1, sizeof(refIdxLX)); - - if (Log2ParMrgLevel > 2 && nCbS == 8) - { - xPb = cu.x; - yPb = cu.y; - nPbW = nCbS; - nPbH = nCbS; - partIdx = 0; - } - - //8.5.3.2.3 - { - PU* puN; - Bs16s xNbN = xPb - 1; - Bs16s yNbN = yPb + nPbH - 1; - bool availableA1, availableB1, availableB0, availableA0, availableB2; - auto CopyPred = [&] (Bs16u N) - { - predFlagLX[N][0] = (puN->inter_pred_idc == PRED_L0 || puN->inter_pred_idc == PRED_BI); - predFlagLX[N][1] = (puN->inter_pred_idc == PRED_L1 || puN->inter_pred_idc == PRED_BI); - if (predFlagLX[N][0]) - { - CP(mvLX[N][0], puN->MvLX[0]); - refIdxLX[N][0] = puN->ref_idx_l0; - } - if (predFlagLX[N][1]) - { - CP(mvLX[N][1], puN->MvLX[1]); - refIdxLX[N][1] = puN->ref_idx_l1; - } - }; - - if ( ( (xPb >> Log2ParMrgLevel) == (xNbN >> Log2ParMrgLevel) - && (yPb >> Log2ParMrgLevel) == (yNbN >> Log2ParMrgLevel)) - || (partIdx == 1 && (cu.PartMode == PART_Nx2N || cu.PartMode == PART_nLx2N || cu.PartMode == PART_nRx2N))) - availableA1 = false; - else - availableA1 = AvailablePb(cu.x, cu.y, nCbS, xPb, yPb, nPbW, nPbH, partIdx, xNbN, yNbN); - - if (availableA1) - { - puN = GetPU(xNbN, yNbN); - - CopyPred(A1); - availableFlag[A1] = true; - - mergeCandList[numCurrMergeCand++] = A1; - if (numCurrMergeCand > pu.merge_idx) - goto l_done; - } - - xNbN = xPb + nPbW - 1; - yNbN = yPb - 1; - - if ( ( (xPb >> Log2ParMrgLevel) == (xNbN >> Log2ParMrgLevel) - && (yPb >> Log2ParMrgLevel) == (yNbN >> Log2ParMrgLevel)) - || (partIdx == 1 && (cu.PartMode == PART_2NxN || cu.PartMode == PART_2NxnU || cu.PartMode == PART_2NxnD))) - availableB1 = false; - else - availableB1 = AvailablePb(cu.x, cu.y, nCbS, xPb, yPb, nPbW, nPbH, partIdx, xNbN, yNbN); - - if (availableB1) - { - puN = GetPU(xNbN, yNbN); - - CopyPred(B1); - - if (!availableA1 || !(EQ(mvLX[B1], mvLX[A1]) && EQ(refIdxLX[B1], refIdxLX[A1]))) - { - availableFlag[B1] = true; - - mergeCandList[numCurrMergeCand++] = B1; - if (numCurrMergeCand > pu.merge_idx) - goto l_done; - } - } - - xNbN = xPb + nPbW; - yNbN = yPb - 1; - - if ( (xPb >> Log2ParMrgLevel) == (xNbN >> Log2ParMrgLevel) - && (yPb >> Log2ParMrgLevel) == (yNbN >> Log2ParMrgLevel)) - availableB0 = false; - else - availableB0 = AvailablePb(cu.x, cu.y, nCbS, xPb, yPb, nPbW, nPbH, partIdx, xNbN, yNbN); - - if (availableB0) - { - puN = GetPU(xNbN, yNbN); - - CopyPred(B0); - - if (!availableB1 || !(EQ(mvLX[B0], mvLX[B1]) && EQ(refIdxLX[B0], refIdxLX[B1]))) - { - availableFlag[B0] = true; - - mergeCandList[numCurrMergeCand++] = B0; - if (numCurrMergeCand > pu.merge_idx) - goto l_done; - } - } - - xNbN = xPb - 1; - yNbN = yPb + nPbH; - - if ( (xPb >> Log2ParMrgLevel) == (xNbN >> Log2ParMrgLevel) - && (yPb >> Log2ParMrgLevel) == (yNbN >> Log2ParMrgLevel)) - availableA0 = false; - else - availableA0 = AvailablePb(cu.x, cu.y, nCbS, xPb, yPb, nPbW, nPbH, partIdx, xNbN, yNbN); - - if (availableA0) - { - puN = GetPU(xNbN, yNbN); - - CopyPred(A0); - - if (!availableA1 || !(EQ(mvLX[A0], mvLX[A1]) && EQ(refIdxLX[A0], refIdxLX[A1]))) - { - availableFlag[A0] = true; - - mergeCandList[numCurrMergeCand++] = A0; - if (numCurrMergeCand > pu.merge_idx) - goto l_done; - } - } - - xNbN = xPb - 1; - yNbN = yPb - 1; - - if ( (xPb >> Log2ParMrgLevel) == (xNbN >> Log2ParMrgLevel) - && (yPb >> Log2ParMrgLevel) == (yNbN >> Log2ParMrgLevel)) - availableB2 = false; - else - availableB2 = AvailablePb(cu.x, cu.y, nCbS, xPb, yPb, nPbW, nPbH, partIdx, xNbN, yNbN); - - if (availableB2) - { - puN = GetPU(xNbN, yNbN); - - CopyPred(B2); - - if ( (!availableA1 || !(EQ(mvLX[B2], mvLX[A1]) && EQ(refIdxLX[B2], refIdxLX[A1]))) - && (!availableB1 || !(EQ(mvLX[B2], mvLX[B1]) && EQ(refIdxLX[B2], refIdxLX[B1]))) - && !(availableFlag[A0] && availableFlag[A1] && availableFlag[B0] && availableFlag[B1])) - { - availableFlag[B2] = true; - - mergeCandList[numCurrMergeCand++] = B2; - if (numCurrMergeCand > pu.merge_idx) - goto l_done; - } - } - } - - { - refIdxLX[Col][0] = 0; - refIdxLX[Col][1] = 0; - - bool availableFlagL0Col = false - , availableFlagL1Col = false; - - //8.5.3.2.8 - if (m_cSlice->temporal_mvp_enabled_flag) - availableFlagL0Col = decodeMvLXCol(xPb, yPb, nPbW, nPbH, 0, refIdxLX[Col][0], mvLX[Col][0]); - - availableFlag[Col] = availableFlagL0Col; - predFlagLX[Col][0] = availableFlagL0Col; - predFlagLX[Col][1] = 0; - - if (m_cSlice->type == SLICE_TYPE::B) - { - //8.5.3.2.8 - if (m_cSlice->temporal_mvp_enabled_flag) - availableFlagL1Col = decodeMvLXCol(xPb, yPb, nPbW, nPbH, 1, refIdxLX[Col][1], mvLX[Col][1]); - - availableFlag[Col] = availableFlagL0Col || availableFlagL1Col; - predFlagLX[Col][1] = availableFlagL1Col; - } - - if (availableFlag[Col]) - { - mergeCandList[numCurrMergeCand++] = Col; - if (numCurrMergeCand > pu.merge_idx) - goto l_done; - } - - } - - numOrigMergeCand = numCurrMergeCand; - MaxNumMergeCand = std::min(m_cSlice->MaxNumMergeCand, pu.merge_idx + 1); - - if ( m_cSlice->type == SLICE_TYPE::B - && numOrigMergeCand > 1 - && numOrigMergeCand < MaxNumMergeCand) - { - //8.5.3.2.4 - Bs16u numInputMergeCand = numCurrMergeCand; - Bs16u combIdx = 0; - auto RefPicList0 = m_cSlice->L0; - auto RefPicList1 = m_cSlice->L1; - - while (combIdx < (numOrigMergeCand * (numOrigMergeCand - 1)) - && numCurrMergeCand < MaxNumMergeCand) - { - auto l0Cand = mergeCandList[lXCandIdx[combIdx][0]]; - auto l1Cand = mergeCandList[lXCandIdx[combIdx][1]]; - - if ( predFlagLX[l0Cand][0] - && predFlagLX[l1Cand][1] - && ( RefPicList0[refIdxLX[l0Cand][0]].POC != RefPicList1[refIdxLX[l1Cand][1]].POC - || !EQ(mvLX[l0Cand][0], mvLX[l1Cand][1]))) - { - Bs16u combCandK = numCurrMergeCand - numInputMergeCand + 6; - - refIdxLX[combCandK][0] = refIdxLX[l0Cand][0]; - refIdxLX[combCandK][1] = refIdxLX[l1Cand][1]; - predFlagLX[combCandK][0] = true; - predFlagLX[combCandK][1] = true; - mvLX[combCandK][0][0] = mvLX[l0Cand][0][0]; - mvLX[combCandK][0][1] = mvLX[l0Cand][0][1]; - mvLX[combCandK][1][0] = mvLX[l1Cand][1][0]; - mvLX[combCandK][1][1] = mvLX[l1Cand][1][1]; - - mergeCandList[numCurrMergeCand] = combCandK; - numCurrMergeCand++; - } - combIdx++; - } - } - - //8.5.3.2.5 - if (numCurrMergeCand < MaxNumMergeCand) - { - Bs16u numRefIdx = (m_cSlice->type == P) - ? m_cSlice->num_ref_idx_l0_active - : BS_MIN(m_cSlice->num_ref_idx_l0_active, m_cSlice->num_ref_idx_l1_active); - Bs16u numInputMergeCand = numCurrMergeCand; - - if (m_cSlice->type == P) - { - for (Bs16u zeroIdx = 0; numCurrMergeCand < MaxNumMergeCand; zeroIdx++) - { - Bs16u zeroCandM = numCurrMergeCand - numInputMergeCand + 12; - - refIdxLX [zeroCandM][0] = (zeroIdx < numRefIdx) ? zeroIdx : 0; - refIdxLX [zeroCandM][1] = -1; - predFlagLX[zeroCandM][0] = 1; - predFlagLX[zeroCandM][1] = 0; - - mergeCandList[numCurrMergeCand] = zeroCandM; - numCurrMergeCand++; - } - } - else - { - for (Bs16u zeroIdx = 0; numCurrMergeCand < MaxNumMergeCand; zeroIdx++) - { - Bs16u zeroCandM = numCurrMergeCand - numInputMergeCand + 12; - - refIdxLX [zeroCandM][0] = (zeroIdx < numRefIdx) ? zeroIdx : 0; - refIdxLX [zeroCandM][1] = (zeroIdx < numRefIdx) ? zeroIdx : 0; - predFlagLX[zeroCandM][0] = 1; - predFlagLX[zeroCandM][1] = 1; - - mergeCandList[numCurrMergeCand] = zeroCandM; - numCurrMergeCand++; - } - } - } - -l_done: - Bs16u N = mergeCandList[pu.merge_idx]; - - CP(pu.MvLX, mvLX[N]); - pu.ref_idx_l0 = refIdxLX[N][0]; - pu.ref_idx_l1 = refIdxLX[N][1]; - - if ( slice.use_integer_mv_flag - || (predFlagLX[N][0] && slice.POC == slice.L0[pu.ref_idx_l0].POC)) - { - pu.MvLX[0][0] = ((pu.MvLX[0][0] >> 2) << 2); - pu.MvLX[0][1] = ((pu.MvLX[0][1] >> 2) << 2); - } - - if ( slice.use_integer_mv_flag - || (predFlagLX[N][1] && slice.POC == slice.L1[pu.ref_idx_l1].POC)) - { - pu.MvLX[1][0] = ((pu.MvLX[1][0] >> 2) << 2); - pu.MvLX[1][1] = ((pu.MvLX[1][1] >> 2) << 2); - } - - if (predFlagLX[N][0] && predFlagLX[N][1]) - pu.inter_pred_idc = PRED_BI; - else - pu.inter_pred_idc = predFlagLX[N][0] ? PRED_L0 : PRED_L1; - - if (pu.inter_pred_idc == PRED_BI && (pu.w + pu.h == 12)) - { - pu.inter_pred_idc = PRED_L0; - } -} - -void Info::decodeMvLX(CU& cu, PU&pu, Bs16u X, Bs32s (&mvdLX)[2], Bs16u partIdx) -{ - if (pu.merge_flag) - throw InvalidSyntax(); - - if (!PredFlagLX(pu, X)) - return; - - auto refIdxLX = (X ? pu.ref_idx_l1 : pu.ref_idx_l0); - auto& RefPicListX = (X ? m_cSlice->L1 : m_cSlice->L0); - auto& RefPicListY = (!X ? m_cSlice->L1 : m_cSlice->L0); - - Bs32s uLX[2], mvpLX[2] = {}; - //8.5.3.2.6: - { - bool availableFlagLXA = false - , availableFlagLXB = false - , availableFlagLXCol = false; - Bs32s mvLXA[2] = {}, mvLXB[2] = {}, i, mvpListLX[2][2]; - Bs16s mvLXCol[2]; - - //8.5.3.2.7 - { - bool isScaledFlagLX = false; - Bs16s xNbA[2], yNbA[2], refIdxA = -1 - , xNbB[3], yNbB[3], refIdxB = -1; - RefPic* refPicListA = 0; - RefPic* refPicListB = 0; - Bs16u nCbS = (1 << cu.log2CbSize); - - xNbA[0] = pu.x - 1; - yNbA[0] = pu.y + pu.h; - xNbA[1] = xNbA[0]; - yNbA[1] = yNbA[0] - 1; - - xNbB[0] = pu.x + pu.w; - yNbB[0] = pu.y - 1; - xNbB[1] = pu.x + pu.w - 1; - yNbB[1] = pu.y - 1; - xNbB[2] = pu.x - 1; - yNbB[2] = pu.y - 1; - - bool availableA[2] = - { - AvailablePb(cu.x, cu.y, nCbS, pu.x, pu.y, pu.w, pu.h, partIdx, xNbA[0], yNbA[0]), - AvailablePb(cu.x, cu.y, nCbS, pu.x, pu.y, pu.w, pu.h, partIdx, xNbA[1], yNbA[1]) - }; - bool availableB[3] = - { - AvailablePb(cu.x, cu.y, nCbS, pu.x, pu.y, pu.w, pu.h, partIdx, xNbB[0], yNbB[0]), - AvailablePb(cu.x, cu.y, nCbS, pu.x, pu.y, pu.w, pu.h, partIdx, xNbB[1], yNbB[1]), - AvailablePb(cu.x, cu.y, nCbS, pu.x, pu.y, pu.w, pu.h, partIdx, xNbB[2], yNbB[2]) - }; - - if (availableA[0] || availableA[1]) - isScaledFlagLX = true; - - for (Bs16u k = 0; k < 2; k++) - { - if (!availableA[k] || availableFlagLXA) - continue; - - PU* p = GetPU(xNbA[k], yNbA[k]); - if (!p) - throw InvalidSyntax(); - PU& puA = *p; - - Bs16u refIdxAX = ( X ? puA.ref_idx_l1 : puA.ref_idx_l0); - Bs16u refIdxAY = (!X ? puA.ref_idx_l1 : puA.ref_idx_l0); - - if ( PredFlagLX(puA, X) - && RefPicListX[refIdxAX].POC == RefPicListX[refIdxLX].POC) - { - availableFlagLXA = true; - mvLXA[0] = puA.MvLX[X][0]; - mvLXA[1] = puA.MvLX[X][1]; - } - else if (PredFlagLX(puA, !X) - && RefPicListY[refIdxAY].POC == RefPicListX[refIdxLX].POC) - { - availableFlagLXA = true; - mvLXA[0] = puA.MvLX[!X][0]; - mvLXA[1] = puA.MvLX[!X][1]; - } - } - - for (Bs16u k = 0; k < 2; k++) - { - if (!availableA[k] || availableFlagLXA) - continue; - - PU* p = GetPU(xNbA[k], yNbA[k]); - if (!p) - throw InvalidSyntax(); - PU& puA = *p; - - Bs16u refIdxAX = ( X ? puA.ref_idx_l1 : puA.ref_idx_l0); - Bs16u refIdxAY = (!X ? puA.ref_idx_l1 : puA.ref_idx_l0); - - if ( PredFlagLX(puA, X) - && RefPicListX[refIdxAX].long_term == RefPicListX[refIdxLX].long_term) - { - availableFlagLXA = true; - mvLXA[0] = puA.MvLX[X][0]; - mvLXA[1] = puA.MvLX[X][1]; - refIdxA = refIdxAX; - refPicListA = RefPicListX; - } - else if ( PredFlagLX(puA, !X) - && RefPicListY[refIdxAY].long_term == RefPicListX[refIdxLX].long_term) - { - availableFlagLXA = true; - mvLXA[0] = puA.MvLX[!X][0]; - mvLXA[1] = puA.MvLX[!X][1]; - refIdxA = refIdxAY; - refPicListA = RefPicListY; - } - - if ( availableFlagLXA - && refPicListA[refIdxA].POC != RefPicListX[refIdxLX].POC - && !refPicListA[refIdxA].long_term - && !RefPicListX[refIdxLX].long_term) - { - Bs32s td = Clip3(-128, 127, m_cSlice->POC - refPicListA[refIdxA].POC); - Bs32s tb = Clip3(-128, 127, m_cSlice->POC - RefPicListX[refIdxLX].POC); - Bs32s tx = (16384 + (BS_ABS(td) >> 1)) / td; - Bs32s distScaleFactor = Clip3(-4096, 4095, (tb * tx + 32) >> 6); - - mvLXA[0] = Clip3(-32768, 32767, Sign(distScaleFactor * mvLXA[0]) - * ((abs(distScaleFactor * mvLXA[0]) + 127) >> 8)); - mvLXA[1] = Clip3(-32768, 32767, Sign(distScaleFactor * mvLXA[1]) - * ((abs(distScaleFactor * mvLXA[1]) + 127) >> 8)); - } - } - - for (Bs16u k = 0; k < 3; k++) - { - if (!availableB[k] || availableFlagLXB) - continue; - - PU* p = GetPU(xNbB[k], yNbB[k]); - if (!p) - throw InvalidSyntax(); - PU& puB = *p; - - Bs16u refIdxBX = ( X ? puB.ref_idx_l1 : puB.ref_idx_l0); - Bs16u refIdxBY = (!X ? puB.ref_idx_l1 : puB.ref_idx_l0); - - if ( PredFlagLX(puB, X) - && RefPicListX[refIdxBX].POC == RefPicListX[refIdxLX].POC) - { - availableFlagLXB = true; - mvLXB[0] = puB.MvLX[X][0]; - mvLXB[1] = puB.MvLX[X][1]; - } - else if (PredFlagLX(puB, !X) - && RefPicListY[refIdxBY].POC == RefPicListX[refIdxLX].POC) - { - availableFlagLXB = true; - mvLXB[0] = puB.MvLX[!X][0]; - mvLXB[1] = puB.MvLX[!X][1]; - } - } - - if (!isScaledFlagLX && availableFlagLXB) - { - availableFlagLXA = true; - mvLXA[0] = mvLXB[0]; - mvLXA[1] = mvLXB[1]; - } - - if (!isScaledFlagLX) - { - availableFlagLXB = false; - - for (Bs16u k = 0; k < 3; k++) - { - if (!availableB[k] || availableFlagLXB) - continue; - - PU* p = GetPU(xNbB[k], yNbB[k]); - if (!p) - throw InvalidSyntax(); - PU& puB = *p; - - Bs16u refIdxBX = ( X ? puB.ref_idx_l1 : puB.ref_idx_l0); - Bs16u refIdxBY = (!X ? puB.ref_idx_l1 : puB.ref_idx_l0); - - if ( PredFlagLX(puB, X) - && RefPicListX[refIdxBX].long_term == RefPicListX[refIdxLX].long_term) - { - availableFlagLXB = true; - mvLXB[0] = puB.MvLX[X][0]; - mvLXB[1] = puB.MvLX[X][1]; - refIdxB = refIdxBX; - refPicListB = RefPicListX; - } - else if ( PredFlagLX(puB, !X) - && RefPicListY[refIdxBY].long_term == RefPicListX[refIdxLX].long_term) - { - availableFlagLXB = true; - mvLXB[0] = puB.MvLX[!X][0]; - mvLXB[1] = puB.MvLX[!X][1]; - refIdxB = refIdxBY; - refPicListB = RefPicListY; - } - - if ( availableFlagLXB - && refPicListB[refIdxB].POC != RefPicListX[refIdxLX].POC - && !refPicListB[refIdxB].long_term - && !RefPicListX[refIdxLX].long_term) - { - Bs32s td = Clip3(-128, 127, m_cSlice->POC - refPicListB[refIdxB].POC); - Bs32s tb = Clip3(-128, 127, m_cSlice->POC - RefPicListX[refIdxLX].POC); - Bs32s tx = (16384 + (BS_ABS(td) >> 1)) / td; - Bs32s distScaleFactor = Clip3(-4096, 4095, (tb * tx + 32) >> 6); - - mvLXB[0] = Clip3(-32768, 32767, Sign(distScaleFactor * mvLXB[0]) - * ((abs(distScaleFactor * mvLXB[0]) + 127) >> 8)); - mvLXB[1] = Clip3(-32768, 32767, Sign(distScaleFactor * mvLXB[1]) - * ((abs(distScaleFactor * mvLXB[1]) + 127) >> 8)); - } - } - } - - } - - bool mvLXA_NE_mvLXB = !EQ(mvLXA, mvLXB); - - if ( availableFlagLXA - && availableFlagLXB - && mvLXA_NE_mvLXB) - { - availableFlagLXCol = false; - } - else if (m_cSlice->temporal_mvp_enabled_flag) - { - //8.5.3.2.8 - availableFlagLXCol = decodeMvLXCol(pu.x, pu.y, pu.w, pu.h, X, refIdxLX, mvLXCol); - } - - i = 0; - if (availableFlagLXA) - { - CP(mvpListLX[i++], mvLXA); - - if (availableFlagLXB && mvLXA_NE_mvLXB) - CP(mvpListLX[i++], mvLXB); - } - else if (availableFlagLXB) - CP(mvpListLX[i++], mvLXB); - - if (i < 2 && availableFlagLXCol) - { - mvpListLX[i][0] = mvLXCol[0]; - mvpListLX[i][1] = mvLXCol[1]; - i++; - } - - while (i < 2) - { - mvpListLX[i][0] = 0; - mvpListLX[i][1] = 0; - i++; - } - - CP(mvpLX, mvpListLX[X ? pu.mvp_l1_flag : pu.mvp_l0_flag]); - } - - auto& slice = *m_cSlice; - - if (slice.use_integer_mv_flag || slice.POC == (X ? slice.L1 : slice.L0)[refIdxLX].POC) - { - uLX[0] = ((((mvpLX[0] >> 2) + mvdLX[0]) << 2) + (1 << 16)) % (1 << 16); - pu.MvLX[X][0] = (uLX[0] >= (1 << 15)) ? (uLX[0] - (1 << 16)) : uLX[0]; - uLX[1] = ((((mvpLX[1] >> 2) + mvdLX[1]) << 2) + (1 << 16)) % (1 << 16); - pu.MvLX[X][1] = (uLX[1] >= (1 << 15)) ? (uLX[1] - (1 << 16)) : uLX[1]; - } - else - { - uLX[0] = (mvpLX[0] + mvdLX[0] + (1 << 16)) % (1 << 16); - pu.MvLX[X][0] = (uLX[0] >= (1 << 15)) ? (uLX[0] - (1 << 16)) : uLX[0]; - uLX[1] = (mvpLX[1] + mvdLX[1] + (1 << 16)) % (1 << 16); - pu.MvLX[X][1] = (uLX[1] >= (1 << 15)) ? (uLX[1] - (1 << 16)) : uLX[1]; - } - - if ( pu.inter_pred_idc == PRED_BI - && X == 1 - && TwoVersionsOfCurrDecPicFlag - && pu.w == 8 - && pu.h == 8) - { - bool noIntegerMvFlag = - !(((pu.MvLX[0][0] & 0x3) == 0 && (pu.MvLX[0][1] & 0x3) == 0) - || ((pu.MvLX[1][0] & 0x3) == 0 && (pu.MvLX[1][1] & 0x3) == 0)); - bool identicalMvs = EQ(pu.MvLX[1], pu.MvLX[0]) - && slice.L0[pu.ref_idx_l0].POC == slice.L1[pu.ref_idx_l1].POC; - - if (noIntegerMvFlag && !identicalMvs) - pu.inter_pred_idc = PRED_L0; - } -} - -bool Info::decodeMvLXCol(Bs16u xPb, Bs16u yPb, Bs16u nPbW, Bs16u nPbH, Bs16u X, Bs16u refIdxLX, Bs16s (&mvLXCol)[2]) -{ - //8.5.3.2.8 - if (!ColPicSlices || !m_cSlice->temporal_mvp_enabled_flag) - throw InvalidSyntax(); - - Slice* ColPic; - CU* colCU; - PU* colPb; - Bs16u ColTs, ColRs, refIdxCol; - Bs16s mvCol[2]; - auto& sps = *m_cSlice->sps; - RefPic *listCol, *LX = (X ? m_cSlice->L1 : m_cSlice->L0); - bool availableFlagLXCol = false; - Bs16s xCol = xPb + nPbW, xColPb; - Bs16s yCol = yPb + nPbH, yColPb; - bool bCentral = - !( (yPb >> CtbLog2SizeY) == (yCol >> CtbLog2SizeY) - && yCol < sps.pic_height_in_luma_samples - && xCol < sps.pic_width_in_luma_samples); - -l_start: - if (bCentral) - { - xCol = xPb + (nPbW >> 1); - yCol = yPb + (nPbH >> 1); - } - - xColPb = ((xCol >> 4) << 4); - yColPb = ((yCol >> 4) << 4); - - ColRs = (yColPb >> CtbLog2SizeY) * PicWidthInCtbsY + (xColPb >> CtbLog2SizeY); - - for (Bs32s i = 0;; i++) - { - ColPic = ColPicSlices[i]; - ColTs = ColPic->pps->CtbAddrRsToTs[ColRs]; - - if ( ColTs >= ColPic->ctu->CtbAddrInTs - && ColTs < (ColPic->ctu->CtbAddrInTs + ColPic->NumCTU)) - break; - if (i + 1 >= NumColSlices) - throw InvalidSyntax(); - } - - if (ColPic->Split) - { - colCU = 0; - auto pCTU = ColPic->ctu; - - while (pCTU && pCTU->CtbAddrInTs != ColTs) - pCTU = pCTU->Next; - - if (pCTU) - colCU = pCTU->Cu; - } - else - { - colCU = ColPic->ctu[ColTs - ColPic->ctu[0].CtbAddrInTs].Cu; - } - if (!colCU) - throw InvalidSyntax(); - - colCU = GetUnit(*colCU, xColPb, yColPb); - if (!colCU) - throw InvalidSyntax(); - if (!colCU->Pu) - goto l_end; - - colPb = GetUnit(*colCU->Pu, xColPb, yColPb); - if (!colPb) - throw InvalidSyntax(); - - if (PredFlagLX(*colPb, 0) == 0) - { - CP(mvCol, colPb->MvLX[1]); - refIdxCol = colPb->ref_idx_l1; - listCol = ColPic->L1; - } - else if (PredFlagLX(*colPb, 1) == 0) - { - CP(mvCol, colPb->MvLX[0]); - refIdxCol = colPb->ref_idx_l0; - listCol = ColPic->L0; - } - else if (NoBackwardPredFlag) - { - CP(mvCol, colPb->MvLX[X]); - refIdxCol = X ? colPb->ref_idx_l1 : colPb->ref_idx_l0; - listCol = X ? ColPic->L1 : ColPic->L0; - } - else - { - CP(mvCol, colPb->MvLX[!m_cSlice->collocated_from_l0_flag]); - refIdxCol = m_cSlice->collocated_from_l0_flag ? colPb->ref_idx_l0 : colPb->ref_idx_l1; - listCol = m_cSlice->collocated_from_l0_flag ? ColPic->L0 : ColPic->L1; - } - - if (LX[refIdxLX].long_term != listCol[refIdxCol].long_term) - goto l_end; - - availableFlagLXCol = true; - - { - Bs32s colPocDiff = ColPic->POC - listCol[refIdxCol].POC; - Bs32s currPocDiff = m_cSlice->POC - LX[refIdxLX].POC; - - if (LX[refIdxLX].long_term || colPocDiff == currPocDiff) - { - mvLXCol[0] = mvCol[0]; - mvLXCol[1] = mvCol[1]; - return true; - } - - Bs32s td = Clip3(-128, 127, colPocDiff); - Bs32s tb = Clip3(-128, 127, currPocDiff); - Bs32s tx = (16384 + (BS_ABS(td) >> 1)) / td; - Bs32s distScaleFactor = Clip3(-4096, 4095, (tb * tx + 32) >> 6); - - mvLXCol[0] = Clip3(-32768, 32767, Sign(distScaleFactor * mvCol[0]) * ((abs(distScaleFactor * mvCol[0]) + 127) >> 8)); - mvLXCol[1] = Clip3(-32768, 32767, Sign(distScaleFactor * mvCol[1]) * ((abs(distScaleFactor * mvCol[1]) + 127) >> 8)); - } - -l_end: - if (!availableFlagLXCol && !bCentral) - { - bCentral = true; - goto l_start; - } - - return availableFlagLXCol; -} - -}; diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_headers.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_headers.cpp deleted file mode 100644 index 85053b6..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_headers.cpp +++ /dev/null @@ -1,2120 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc2_parser.h" -#include "hevc2_trace.h" -#include - -using namespace BS_HEVC2; -using namespace BsReader2; - -void Parser::parseNUH(NALU& nalu) -{ - TLAuto tl(*this, TRACE_NUH); - - BS2_TRACE_STR("----------------------------------"); - - TLStart(TRACE_OFFSET); - BS2_TRACE(nalu.StartOffset, nalu.StartOffset); - TLEnd(); - - if (u1()) - throw InvalidSyntax(); - - BS2_SETM(u(6), nalu.nal_unit_type, NaluTraceMap); - BS2_SET(u(6), nalu.nuh_layer_id); - BS2_SET(u(3), nalu.nuh_temporal_id_plus1); -} - -void Parser::parseAUD(AUD& aud) -{ - TLAuto tl(*this, TRACE_AUD); - - BS2_SETM(u(3), aud.pic_type, PicTypeTraceMap); - - if (!TrailingBits()) - throw InvalidSyntax(); -} - -void Parser::parseSLO(SubLayerOrderingInfo* slo, bool f, Bs32u n) -{ -#define PARSE_SLO(_i)\ - if ((_i) == n || (f && (_i) <= n)) \ - { \ - BS2_SET(ue(), slo[_i].max_dec_pic_buffering_minus1); \ - BS2_SET(ue(), slo[_i].max_num_reorder_pics); \ - BS2_SET(ue(), slo[_i].max_latency_increase_plus1); \ - } - - PARSE_SLO(0); - PARSE_SLO(1); - PARSE_SLO(2); - PARSE_SLO(3); - PARSE_SLO(4); - PARSE_SLO(5); - PARSE_SLO(6); - PARSE_SLO(7); - -#undef PARSE_SLO -} - -inline bool PCF(Bs32u f, Bs32u i) { return !!(f & (1 << (31 - i))); } -inline bool isProfile(PTL& ptl, Bs32u profile) -{ - return (ptl.profile_idc == profile || PCF(ptl.profile_compatibility_flags, profile)); -} - -void Parser::parsePTL(PTL& ptl) -{ - if (ptl.profile_present_flag) - { - BS2_SET(u(2), ptl.profile_space); - BS2_SET(u1(), ptl.tier_flag); - BS2_SETM(u(5), ptl.profile_idc, ProfileTraceMap()); - - ptl.profile_compatibility_flags = u(32); - BS2_TRACE_BIN(&ptl.profile_compatibility_flags, 0, 32, ptl.profile_compatibility_flags); - - BS2_SET(u1(), ptl.progressive_source_flag); - BS2_SET(u1(), ptl.interlaced_source_flag); - BS2_SET(u1(), ptl.non_packed_constraint_flag); - BS2_SET(u1(), ptl.frame_only_constraint_flag); - - if ( isProfile(ptl, REXT) - || isProfile(ptl, REXT_HT) - || isProfile(ptl, MAIN_MV) - || isProfile(ptl, MAIN_SC) - || isProfile(ptl, MAIN_3D) - || isProfile(ptl, SCC) - || isProfile(ptl, REXT_SC)) - { - BS2_SET(u1(), ptl.max_12bit_constraint_flag); - BS2_SET(u1(), ptl.max_10bit_constraint_flag); - BS2_SET(u1(), ptl.max_8bit_constraint_flag); - BS2_SET(u1(), ptl.max_422chroma_constraint_flag); - BS2_SET(u1(), ptl.max_420chroma_constraint_flag); - BS2_SET(u1(), ptl.max_monochrome_constraint_flag); - BS2_SET(u1(), ptl.intra_constraint_flag); - BS2_SET(u1(), ptl.one_picture_only_constraint_flag); - BS2_SET(u1(), ptl.lower_bit_rate_constraint_flag); - - if ( isProfile(ptl, REXT_HT) - || isProfile(ptl, SCC) - || isProfile(ptl, REXT_SC)) - { - BS2_SET(u1(), ptl.max_14bit_constraint_flag); - BS2_SET(u(10), ptl.reserved_zero_33bits_0_9); - BS2_SET(u(23), ptl.reserved_zero_33bits_10_32); - } - else - { - BS2_SET(u(11), ptl.reserved_zero_34bits_0_10); - BS2_SET(u(23), ptl.reserved_zero_34bits_11_33); - } - } - else - { - BS2_SET(u(20), ptl.reserved_zero_43bits_0_19); - BS2_SET(u(23), ptl.reserved_zero_43bits_20_42); - } - - if ( isProfile(ptl, MAIN) - || isProfile(ptl, MAIN_10) - || isProfile(ptl, MAIN_SP) - || isProfile(ptl, REXT) - || isProfile(ptl, REXT_HT) - || isProfile(ptl, SCC)) - { - BS2_SET(u1(), ptl.inbld_flag); - } - else - BS2_SET(u1(), ptl.reserved_zero_bit); - } - - if (ptl.level_present_flag) - BS2_SET(u(8), ptl.level_idc); -} - -void Parser::parsePTL(SubLayers& sl, Bs32u max_sub_layers_minus1) -{ - sl.general.profile_present_flag = 1; - sl.general.level_present_flag = 1; - - parsePTL(sl.general); - - for (Bs32u i = 0; i < max_sub_layers_minus1; i++) - { - BS2_SET(u1(), sl.sub_layer[i].profile_present_flag); - BS2_SET(u1(), sl.sub_layer[i].level_present_flag); - } - - if (max_sub_layers_minus1) - u((8 - max_sub_layers_minus1) * 2); - - for (Bs32u i = 0; i < max_sub_layers_minus1; i++) - { - BS2_TRACE(i, sub_layer); - parsePTL(sl.sub_layer[i]); - } -} - -void Parser::parseHRD( - HRD& hrd, void* base, bool commonInfPresentFlag, Bs32u maxNumSubLayersMinus1) -{ - if (commonInfPresentFlag) - { - BS2_SET(u1(), hrd.nal_hrd_parameters_present_flag); - BS2_SET(u1(), hrd.vcl_hrd_parameters_present_flag); - - if ( hrd.nal_hrd_parameters_present_flag - || hrd.vcl_hrd_parameters_present_flag) - { - BS2_SET(u1(), hrd.sub_pic_hrd_params_present_flag); - - if (hrd.sub_pic_hrd_params_present_flag) - { - BS2_SET(u(8), hrd.tick_divisor_minus2); - BS2_SET(u(5), hrd.du_cpb_removal_delay_increment_length_minus1); - BS2_SET(u1(), hrd.sub_pic_cpb_params_in_pic_timing_sei_flag); - BS2_SET(u(5), hrd.dpb_output_delay_du_length_minus1); - } - - BS2_SET(u(4), hrd.bit_rate_scale); - BS2_SET(u(4), hrd.cpb_size_scale); - - if (hrd.sub_pic_hrd_params_present_flag) - BS2_SET(u(4), hrd.cpb_size_du_scale); - - BS2_SET(u(5), hrd.initial_cpb_removal_delay_length_minus1); - BS2_SET(u(5), hrd.au_cpb_removal_delay_length_minus1); - BS2_SET(u(5), hrd.dpb_output_delay_length_minus1); - } - } - - for (Bs32u i = 0; i <= maxNumSubLayersMinus1; i++) - { - auto& slhrd = hrd.sl[i]; - - BS2_TRACE(i, SubLayer); - - BS2_SET(u1(), slhrd.fixed_pic_rate_general_flag); - slhrd.fixed_pic_rate_within_cvs_flag = slhrd.fixed_pic_rate_general_flag; - - if (!slhrd.fixed_pic_rate_general_flag) - BS2_SET(u1(), slhrd.fixed_pic_rate_within_cvs_flag); - - if (slhrd.fixed_pic_rate_within_cvs_flag) - { - BS2_SET(ue(), slhrd.elemental_duration_in_tc_minus1); - } - else - BS2_SET(u1(), slhrd.low_delay_hrd_flag); - - if (!slhrd.low_delay_hrd_flag) - BS2_SET(ue(), slhrd.cpb_cnt_minus1); - - if (hrd.nal_hrd_parameters_present_flag) - { - slhrd.nal = alloc(base, slhrd.cpb_cnt_minus1 + 1); - - BS2_TRACE_STR("NAL HRD"); - - for (i = 0; i <= slhrd.cpb_cnt_minus1; i++) - { - auto& cpb = slhrd.nal[i]; - - BS2_SET(ue(), cpb.bit_rate_value_minus1); - BS2_SET(ue(), cpb.cpb_size_value_minus1); - - if (hrd.sub_pic_hrd_params_present_flag) - { - BS2_SET(ue(), cpb.bit_rate_du_value_minus1); - BS2_SET(ue(), cpb.cpb_size_du_value_minus1); - } - - BS2_SET(u1(), cpb.cbr_flag); - } - } - - if (hrd.vcl_hrd_parameters_present_flag) - { - slhrd.vcl = alloc(base, slhrd.cpb_cnt_minus1 + 1); - - BS2_TRACE_STR("VCL HRD"); - - for (i = 0; i <= slhrd.cpb_cnt_minus1; i++) - { - auto& cpb = slhrd.vcl[i]; - - BS2_SET(ue(), cpb.bit_rate_value_minus1); - BS2_SET(ue(), cpb.cpb_size_value_minus1); - - if (hrd.sub_pic_hrd_params_present_flag) - { - BS2_SET(ue(), cpb.bit_rate_du_value_minus1); - BS2_SET(ue(), cpb.cpb_size_du_value_minus1); - } - - BS2_SET(u1(), cpb.cbr_flag); - } - } - } -} - -void Parser::parseVPS(VPS& vps) -{ - TLAuto tl(*this, TRACE_VPS); - - BS2_SET(u(4), vps.video_parameter_set_id); - BS2_SET(u1(), vps.base_layer_internal_flag); - BS2_SET(u1(), vps.base_layer_available_flag); - BS2_SET(u(6), vps.max_layers_minus1); - BS2_SET(u(3), vps.max_sub_layers_minus1); - BS2_SET(u1(), vps.temporal_id_nesting_flag); - BS2_SET(u(16), vps.reserved_0xffff_16bits); - - parsePTL(vps, vps.max_sub_layers_minus1); - - BS2_SET(u1(), vps.sub_layer_ordering_info_present_flag); - parseSLO(vps.slo, vps.sub_layer_ordering_info_present_flag, vps.max_sub_layers_minus1); - - BS2_SET(u(6), vps.max_layer_id); - BS2_SET(ue(), vps.num_layer_sets_minus1); - - { - Bs32u S = (vps.max_layer_id + 1) * (vps.num_layer_sets_minus1 + 1); - - vps.layer_id_included_flags = alloc(&vps, (S + 7) / 8); - GetBits(vps.layer_id_included_flags, 1, S - 1); - - BS2_TRACE_BIN(vps.layer_id_included_flags, 0, S, vps.layer_id_included_flags); - } - - BS2_SET(u1(), vps.timing_info_present_flag); - - if (vps.timing_info_present_flag) - { - BS2_SET(u(32), vps.num_units_in_tick); - BS2_SET(u(32), vps.time_scale); - BS2_SET(u1(), vps.poc_proportional_to_timing_flag); - - if (vps.poc_proportional_to_timing_flag) - BS2_SET(ue(), vps.num_ticks_poc_diff_one_minus1); - - BS2_SET(ue(), vps.num_hrd_parameters); - - vps.hrd = alloc(&vps, vps.num_hrd_parameters); - - for (Bs32u i = 0; i < vps.num_hrd_parameters; i++) - { - BS2_SET(ue(), vps.hrd[i].hrd_layer_set_idx); - - if (i) - BS2_SET(u1(), vps.hrd[i].cprms_present_flag) - else - vps.hrd[i].cprms_present_flag = 1; - - parseHRD(vps.hrd[i], vps.hrd, - vps.hrd[i].cprms_present_flag, vps.max_sub_layers_minus1); - } - } - - BS2_SET(u1(), vps.extension_flag); - - if (vps.extension_flag) - { - vps.ExtBits = parseEXT(vps.ExtData); - - if (vps.ExtData) - bound(vps.ExtData, &vps); - } - - if (!TrailingBits()) - throw InvalidSyntax(); -} - -Bs32u Parser::parseEXT(Bs8u*& ExtData) -{ - std::vector data; - Bs32u ExtBits = 0; - Bs8u B = 0; - Bs8u O = 8; - - while (more_rbsp_data()) - { - B |= (u1() << (--O)); - - if (!O) - { - data.push_back(B); - B = 0; - O = 8; - } - } - - if (O < 8) - data.push_back(B); - - BS2_SET(Bs32u(data.size() * 8 - O % 8), ExtBits); - - ExtData = alloc(0, (Bs32u)data.size()); - - memcpy(ExtData, data.data(), data.size()); - - if (ExtBits > 32 * 8) - { - BS2_TRACE_ARR_F(ExtData, data.size(), 16, "%02X "); - } - else - { - BS2_TRACE_BIN(ExtData, 0, ExtBits, ExtData); - } - - return ExtBits; -} - -const Bs8u DSL_[3][64] = -{ - { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 16, 17, 16, 17, 18, - 17, 18, 18, 17, 18, 21, 19, 20, 21, 20, 19, 21, 24, 22, 22, 24, - 24, 22, 22, 24, 25, 25, 27, 30, 27, 25, 25, 29, 31, 35, 35, 31, - 29, 36, 41, 44, 41, 36, 47, 54, 54, 47, 65, 70, 65, 88, 88, 115 - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, - 18, 18, 18, 18, 18, 20, 20, 20, 20, 20, 20, 20, 24, 24, 24, 24, - 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 28, 28, 28, 28, 28, - 28, 33, 33, 33, 33, 33, 41, 41, 41, 41, 54, 54, 54, 71, 71, 91 - }, -}; - -inline const Bs8u* DSL(Bs32u sizeId, Bs32u matrixId) -{ - if (sizeId == 0) - return DSL_[0]; - if (matrixId > 2) - return DSL_[2]; - return DSL_[1]; -} - -void Parser::parseSLD(QM& qm) -{ - Bs8u list[64] = {}; - Bs16u dim[] = { 1, 4, 4 }; - - for (Bs32u sizeId = 0; sizeId < 4; sizeId++) - { - for (Bs32u matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1) - { - Bs32u num = std::min(64, (1 << (4 + (sizeId << 1)))); - Bs8u dc = 0; - Bs32u refMatrixId = matrixId; - - if (!u1()) //scaling_list_pred_mode_flag - { - // scaling_list_pred_matrix_id_delta - refMatrixId = matrixId - ue() * ((sizeId == 3) ? 3 : 1); - - if (refMatrixId == matrixId) - { - memcpy(list, DSL(sizeId, refMatrixId), num); - dc = list[0]; - } - } - else - { - Bs32s next = 8; - - if (sizeId > 1) - { - next = se() + 8; //scaling_list_dc_coef_minus8[ sizeId - 2 ][ matrixId ] - dc = Bs8u(next); - } - - for (Bs32u i = 0; i < num; i++) - { - next = (next + se() + 256) % 256; //scaling_list_delta_coef - list[i] = Bs8u(next); - } - } - - //dim[1] = dim[2] = 4 << sizeId; - - switch (sizeId) - { - case 0: - if (refMatrixId < matrixId) - { - memcpy( - qm.ScalingFactor0[matrixId], - qm.ScalingFactor0[refMatrixId], - sizeof(qm.ScalingFactor0[0])); - } - else - { - for (Bs32u i = 0; i < 16; i++) - qm.ScalingFactor0[matrixId] - [ScanOrder2[0][i][0]] - [ScanOrder2[0][i][1]] - = list[i]; - } - //BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[matrixId], dim, 1, 0, "%3d "); - break; - case 1: - if (refMatrixId < matrixId) - { - memcpy( - qm.ScalingFactor1[matrixId], - qm.ScalingFactor1[refMatrixId], - sizeof(qm.ScalingFactor1[0])); - } - else - { - for (Bs32u i = 0; i < 64; i++) - qm.ScalingFactor1[matrixId] - [ScanOrder3[0][i][0]] - [ScanOrder3[0][i][1]] - = list[i]; - } - //BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[matrixId], dim, 1, 0, "%3d "); - break; - case 2: - if (refMatrixId < matrixId) - { - memcpy( - qm.ScalingFactor2[matrixId], - qm.ScalingFactor2[refMatrixId], - sizeof(qm.ScalingFactor2[0])); - } - else - { - for (Bs32u i = 0; i < 64; i++) - for (Bs32u j = 0; j < 2; j++) - for (Bs32u k = 0; k < 2; k++) - qm.ScalingFactor2[matrixId] - [ScanOrder3[0][i][0] * 2 + k] - [ScanOrder3[0][i][1] * 2 + j] - = list[i]; - qm.ScalingFactor2[matrixId][0][0] = dc; - } - //BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[matrixId], dim, 1, 0, "%3d "); - - if (matrixId % 3 == 0) - break; - - dim[1] = dim[2] = 32; - case 3: - if (refMatrixId < matrixId) - { - memcpy( - qm.ScalingFactor3[matrixId], - qm.ScalingFactor3[refMatrixId], - sizeof(qm.ScalingFactor3[0])); - } - else - { - for (Bs32u i = 0; i < 64; i++) - for (Bs32u j = 0; j < 4; j++) - for (Bs32u k = 0; k < 4; k++) - qm.ScalingFactor3[matrixId] - [ScanOrder3[0][i][0] * 4 + k] - [ScanOrder3[0][i][1] * 4 + j] - = list[i]; - qm.ScalingFactor3[matrixId][0][0] = dc; - } - //BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[matrixId], dim, 1, 0, "%3d "); - break; - default: - throw Exception(BS_ERR_UNKNOWN); - } - } - } - - dim[1] = dim[2] = 4; - - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[QM_IntraY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[QM_IntraCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[QM_IntraCr], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[QM_InterY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[QM_InterCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor0[QM_InterCr], dim, 1, 0, "%3d "); - - dim[1] = dim[2] = 8; - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[QM_IntraY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[QM_IntraCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[QM_IntraCr], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[QM_InterY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[QM_InterCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor1[QM_InterCr], dim, 1, 0, "%3d "); - - dim[1] = dim[2] = 16; - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[QM_IntraY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[QM_IntraCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[QM_IntraCr], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[QM_InterY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[QM_InterCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor2[QM_InterCr], dim, 1, 0, "%3d "); - - dim[1] = dim[2] = 32; - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[QM_IntraY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[QM_IntraCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[QM_IntraCr], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[QM_InterY], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[QM_InterCb], dim, 1, 0, "%3d "); - BS2_TRACE_MDARR(Bs8u, qm.ScalingFactor3[QM_InterCr], dim, 1, 0, "%3d "); -} - -struct DPocSort -{ - bool operator () (Bs16s l, Bs16s r) - { - if (l < 0 && r > 0) return true; - if (r < 0 && l > 0) return false; - if (l < 0) return (l > r); - return (l < r); - } -}; - -void Parser::ParseSTRPS(STRPS* strps, Bs32u num, Bs32u idx) -{ - STRPS& cur = strps[idx]; - Bs16u& N = cur.NumDeltaPocs; - - if (idx == num) - memset(&cur, 0, sizeof(cur)); - - if (idx && u1()) //inter_ref_pic_set_prediction_flag - { - std::map Used; - Bs32s dIdx = 1, dRPS = 0; - - if (idx == num) - dIdx += ue(); //delta_idx_minus1 - - dRPS = (1 - 2 * u1()) * (ue() + 1); //delta_rps_sign, abs_delta_rps_minus1 - - STRPS& ref = strps[idx - dIdx]; - - for (Bs32u i = 0; i <= ref.NumDeltaPocs; i++) - { - bool used = !!u1(); //used_by_curr_pic_flag - - if (used || u1()) //use_delta_flag - { - //SetBit(cur.UsedByCurrPicFlags, N, used); - cur.DeltaPoc[N] = (i < ref.NumDeltaPocs ? ref.DeltaPoc[i] : 0) + dRPS; - Used[cur.DeltaPoc[N]] = used; - N++; - } - } - - std::sort(cur.DeltaPoc, cur.DeltaPoc + cur.NumDeltaPocs, DPocSort()); - - for (Bs16u i = 0; i < N; i++) - SetBit(cur.UsedByCurrPicFlags, i, Used[cur.DeltaPoc[i]]); - } - else - { - Bs16u neg = ue(); //num_negative_pics; - N = neg + ue(); //num_positive_pics - - for (Bs32u i = 0; i < N; i++) - { - cur.DeltaPoc[i] = (1 - 2 * (i < neg)) * (ue() + 1); //delta_poc_sX_minus1 - if (i > 0 && i != neg) - cur.DeltaPoc[i] += cur.DeltaPoc[i - 1]; - SetBit(cur.UsedByCurrPicFlags, i, !!u1()); //used_by_curr_pic_sX_flag - } - } - //BS2_TRACE(cur.NumDeltaPocs, strps[idx].NumDeltaPocs); - BS2_TRACE_BIN(&cur.UsedByCurrPicFlags, 0, cur.NumDeltaPocs, strps[idx].UsedByCurrPicFlags); - BS2_TRACE_ARR(strps[idx].DeltaPoc, cur.NumDeltaPocs, 0); -} - -void Parser::parseVUI(VUI& vui, Bs32u maxNumSubLayersMinus1) -{ - BS2_SET(u1(), vui.aspect_ratio_info_present_flag); - - if (vui.aspect_ratio_info_present_flag) - { - BS2_SETM(u(8), vui.aspect_ratio_idc, ARIdcTraceMap()); - - if (vui.aspect_ratio_idc == Extended_SAR) - { - BS2_SET(u(16), vui.sar_width); - BS2_SET(u(16), vui.sar_height); - } - } - - BS2_SET(u1(), vui.overscan_info_present_flag); - - if (vui.overscan_info_present_flag) - BS2_SET(u1(), vui.overscan_appropriate_flag); - - BS2_SET(u1(), vui.video_signal_type_present_flag); - - if (vui.video_signal_type_present_flag) - { - BS2_SETM(u(3), vui.video_format, VideoFormatTraceMap); - BS2_SET(u1(), vui.video_full_range_flag); - BS2_SET(u1(), vui.colour_description_present_flag); - - if (vui.colour_description_present_flag) - { - BS2_SET(u(8), vui.colour_primaries); - BS2_SET(u(8), vui.transfer_characteristics); - BS2_SET(u(8), vui.matrix_coeffs); - } - } - - BS2_SET(u1(), vui.chroma_loc_info_present_flag); - - if (vui.chroma_loc_info_present_flag) - { - BS2_SET(ue(), vui.chroma_sample_loc_type_top_field); - BS2_SET(ue(), vui.chroma_sample_loc_type_bottom_field); - } - - BS2_SET(u1(), vui.neutral_chroma_indication_flag); - BS2_SET(u1(), vui.field_seq_flag); - BS2_SET(u1(), vui.frame_field_info_present_flag); - BS2_SET(u1(), vui.default_display_window_flag); - - if (vui.default_display_window_flag) - { - BS2_SET(ue(), vui.def_disp_win_left_offset); - BS2_SET(ue(), vui.def_disp_win_right_offset); - BS2_SET(ue(), vui.def_disp_win_top_offset); - BS2_SET(ue(), vui.def_disp_win_bottom_offset); - } - - BS2_SET(u1(), vui.timing_info_present_flag); - - if (vui.timing_info_present_flag) - { - BS2_SET(u(32), vui.num_units_in_tick); - BS2_SET(u(32), vui.time_scale); - BS2_SET(u1(), vui.poc_proportional_to_timing_flag); - - if (vui.poc_proportional_to_timing_flag) - BS2_SET(ue(), vui.num_ticks_poc_diff_one_minus1); - - BS2_SET(u1(), vui.hrd_parameters_present_flag); - - if (vui.hrd_parameters_present_flag) - { - vui.hrd = alloc(&vui); - parseHRD(*vui.hrd, vui.hrd, 1, maxNumSubLayersMinus1); - } - } - - BS2_SET(u1(), vui.bitstream_restriction_flag); - - if (vui.bitstream_restriction_flag) - { - BS2_SET(u1(), vui.tiles_fixed_structure_flag); - BS2_SET(u1(), vui.motion_vectors_over_pic_boundaries_flag); - BS2_SET(u1(), vui.restricted_ref_pic_lists_flag); - BS2_SET(ue(), vui.min_spatial_segmentation_idc); - BS2_SET(ue(), vui.max_bytes_per_pic_denom); - BS2_SET(ue(), vui.max_bits_per_min_cu_denom); - BS2_SET(ue(), vui.log2_max_mv_length_horizontal); - BS2_SET(ue(), vui.log2_max_mv_length_vertical); - } -} - -void Parser::parseSPS(SPS& sps) -{ - TLAuto tl(*this, TRACE_SPS); - - BS2_SET(u(4), sps.video_parameter_set_id); - BS2_SET(u(3), sps.max_sub_layers_minus1); - BS2_SET(u1(), sps.temporal_id_nesting_flag); - - parsePTL(sps, sps.max_sub_layers_minus1); - - BS2_SET(ue(), sps.seq_parameter_set_id); - BS2_SETM(ue(), sps.chroma_format_idc, ChromaFormatTraceMap); - - if (sps.chroma_format_idc == CHROMA_444) - BS2_SET(u1(), sps.temporal_id_nesting_flag); - - BS2_SET(ue(), sps.pic_width_in_luma_samples); - BS2_SET(ue(), sps.pic_height_in_luma_samples); - - BS2_SET(u1(), sps.conformance_window_flag); - - if (sps.conformance_window_flag) - { - BS2_SET(ue(), sps.conf_win_left_offset); - BS2_SET(ue(), sps.conf_win_right_offset); - BS2_SET(ue(), sps.conf_win_top_offset); - BS2_SET(ue(), sps.conf_win_bottom_offset); - } - - BS2_SET(ue(), sps.bit_depth_luma_minus8); - BS2_SET(ue(), sps.bit_depth_chroma_minus8); - BS2_SET(ue(), sps.log2_max_pic_order_cnt_lsb_minus4); - - BS2_SET(u1(), sps.sub_layer_ordering_info_present_flag); - - parseSLO(sps.slo, sps.sub_layer_ordering_info_present_flag, sps.max_sub_layers_minus1); - - BS2_SET(ue(), sps.log2_min_luma_coding_block_size_minus3); - BS2_SET(ue(), sps.log2_diff_max_min_luma_coding_block_size); - BS2_SET(ue(), sps.log2_min_luma_transform_block_size_minus2); - BS2_SET(ue(), sps.log2_diff_max_min_luma_transform_block_size); - BS2_SET(ue(), sps.max_transform_hierarchy_depth_inter); - BS2_SET(ue(), sps.max_transform_hierarchy_depth_intra); - - BS2_SET(u1(), sps.scaling_list_enabled_flag); - - if (sps.scaling_list_enabled_flag) - { - BS2_SET(u1(), sps.scaling_list_data_present_flag); - - if (sps.scaling_list_data_present_flag) - { - sps.qm = alloc(&sps); - parseSLD(*sps.qm); - } - } - - BS2_SET(u1(), sps.amp_enabled_flag); - BS2_SET(u1(), sps.sample_adaptive_offset_enabled_flag); - BS2_SET(u1(), sps.pcm_enabled_flag); - - if (sps.pcm_enabled_flag) - { - BS2_SET(u(4), sps.pcm_sample_bit_depth_luma_minus1); - BS2_SET(u(4), sps.pcm_sample_bit_depth_chroma_minus1); - BS2_SET(ue(), sps.log2_min_pcm_luma_coding_block_size_minus3); - BS2_SET(ue(), sps.log2_diff_max_min_pcm_luma_coding_block_size); - BS2_SET(u1(), sps.pcm_loop_filter_disabled_flag); - } - - BS2_SET(ue(), sps.num_short_term_ref_pic_sets); - sps.strps = alloc(&sps, sps.num_short_term_ref_pic_sets + 1); - - if (sps.num_short_term_ref_pic_sets) - { - for (Bs32u i = 0; i < sps.num_short_term_ref_pic_sets; i++) - ParseSTRPS(sps.strps, sps.num_short_term_ref_pic_sets, i); - } - - BS2_SET(u1(), sps.long_term_ref_pics_present_flag); - - if (sps.long_term_ref_pics_present_flag) - { - BS2_SET(ue(), sps.num_long_term_ref_pics); - - if (sps.num_long_term_ref_pics) - { - sps.lt_ref_pic_poc_lsb = alloc(&sps, sps.num_long_term_ref_pics); - - for (Bs32u i = 0; i < sps.num_long_term_ref_pics; i++) - { - sps.lt_ref_pic_poc_lsb[i] = u(sps.log2_max_pic_order_cnt_lsb_minus4 + 4); - SetBit(sps.used_by_curr_pic_lt_flags, i, !!u1()); - } - - BS2_TRACE_BIN(&sps.used_by_curr_pic_lt_flags, 0, sps.num_long_term_ref_pics, sps.used_by_curr_pic_lt_flags); - BS2_TRACE_ARR(sps.lt_ref_pic_poc_lsb, sps.num_long_term_ref_pics, 0); - } - } - - BS2_SET(u1(), sps.temporal_mvp_enabled_flag); - BS2_SET(u1(), sps.strong_intra_smoothing_enabled_flag); - BS2_SET(u1(), sps.vui_parameters_present_flag); - - if (sps.vui_parameters_present_flag) - { - sps.vui = alloc(&sps); - parseVUI(*sps.vui, sps.max_sub_layers_minus1); - } - - BS2_SET(u1(), sps.extension_present_flag); - - if (sps.extension_present_flag) - { - BS2_SET(u1(), sps.range_extension_flag); - BS2_SET(u1(), sps.multilayer_extension_flag); - BS2_SET(u1(), sps.extension_3d_flag); - BS2_SET(u1(), sps.scc_extension_flag); - BS2_SET(u(4), sps.extension_xbits); - } - - if (sps.range_extension_flag) - { - BS2_SET(u1(), sps.transform_skip_rotation_enabled_flag); - BS2_SET(u1(), sps.transform_skip_context_enabled_flag); - BS2_SET(u1(), sps.implicit_rdpcm_enabled_flag); - BS2_SET(u1(), sps.explicit_rdpcm_enabled_flag); - BS2_SET(u1(), sps.extended_precision_processing_flag); - BS2_SET(u1(), sps.intra_smoothing_disabled_flag); - BS2_SET(u1(), sps.high_precision_offsets_enabled_flag); - BS2_SET(u1(), sps.persistent_rice_adaptation_enabled_flag); - BS2_SET(u1(), sps.cabac_bypass_alignment_enabled_flag); - } - - if (sps.multilayer_extension_flag) - BS2_SET(u1(), sps.inter_view_mv_vert_constraint_flag); - - if (sps.extension_3d_flag) - { - //sps_3d_extension() /* specified in Annex I */ - BS2_TRACE(u1(), iv_di_mc_enabled_flag[0]); - BS2_TRACE(u1(), iv_mv_scal_enabled_flag[0]); - BS2_TRACE(ue(), log2_ivmc_sub_pb_size_minus3[0]); - BS2_TRACE(u1(), iv_res_pred_enabled_flag[0]); - BS2_TRACE(u1(), depth_ref_enabled_flag[0]); - BS2_TRACE(u1(), vsp_mc_enabled_flag[0]); - BS2_TRACE(u1(), dbbp_enabled_flag[0]); - BS2_TRACE(u1(), iv_di_mc_enabled_flag[1]); - BS2_TRACE(u1(), iv_mv_scal_enabled_flag[1]); - BS2_TRACE(u1(), tex_mc_enabled_flag[1]); - BS2_TRACE(ue(), log2_texmc_sub_pb_size_minus3[1]); - BS2_TRACE(u1(), intra_contour_enabled_flag[1]); - BS2_TRACE(u1(), intra_dc_only_wedge_enabled_flag[1]); - BS2_TRACE(u1(), cqt_cu_part_pred_enabled_flag[1]); - BS2_TRACE(u1(), inter_dc_only_enabled_flag[1]); - BS2_TRACE(u1(), skip_intra_enabled_flag[1]); - } - - if (sps.scc_extension_flag) - { - BS2_SET(u1(), sps.curr_pic_ref_enabled_flag); - BS2_SET(u1(), sps.palette_mode_enabled_flag); - - if (sps.palette_mode_enabled_flag) - { - BS2_SET(ue(), sps.palette_max_size); - BS2_SET((Bs32s)ue(), sps.delta_palette_max_predictor_size); - BS2_SET(u1(), sps.palette_predictor_initializer_present_flag); - - if (sps.palette_predictor_initializer_present_flag) - { - BS2_SET(ue() + 1, sps.num_palette_predictor_initializer); - Bs16u numComps = (sps.chroma_format_idc == CHROMA_400) ? 1 : 3; - - sps.palette_predictor_initializers[0] = alloc(&sps, sps.num_palette_predictor_initializer * numComps); - BS2_SET_ARR(u(sps.bit_depth_luma_minus8 + 8) - , sps.palette_predictor_initializers[0] - , sps.num_palette_predictor_initializer, 0); - - if (numComps > 1) - { - sps.palette_predictor_initializers[1] = sps.palette_predictor_initializers[0] + sps.num_palette_predictor_initializer; - sps.palette_predictor_initializers[2] = sps.palette_predictor_initializers[1] + sps.num_palette_predictor_initializer; - - BS2_SET_ARR(u(sps.bit_depth_chroma_minus8 + 8) - , sps.palette_predictor_initializers[1] - , sps.num_palette_predictor_initializer, 0); - BS2_SET_ARR(u(sps.bit_depth_chroma_minus8 + 8) - , sps.palette_predictor_initializers[2] - , sps.num_palette_predictor_initializer, 0); - } - } - } - - BS2_SET(u(2), sps.motion_vector_resolution_control_idc); - BS2_SET(u1(), sps.intra_boundary_filtering_disabled_flag); - } - - if (sps.extension_xbits) - { - sps.ExtBits = parseEXT(sps.ExtData); - - if (sps.ExtData) - bound(sps.ExtData, &sps); - } - - if (!TrailingBits()) - throw InvalidSyntax(); -} - -void Parser::parsePPS(PPS& pps) -{ - TLAuto tl(*this, TRACE_PPS); - - BS2_SET(ue(), pps.pic_parameter_set_id); - BS2_SET(ue(), pps.seq_parameter_set_id); - - SPS& sps = *m_sps[pps.seq_parameter_set_id]; - - BS2_SET(u1(), pps.dependent_slice_segments_enabled_flag); - BS2_SET(u1(), pps.output_flag_present_flag); - BS2_SET(u(3), pps.num_extra_slice_header_bits); - BS2_SET(u1(), pps.sign_data_hiding_enabled_flag); - BS2_SET(u1(), pps.cabac_init_present_flag); - BS2_SET(ue(), pps.num_ref_idx_l0_default_active_minus1); - BS2_SET(ue(), pps.num_ref_idx_l1_default_active_minus1); - BS2_SET(se(), pps.init_qp_minus26); - BS2_SET(u1(), pps.constrained_intra_pred_flag); - BS2_SET(u1(), pps.transform_skip_enabled_flag); - BS2_SET(u1(), pps.cu_qp_delta_enabled_flag); - - if (pps.cu_qp_delta_enabled_flag) - BS2_SET(ue(), pps.diff_cu_qp_delta_depth); - - BS2_SET(se(), pps.cb_qp_offset); - BS2_SET(se(), pps.cr_qp_offset); - - BS2_SET(u1(), pps.slice_chroma_qp_offsets_present_flag); - BS2_SET(u1(), pps.weighted_pred_flag); - BS2_SET(u1(), pps.weighted_bipred_flag); - BS2_SET(u1(), pps.transquant_bypass_enabled_flag); - BS2_SET(u1(), pps.tiles_enabled_flag); - BS2_SET(u1(), pps.entropy_coding_sync_enabled_flag); - - if (pps.tiles_enabled_flag) - { - BS2_SET(ue(), pps.num_tile_columns_minus1); - BS2_SET(ue(), pps.num_tile_rows_minus1); - BS2_SET(u1(), pps.uniform_spacing_flag); - - pps.column_width_minus1 = alloc(&pps, pps.num_tile_columns_minus1 + 1); - pps.row_height_minus1 = alloc(&pps, pps.num_tile_rows_minus1 + 1); - - if (!pps.uniform_spacing_flag) - { - BS2_SET_ARR(ue(), pps.column_width_minus1, pps.num_tile_columns_minus1, 0); - BS2_SET_ARR(ue(), pps.row_height_minus1, pps.num_tile_rows_minus1, 0); - } - else - { - Bs16u LCUSize = (1 << (sps.log2_min_luma_coding_block_size_minus3 + 3 + sps.log2_diff_max_min_luma_coding_block_size)); - Bs16u nCol = CeilDiv(sps.pic_width_in_luma_samples, LCUSize); - Bs16u nRow = CeilDiv(sps.pic_height_in_luma_samples, LCUSize); - Bs16u nTCol = pps.num_tile_columns_minus1 + 1; - Bs16u nTRow = pps.num_tile_rows_minus1 + 1; - - for (Bs16u i = 0; i < nTCol - 1; i++) - pps.column_width_minus1[i] = ((i + 1) * nCol) / nTCol - (i * nCol) / nTCol - 1; - for (Bs16u j = 0; j < nTRow - 1; j++) - pps.row_height_minus1[j] = ((j + 1) * nRow) / nTRow - (j * nRow) / nTRow - 1; - } - - BS2_SET(u1(), pps.loop_filter_across_tiles_enabled_flag); - } - - BS2_SET(u1(), pps.loop_filter_across_slices_enabled_flag); - BS2_SET(u1(), pps.deblocking_filter_control_present_flag); - - if (pps.deblocking_filter_control_present_flag) - { - BS2_SET(u1(), pps.deblocking_filter_override_enabled_flag); - BS2_SET(u1(), pps.deblocking_filter_disabled_flag); - - if (!pps.deblocking_filter_disabled_flag) - { - BS2_SET(se(), pps.beta_offset_div2); - BS2_SET(se(), pps.tc_offset_div2); - } - } - - BS2_SET(u1(), pps.scaling_list_data_present_flag); - - if (pps.scaling_list_data_present_flag) - { - pps.qm = alloc(&pps); - parseSLD(*pps.qm); - } - - BS2_SET(u1(), pps.lists_modification_present_flag); - BS2_SET(ue(), pps.log2_parallel_merge_level_minus2); - BS2_SET(u1(), pps.slice_segment_header_extension_present_flag); - BS2_SET(u1(), pps.extension_present_flag); - - if (pps.extension_present_flag) - { - BS2_SET(u1(), pps.range_extension_flag); - BS2_SET(u1(), pps.multilayer_extension_flag); - BS2_SET(u1(), pps.extension_3d_flag); - BS2_SET(u1(), pps.scc_extension_flag); - BS2_SET(u(4), pps.extension_xbits); - } - - if (pps.range_extension_flag) - { - if (pps.transform_skip_enabled_flag) - BS2_SET(ue(), pps.log2_max_transform_skip_block_size_minus2); - - BS2_SET(u1(), pps.cross_component_prediction_enabled_flag); - BS2_SET(u1(), pps.chroma_qp_offset_list_enabled_flag); - - if (pps.chroma_qp_offset_list_enabled_flag) - { - - BS2_SET(ue(), pps.diff_cu_chroma_qp_offset_depth); - BS2_SET(ue(), pps.chroma_qp_offset_list_len_minus1); - - for (Bs32u i = 0; i <= pps.chroma_qp_offset_list_len_minus1; i++) - { - pps.cb_qp_offset_list[i] = se(); - pps.cr_qp_offset_list[i] = se(); - } - - BS2_TRACE_ARR(pps.cb_qp_offset_list, pps.chroma_qp_offset_list_len_minus1 + 1, 0); - BS2_TRACE_ARR(pps.cr_qp_offset_list, pps.chroma_qp_offset_list_len_minus1 + 1, 0); - } - - BS2_SET(ue(), pps.log2_sao_offset_scale_luma); - BS2_SET(ue(), pps.log2_sao_offset_scale_chroma); - } - - if (pps.multilayer_extension_flag) - { - //pps_multilayer_extension() /* specified in Annex F */ - parseMLE(pps); - } - - if (pps.extension_3d_flag) - { - //pps_3d_extension() /* specified in Annex I */ - parse3DE(pps); - } - - if (pps.scc_extension_flag) - { - BS2_SET(u1(), pps.curr_pic_ref_enabled_flag); - BS2_SET(u1(), pps.residual_adaptive_colour_transform_enabled_flag); - - if (pps.residual_adaptive_colour_transform_enabled_flag) - { - BS2_SET(u1(), pps.slice_act_qp_offsets_present_flag); - BS2_SET(se() - 5, pps.ActQpOffsetY); - BS2_SET(se() - 5, pps.ActQpOffsetCb); - BS2_SET(se() - 3, pps.ActQpOffsetCr); - } - - BS2_SET(u1(), pps.palette_predictor_initializer_present_flag); - - if (pps.palette_predictor_initializer_present_flag) - { - BS2_SET(ue(), pps.num_palette_predictor_initializer); - - if (pps.num_palette_predictor_initializer) - { - BS2_SET(u1(), pps.monochrome_palette_flag); - BS2_SET(ue(), pps.luma_bit_depth_entry_minus8); - - if (!pps.monochrome_palette_flag) - BS2_SET(ue(), pps.chroma_bit_depth_entry_minus8); - - Bs16u numComps = pps.monochrome_palette_flag ? 1 : 3; - - pps.palette_predictor_initializers[0] = alloc(&pps, pps.num_palette_predictor_initializer * numComps); - BS2_SET_ARR(u(pps.luma_bit_depth_entry_minus8 + 8) - , pps.palette_predictor_initializers[0] - , pps.num_palette_predictor_initializer, 0); - - if (numComps > 1) - { - pps.palette_predictor_initializers[1] = pps.palette_predictor_initializers[0] + pps.num_palette_predictor_initializer; - pps.palette_predictor_initializers[2] = pps.palette_predictor_initializers[1] + pps.num_palette_predictor_initializer; - - BS2_SET_ARR(u(pps.chroma_bit_depth_entry_minus8 + 8) - , pps.palette_predictor_initializers[1] - , pps.num_palette_predictor_initializer, 0); - BS2_SET_ARR(u(pps.chroma_bit_depth_entry_minus8 + 8) - , pps.palette_predictor_initializers[2] - , pps.num_palette_predictor_initializer, 0); - } - } - } - } - - if (pps.extension_xbits) - { - pps.ExtBits = parseEXT(pps.ExtData); - - if (pps.ExtData) - bound(pps.ExtData, &pps); - } - - if (!TrailingBits()) - throw InvalidSyntax(); -} - -void Parser::parseMLE(PPS& pps) -{ - (void)pps; - - Bs32s pps_infer_scaling_list_flag - , num_ref_loc_offsets - , tmp - , cm_octant_depth - , PartNumY - , CMResLSBits = 10; //Max(0, (10 + BitDepthCmInputY - BitDepthCmOutputY - cm_res_quant_bits -(cm_delta_flc_bits_minus1 + 1))) - - std::function colour_mapping_octants = [&]( - Bs32s inpDepth - , Bs32s idxY - , Bs32s idxCb - , Bs32s idxCr - , Bs32s inpLength) -> void - { - Bs32s split_octant_flag = 0, i, j, c, m, n, k; - - if (inpDepth < cm_octant_depth) - BS2_SET(u1(), split_octant_flag); - - if (split_octant_flag) - { - for (k = 0; k < 2; k++) - for (m = 0; m < 2; m++) - for (n = 0; n < 2; n++) - colour_mapping_octants( - inpDepth + 1 - , idxY + PartNumY * k * inpLength / 2 - , idxCb + m * inpLength / 2 - , idxCr + n * inpLength / 2 - , inpLength / 2); - } - else - { - for (i = 0; i < PartNumY; i++) - { - //idxShiftY = idxY + ((i << (cm_octant_depth - inpDepth)) - for (j = 0; j < 4; j++) - { - BS2_TRACE(tmp = u1(), coded_res_flag[idxShiftY][idxCb][idxCr][j]); - if (!tmp) - continue; - - for (c = 0; c < 3; c++) - { - BS2_TRACE(m = ue(), res_coeff_q[idxShiftY][idxCb][idxCr][j][c]); - BS2_TRACE(n = u(CMResLSBits), res_coeff_r[idxShiftY][idxCb][idxCr][j][c]); - if (m || n) - BS2_TRACE(u1(), res_coeff_s[idxShiftY][idxCb][idxCr][j][c]); - } - } - } - } - }; - - BS2_TRACE(u1(), poc_reset_info_present_flag); - BS2_SET(u1(), pps_infer_scaling_list_flag); - - if (pps_infer_scaling_list_flag) - BS2_TRACE(u(6), pps_scaling_list_ref_layer_id); - - BS2_SET(ue(), num_ref_loc_offsets); - - for (Bs32s i = 0; i < num_ref_loc_offsets; i++) - { - BS2_TRACE(u(6), ref_loc_offset_layer_id[i]); - BS2_TRACE(tmp = u1(), scaled_ref_layer_offset_present_flag[i]); - if (tmp) - { - BS2_TRACE(se(), scaled_ref_layer_left_offset[ref_loc_offset_layer_id[i]]); - BS2_TRACE(se(), scaled_ref_layer_top_offset[ref_loc_offset_layer_id[i]]); - BS2_TRACE(se(), scaled_ref_layer_right_offset[ref_loc_offset_layer_id[i]]); - BS2_TRACE(se(), scaled_ref_layer_bottom_offset[ref_loc_offset_layer_id[i]]); - } - BS2_TRACE(tmp = u1(), ref_region_offset_present_flag[i]); - if (tmp) - { - BS2_TRACE(se(), ref_region_left_offset[ref_loc_offset_layer_id[i]]); - BS2_TRACE(se(), ref_region_top_offset[ref_loc_offset_layer_id[i]]); - BS2_TRACE(se(), ref_region_right_offset[ref_loc_offset_layer_id[i]]); - BS2_TRACE(se(), ref_region_bottom_offset[ref_loc_offset_layer_id[i]]); - } - BS2_TRACE(tmp = u1(), resample_phase_set_present_flag[i]); - if (tmp) - { - BS2_TRACE(ue(), phase_hor_luma[ref_loc_offset_layer_id[i]]); - BS2_TRACE(ue(), phase_ver_luma[ref_loc_offset_layer_id[i]]); - BS2_TRACE(ue(), phase_hor_chroma_plus8[ref_loc_offset_layer_id[i]]); - BS2_TRACE(ue(), phase_ver_chroma_plus8[ref_loc_offset_layer_id[i]]); - } - } - - BS2_TRACE(tmp = u1(), colour_mapping_enabled_flag[i]); - if (tmp) - { - //colour_mapping_table( ) - BS2_TRACE(tmp = ue(), num_cm_ref_layers_minus1); - BS2_TRACE_ARR_VF(u(6), cm_ref_layer_id, Bs32u(tmp+1), 0, " %d,"); - BS2_SET(u(2), cm_octant_depth); - BS2_TRACE(tmp = u(2), cm_y_part_num_log2); - PartNumY = (1 << tmp); - BS2_TRACE(tmp = ue(), luma_bit_depth_cm_input_minus8); - CMResLSBits += (8 + tmp); //BitDepthCmInputY - BS2_TRACE(ue(), chroma_bit_depth_cm_input_minus8); - BS2_TRACE(tmp = ue(), luma_bit_depth_cm_output_minus8); - CMResLSBits -= (8 + tmp); //BitDepthCmOutputY - BS2_TRACE(ue(), chroma_bit_depth_cm_output_minus8); - BS2_TRACE(tmp = u(2), cm_res_quant_bits); - CMResLSBits -= tmp; - BS2_TRACE(tmp = u(2), cm_delta_flc_bits_minus1); - CMResLSBits -= (tmp + 1); - CMResLSBits = BS_MAX(0, CMResLSBits); - - if (cm_octant_depth == 1) - { - BS2_TRACE(se(), cm_adapt_threshold_u_delta); - BS2_TRACE(se(), cm_adapt_threshold_v_delta); - } - - colour_mapping_octants(0, 0, 0, 0, 1 << cm_octant_depth); - } -} - -void Parser::parse3DE(PPS& pps) -{ - (void)pps; - - Bs32s tmp, i, j, k - , pps_depth_layers_minus1 - , depthMaxValue - , dlBD - , num_val_delta_dlt - , dlt_val_flags_present_flag - , max_diff - , min_diff_minus1 = 0; - - auto delta_dlt = [&](Bs32s) - { - BS2_SET(u(dlBD), num_val_delta_dlt); - if (num_val_delta_dlt > 0) - { - max_diff = 0; - - if (num_val_delta_dlt > 1) - BS2_SET(u(dlBD), max_diff); - - if (num_val_delta_dlt > 2 && max_diff > 0) - BS2_SET(u(CeilLog2(max_diff + 1)), min_diff_minus1) - else - min_diff_minus1 = max_diff - 1; - - BS2_TRACE(u(dlBD), delta_dlt_val0); - - if (max_diff > (min_diff_minus1 + 1)) - for (k = 1; k < num_val_delta_dlt; k++) - BS2_TRACE(u(CeilLog2(max_diff - min_diff_minus1)), delta_val_diff_minus_min[k]); - } - }; - - BS2_TRACE(tmp = u(1), dlts_present_flag); - if (tmp) - { - BS2_SET(u(6), pps_depth_layers_minus1); - BS2_TRACE(tmp = u(4), pps_bit_depth_for_depth_layers_minus8); - dlBD = (tmp + 8); - depthMaxValue = (1 << dlBD) - 1; - - for (i = 0; i <= pps_depth_layers_minus1; i++) - { - BS2_TRACE(tmp = u(1), dlt_flag[i]); - if (tmp) - { - dlt_val_flags_present_flag = 0; - - BS2_TRACE(tmp = u(1), dlt_pred_flag[i]); - if (!tmp) - BS2_TRACE(dlt_val_flags_present_flag = u(1), dlt_val_flags_present_flag[i]); - - if (dlt_val_flags_present_flag) - for (j = 0; j <= depthMaxValue; j++) - BS2_TRACE(u(1), dlt_value_flag[i][j]) - else - delta_dlt(i); - } - } - } -} - -void Parser::parseSEIPL(APS_SEI& aps) -{ - BS2_SET(u(4), aps.active_video_parameter_set_id); - BS2_SET(u1(), aps.self_contained_cvs_flag); - BS2_SET(u1(), aps.no_parameter_set_update_flag); - BS2_SET(ue(), aps.num_sps_ids_minus1); - - aps.active_seq_parameter_set_id = alloc(&aps, aps.num_sps_ids_minus1 + 1); - - BS2_SET_ARR(ue(), aps.active_seq_parameter_set_id, aps.num_sps_ids_minus1 + 1, 0); - - if (!m_vps[aps.active_video_parameter_set_id]) - throw NoActiveSet(); - - VPS& vps = *m_vps[aps.active_video_parameter_set_id]; - - aps.layer_sps_idx = alloc(&aps, vps.max_layers_minus1 + 1); - - for (Bs32u i = vps.base_layer_internal_flag; i <= vps.max_layers_minus1; i++) - aps.layer_sps_idx[i] = ue(); - - BS2_TRACE_ARR(aps.layer_sps_idx, vps.max_layers_minus1 + 1, 0); - - m_activeSPS = m_sps[aps.layer_sps_idx[0]]; -} - -void Parser::parseSEIPL(BP_SEI& bp) -{ - BS2_SET(ue(), bp.seq_parameter_set_id); - - if (!m_sps[bp.seq_parameter_set_id]) - throw NoActiveSet(); - - SPS& sps = *m_sps[bp.seq_parameter_set_id]; - HRD hrd = {}; - hrd.au_cpb_removal_delay_length_minus1 = 23; - - if ( sps.vui_parameters_present_flag - && sps.vui->hrd_parameters_present_flag) - hrd = *sps.vui->hrd; - - if (!hrd.sub_pic_hrd_params_present_flag) - BS2_SET(u1(), bp.irap_cpb_params_present_flag); - - if (bp.irap_cpb_params_present_flag) - { - BS2_SET(u(hrd.au_cpb_removal_delay_length_minus1 + 1), bp.cpb_delay_offset); - BS2_SET(u(hrd.dpb_output_delay_length_minus1 + 1), bp.dpb_delay_offset); - } - - BS2_SET(u1(), bp.concatenation_flag); - BS2_SET(u(hrd.au_cpb_removal_delay_length_minus1 + 1), bp.au_cpb_removal_delay_delta_minus1); - - if (hrd.nal_hrd_parameters_present_flag) - { - bp.nal = alloc(&bp, hrd.sl[0].cpb_cnt_minus1 + 1); - - for (Bs32u i = 0; i < (Bs32u)hrd.sl[0].cpb_cnt_minus1 + 1; i++) - { - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.nal[i].initial_cpb_removal_delay); - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.nal[i].initial_cpb_removal_offset); - - if ( hrd.sub_pic_hrd_params_present_flag - || bp.irap_cpb_params_present_flag) - { - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.nal[i].initial_alt_cpb_removal_delay); - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.nal[i].initial_alt_cpb_removal_offset); - } - } - } - - if (hrd.vcl_hrd_parameters_present_flag) - { - bp.vcl = alloc(&bp, hrd.sl[0].cpb_cnt_minus1 + 1); - - for (Bs32u i = 0; i < (Bs32u)hrd.sl[0].cpb_cnt_minus1 + 1; i++) - { - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.vcl[i].initial_cpb_removal_delay); - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.vcl[i].initial_cpb_removal_offset); - - if (hrd.sub_pic_hrd_params_present_flag - || bp.irap_cpb_params_present_flag) - { - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.vcl[i].initial_alt_cpb_removal_delay); - BS2_SET(u(hrd.initial_cpb_removal_delay_length_minus1 + 1), - bp.vcl[i].initial_alt_cpb_removal_offset); - } - } - } - - try - { - Bs32u o = (8 - GetBitOffset()); - Bs32u B = u(o); - - if (B != (1u << o)) - BS2_SET((B >> (o - 1)), bp.use_alt_cpb_params_flag); - } - catch (EndOfBuffer&) - { - //ignore - } -} - -void Parser::parseSEIPL(PT_SEI& pt) -{ - if (!m_activeSPS) - throw NoActiveSet(); - - SPS& sps = *m_activeSPS; - - if (!sps.vui_parameters_present_flag) - return; - - VUI& vui = *sps.vui; - - if (vui.frame_field_info_present_flag) - { - BS2_SETM(u(4), pt.pic_struct, PicStructTraceMap); - BS2_SETM(u(2), pt.source_scan_type, ScanTypeTraceMap); - BS2_SET(u1(), pt.duplicate_flag); - } - - if ( vui.hrd_parameters_present_flag - && (vui.hrd->nal_hrd_parameters_present_flag - || vui.hrd->vcl_hrd_parameters_present_flag)) - { - HRD& hrd = *vui.hrd; - - BS2_SET(u(hrd.au_cpb_removal_delay_length_minus1 + 1), pt.au_cpb_removal_delay_minus1); - BS2_SET(u(hrd.dpb_output_delay_length_minus1 + 1), pt.pic_dpb_output_delay); - - if (hrd.sub_pic_hrd_params_present_flag) - BS2_SET(u(hrd.dpb_output_delay_du_length_minus1 + 1), pt.pic_dpb_output_du_delay); - - if ( hrd.sub_pic_hrd_params_present_flag - && hrd.sub_pic_cpb_params_in_pic_timing_sei_flag) - { - BS2_SET(ue(), pt.num_decoding_units_minus1); - BS2_SET(u1(), pt.du_common_cpb_removal_delay_flag); - - if (pt.du_common_cpb_removal_delay_flag) - BS2_SET(u(hrd.du_cpb_removal_delay_increment_length_minus1 + 1), - pt.du_common_cpb_removal_delay_increment_minus1); - - pt.num_nalus_in_du_minus1 = alloc(&pt, pt.num_decoding_units_minus1 + 1); - - if (!pt.du_common_cpb_removal_delay_flag) - pt.du_cpb_removal_delay_increment_minus1 = - alloc(&pt, pt.num_decoding_units_minus1); - - for (Bs32u i = 0; i < pt.num_decoding_units_minus1; i++) - { - pt.num_nalus_in_du_minus1[i] = ue(); - - if (!pt.du_common_cpb_removal_delay_flag) - pt.du_cpb_removal_delay_increment_minus1[i] = - u(hrd.du_cpb_removal_delay_increment_length_minus1 + 1); - } - - pt.num_nalus_in_du_minus1[pt.num_decoding_units_minus1] = ue(); - - BS2_TRACE_ARR(pt.num_nalus_in_du_minus1, pt.num_decoding_units_minus1 + 1, 0); - - if (!pt.du_common_cpb_removal_delay_flag) - BS2_TRACE_ARR(pt.du_cpb_removal_delay_increment_minus1, - pt.num_decoding_units_minus1, 0); - } - } -} - -void Parser::parseSEIPL(RP_SEI& rp) -{ - BS2_SET(se(), rp.recovery_poc_cnt); - BS2_SET(u1(), rp.exact_match_flag); - BS2_SET(u1(), rp.broken_link_flag); -} - -void Parser::parseSEIPL(SEI& sei) -{ - TLAuto tl(*this, TRACE_SEI); - StateSwitcher st(*this); - - SetEmulation(false); - Reset(sei.rawData, sei.payloadSize); - - if (!m_postponedSEI.empty() && m_postponedSEI.front() == &sei) - { - BS2_TRACE_STR("----------------------------------"); - BS2_SETM(sei.payloadType, sei.payloadType, SEITypeTraceMap()); - } - - try - { - switch (sei.payloadType) - { - case SEI_ACTIVE_PARAMETER_SETS: - if (!sei.aps) - sei.aps = alloc(&sei); - parseSEIPL(*sei.aps); - break; - case SEI_BUFFERING_PERIOD: - if (!sei.bp) - sei.bp = alloc(&sei); - parseSEIPL(*sei.bp); - break; - case SEI_PICTURE_TIMING: - if (!sei.pt) - sei.pt = alloc(&sei); - parseSEIPL(*sei.pt); - break; - case SEI_RECOVERY_POINT: - if (!sei.rp) - sei.rp = alloc(&sei); - parseSEIPL(*sei.rp); - break; - default: - break; - } - } - catch (EndOfBuffer&) - { - throw InvalidSyntax(); - } -} - -void Parser::parseSEI(SEI& first) -{ - TLAuto tl(*this, TRACE_SEI); - - SEI* next = &first; - - for (;;) - { - Bs8u lastByte; - SEI& sei = *next; - - do - { - lastByte = u8(); - sei.payloadType += lastByte; - } while (lastByte == 0xff); - - BS2_SETM(sei.payloadType, sei.payloadType, SEITypeTraceMap()); - - do - { - lastByte = u8(); - sei.payloadSize += lastByte; - } while (lastByte == 0xff); - - BS2_TRACE(sei.payloadSize, sei.payloadSize); - - sei.rawData = alloc(&sei, sei.payloadSize); - - BS2_SET_ARR_F(GetByte(), sei.rawData, sei.payloadSize, - 16 * (sei.payloadSize > 16), "%02X "); - - if (GetBitOffset() && !TrailingBits()) - throw InvalidSyntax(); - - try - { - parseSEIPL(sei); - } - catch (NoActiveSet&) - { - m_postponedSEI.push_back(&sei); - } - - if (!more_rbsp_data()) - break; - - next = sei.next = alloc(&sei); - } - - if (!TrailingBits()) - throw InvalidSyntax(); - -} - -void Parser::parseSSH(NALU& nalu) -{ - TLAuto tl(*this, TRACE_SSH); - Slice& slice = *nalu.slice; - Bs32u NUT = nalu.nal_unit_type; - Bs32u i, sz, NumPicTotalCurr; - - BS2_SET(u1(), slice.first_slice_segment_in_pic_flag); - - if (NUT >= BLA_W_LP && NUT <= RSV_IRAP_VCL23) - BS2_SET(u1(), slice.no_output_of_prior_pics_flag); - - BS2_SET(ue(), slice.pic_parameter_set_id); - - slice.pps = m_pps[slice.pic_parameter_set_id]; - - if (!slice.pps) - throw NoActiveSet(); - - slice.sps = m_activeSPS = m_sps[slice.pps->seq_parameter_set_id]; - - if (!slice.sps) - throw NoActiveSet(); - - SPS& sps = *slice.sps; - PPS& pps = *slice.pps; - - bound(&sps, &slice); - bound(&pps, &slice); - - if (!slice.first_slice_segment_in_pic_flag) - { - if (pps.dependent_slice_segments_enabled_flag) - BS2_SET(u1(), slice.dependent_slice_segment_flag); - - Bs16u MaxCU = (1 << (sps.log2_min_luma_coding_block_size_minus3 + 3 + sps.log2_diff_max_min_luma_coding_block_size)); - Bs32u PicSizeInCtbsY = CeilDiv(sps.pic_width_in_luma_samples, MaxCU) - * CeilDiv(sps.pic_height_in_luma_samples, MaxCU); - - BS2_SET(u(CeilLog2(PicSizeInCtbsY)), slice.slice_segment_address); - } - - if (slice.dependent_slice_segment_flag) - goto l_ep_offsets; - - if (pps.num_extra_slice_header_bits) - { - slice.reserved_flags = u(pps.num_extra_slice_header_bits) << (8 - pps.num_extra_slice_header_bits); - Bs8u flags = (Bs8u)slice.reserved_flags; - BS2_TRACE_BIN(&flags, 0, pps.num_extra_slice_header_bits, slice.reserved_flags); - } - - BS2_SETM(ue(), slice.type, SliceTypeTraceMap); - - if (pps.output_flag_present_flag) - BS2_SET(u1(), slice.pic_output_flag); - - if (sps.separate_colour_plane_flag) - BS2_SET(u(2), slice.colour_plane_id); - - if (NUT == IDR_W_RADL || NUT == IDR_N_LP) - goto l_after_dpb; - - BS2_SET(u(sps.log2_max_pic_order_cnt_lsb_minus4 + 4), slice.pic_order_cnt_lsb); - BS2_SET(u1(), slice.short_term_ref_pic_set_sps_flag); - - if (!slice.short_term_ref_pic_set_sps_flag) - { - ParseSTRPS(sps.strps, sps.num_short_term_ref_pic_sets, sps.num_short_term_ref_pic_sets); - slice.strps = sps.strps[sps.num_short_term_ref_pic_sets]; - } - else if (sps.num_short_term_ref_pic_sets > 1) - { - BS2_SET(u(CeilLog2(sps.num_short_term_ref_pic_sets)), slice.short_term_ref_pic_set_idx) - slice.strps = sps.strps[slice.short_term_ref_pic_set_idx]; - } - else if (sps.num_short_term_ref_pic_sets == 1) - { - slice.strps = sps.strps[0]; - } - - if (!sps.long_term_ref_pics_present_flag) - goto l_after_lt; - - if (sps.num_long_term_ref_pics) - BS2_SET(ue(), slice.num_long_term_sps); - - BS2_SET(ue(), slice.num_long_term_pics); - - sz = slice.num_long_term_sps + slice.num_long_term_pics; - slice.poc_lsb_lt = alloc(&slice, sz); - slice.DeltaPocMsbCycleLt = alloc(&slice, sz); - - for (i = 0; i < sz; i++) - { - if (i < slice.num_long_term_sps) - { - Bs32u lt_idx_sps = - (sps.num_long_term_ref_pics > 0) ? u(CeilLog2(sps.num_long_term_ref_pics)) : 0; - - slice.poc_lsb_lt[i] = sps.lt_ref_pic_poc_lsb[lt_idx_sps]; - SetBit(slice.used_by_curr_pic_lt_flags, i, - BS_HEVC2::GetBit(sps.used_by_curr_pic_lt_flags, lt_idx_sps)); - } - else - { - slice.poc_lsb_lt[i] = u(sps.log2_max_pic_order_cnt_lsb_minus4 + 4); - SetBit(slice.used_by_curr_pic_lt_flags, i, !!u1()); - } - - if (u1()) // delta_poc_msb_present_flag - slice.DeltaPocMsbCycleLt[i] = ue(); - - if (i && i != slice.num_long_term_sps) - slice.DeltaPocMsbCycleLt[i] += slice.DeltaPocMsbCycleLt[i - 1]; - } - - if (sz) - { - BS2_TRACE_BIN(&slice.used_by_curr_pic_lt_flags, 0, sz, slice.used_by_curr_pic_lt_flags); - BS2_TRACE_ARR(slice.poc_lsb_lt, sz, 0); - BS2_TRACE_ARR(slice.DeltaPocMsbCycleLt, sz, 0); - } - -l_after_lt: - if (sps.temporal_mvp_enabled_flag) - BS2_SET(u1(), slice.temporal_mvp_enabled_flag); - -l_after_dpb: - - slice.DPB = alloc(&slice, slice.strps.NumDeltaPocs + slice.num_long_term_sps + slice.num_long_term_pics); - - if (sps.sample_adaptive_offset_enabled_flag) - { - BS2_SET(u1(), slice.sao_luma_flag); - - if (sps.chroma_format_idc != 0) - BS2_SET(u1(), slice.sao_chroma_flag); - } - - if (slice.type == I) - goto l_qp; - - BS2_SET(u1(), slice.num_ref_idx_active_override_flag); - - if (slice.num_ref_idx_active_override_flag) - { - BS2_SET(ue() + 1, slice.num_ref_idx_l0_active); - - if (slice.type == SLICE_TYPE::B) - BS2_SET(ue() + 1, slice.num_ref_idx_l1_active); - } - else - { - slice.num_ref_idx_l0_active = 1 + pps.num_ref_idx_l0_default_active_minus1; - - if (slice.type == SLICE_TYPE::B) - slice.num_ref_idx_l1_active = (1 + pps.num_ref_idx_l1_default_active_minus1); - } - - slice.L0 = alloc(&slice, slice.num_ref_idx_l0_active); - slice.L1 = alloc(&slice, slice.num_ref_idx_l1_active); - - NumPicTotalCurr = CntBits(slice.strps.UsedByCurrPicFlags) + CntBits(slice.used_by_curr_pic_lt_flags); - - if (pps.lists_modification_present_flag && NumPicTotalCurr > 1) - { - sz = CeilLog2(NumPicTotalCurr); - - BS2_SET(u1(), slice.ref_pic_list_modification_flag_l0); - - if (slice.ref_pic_list_modification_flag_l0) - BS2_SET_ARR(u(sz), slice.list_entry_lx[0], slice.num_ref_idx_l0_active, 0); - - if (slice.type == SLICE_TYPE::B) - { - BS2_SET(u1(), slice.ref_pic_list_modification_flag_l1); - - if (slice.ref_pic_list_modification_flag_l1) - BS2_SET_ARR(u(sz), slice.list_entry_lx[1], slice.num_ref_idx_l1_active, 0); - } - } - - if (slice.type == SLICE_TYPE::B) - BS2_SET(u1(), slice.mvd_l1_zero_flag); - - if (pps.cabac_init_present_flag) - BS2_SET(u1(), slice.cabac_init_flag); - - if (slice.temporal_mvp_enabled_flag) - { - if (slice.type == SLICE_TYPE::B) - BS2_SET(u1(), slice.collocated_from_l0_flag) - else - slice.collocated_from_l0_flag = 1; - - if ( (slice.collocated_from_l0_flag && slice.num_ref_idx_l0_active > 1) - || (!slice.collocated_from_l0_flag && slice.num_ref_idx_l1_active > 1)) - BS2_SET(ue(), slice.collocated_ref_idx); - } - -#define Clip3(_min, _max, _x) std::min(std::max(_min, _x), _max) - - if ( (pps.weighted_pred_flag && slice.type == SLICE_TYPE::P) - || (pps.weighted_bipred_flag && slice.type == SLICE_TYPE::B)) - { - Bs16s WpOffsetHalfRangeC = 1 << (sps.high_precision_offsets_enabled_flag ? (sps.bit_depth_chroma_minus8 + 8 - 1) : 7); - Bs16u dim[] = {1, 16, 3, 2}; - slice.pwt = alloc(&slice, 1 + (slice.type == SLICE_TYPE::B)); - - BS2_SET(ue(), slice.luma_log2_weight_denom); - if (sps.chroma_format_idc != 0) - BS2_SET(slice.luma_log2_weight_denom + se(), slice.chroma_log2_weight_denom); - - if (pps.curr_pic_ref_enabled_flag) - { - //have to decode RPL right now - NoRaslOutputFlag = m_bNewSequence || isIDR(nalu) || isBLA(nalu); - MaxPicOrderCntLsb = (1 << (sps.log2_max_pic_order_cnt_lsb_minus4 + 4)); - - decodePOC(nalu); - - if ( m_bNewSequence || !m_cSlice || (m_cSlice->POC != slice.POC) - || (m_cSlice->POC == slice.POC && CtuInRs[slice.slice_segment_address])) - m_DPB.swap(m_DPBafter); - - m_prevSlicePOC = slice.POC; - - decodeRPL(nalu); - - m_bRPLDecoded = true; - } - - for (Bs32u l = 0; l < 2; l++) - { - auto& LX = l ? slice.L1 : slice.L0; - Bs32u nCPR = 0; - - sz = l ? slice.num_ref_idx_l1_active : slice.num_ref_idx_l0_active; - - if (pps.curr_pic_ref_enabled_flag) - for (i = 0; i < sz; i++) - nCPR += (LX[i].POC == slice.POC); - - Bs16u lumaw = u(sz - nCPR) << nCPR; - Bs16u chromaw = 0; - - if (sps.chroma_format_idc != 0) - chromaw = u(sz - nCPR) << nCPR; - - for (i = 0; i < sz; i++) - { - auto& entry = slice.pwt[l][i]; - - entry[0][0] = (1 << slice.luma_log2_weight_denom); - entry[1][0] = (1 << slice.chroma_log2_weight_denom); - entry[2][0] = (1 << slice.chroma_log2_weight_denom); - - if (pps.curr_pic_ref_enabled_flag && LX[i].POC == slice.POC) - { - lumaw >>= 1; - chromaw >>= 1; - continue; - } - - if (lumaw & (1 << (sz - i - 1))) - { - entry[0][0] += se(); - entry[0][1] = se(); - } - - if (chromaw & (1 << (sz - i - 1))) - { - entry[1][0] += se(); - entry[1][1] = Clip3(-WpOffsetHalfRangeC, WpOffsetHalfRangeC - 1, - (WpOffsetHalfRangeC + se() - ((WpOffsetHalfRangeC * entry[1][0]) >> slice.chroma_log2_weight_denom))); - entry[2][0] += se(); - entry[2][1] = Clip3(-WpOffsetHalfRangeC, WpOffsetHalfRangeC - 1, - (WpOffsetHalfRangeC + se() - ((WpOffsetHalfRangeC * entry[2][0]) >> slice.chroma_log2_weight_denom))); - } - } - } - - dim[1] = slice.num_ref_idx_l0_active; - BS2_TRACE_MDARR(Bs16s, slice.pwt[0], dim, 1, 0, "%4i "); - - if (slice.type == SLICE_TYPE::B) - { - dim[1] = slice.num_ref_idx_l1_active; - BS2_TRACE_MDARR(Bs16s, slice.pwt[1], dim, 1, 0, "%4i "); - } - } - - BS2_SET(5 - ue(), slice.MaxNumMergeCand); - - if (sps.motion_vector_resolution_control_idc == 2) - BS2_SET(u1(), slice.use_integer_mv_flag) - else - slice.use_integer_mv_flag = sps.motion_vector_resolution_control_idc; - -l_qp: - BS2_SET(se(), slice.qp_delta); - - if (pps.slice_chroma_qp_offsets_present_flag) - { - BS2_SET(se(), slice.cb_qp_offset); - BS2_SET(se(), slice.cr_qp_offset); - } - - if (pps.slice_act_qp_offsets_present_flag) - { - BS2_SET(se(), slice.act_y_qp_offset); - BS2_SET(se(), slice.act_cb_qp_offset); - BS2_SET(se(), slice.act_cr_qp_offset); - } - - if (pps.chroma_qp_offset_list_enabled_flag) - BS2_SET(u1(), slice.cu_chroma_qp_offset_enabled_flag); - - if (pps.deblocking_filter_override_enabled_flag) - BS2_SET(u1(), slice.deblocking_filter_override_flag); - - if (slice.deblocking_filter_override_flag) - { - BS2_SET(u1(), slice.deblocking_filter_disabled_flag); - - if (!slice.deblocking_filter_disabled_flag) - { - BS2_SET(se(), slice.beta_offset_div2); - BS2_SET(se(), slice.tc_offset_div2); - } - } - else - slice.deblocking_filter_disabled_flag = pps.deblocking_filter_disabled_flag; - - if (pps.loop_filter_across_slices_enabled_flag - && (slice.sao_luma_flag - || slice.sao_chroma_flag - || !slice.deblocking_filter_disabled_flag)) - BS2_SET(u1(), slice.loop_filter_across_slices_enabled_flag); - -l_ep_offsets: - if (pps.tiles_enabled_flag || pps.entropy_coding_sync_enabled_flag) - { - BS2_SET(ue(), slice.num_entry_point_offsets); - - if (slice.num_entry_point_offsets) - { - slice.entry_point_offset_minus1 = alloc(&slice, slice.num_entry_point_offsets); - - BS2_SET(ue(), slice.offset_len_minus1); - BS2_SET_ARR( - u(slice.offset_len_minus1 + 1), - slice.entry_point_offset_minus1, - slice.num_entry_point_offsets, 0); - } - } - - if (pps.slice_segment_header_extension_present_flag) - { - BS2_SET(ue() * 8, slice.ExtBits); - - if (slice.ExtBits) - { - slice.ExtData = alloc(&slice, slice.ExtBits / 8); - - BS2_SET_ARR_F(u8(), slice.ExtData, slice.ExtBits / 8, 16, "%02X "); - } - } - - if (!TrailingBits()) - throw InvalidSyntax(); -} - -void Parser::parseRBSP(NALU& nalu) -{ - switch (nalu.nal_unit_type) - { - case AUD_NUT: - nalu.aud = alloc(&nalu); - parseAUD(*nalu.aud); - break; - case VPS_NUT: - nalu.vps = alloc(&nalu); - parseVPS(*nalu.vps); - lock(nalu.vps); - unlock(m_vps[nalu.vps->video_parameter_set_id]); - m_vps[nalu.vps->video_parameter_set_id] = nalu.vps; - break; - case SPS_NUT: - nalu.sps = alloc(&nalu); - parseSPS(*nalu.sps); - lock(nalu.sps); - unlock(m_sps[nalu.sps->seq_parameter_set_id]); - m_sps[nalu.sps->seq_parameter_set_id] = nalu.sps; - break; - case PPS_NUT: - nalu.pps = alloc(&nalu); - parsePPS(*nalu.pps); - lock(nalu.pps); - unlock(m_pps[nalu.pps->pic_parameter_set_id]); - m_pps[nalu.pps->pic_parameter_set_id] = nalu.pps; - break; - case PREFIX_SEI_NUT: - case SUFFIX_SEI_NUT: - nalu.sei = alloc(&nalu); - parseSEI(*nalu.sei); - break; - case TRAIL_N: - case TRAIL_R: - case TSA_N: - case TSA_R: - case STSA_N: - case STSA_R: - case RADL_N: - case RADL_R: - case RASL_N: - case RASL_R: - case BLA_W_LP: - case BLA_W_RADL: - case BLA_N_LP: - case IDR_W_RADL: - case IDR_N_LP: - case CRA_NUT: - nalu.slice = alloc(&nalu); - parseSSH(nalu); - { - auto& slice = *nalu.slice; - auto prevSlice = m_cSlice; - - Lock(&slice); - decodeSSH(nalu, m_bNewSequence); - Unlock(prevSlice); - - if (!slice.pps->CtbAddrRsToTs && !CtbAddrRsToTs.empty()) - { - slice.pps->CtbAddrRsToTs = alloc(slice.pps, (Bs32u)CtbAddrRsToTs.size()); - memmove(slice.pps->CtbAddrRsToTs, &CtbAddrRsToTs[0], CtbAddrRsToTs.size() * sizeof(CtbAddrRsToTs[0])); - } - - TLStart(TRACE_REF); - - BS2_TRACE(slice.POC, slice.POC); - -//ignore raw value in printf() params in BS2_SET_ARR_M(), print only mapped one -#if defined(__GNUC__) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wformat-extra-args" -#elif defined(__clang__) - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wformat-extra-args" -#else - #pragma warning(disable:4474) -#endif - BS2_SET_ARR_M(slice.DPB[_i], slice.DPB, - slice.strps.NumDeltaPocs + slice.num_long_term_sps + slice.num_long_term_pics, 1, "%s ", RPLTraceMap()); - - if (slice.num_ref_idx_l0_active) - BS2_SET_ARR_M(slice.L0[_i], slice.L0, slice.num_ref_idx_l0_active, 1, "%s ", RPLTraceMap()); - if (slice.num_ref_idx_l1_active) - BS2_SET_ARR_M(slice.L1[_i], slice.L1, slice.num_ref_idx_l1_active, 1, "%s ", RPLTraceMap()); -#if defined(__GNUC__) - #pragma GCC diagnostic pop -#elif defined(__clang__) - #pragma clang diagnostic pop -#else - #pragma warning(default:4474) -#endif - - TLEnd(); - } - m_bNewSequence = false; - break; - case EOS_NUT: - case EOB_NUT: - m_bNewSequence = true; - break; - default: - break; - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_parser.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_parser.cpp deleted file mode 100644 index dfa0768..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_parser.cpp +++ /dev/null @@ -1,1011 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc2_parser.h" - -using namespace BS_HEVC2; -using namespace BsReader2; -using namespace BsThread; - -//Scheduler Parser::m_thread; - -Parser::Parser(Bs32u mode) - : SDParser((mode & PARSE_SSD_TC) == PARSE_SSD_TC) - , m_mode(mode) - , m_au(0) - , m_bNewSequence(true) -{ - SetTraceLevel(TRACE_DEFAULT); - SetEmulation(true); - SetZero(true); - m_lastNALU.p = 0; - m_lastNALU.prealloc = false; - std::fill_n(m_vps, 16, nullptr); - std::fill_n(m_sps, 16, nullptr); - std::fill_n(m_pps, 64, nullptr); - memset(&m_prevPOC, 0, sizeof(m_prevPOC)); - m_pAllocator = &(BS_MEM::Allocator&)*this; - - m_asyncAUMax = 0; - m_asyncAUCnt = 0; - - Bs32u hwThreads = 0; - - if (m_mode & ASYNC) - { - hwThreads = std::max(1u, std::thread::hardware_concurrency()); - m_asyncAUMax = hwThreads * 2; - } - - if (m_mode & PARALLEL_SD) - { - Bs32u id = 0; - m_sdt.resize(hwThreads); - - for (auto& sdt : m_sdt) - { -#ifdef __BS_TRACE__ - char fname[] = "X_bs_thread.log"; - fname[0] = '0' + (id % 10); -#if !defined(__GNUC__) && !defined(__clang__) - #pragma warning(disable:4996) -#endif - FILE* log = fopen(fname, "w"); - sdt.p.SetLog(log); -#endif - - sdt.locked = 0; - sdt.p.m_pAllocator = &(BS_MEM::Allocator&)*this; - sdt.p.SetEmulation(false); - sdt.p.SetTraceLevel(TRACE_DEFAULT); - - id++; - } - } - - if (m_mode & (PARALLEL_SD | PARALLEL_TILES)) - hwThreads++; - - if (hwThreads) - m_thread.Init(hwThreads); - - m_auErr = BS_ERR_NONE; - m_prevSP = 0; -} - -Parser::~Parser() -{ - if (m_mode & ASYNC) - { - for (auto t : m_spAuToId) - m_thread.Sync(t.second.AUDone, -1); - m_thread.Close(); - } -} - -BSErr Parser::open(const char* file_name) -{ - if (!Open(file_name)) - return BS_ERR_INVALID_PARAMS; - - Reset(this); - - return BS_ERR_NONE; -} - -BSErr Parser::Lock(void* p) -{ - try - { - lock(p); - } - catch (std::bad_alloc()) - { - return BS_ERR_MEM_ALLOC; - } - return BS_ERR_NONE; -} - -BSErr Parser::Unlock(void* p) -{ - try - { - unlock(p); - } - catch (std::bad_alloc()) - { - return BS_ERR_MEM_ALLOC; - } - return BS_ERR_NONE; -} - -void Parser::set_trace_level(Bs32u level) -{ - SetTraceLevel(level); - - for (auto& t : m_sdt) - t.p.SetTraceLevel(level); -} - -inline bool isSuffix(NALU& nalu, bool nextBit){ - return (isSlice(nalu) && !nextBit) - || (nalu.nal_unit_type == SUFFIX_SEI_NUT) - || (nalu.nal_unit_type == FD_NUT) - || (nalu.nal_unit_type == EOS_NUT) - || (nalu.nal_unit_type == EOB_NUT) - || ((nalu.nal_unit_type >= RSV_NVCL45) && (nalu.nal_unit_type <= RSV_NVCL47)) - || ((nalu.nal_unit_type >= UNSPEC56) && (nalu.nal_unit_type <= UNSPEC63)); -} - -struct ParallelAUPar -{ - Parser* p; - NALU* pAU; -}; - -BsThread::State Parser::ParallelAU(void* par, unsigned int) -{ - Parser* p = ((ParallelAUPar*)par)->p; - NALU* pAU = ((ParallelAUPar*)par)->pAU; - - if (p->m_lastNALU.p) - { - *pAU = *p->m_lastNALU.p; - - if (p->m_lastNALU.complete) - p->bound(p->m_lastNALU.p, pAU); - - p->free(p->m_lastNALU.p); - } - else - p->m_lastNALU.prealloc = true; - - p->m_lastNALU.p = pAU; - - p->m_auErr = p->ParseNextAu(pAU); - - p->free(par); - - if (p->m_auErr) - { - p->m_spAuToId[pAU].sts = p->m_auErr; - return FAILED; - } - - p->m_spAuToId[pAU].sts = BS_ERR_NONE; - - return DONE; -} - -BsThread::State Parser::AUDone(void* par, unsigned int n) -{ - (void)n; - SyncPoint* sp = (SyncPoint*)par; - - //Redundunt sync, must be resolved through dependencies - /*if (n == 0) - m_thread.Sync(sp->AU, 0);*/ - - if (sp->sts) - return FAILED; - - for (auto& t : sp->SD) - { - //Redundunt sync, must be resolved through dependencies - /*if (!Ready(t.state)) - t.state = m_thread.Sync(t.sp, 0);*/ - - if (!Ready(t.state)) - { - //should never be reached if all dependencies are set correctly - return WAITING; - } - - if (t.state != DONE) - { - sp->sts = BS_ERR_UNKNOWN; - return t.state; // FAILED/LOST - } - } - - //merge tiles - NALU* base = 0; - CTU* lastCTU = 0; - for (auto& t : sp->SD) - { - NALU* cur = t.Slice; - - //forbidden_zero_bit == 0 is indicator for "real" slice - //otherwise slice was constructed by tile threading and must be merged with previous "real" - if (!t.Slice->forbidden_zero_bit) - { - if (base) - sp->pAllocator->unlock(base); - - base = cur; - lastCTU = &base->slice->ctu[base->slice->NumCTU - 1]; - } - else if (base) - { - base->NumBytesInRbsp += cur->NumBytesInRbsp; - - if (!base->slice->ctu) - base->slice->ctu = cur->slice->ctu; - else - lastCTU->Next = cur->slice->ctu; - - base->slice->NumCTU += cur->slice->NumCTU; - - lastCTU = &cur->slice->ctu[cur->slice->NumCTU - 1]; - - sp->pAllocator->bound(cur->slice->ctu, base->slice); - sp->pAllocator->free(t.Slice); - } - else - { - //1st slice must always be "real" unless things went really ugly - sp->sts = BS_ERR_UNKNOWN; - return FAILED; - } - } - - if (base) - sp->pAllocator->unlock(base); - - return DONE; -} - -struct SDTWaitPar -{ - Parser* p; - SDThread* pSDT; -}; - -BsThread::State Parser::SDTWait(void* _par, unsigned int) -{ - SDTWaitPar* par = (SDTWaitPar*)_par; - - for (auto& t : par->p->m_sdt) - { - std::unique_lock lockSDT(t.mtx); - - if (!t.locked) - { - t.locked++; - par->pSDT = &t; - return DONE; - } - } - - par->pSDT = 0; - - return WAITING; -} - -BSErr Parser::sync(NALU* pAU) -{ - std::unique_lock lock(m_mtx); - - if (!!m_spAuToId.count(pAU)) - { - m_asyncAUCnt--; - - lock.unlock(); - - if (DONE != m_thread.Sync(m_spAuToId[pAU].AUDone, -1)) - return m_spAuToId[pAU].sts; - - lock.lock(); - - m_spAuToId.erase(pAU); - return BS_ERR_NONE; - } - - return BS_ERR_INVALID_PARAMS; -} - -BSErr Parser::parse_next_au(NALU*& pAU) -{ - if (m_mode & PARALLEL_AU) - { - if (m_asyncAUCnt >= m_asyncAUMax) - { - NALU* spAU = 0; - { - std::unique_lock lockMap(m_mtx); - auto sp0 = std::min_element(m_spAuToId.begin(), m_spAuToId.end(), - [] (const std::pair& p0, - const std::pair& p1) { return p0.second.AU < p1.second.AU; } ); - spAU = sp0->first; - } - - BSErr sts = sync(spAU); - - if (sts) - return sts; - } - - m_asyncAUCnt++; - return ParseNextAuSubmit(pAU); - } - - BSErr sts = ParseNextAu(pAU); - - if (!sts && (m_mode & PARALLEL_SD)) - { - std::unique_lock lockMap(m_mtx); - auto& sp = m_spAuToId[pAU]; - - if (!sp.SD.empty()) - { - std::vector dep; - - for (auto sd : sp.SD) - dep.push_back(sd.sp); - - sp.sts = BS_ERR_NONE; - sp.AU = sp.SD.front().sp; - sp.pAllocator = this; - - auto spAUDone = sp.AUDone = m_thread.Submit(AUDone, &m_spAuToId[pAU], 0, (Bs32u)dep.size(), &dep[0]); - - lockMap.unlock(); - - if (DONE != m_thread.Sync(spAUDone, -1)) - return BS_ERR_UNKNOWN; - - lockMap.lock(); - } - - m_spAuToId.erase(pAU); - } - - return sts; -} - -BSErr Parser::ParseNextAuSubmit(NALU*& pAU) -{ - std::unique_lock lock(m_mtx); - BsThread::State st = QUEUED; - auto sp0 = std::min_element(m_spAuToId.begin(), m_spAuToId.end(), - [] (const std::pair& p0, - const std::pair& p1) { return p0.second.AU < p1.second.AU; } ); - bool AUSubmitted = false; - - if (!m_spAuToId.empty() && !(m_mode & PARALLEL_SD)) - st = m_thread.Sync(sp0->second.AU, 0); - - if (st == FAILED || st == LOST) - { - BSErr sts = m_auErr; - m_auErr = BS_ERR_NONE; - return sts; - } - - auto pPar = alloc(); - pAU = alloc(); - - if (!!m_spAuToId.count(pAU)) - { - m_thread.Abort(m_spAuToId[pAU].AUDone, -1); - m_spAuToId.erase(pAU); - } - - pPar->p = this; - pPar->pAU = pAU; - - for (Bs32u i = 0; ; i++) - { - try - { - if (!AUSubmitted) - { - m_spAuToId[pAU].AU = m_thread.Submit(ParallelAU, pPar, 0, !!m_prevSP, m_prevSP ? &m_spAuToId[m_prevSP].AU : 0); - AUSubmitted = true; - } - if (m_mode & PARALLEL_SD) - { - m_spAuToId[pAU].AUDone = m_thread.Submit(AUDone, &m_spAuToId[pAU], 1, 1, &m_spAuToId[pAU].AU); - m_thread.Detach(m_spAuToId[pAU].AU); - } - else - m_spAuToId[pAU].AUDone = m_spAuToId[pAU].AU; - } - catch (TaskQueueOverflow&) - { - m_thread.WaitForAny(-1); - - if (i > m_asyncAUMax) - return BS_ERR_UNKNOWN; - - continue; - } - - break; - } - m_prevSP = pAU; - - return BS_ERR_NONE; -} - -struct AutoUnlockSDT -{ - SDThread*& m_pSDT; - AutoUnlockSDT(SDThread*& pSDT) : m_pSDT(pSDT) {} - ~AutoUnlockSDT() - { - if (m_pSDT) - { - std::unique_lock lock(m_pSDT->mtx); - m_pSDT->locked--; - } - } -}; - -NALU* Parser::GetColPic(Slice& slice) -{ - if (slice.temporal_mvp_enabled_flag && slice.type != I) - { - if (slice.collocated_from_l0_flag) - return m_ColPic[slice.L0[slice.collocated_ref_idx].POC]; - else - return m_ColPic[slice.L1[slice.collocated_ref_idx].POC]; - } - return 0; -} - -void Parser::UpdateColPics(NALU* AU, Slice& slice) -{ - std::list uselessPics; - - for (auto& c : m_ColPic) - { - if ( /*(NewPicture && slice.temporal_mvp_enabled_flag == 0) - ||*/ m_DPBafter[c.first] == false) - { - unlock(c.second); - uselessPics.push_back(c.first); - } - } - - for (auto& c : uselessPics) - { - m_ColPic.erase(c); - } - - if (m_DPBafter[slice.POC] && m_ColPic[slice.POC] != AU) - { - if (m_ColPic[slice.POC]) - unlock(m_ColPic[slice.POC]); - - lock(AU); - m_ColPic[slice.POC] = AU; - } -} - -BSErr Parser::ParseNextAu(NALU*& pAU) -{ - NALU* firstNALU = m_lastNALU.p; - bool picStarted = m_lastNALU.p && !m_lastNALU.prealloc && isSlice(*m_lastNALU.p); - Bs32u auSize = 0; - SDThread* pSDT = 0; - std::vector sliceDep; - AutoUnlockSDT _au(pSDT); - m_activeSPS = 0; - - try - { - for (;; auSize++) - { - NALUDesc& nalu = m_lastNALU; - - if (!nalu.p || nalu.complete || nalu.prealloc) - { - bool LongStartCode = NextStartCode(false); - - SetEmuBytes(0); - - if (!nalu.prealloc) - { - if (nalu.p) - nalu.p = nalu.p->next = alloc(); - else - firstNALU = nalu.p = alloc(); - } - - nalu.prealloc = false; - nalu.complete = false; - nalu.p->StartOffset = GetByteOffset() - (3 + LongStartCode); - - parseNUH(*nalu.p); - - nalu.NuhBytes = Bs32u(GetByteOffset() - nalu.p->StartOffset); - - if (!picStarted) - picStarted = isSlice(*m_lastNALU.p) && NextBits(1); - else if (!isSuffix(*nalu.p, isSlice(*m_lastNALU.p) && NextBits(1))) - break; - } - - if (!nalu.complete) - { - parseRBSP(*nalu.p); - - if (isSlice(*nalu.p)) - { - while (!m_postponedSEI.empty()) - { - parseSEIPL(*m_postponedSEI.front()); - m_postponedSEI.pop_front(); - } - - if (m_mode & PARSE_SSD) - { - if (m_mode & PARALLEL_SD) - { - nalu.p->NumBytesInRbsp = Bs32u(GetByteOffset() - nalu.p->StartOffset - nalu.NuhBytes - GetEmuBytes()); - ParseSSDSubmit(pSDT, firstNALU); - } - else - { - m_cSlice->ctu = parseSSD(*nalu.p, GetColPic(*m_cSlice)); - bound(m_cSlice->ctu, m_cSlice); - } - - UpdateColPics(firstNALU, *m_cSlice); - } - } - } - - nalu.p->NumBytesInNalUnit = Bs32u((GetByteOffset() - nalu.p->StartOffset) - (nalu.NuhBytes - 2)); - if (!nalu.p->NumBytesInRbsp) - nalu.p->NumBytesInRbsp = nalu.p->NumBytesInNalUnit - GetEmuBytes() - 2; - - try - { - NextStartCode(true); - } - catch (EndOfBuffer&) - { - nalu.complete = true; - } - - if (!nalu.complete) - { - nalu.p->NumBytesInNalUnit = Bs32u(GetByteOffset() - nalu.p->StartOffset - (nalu.NuhBytes - 2)); - if (!nalu.p->NumBytesInRbsp) - nalu.p->NumBytesInRbsp = nalu.p->NumBytesInNalUnit - GetEmuBytes() - 2; - nalu.complete = true; - } - - TLStart(TRACE_SIZE); - BS2_TRACE(nalu.p->NumBytesInNalUnit, nalu.NumBytesInNalUnit); - BS2_TRACE(nalu.p->NumBytesInRbsp, nalu.NumBytesInRbsp); - TLEnd(); - } - } - catch (EndOfBuffer&) - { - if (!auSize) - { - if (firstNALU) - free(firstNALU); - m_lastNALU.p = 0; - return BS_ERR_MORE_DATA; - } - } - catch (std::bad_alloc&) - { - return BS_ERR_MEM_ALLOC; - } - catch (Exception& ex) - { - return ex.Err(); - } - catch (...) - { - return BS_ERR_UNKNOWN; - } - - try - { - if (m_au) - free(m_au); - - m_au = firstNALU; - - while (--auSize) - { - bound(firstNALU->next, firstNALU); - firstNALU = firstNALU->next; - } - - if (firstNALU == m_lastNALU.p) - m_lastNALU.p = 0; - - firstNALU->next = 0; - } - catch (std::bad_alloc&) - { - return BS_ERR_MEM_ALLOC; - } - - pAU = m_au; - - return BS_ERR_NONE; -} - -struct SplitTilesPar -{ - Bs32u NumBytesInRbsp; - Bs16u AddrInRs; - Bs16u AddrInTs; - Bs32u NumCtb; -}; - -Bs32u Parser::ParseSSDSubmit(SDThread*& pSDT, NALU* AU) -{ - std::unique_lock lockMap(m_mtx, std::defer_lock); - auto& nalu = m_lastNALU; - Bs32u CurRBSP = 0; - std::vector sliceDep; - size_t MaxRBSP = 5ull * RawCtuBits / 3 * PicSizeInCtbsY / 8; - Slice* pSlice = m_cSlice; - SDPar sdpar = {nalu.p, GetColPic(*pSlice), nalu.p->NumBytesInRbsp, PicSizeInCtbsY, false, false, nullptr}; - std::vector SplitTiles; - Bs8u* pRBSP = 0; - BsThread::SyncPoint spColPic; - Bs16u SliceAddrRs = pSlice->slice_segment_address; - - auto GetSDT = [this] () -> SDThread* - { - auto it = std::find_if(m_sdt.begin(), m_sdt.end(), - [](SDThread& t) - { - std::unique_lock lockSDT(t.mtx); - - if (!t.locked) - { - t.locked++; - return true; - } - return false; - }); - - if (it == m_sdt.end()) - { - SDTWaitPar par = {this, 0}; - - auto spw = m_thread.Submit(SDTWait, &par, 2, 0, 0); - - if (DONE != m_thread.Sync(spw, -1) || !par.pSDT) - throw Exception(BS_ERR_UNKNOWN); - - return par.pSDT; - } - - return &*it; - }; - - auto SubmitTask = [&] () - { - BsThread::SyncPoint sp; - - for (;;) - { - try - { - sp = m_thread.Submit(ParallelSD, pSDT, 0, (Bs32u)sliceDep.size(), sliceDep.empty() ? 0 : &sliceDep[0]); - } - catch (TaskQueueOverflow&) - { - m_thread.WaitForAny(-1); - continue; - } - break; - } - - if (m_mode & PARALLEL_AU) - m_thread.AddDependency(m_spAuToId[AU].AUDone, 1, &sp); - - m_thread.Detach(sp); - - sdpar.pTask->sp = sp; - sdpar.pTask->state = WAITING; - sdpar.pTask->Slice = sdpar.Slice; - }; - - - if ( pSlice->num_entry_point_offsets - && colWidth.size() * rowHeight.size() > 1 - && (m_mode & PARALLEL_TILES)) - { - Bs16u AddrInTs = CtbAddrRsToTs[pSlice->slice_segment_address]; - Bs16u Tid = TileId[AddrInTs]; - Bs16u EPid = 0; - Bs32u TargetRBSP, LastRBSP; - - SplitTiles.resize(1); - SplitTiles.back().AddrInTs = AddrInTs; - SplitTiles.back().AddrInRs = pSlice->slice_segment_address; - m_rbsp.resize(MaxRBSP); - pRBSP = &m_rbsp[0]; - - for (Bs16u i = 0; i < pSlice->num_entry_point_offsets; i++) - CurRBSP += pSlice->entry_point_offset_minus1[i] + 1; - - SetEmulation(false); - if (CurRBSP != ExtractData(&m_rbsp[0], (Bs32u)CurRBSP)) - throw InvalidSyntax(); - CurRBSP += LastRBSP = ExtractRBSP(&m_rbsp[CurRBSP], (Bs32u)MaxRBSP - CurRBSP); - SetEmulation(true); - - sdpar.Emulation = true; - - TargetRBSP = Bs32u(CurRBSP / m_sdt.size()); - - auto NewTile = [&] () - { - AddrInTs += (colWidth[Tid % colWidth.size()] * rowHeight[Tid / colWidth.size()]); - Tid = TileId[AddrInTs]; - - if (SplitTiles.back().NumBytesInRbsp >= TargetRBSP) - { - SplitTilesPar t = {}; - t.AddrInTs = AddrInTs; - t.AddrInRs = CtbAddrTsToRs[AddrInTs]; - SplitTiles.back().NumCtb = AddrInTs - SplitTiles.back().AddrInTs; - t.NumCtb = PicSizeInCtbsY - AddrInTs; - SplitTiles.push_back(t); - } - }; - - if ( pSlice->pps->entropy_coding_sync_enabled_flag - && pSlice->num_entry_point_offsets + 1 > rowHeight[Tid]) - { - while (EPid < pSlice->num_entry_point_offsets) - { - SplitTiles.back().NumBytesInRbsp += pSlice->entry_point_offset_minus1[EPid++] + 1; - - if (EPid == rowHeight[Tid]) - NewTile(); - } - } - else - { - while (EPid < pSlice->num_entry_point_offsets) - { - SplitTiles.back().NumBytesInRbsp += pSlice->entry_point_offset_minus1[EPid++] + 1; - NewTile(); - } - } - - SplitTiles.back().NumBytesInRbsp += LastRBSP; - } - - lockMap.lock(); - if (sdpar.ColPic && !!m_spAuToId.count(sdpar.ColPic)) - { - spColPic = m_spAuToId[sdpar.ColPic].AUDone; - sliceDep.push_back(spColPic); - } - lockMap.unlock(); - - if (SplitTiles.empty()) - { - if (sdpar.ColPic) - lock(sdpar.ColPic); - - lock(sdpar.Slice); - - if (!pSlice->dependent_slice_segment_flag) - { - if (pSDT && pSDT->locked) - { - std::unique_lock lockSDT(pSDT->mtx); - pSDT->locked--; - } - - pSDT = GetSDT(); - } - - { - std::unique_lock lockSDT(pSDT->mtx); - - pSDT->locked++; - - if (!pSlice->dependent_slice_segment_flag) - { - pSDT->RBSPSize = 0; - pSDT->RBSPOffset = 0; - (Info&)pSDT->p = *(Info*)this; - pSDT->rbsp.resize(MaxRBSP); - sdpar.NewPicture = true; - } - else - { - if (NewPicture) - throw InvalidSyntax(); - - lockMap.lock(); - sliceDep.push_back(m_spAuToId[AU].SD.back().sp); - lockMap.unlock(); - } - - CurRBSP = ExtractRBSP(&pSDT->rbsp[pSDT->RBSPSize], Bs32u(MaxRBSP - pSDT->RBSPSize)); - nalu.p->NumBytesInRbsp += CurRBSP; - pSDT->RBSPSize += CurRBSP; - - lockMap.lock(); - m_spAuToId[AU].pAllocator = this; - m_spAuToId[AU].SD.push_back(SDDesc()); - sdpar.pTask = &m_spAuToId[AU].SD.back(); - lockMap.unlock(); - - pSDT->par.push_back(sdpar); - - SubmitTask(); - } - - return CurRBSP; - } - - - for (Bs16u TGId = 0; TGId < SplitTiles.size(); TGId++) - { - sliceDep.resize(0); - - if (sdpar.ColPic) - { - lock(sdpar.ColPic); - sliceDep.push_back(spColPic); - } - - if (TGId > 0) - pSDT = GetSDT(); - else if (!pSlice->dependent_slice_segment_flag) - { - if (pSDT && pSDT->locked) - { - std::unique_lock lockSDT(pSDT->mtx); - pSDT->locked--; - } - - pSDT = GetSDT(); - } - else - { - for (auto pN = AU; !!pN; pN = pN->next) - { - if (isSlice(*pN) && !pN->slice->dependent_slice_segment_flag) - SliceAddrRs = pN->slice->slice_segment_address; - } - - lockMap.lock(); - sliceDep.push_back(m_spAuToId[AU].SD.back().sp); - lockMap.unlock(); - } - - { - std::unique_lock lockSDT(pSDT->mtx); - - if (TGId > 0) - { - NALU* fakeNALU = alloc(); - Slice* fakeSlice = alloc(fakeNALU); - - *fakeNALU = *nalu.p; - *fakeSlice = *pSlice; - fakeNALU->slice = fakeSlice; - fakeNALU->forbidden_zero_bit = 1; - sdpar.Slice = fakeNALU; - - for (Bs16u i = SplitTiles[TGId - 1].AddrInTs; i < SplitTiles[TGId].AddrInTs; i++) - SliceAddrRsInTs[i] = SliceAddrRs; - } - else - { - if (pSlice->dependent_slice_segment_flag) - pSDT->locked++; - lock(sdpar.Slice); - } - - if (!pSlice->dependent_slice_segment_flag || TGId > 0) - { - pSDT->RBSPSize = 0; - pSDT->RBSPOffset = 0; - pSDT->rbsp.resize(MaxRBSP); - sdpar.NewPicture = true; - } - - memmove(&pSDT->rbsp[pSDT->RBSPSize], pRBSP, SplitTiles[TGId].NumBytesInRbsp); - pRBSP += SplitTiles[TGId].NumBytesInRbsp; - - pSDT->RBSPSize += SplitTiles[TGId].NumBytesInRbsp; - (Info&)pSDT->p = *(Info*)this; - - sdpar.Slice->NumBytesInRbsp = SplitTiles[TGId].NumBytesInRbsp + sdpar.HeaderSize; - sdpar.Slice->slice->slice_segment_address = SplitTiles[TGId].AddrInRs; - sdpar.Slice->slice->Split = (TGId + 1u) < SplitTiles.size(); - sdpar.NumCtb = SplitTiles[TGId].NumCtb; - - if (!sdpar.Slice->slice->Split) - pSDT->locked++; - - lockMap.lock(); - m_spAuToId[AU].pAllocator = this; - m_spAuToId[AU].SD.push_back(SDDesc()); - sdpar.pTask = &m_spAuToId[AU].SD.back(); - lockMap.unlock(); - - pSDT->par.push_back(sdpar); - - SubmitTask(); - - sdpar.HeaderSize = 0; - } - } - - return CurRBSP; -} - -BsThread::State Parser::ParallelSD(void* self, unsigned int) -{ - SDThread& sdt = *(SDThread*)self; - std::unique_lock lock(sdt.mtx); - SDPar par = sdt.par.front(); - BsThread::State st = DONE; - - lock.unlock(); - - sdt.p.NewPicture = par.NewPicture; - sdt.p.m_cSlice = par.Slice->slice; - sdt.p.SetEmulation(par.Emulation); - sdt.p.SetEmuBytes(0); - - try - { - sdt.p.Reset(&sdt.rbsp[0] + sdt.RBSPOffset, par.Slice->NumBytesInRbsp - par.HeaderSize); - par.Slice->slice->ctu = sdt.p.parseSSD(*par.Slice, par.ColPic, par.NumCtb); - sdt.p.m_pAllocator->bound(par.Slice->slice->ctu, par.Slice->slice); - } - catch(...) - { - st = FAILED; - } - - if (par.pTask) - par.pTask->state = st; - - lock.lock(); - - sdt.RBSPOffset += (par.Slice->NumBytesInRbsp - par.HeaderSize); - - par.Slice->NumBytesInRbsp -= sdt.p.GetEmuBytes(); - - if (par.ColPic) - sdt.p.m_pAllocator->unlock(par.ColPic); - sdt.par.pop_front(); - - sdt.p.NewPicture = false; - sdt.locked--; - - return st; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_ssdata.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_ssdata.cpp deleted file mode 100644 index f8249b2..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_ssdata.cpp +++ /dev/null @@ -1,2060 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc2_parser.h" -#include "hevc2_trace.h" - -using namespace BS_HEVC2; -using namespace BsReader2; - -#undef BS2_TRO -#define BS2_TRO\ - if (TraceOffset()) fprintf(GetLog(), "0x%016llX[%i]|%3u|%3u: ",\ - GetByteOffset(), GetBitOffset(), GetR(), GetV()); - -SDParser::SDParser(bool report_TC) - : Reader() - , CABAC((Reader&)*this) - , report_TCLevels(report_TC) - , m_pAllocator(nullptr) -{ - SetTraceLevel(TRACE_DEFAULT); - SetEmulation(false); -} - -bool SDParser::more_rbsp_data() -{ - Bs8u b[5]; - - if (!NextBytes(b, 5)) - return !TrailingBits(true); - - if ( (b[0] == 0 && b[1] == 0 && b[2] == 1) - || (b[0] == 0 && b[1] == 0 && b[2] == 0 && b[3] == 1)) - return false; - - if ( (b[1] == 0 && b[2] == 0 && b[3] == 1) - || (b[1] == 0 && b[2] == 0 && b[3] == 0 && b[4] == 1)) - return !TrailingBits(true); - - return true; -} - -CTU* SDParser::parseSSD(NALU& nalu, NALU* pColPic, Bs32u NumCtb) -{ - TLAuto tl(*this, TRACE_CTU); - BS_MEM::AutoLock _cpLock(m_pAllocator, pColPic); - auto& slice = *nalu.slice; - auto& pps = *slice.pps; - std::vector colSLices; - - if (NewPicture) - { - Bs32u PicSizeInMinTbY = PicSizeInMinCbsY - * (1 << (MinCbLog2SizeY - MinTbLog2SizeY)) * (1 << (MinCbLog2SizeY - MinTbLog2SizeY)); - - m_ctu.clear(); - m_cu.clear(); - m_pu.clear(); - m_tu.clear(); - - TCLevels.reserve(1 << (2*MaxTbLog2SizeY)); - - if (report_TCLevels) - { - m_TC_lvl.clear(); - m_TC_lvl.reserve(PicSizeInSamplesY); - } - m_ctu.reserve(PicSizeInCtbsY); - m_cu.reserve(PicSizeInMinCbsY); - m_pu.reserve(PicSizeInMinCbsY * 4); - m_tu.reserve(PicSizeInMinTbY); - } - - auto nCTU = m_ctu.size(); - auto nCU = m_cu.size(); - auto nPU = m_pu.size(); - auto nTU = m_tu.size(); - - Bs16u CtbAddrInRs = slice.slice_segment_address; - Bs16u CtbAddrInTs = CtbAddrRsToTs[CtbAddrInRs]; - Bs16u SliceAddrRs = (slice.dependent_slice_segment_flag) ? SliceAddrRsInTs[CtbAddrInTs - 1] : CtbAddrInRs; - Bs16u xCtb = (CtbAddrInRs % PicWidthInCtbsY) << CtbLog2SizeY; - Bs16u yCtb = (CtbAddrInRs / PicWidthInCtbsY) << CtbLog2SizeY; - - while (pColPic) - { - if (isSlice(*pColPic)) - colSLices.push_back(pColPic->slice); - pColPic = pColPic->next; - } - - if (!colSLices.empty()) - { - ColPicSlices = &colSLices[0]; - NumColSlices = (Bs16u)colSLices.size(); - } - - SliceAddrRsInTs[CtbAddrInTs] = SliceAddrRs; - - if ( !slice.dependent_slice_segment_flag - || TileId[CtbAddrInTs] != TileId[CtbAddrInTs-1]) - { - InitCtx(); - } - else if (pps.entropy_coding_sync_enabled_flag && (CtbAddrInRs % PicWidthInCtbsY) == 0) - { - if (AvailableZs(xCtb, yCtb, xCtb + CtbLog2SizeY, yCtb - CtbLog2SizeY)) - SyncWPP(); - else - InitCtx(); - } - else - { - SyncDS(); - } - qPY_PREV = SliceQpY; - - InitADE(); - - if (pps.entropy_coding_sync_enabled_flag && PicWidthInCtbsY == 1) - StoreWPP(); - - CTU* pCTU = Alloc(); - - for (;;) - { - auto& ctu = *pCTU; - - CtuInRs[CtbAddrInRs] = pCTU; - - BS2_SET(CtbAddrInRs, ctu.CtbAddrInRs); - BS2_SET(CtbAddrInTs, ctu.CtbAddrInTs); - - if (slice.sao_luma_flag || slice.sao_chroma_flag) - parseSAO(ctu, xCtb >> CtbLog2SizeY, yCtb >> CtbLog2SizeY); - - ctu.Cu = Alloc(); - ctu.Cu->x = xCtb; - ctu.Cu->y = yCtb; - parseCQT(*ctu.Cu, CtbLog2SizeY, 0); - - if (slice.Split && !--NumCtb) - break; - - BS2_SET(EndOfSliceSegmentFlag(), ctu.end_of_slice_segment_flag); - - if (pps.entropy_coding_sync_enabled_flag && (CtbAddrInRs % PicWidthInCtbsY) == 1) - StoreWPP(); - - if (ctu.end_of_slice_segment_flag) - { - if (pps.dependent_slice_segments_enabled_flag) - StoreDS(); - break; - } - - pCTU->Next = Alloc(); - pCTU = pCTU->Next; - CtbAddrInTs++; - CtbAddrInRs = CtbAddrTsToRs[CtbAddrInTs]; - xCtb = (CtbAddrInRs % PicWidthInCtbsY) << CtbLog2SizeY; - yCtb = (CtbAddrInRs / PicWidthInCtbsY) << CtbLog2SizeY; - SliceAddrRsInTs[CtbAddrInTs] = SliceAddrRs; - - if ( ( pps.tiles_enabled_flag - && TileId[CtbAddrInTs] != TileId[CtbAddrInTs - 1]) - || ( pps.entropy_coding_sync_enabled_flag - && (CtbAddrInTs % PicWidthInCtbsY == 0 || TileId[CtbAddrInTs] != TileId[CtbAddrRsToTs[CtbAddrInRs - 1]]))) - { - if (!EndOfSubsetOneBit()) - throw InvalidSyntax(); - - InitPCMBlock(); - - if (GetBitOffset() && u(8 - GetBitOffset())) - throw InvalidSyntax(); - } - - if (TileId[CtbAddrInTs] != TileId[CtbAddrInTs - 1]) - { - InitCtx(); - InitADE(); - qPY_PREV = SliceQpY; - } - else if (pps.entropy_coding_sync_enabled_flag && (CtbAddrInRs % PicWidthInCtbsY) == 0) - { - InitPCMBlock(); - - if (AvailableZs(xCtb, yCtb, xCtb + CtbLog2SizeY, yCtb - CtbLog2SizeY)) - SyncWPP(); - else - InitCtx(); - InitADE(); - qPY_PREV = SliceQpY; - } - } - - if (!pCTU || (!pCTU->end_of_slice_segment_flag && !slice.Split)) - throw InvalidSyntax(); - - if (m_pAllocator) - { - nCTU = m_ctu.size() - nCTU; - nCU = m_cu.size() - nCU; - nPU = m_pu.size() - nPU; - nTU = m_tu.size() - nTU; - - pCTU = m_pAllocator->alloc(0, (Bs32u)nCTU); - auto pCU = m_pAllocator->alloc(pCTU, (Bs32u)nCU); - auto pPU = m_pAllocator->alloc(pCTU, (Bs32u)nPU); - auto pTU = m_pAllocator->alloc(pCTU, (Bs32u)nTU); - CTU* pCTU0 = nCTU ? &m_ctu[m_ctu.size() - nCTU] : 0; - CU* pCU0 = nCU ? &m_cu[m_cu.size() - nCU] : 0; - PU* pPU0 = nPU ? &m_pu[m_pu.size() - nPU] : 0; - TU* pTU0 = nTU ? &m_tu[m_tu.size() - nTU] : 0; - - if (pCTU)memmove(pCTU, pCTU0, sizeof(CTU) * nCTU); - if (pCU) memmove(pCU, pCU0, sizeof(CU) * nCU); - if (pPU) memmove(pPU, pPU0, sizeof(PU) * nPU); - if (pTU) memmove(pTU, pTU0, sizeof(TU) * nTU); - - Bs32s* pTC_levels = nullptr; - if (report_TCLevels) - { - pTC_levels = m_pAllocator->alloc(pCTU, Bs32u(m_TC_lvl.size())); - if (pTC_levels) std::copy(std::begin(m_TC_lvl), std::end(m_TC_lvl), pTC_levels); - } - - auto pcCTU = pCTU; - - for (;;) - { - if (pcCTU->Cu) - { - auto pcCU = pcCTU->Cu = pCU + (pcCTU->Cu - pCU0); - - for (;;) - { - if (pcCU->Pu) - { - auto pcPU = pcCU->Pu = pPU + (pcCU->Pu - pPU0); - - for (;;) - { - if (!pcPU->Next) - break; - pcPU = pcPU->Next = pPU + (pcPU->Next - pPU0); - } - } - - if (pcCU->Tu) - { - auto pcTU = pcCU->Tu = pTU + (pcCU->Tu - pTU0); - - for (;;) - { - if (report_TCLevels && pcTU->tc_levels_luma) - { - pcTU->tc_levels_luma = pTC_levels + std::distance(m_TC_lvl.data(), pcTU->tc_levels_luma); - } - - if (!pcTU->Next) - break; - pcTU = pcTU->Next = pTU + (pcTU->Next - pTU0); - } - } - - if (!pcCU->Next) - break; - pcCU = pcCU->Next = pCU + (pcCU->Next - pCU0); - } - } - - if (!pcCTU->Next) - break; - pcCTU = pcCTU->Next = pCTU + (pcCTU->Next - pCTU0); - } - - BS2_SET((Bs32u)nCTU, slice.NumCTU); - - //printf("NumCTU = %d\n", slice.NumCTU); - } - - ColPicSlices = 0; - NumColSlices = 0; - - return pCTU; -} - -void SDParser::parseSAO(CTU& ctu, Bs16u rx, Bs16u ry) -{ - TLAuto tl(*this, TRACE_CTU); - auto SliceAddrRs = SliceAddrRsInTs[ctu.CtbAddrInTs]; - Bs16u nc = (ChromaArrayType != 0 ? 3 : 1); - - auto ParseType1 = [&] (Bs16u cIdx) - { - for (Bs16u i = 0; i < 4; i++) - if (ctu.sao[cIdx].offset[i] && SaoOffsetSign()) - ctu.sao[cIdx].offset[i] *= -1; - - BS2_SET(SaoBandPosition(), ctu.sao[cIdx].band_position); - }; - - if (rx > 0) - { - bool leftCtbInSliceSeg = (ctu.CtbAddrInRs > SliceAddrRs); - bool leftCtbInTile = (TileId[ctu.CtbAddrInTs] == TileId[CtbAddrRsToTs[ctu.CtbAddrInRs - 1]]); - - if( leftCtbInSliceSeg && leftCtbInTile ) - BS2_SET(SaoMergeLeftFlag(), ctu.sao_merge_left_flag); - - if (ctu.sao_merge_left_flag) - { - for (Bs16u cIdx = 0; cIdx < nc; cIdx++) - ctu.sao[cIdx] = GetSAO(cIdx, rx - 1, ry); - - goto l_exit; - } - } - - if (ry > 0) - { - bool upCtbInSliceSeg = ((ctu.CtbAddrInRs - PicWidthInCtbsY) >= SliceAddrRs); - bool upCtbInTile = (TileId[ctu.CtbAddrInTs] == TileId[CtbAddrRsToTs[ctu.CtbAddrInRs - PicWidthInCtbsY]]); - - if( upCtbInSliceSeg && upCtbInTile ) - BS2_SET(SaoMergeUpFlag(), ctu.sao_merge_up_flag); - - if (ctu.sao_merge_up_flag) - { - for (Bs16u cIdx = 0; cIdx < nc; cIdx++) - ctu.sao[cIdx] = GetSAO(cIdx, rx, ry - 1); - - goto l_exit; - } - } - - if (m_cSlice->sao_luma_flag) - { - BS2_SETM(SaoTypeIdxLuma(), ctu.sao[0].type_idx, SAOTypeTraceMap) - - if( ctu.sao[0].type_idx != 0 ) - { - for (Bs16u i = 0; i < 4; i++) - ctu.sao[0].offset[i] = SaoOffsetAbs(BitDepthY); - - if (ctu.sao[0].type_idx == 1) - ParseType1(0); - else - BS2_SETM(SaoEoClassLuma(), ctu.sao[0].eo_class, EOClassTraceMap); - - if (ctu.sao[0].type_idx == 2) - { - ctu.sao[0].offset[2] *= -1; - ctu.sao[0].offset[3] *= -1; - } - - BS2_TRACE_ARR(ctu.sao[0].offset, 4, 0); - } - } - - if (m_cSlice->sao_chroma_flag && nc > 1) - { - BS2_SETM(SaoTypeIdxChroma(), ctu.sao[1].type_idx, SAOTypeTraceMap); - - if (ctu.sao[1].type_idx != 0) - { - for (Bs16u i = 0; i < 4; i++) - ctu.sao[1].offset[i] = SaoOffsetAbs(BitDepthC); - - if (ctu.sao[1].type_idx == 1) - ParseType1(1); - else - BS2_SETM(SaoEoClassChroma(), ctu.sao[1].eo_class, EOClassTraceMap); - - if (ctu.sao[1].type_idx == 2) - { - ctu.sao[1].offset[2] *= -1; - ctu.sao[1].offset[3] *= -1; - } - - BS2_TRACE_ARR(ctu.sao[1].offset, 4, 0); - } - - BS2_SETM(ctu.sao[1].type_idx, ctu.sao[2].type_idx, SAOTypeTraceMap); - - if (ctu.sao[2].type_idx != 0) - { - for (Bs16u i = 0; i < 4; i++) - ctu.sao[2].offset[i] = SaoOffsetAbs(BitDepthC); - - if (ctu.sao[2].type_idx == 1) - ParseType1(2); - else - BS2_SETM(ctu.sao[1].eo_class, ctu.sao[2].eo_class, EOClassTraceMap); - - if (ctu.sao[2].type_idx == 2) - { - ctu.sao[2].offset[2] *= -1; - ctu.sao[2].offset[3] *= -1; - } - - BS2_TRACE_ARR(ctu.sao[2].offset, 4, 0); - } - } - -l_exit: - for (Bs16u cIdx = 0; cIdx < nc; cIdx++) - GetSAO(cIdx, rx, ry) = ctu.sao[cIdx]; -} - -CU* SDParser::parseCQT(CU& cu, Bs16u log2CbSize, Bs16u cqtDepth) -{ - TLAuto tl(*this, TRACE_CQT); - auto& sps = *m_cSlice->sps; - auto& pps = *m_cSlice->pps; - auto x0 = cu.x; - auto y0 = cu.y; - bool split_cu_flag = false; - - cu.log2CbSize = log2CbSize; - - if ( x0 + (1 << log2CbSize) <= sps.pic_width_in_luma_samples - && y0 + (1 << log2CbSize) <= sps.pic_height_in_luma_samples - && log2CbSize > MinCbLog2SizeY) - { - BS2_SET(SplitCuFlag(x0, y0), split_cu_flag); - } - else - { - BS2_SET((log2CbSize > MinCbLog2SizeY), split_cu_flag); - } - - if (pps.cu_qp_delta_enabled_flag && log2CbSize >= Log2MinCuQpDeltaSize) - { - IsCuQpDeltaCoded = false; - CuQpDeltaVal = 0; - } - - if ( m_cSlice->cu_chroma_qp_offset_enabled_flag - && log2CbSize >= Log2MinCuChromaQpOffsetSize ) - { - IsCuChromaQpOffsetCoded = false; - } - - if (split_cu_flag) - { - CU* pCu; - Bs16u x1 = x0 + (1 << (log2CbSize - 1)); - Bs16u y1 = y0 + (1 << (log2CbSize - 1)); - - log2CbSize--; - cqtDepth++; - - auto ParseTree = [&] (Bs16u x, Bs16u y) - { - pCu->Next = Alloc(); - pCu = pCu->Next; - pCu->x = x; - pCu->y = y; - pCu = parseCQT(*pCu, log2CbSize, cqtDepth); - }; - - pCu = parseCQT(cu, log2CbSize, cqtDepth); - - if (x1 < sps.pic_width_in_luma_samples) - ParseTree(x1, y0); - - if (y1 < sps.pic_height_in_luma_samples) - ParseTree(x0, y1); - - if ( x1 < sps.pic_width_in_luma_samples - && y1 < sps.pic_height_in_luma_samples) - ParseTree(x1, y1); - - return pCu; - } - - parseCU(cu); - - return &cu; -} - -struct LumaPred -{ - Bs8u prev_intra_luma_pred_flag : 1; - Bs8u mpm_idx : 2; - Bs8u rem_intra_luma_pred_mode : 5; -}; - -const Bs8u ModeIdxTable[5][5] = -{ -// 0 26 10 1 X -/*0*/{34, 0, 0, 0, 0}, -/*1*/{26, 34, 26, 26, 26}, -/*2*/{10, 10, 34, 10, 10}, -/*3*/{ 1, 1, 1, 34, 1}, -/*4*/{ 0, 26, 10, 1, 0xff} -}; - -inline Bs8u ModeIdx(Bs8u intra_chroma_pred_mode, Bs8u IntraPredModeY) -{ - Bs16u i; - switch (IntraPredModeY) - { - case 0: i = 0; break; - case 26: i = 1; break; - case 10: i = 2; break; - case 1: i = 3; break; - default: i = 4; break; - } - - if (i == 4 && intra_chroma_pred_mode == 4) - return IntraPredModeY; - - return ModeIdxTable[intra_chroma_pred_mode][i]; -} - -const Bs8u ModeIdxTrans[35] = -{ - 0, 1, 2, 2, 2, 2, - 3, 5, 7, 8, 10, 12, - 13, 15, 17, 18, 19, 20, - 21, 22, 23, 23, 24, 24, - 25, 25, 26, 27, 27, 28, - 28, 29, 29, 30, 31 -}; - -void SDParser::parseCU(CU& cu) -{ - TLAuto tl(*this, TRACE_CU); - auto& sps = *m_cSlice->sps; - auto& pps = *m_cSlice->pps; - auto& slice = *m_cSlice; -#ifdef __BS_TRACE__ - const Bs16u dim[] = { 1, 2, 2 }; -#endif - const Bs32u traceAddr = TRACE_PRED|TRACE_CU|TRACE_QP; - - TLStart(traceAddr); - BS2_TRACE(cu.x, cu.x); - BS2_TRACE(cu.y, cu.y); - BS2_TRACE(cu.log2CbSize, cu.log2CbSize); - TLEnd(); - - if ( pps.cu_qp_delta_enabled_flag - && !(cu.x & ((1 << Log2MinCuQpDeltaSize) - 1)) //only for 1st Cu in Qg - && !(cu.y & ((1 << Log2MinCuQpDeltaSize) - 1))) - { - //8.6.1 Derivation process for quantization parameters - Bs16s qPY_A, qPY_B; - Bs16s xQg = cu.x/* - (cu.x & ((1 << Log2MinCuQpDeltaSize) - 1))*/; - Bs16s yQg = cu.y/* - (cu.y & ((1 << Log2MinCuQpDeltaSize) - 1))*/; - bool availableA = AvailableZs(cu.x, cu.y, xQg - 1, yQg); - bool availableB = AvailableZs(cu.x, cu.y, xQg, yQg - 1); - Bs16s xTmpA = (xQg - 1) >> MinTbLog2SizeY; - Bs16s yTmpA = yQg >> MinTbLog2SizeY; - Bs16s xTmpB = xQg >> MinTbLog2SizeY; - Bs16s yTmpB = (yQg - 1) >> MinTbLog2SizeY; - Bs32u ctbAddrA = availableA ? (MinTbAddrZs(xTmpA, yTmpA) >> (2 * (CtbLog2SizeY - MinTbLog2SizeY))) : 0; - Bs32u ctbAddrB = availableB ? (MinTbAddrZs(xTmpB, yTmpB) >> (2 * (CtbLog2SizeY - MinTbLog2SizeY))) : 0; - Bs32u CtbAddrInTs = CtbAddrRsToTs[(cu.y >> CtbLog2SizeY) * PicWidthInCtbsY + (cu.x >> CtbLog2SizeY)]; - - if (!availableA || ctbAddrA != CtbAddrInTs) - qPY_A = qPY_PREV; - else - { - CU* pCU = GetCU(xQg - 1, yQg); - if (!pCU) - throw InvalidSyntax(); - qPY_A = pCU->QpY; - } - - if (!availableB || ctbAddrB != CtbAddrInTs) - qPY_B = qPY_PREV; - else - { - CU* pCU = GetCU(xQg, yQg - 1); - if (!pCU) - throw InvalidSyntax(); - qPY_B = pCU->QpY; - } - - qPY_PREV = ((qPY_A + qPY_B + 1) >> 1); // qPY_PREV = qPY_PRED - } - - cu.QpY = qPY_PREV; - cu.QpCb = GetQpCb(cu.QpY, 0); - cu.QpCr = GetQpCr(cu.QpY, 0); - - if (pps.transquant_bypass_enabled_flag) - BS2_SET(CuTransquantBypassFlag(), cu.transquant_bypass_flag); - - if (slice.type != I && CuSkipFlag(cu.x, cu.y)) - BS2_SETM(MODE_SKIP, cu.PredMode, PredModeTraceMap); - - Bs16u nCbS = (1 << cu.log2CbSize); - - if (cu.PredMode == MODE_SKIP) - { - TLAuto tl(*this, TRACE_PU); - cu.Pu = Alloc(); - auto& pu = *cu.Pu; - - pu.x = cu.x; - pu.y = cu.y; - pu.w = nCbS; - pu.h = nCbS; - - pu.merge_flag = 1; - - if (slice.MaxNumMergeCand > 1) - BS2_SET(MergeIdx(), pu.merge_idx); - - decodeMvLX(cu, pu, 0); - - BS2_TRACE(pu.inter_pred_idc, pu.inter_pred_idc); - - TLStart(TRACE_PRED|TRACE_PU); - - BS2_TRACE(pu.x, pu.x); - BS2_TRACE(pu.y, pu.y); - BS2_TRACE(pu.w, pu.w); - BS2_TRACE(pu.h, pu.h); - - if (pu.inter_pred_idc != PRED_L1) - BS2_TRACE(pu.ref_idx_l0, pu.ref_idx_l0); - if (pu.inter_pred_idc != PRED_L0) - BS2_TRACE(pu.ref_idx_l1, pu.ref_idx_l1); - - BS2_TRACE_MDARR(Bs16s, pu.MvLX, dim, 1, 0, "%i "); - - TLEnd(); - - return; - } - - if (slice.type != I) - BS2_SETM(PredModeFlag(), cu.PredMode, PredModeTraceMap) - else - BS2_SETM(MODE_INTRA, cu.PredMode, PredModeTraceMap); - - if ( sps.palette_mode_enabled_flag - && cu.PredMode == MODE_INTRA - && cu.log2CbSize <= MaxTbLog2SizeY) - { - BS2_SET(PaletteModeFlag(), cu.palette_mode_flag); - - if (cu.palette_mode_flag) - { - parsePC(cu); - - TLStart(TRACE_QP); - BS2_TRACE(cu.QpY, cu.QpY); - BS2_TRACE(cu.QpCb, cu.QpCb); - BS2_TRACE(cu.QpCr, cu.QpCr); - TLEnd(); - return; - } - } - - if (cu.PredMode != MODE_INTRA || cu.log2CbSize == MinCbLog2SizeY) - BS2_SETM(PartMode(cu.PredMode == MODE_INTRA, cu.log2CbSize), cu.PartMode, PartModeTraceMap); - - if (cu.PredMode == MODE_INTRA) - { - if ( cu.PartMode == PART_2Nx2N - && sps.pcm_enabled_flag - && cu.log2CbSize >= Log2MinIpcmCbSizeY - && cu.log2CbSize <= Log2MaxIpcmCbSizeY) - { - BS2_SET(PcmFlag(), cu.pcm_flag); - } - - if (cu.pcm_flag) - { - TLAuto tl1(*this, TRACE_COEF); - - InitPCMBlock(); - - while (GetBitOffset()) - if (u1()) - throw InvalidSyntax(); - - Bs16u size = (1 << (cu.log2CbSize << 1)); - Bs16u split = nCbS; - - if (!TLTest(traceAddr)) - { - BS2_TRACE(cu.x, cu.x); - BS2_TRACE(cu.y, cu.y); - BS2_TRACE(cu.log2CbSize, cu.log2CbSize); - } - - BS2_TRACE_ARR_VF(u(sps.pcm_sample_bit_depth_luma_minus1+1), - pcm_sample_luma, size, split, BitDepthY > 8 ? "%04X " : "%02X "); - - if(ChromaArrayType != 0) - { - size = ((2 << (cu.log2CbSize << 1)) / (SubWidthC * SubHeightC)); - split /= SubWidthC; - - BS2_TRACE_ARR_VF(u(sps.pcm_sample_bit_depth_chroma_minus1+1), - pcm_sample_chroma, size, split, BitDepthC > 8 ? "%04X " : "%02X "); - } - - InitADE(); - - return; - } - - LumaPred lp[2][2] = {}; - Bs16u pbOffset = (cu.PartMode == PART_NxN ) ? (nCbS / 2) : nCbS, i, j; - - memset(intra_chroma_pred_mode, 0, sizeof(intra_chroma_pred_mode)); - - for (j = 0; j < nCbS / pbOffset; j++) - for (i = 0; i < nCbS / pbOffset; i++) - BS2_SET(PrevIntraLumaPredFlag(), lp[i][j].prev_intra_luma_pred_flag); - - for (j = 0; j < nCbS / pbOffset; j++) - { - for (i = 0; i < nCbS / pbOffset; i++) - { - if (lp[i][j].prev_intra_luma_pred_flag) - BS2_SET(MpmIdx(), lp[i][j].mpm_idx) - else - BS2_SET(RemIntraLumaPredMode(), lp[i][j].rem_intra_luma_pred_mode); - } - } - - for (j = 0; j < nCbS / pbOffset; j++) - { - for (i = 0; i < nCbS / pbOffset; i++) - { - auto& clp = lp[j][i]; - auto& IntraPredModeY = cu.IntraPredModeY[j][i]; - Bs16u xPb = cu.x + j * pbOffset; - Bs16u yPb = cu.y + i * pbOffset; - bool availableX[2] = - { - AvailableZs(xPb, yPb, xPb - 1, yPb), - AvailableZs(xPb, yPb, xPb, yPb - 1) - }; - Bs8u candIntraPredModeX[2] = {}; - Bs8u candModeList[3] = {}; - - for (Bs16u c = 0; c < 2; c++) - { - if (!availableX[c]) - candIntraPredModeX[c] = 1; - else - { - CU* cuX = GetCU(xPb - !c, yPb - c); - - if (!cuX) - throw InvalidSyntax(); - - if (cuX->PredMode != MODE_INTRA || cuX->pcm_flag ) - candIntraPredModeX[c] = 1; - else if (c && ((yPb - c) < ((yPb >> CtbLog2SizeY) << CtbLog2SizeY))) - candIntraPredModeX[c] = 1; - else - candIntraPredModeX[c] = cuX->IntraPredModeY[!!(j - !c)][!!(i - c)]; - } - } - - if (candIntraPredModeX[0] == candIntraPredModeX[1]) - { - if (candIntraPredModeX[0] < 2) - { - candModeList[0] = 0; - candModeList[1] = 1; - candModeList[2] = 26; - } - else - { - candModeList[0] = candIntraPredModeX[0]; - candModeList[1] = 2 + ((candIntraPredModeX[0] + 29) % 32); - candModeList[2] = 2 + ((candIntraPredModeX[0] - 2 + 1) % 32); - } - } - else - { - candModeList[0] = candIntraPredModeX[0]; - candModeList[1] = candIntraPredModeX[1]; - - if (candModeList[0] != 0 && candModeList[1] != 0) - candModeList[2] = 0; - else if (candModeList[0] != 1 && candModeList[1] != 1) - candModeList[2] = 1; - else - candModeList[2] = 26; - } - - if (clp.prev_intra_luma_pred_flag) - IntraPredModeY = candModeList[clp.mpm_idx]; - else - { - if (candModeList[0] > candModeList[1]) - std::swap(candModeList[0], candModeList[1]); - - if (candModeList[0] > candModeList[2]) - std::swap(candModeList[0], candModeList[2]); - - if (candModeList[1] > candModeList[2]) - std::swap(candModeList[1], candModeList[2]); - - IntraPredModeY = clp.rem_intra_luma_pred_mode; - - for (Bs16u c = 0; c < 3; c++) - IntraPredModeY += (IntraPredModeY >= candModeList[c]); - } - } - } - - TLStart(TRACE_PRED); - - if (nCbS == pbOffset) - { - cu.IntraPredModeY[0][1] = cu.IntraPredModeY[0][0]; - cu.IntraPredModeY[1][0] = cu.IntraPredModeY[0][0]; - cu.IntraPredModeY[1][1] = cu.IntraPredModeY[0][0]; - - BS2_SETM(cu.IntraPredModeY[0][0], cu.IntraPredModeY[0][0], IntraPredModeTraceMap); - } - else if (Trace()) - { - Bs8u IntraPredModeY[4] = - { - cu.IntraPredModeY[0][0], cu.IntraPredModeY[1][0], - cu.IntraPredModeY[0][1], cu.IntraPredModeY[1][1], - }; - BS2_SET_ARR_M(IntraPredModeY[_i], IntraPredModeY, 4, 2, " %8s(%2i)", IntraPredModeTraceMap); - } - - if (ChromaArrayType == 3 && nCbS != pbOffset) - { - TLStart(TRACE_CU); - BS2_SET(IntraChromaPredMode(), intra_chroma_pred_mode[0][0]); - BS2_SET(IntraChromaPredMode(), intra_chroma_pred_mode[1][0]); - BS2_SET(IntraChromaPredMode(), intra_chroma_pred_mode[0][1]); - BS2_SET(IntraChromaPredMode(), intra_chroma_pred_mode[1][1]); - TLEnd(); - - cu.IntraPredModeC[0][0] = ModeIdx(intra_chroma_pred_mode[0][0], cu.IntraPredModeY[0][0]); - cu.IntraPredModeC[0][1] = ModeIdx(intra_chroma_pred_mode[0][1], cu.IntraPredModeY[0][1]); - cu.IntraPredModeC[1][0] = ModeIdx(intra_chroma_pred_mode[1][0], cu.IntraPredModeY[1][0]); - cu.IntraPredModeC[1][1] = ModeIdx(intra_chroma_pred_mode[1][1], cu.IntraPredModeY[1][1]); - - if (Trace()) - { - Bs8u IntraPredModeC[4] = - { - cu.IntraPredModeC[0][0], cu.IntraPredModeC[1][0], - cu.IntraPredModeC[0][1], cu.IntraPredModeC[1][1], - }; - BS2_SET_ARR_M(IntraPredModeC[_i], IntraPredModeC, 4, 2, " %8s(%2i)", IntraPredModeTraceMap); - } - } - else if (ChromaArrayType != 0) - { - TLStart(TRACE_CU); - BS2_SET(IntraChromaPredMode(), intra_chroma_pred_mode[0][0]); - TLEnd(); - - intra_chroma_pred_mode[0][1] = intra_chroma_pred_mode[0][0]; - intra_chroma_pred_mode[1][0] = intra_chroma_pred_mode[0][0]; - intra_chroma_pred_mode[1][1] = intra_chroma_pred_mode[0][0]; - - cu.IntraPredModeC[0][0] = ModeIdx(intra_chroma_pred_mode[0][0], cu.IntraPredModeY[0][0]); - - if (ChromaArrayType == 2) - cu.IntraPredModeC[0][0] = ModeIdxTrans[cu.IntraPredModeC[0][0]]; - - cu.IntraPredModeC[0][1] = cu.IntraPredModeC[0][0]; - cu.IntraPredModeC[1][0] = cu.IntraPredModeC[0][0]; - cu.IntraPredModeC[1][1] = cu.IntraPredModeC[0][0]; - - BS2_SETM(cu.IntraPredModeC[0][0], cu.IntraPredModeC[0][0], IntraPredModeTraceMap); - } - TLEnd(); - } - else - { - auto x0 = cu.x; - auto y0 = cu.y; - Bs16u CtDepth = CtbLog2SizeY - cu.log2CbSize; - - auto PredictionUnit = [&] (Bs16u x, Bs16u y, Bs16u w, Bs16u h, Bs16u partIdx) -> PU* - { - PU* pPU = Alloc(); - pPU->x = x; - pPU->y = y; - pPU->w = w; - pPU->h = h; - - parsePU(cu, *pPU, CtDepth, partIdx); - - return pPU; - }; - - switch (cu.PartMode) - { - case PART_2Nx2N: - cu.Pu = - PredictionUnit(x0, y0, nCbS, nCbS, 0); - break; - case PART_2NxN: - cu.Pu = - PredictionUnit(x0, y0, nCbS, nCbS / 2, 0); - cu.Pu->Next = - PredictionUnit(x0, y0 + nCbS / 2, nCbS, nCbS / 2, 1); - break; - case PART_Nx2N: - cu.Pu = - PredictionUnit(x0, y0, nCbS / 2, nCbS, 0); - cu.Pu->Next = - PredictionUnit(x0 + nCbS / 2, y0, nCbS / 2, nCbS, 1); - break; - case PART_2NxnU: - cu.Pu = - PredictionUnit(x0, y0, nCbS, nCbS / 4, 0); - cu.Pu->Next = - PredictionUnit(x0, y0 + nCbS / 4, nCbS, nCbS * 3 / 4, 1); - break; - case PART_2NxnD: - cu.Pu = - PredictionUnit(x0, y0, nCbS, nCbS * 3 / 4, 0); - cu.Pu->Next = - PredictionUnit(x0, y0 + nCbS * 3 / 4, nCbS, nCbS / 4, 1); - break; - case PART_nLx2N: - cu.Pu = - PredictionUnit(x0, y0, nCbS / 4, nCbS, 0); - cu.Pu->Next = - PredictionUnit(x0 + nCbS / 4, y0, nCbS * 3 / 4, nCbS, 1); - break; - case PART_nRx2N: - cu.Pu = - PredictionUnit(x0, y0, nCbS * 3 / 4, nCbS, 0); - cu.Pu->Next = - PredictionUnit(x0 + nCbS * 3 / 4, y0, nCbS / 4, nCbS, 1); - break; - case PART_NxN: - cu.Pu = - PredictionUnit(x0, y0, nCbS / 2, nCbS / 2, 0); - cu.Pu->Next = - PredictionUnit(x0 + nCbS / 2, y0, nCbS / 2, nCbS / 2, 1); - cu.Pu->Next->Next = - PredictionUnit(x0, y0 + nCbS / 2, nCbS / 2, nCbS / 2, 2); - cu.Pu->Next->Next->Next = - PredictionUnit(x0 + nCbS / 2, y0 + nCbS / 2, nCbS / 2, nCbS / 2, 3); - break; - default: - throw InvalidSyntax(); - } - } - - bool rqt_root_cbf = true; - - if ( cu.PredMode != MODE_INTRA - && !(cu.PartMode == PART_2Nx2N && cu.Pu->merge_flag)) - BS2_SET(RqtRootCbf(), rqt_root_cbf) - - if (rqt_root_cbf) - { - IntraSplitFlag = cu.PredMode == MODE_INTRA && cu.PartMode == PART_NxN; - MaxTrafoDepth = (cu.PredMode == MODE_INTRA ? (sps.max_transform_hierarchy_depth_intra + IntraSplitFlag ) : sps.max_transform_hierarchy_depth_inter); - - cu.Tu = Alloc(); - cu.Tu->log2TrafoSize = cu.log2CbSize; - cu.Tu->x = cu.x; - cu.Tu->y = cu.y; - - parseTT(cu, *cu.Tu, *cu.Tu, 0); - } - - TLStart(TRACE_QP); - - BS2_TRACE(cu.QpY, cu.QpY); - BS2_TRACE(cu.QpCb, cu.QpCb); - BS2_TRACE(cu.QpCr, cu.QpCr); - - TLEnd(); -} - -void SDParser::parsePU(CU& cu, PU& pu, Bs16u CtDepth, Bs16u partIdx) -{ - TLAuto tl(*this, TRACE_PU); -#ifdef __BS_TRACE__ - const Bs16u dim[] = { 1, 2, 2 }; -#endif - auto& slice = *m_cSlice; - Bs32s MvdLX[2][2] = {}; - auto mvd_coding = [&] (Bs16u refList) - { - bool abs_mvd_greater0_flag[2] = {}; - bool abs_mvd_greater1_flag[2] = {}; - bool mvd_sign_flag[2] = {}; - Bs32s abs_mvd_minus2[2] = {-1, -1}; - - BS2_SET(AbsMvdGreater0Flag(), abs_mvd_greater0_flag[0]); - BS2_SET(AbsMvdGreater0Flag(), abs_mvd_greater0_flag[1]); - - if (abs_mvd_greater0_flag[0]) - BS2_SET(AbsMvdGreater1Flag(), abs_mvd_greater1_flag[0]); - - if (abs_mvd_greater0_flag[1]) - BS2_SET(AbsMvdGreater1Flag(), abs_mvd_greater1_flag[1]); - - if (abs_mvd_greater0_flag[0]) - { - if (abs_mvd_greater1_flag[0]) - BS2_SET(AbsMvdMinus2(), abs_mvd_minus2[0]); - - BS2_SET(MvdSignFlag(), mvd_sign_flag[0]); - } - - if (abs_mvd_greater0_flag[1]) - { - if (abs_mvd_greater1_flag[1]) - BS2_SET(AbsMvdMinus2(), abs_mvd_minus2[1]); - - BS2_SET(MvdSignFlag(), mvd_sign_flag[1]); - } - - MvdLX[refList][0] = abs_mvd_greater0_flag[0] * (abs_mvd_minus2[0] + 2) * (1 - 2 * mvd_sign_flag[0]); - MvdLX[refList][1] = abs_mvd_greater0_flag[1] * (abs_mvd_minus2[1] + 2) * (1 - 2 * mvd_sign_flag[1]); - }; - - TLStart(TRACE_PRED | TRACE_PU); - BS2_TRACE(pu.x, pu.x); - BS2_TRACE(pu.y, pu.y); - BS2_TRACE(pu.w, pu.w); - BS2_TRACE(pu.h, pu.h); - TLEnd(); - - BS2_SET(MergeFlag(), pu.merge_flag); - - if (pu.merge_flag) - { - if (slice.MaxNumMergeCand > 1) - BS2_SET(MergeIdx(), pu.merge_idx); - - decodeMvLX(cu, pu, partIdx); - - BS2_TRACE(pu.inter_pred_idc, pu.inter_pred_idc); - - TLStart(TRACE_PRED | TRACE_PU); - - if (pu.inter_pred_idc != PRED_L1) - BS2_TRACE(pu.ref_idx_l0, pu.ref_idx_l0); - if (pu.inter_pred_idc != PRED_L0) - BS2_TRACE(pu.ref_idx_l1, pu.ref_idx_l1); - - BS2_TRACE_MDARR(Bs16s, pu.MvLX, dim, 1, 0, "%i "); - - TLEnd(); - - return; - } - - if (slice.type == SLICE_TYPE::B) - BS2_SET(InterPredIdc(pu.w, pu.h, CtDepth), pu.inter_pred_idc); - - if (pu.inter_pred_idc != PRED_L1) - { - if ( slice.num_ref_idx_l0_active > 1) - { - TLStart(TRACE_PRED | TRACE_PU); - BS2_SET(RefIdxL0(), pu.ref_idx_l0); - TLEnd(); - } - - mvd_coding(0); - - BS2_SET(MvpL0Flag(), pu.mvp_l0_flag); - } - - if (pu.inter_pred_idc != PRED_L0) - { - if (slice.num_ref_idx_l1_active > 1) - { - TLStart(TRACE_PRED | TRACE_PU); - BS2_SET(RefIdxL1(), pu.ref_idx_l1); - TLEnd(); - } - - if (slice.mvd_l1_zero_flag && pu.inter_pred_idc == PRED_BI) - { - //MvdL1[ x0 ][ y0 ][ 0 ] = 0 - //MvdL1[ x0 ][ y0 ][ 1 ] = 0 - } - else - mvd_coding(1); - - BS2_SET(MvpL1Flag(), pu.mvp_l1_flag); - } - - BS2_TRACE_MDARR(Bs32s, MvdLX, dim, 1, 0, "%i "); - - if (pu.inter_pred_idc != PRED_L1) - decodeMvLX(cu, pu, 0, MvdLX[0], partIdx); - - if (pu.inter_pred_idc != PRED_L0) - decodeMvLX(cu, pu, 1, MvdLX[1], partIdx); - - TLStart(TRACE_PRED | TRACE_PU); - BS2_TRACE_MDARR(Bs16s, pu.MvLX, dim, 1, 0, "%i "); - - TLEnd(); -} - -TU* SDParser::parseTT(CU& cu, TU& tu, TU& tuBase, Bs16u blkIdx) -{ - TLAuto tl(*this, TRACE_TT); - Bs16u trafoDepth = cu.log2CbSize - tu.log2TrafoSize; - bool split_transform_flag; - - if ( tu.log2TrafoSize <= MaxTbLog2SizeY - && tu.log2TrafoSize > MinTbLog2SizeY - && trafoDepth < MaxTrafoDepth - && !(IntraSplitFlag && (trafoDepth == 0))) - { - BS2_SET(SplitTransformFlag(tu.log2TrafoSize), split_transform_flag); - } - else - { - bool interSplitFlag = - (m_cSlice->sps->max_transform_hierarchy_depth_inter == 0) - && (cu.PredMode == MODE_INTER) - && (cu.PartMode != PART_2Nx2N) - && (trafoDepth == 0); - BS2_SET( - (tu.log2TrafoSize > MaxTbLog2SizeY) - || (IntraSplitFlag && 0 == trafoDepth) - || interSplitFlag - , split_transform_flag); - } - - if ((tu.log2TrafoSize > 2 && ChromaArrayType != 0 ) || ChromaArrayType == 3) - { - if (trafoDepth == 0 || tuBase.cbf_cb) - { - BS2_SET(CbfCb(trafoDepth), tu.cbf_cb); - - if (ChromaArrayType == 2 && (!split_transform_flag || tu.log2TrafoSize == 3)) - BS2_SET(CbfCb(trafoDepth), tu.cbf_cb1) - } - - if (trafoDepth == 0 || tuBase.cbf_cr) - { - BS2_SET(CbfCr(trafoDepth), tu.cbf_cr); - - if (ChromaArrayType == 2 && (!split_transform_flag || tu.log2TrafoSize == 3)) - BS2_SET(CbfCr(trafoDepth), tu.cbf_cr1) - } - } - - if (split_transform_flag) - { - TU tu0 = tu, *pTU = &tu; - Bs16u x0 = tu0.x; - Bs16u y0 = tu0.y; - Bs16u x1 = x0 + (1 << (tu0.log2TrafoSize - 1)); - Bs16u y1 = y0 + (1 << (tu0.log2TrafoSize - 1)); - auto transform_tree = [&] (Bs16u x, Bs16u y, Bs16u blk) - { - pTU->x = x; - pTU->y = y; - pTU->log2TrafoSize = tu0.log2TrafoSize - 1; - pTU = parseTT(cu, *pTU, tu0, blk); - }; - - tu = TU(); - transform_tree(x0, y0, 0); - - pTU->Next = Alloc(); - pTU = pTU->Next; - transform_tree(x1, y0, 1); - - pTU->Next = Alloc(); - pTU = pTU->Next; - transform_tree(x0, y1, 2); - - pTU->Next = Alloc(); - pTU = pTU->Next; - transform_tree(x1, y1, 3); - - return pTU; - } - - if ( cu.PredMode == MODE_INTRA - || trafoDepth != 0 - || tu.cbf_cb - || tu.cbf_cr - || tu.cbf_cb1 - || tu.cbf_cr1) - { - BS2_SET(CbfLuma(trafoDepth), tu.cbf_luma); - } - else - BS2_SET(1, tu.cbf_luma); - - parseTU(cu, tu, tuBase, blkIdx); - - return &tu; -} - -void SDParser::parseDQP(CU& cu) -{ - auto& pps = *m_cSlice->pps; - - if (pps.cu_qp_delta_enabled_flag && !IsCuQpDeltaCoded) - { - CuQpDeltaVal = CuQpDeltaAbs(); - - if (CuQpDeltaVal && CuQpDeltaSignFlag()) - CuQpDeltaVal *= -1; - - IsCuQpDeltaCoded = true; - - BS2_TRACE(CuQpDeltaVal, CuQpDeltaVal); - cu.QpY = ((qPY_PREV + CuQpDeltaVal + 52 + 2 * QpBdOffsetY) % (52 + QpBdOffsetY)) - QpBdOffsetY; - cu.QpCb = GetQpCb(cu.QpY, 0); - cu.QpCr = GetQpCr(cu.QpY, 0); - - qPY_PREV = cu.QpY; - } -} - -void SDParser::parseCQPO(CU& cu) -{ - auto& pps = *m_cSlice->pps; - auto& slice = *m_cSlice; - - if (slice.cu_chroma_qp_offset_enabled_flag && !IsCuChromaQpOffsetCoded) - { - BS2_SET(CuChromaQpOffsetFlag(), cu.chroma_qp_offset_flag); - - if (cu.chroma_qp_offset_flag && pps.chroma_qp_offset_list_len_minus1 > 0) - { - BS2_SET(CuChromaQpOffsetIdx(), cu.chroma_qp_offset_idx); - - cu.QpCb = GetQpCb(cu.QpY, pps.cb_qp_offset_list[cu.chroma_qp_offset_idx]); - cu.QpCr = GetQpCr(cu.QpY, pps.cr_qp_offset_list[cu.chroma_qp_offset_idx]); - } - - IsCuChromaQpOffsetCoded = true; - } -} - -void SDParser::parseTU(CU& cu, TU& tu, TU& tuBase, Bs16u blkIdx) -{ - TLAuto tl(*this, TRACE_TU); - Bs16u log2TrafoSizeC = BS_MAX(2, tu.log2TrafoSize - (ChromaArrayType == 3 ? 0 : 1)); - auto& pps = *m_cSlice->pps; - auto& slice = *m_cSlice; - bool cbfLuma = tu.cbf_luma, cbfChroma; - Bs16u x0 = tu.x; - Bs16u y0 = tu.y; - Bs16u xBase = tuBase.x; - Bs16u yBase = tuBase.y; - Bs16u xP = (x0 >> MinCbLog2SizeY) << MinCbLog2SizeY; - Bs16u yP = (y0 >> MinCbLog2SizeY) << MinCbLog2SizeY; - Bs16u nCbS = (1 << MinCbLog2SizeY); - Bs16u log2TrafoSize = tu.log2TrafoSize; - auto ICPM = [&](Bs16u x, Bs16u y) - { - return intra_chroma_pred_mode[(x - cu.x) >= (1 << (cu.log2CbSize - 1))][(y - cu.y) >= (1 << (cu.log2CbSize - 1))]; - }; - - BS2_TRACE(tu.x, tu.x); - BS2_TRACE(tu.y, tu.y); - BS2_TRACE(tu.log2TrafoSize, tu.log2TrafoSize); - - if (ChromaArrayType != 3 && tu.log2TrafoSize == 2) - cbfChroma = tuBase.cbf_cb || tuBase.cbf_cr || tuBase.cbf_cb1 || tuBase.cbf_cr1; - else - cbfChroma = tu.cbf_cb || tu.cbf_cr || tu.cbf_cb1 || tu.cbf_cr1; - - if (!cbfLuma && !cbfChroma) - return; - - if ( pps.residual_adaptive_colour_transform_enabled_flag - && ( cu.PredMode == MODE_INTER - || (cu.PartMode == PART_2Nx2N && ICPM(x0, y0) == 4) - || ( 4 == ICPM(xP, yP) - && 4 == ICPM(xP + nCbS / 2, yP) - && 4 == ICPM(xP, yP + nCbS / 2) - && 4 == ICPM(xP + nCbS / 2, yP + nCbS / 2)))) - { - BS2_SET(TuResidualActFlag(), tu.tu_residual_act_flag); - } - - parseDQP(cu); - - if (cbfChroma && !cu.transquant_bypass_flag) - parseCQPO(cu); - - if (pps.residual_adaptive_colour_transform_enabled_flag) - { - tu.QP[0] = cu.QpY + Bs16s((pps.ActQpOffsetY + slice.act_y_qp_offset) * tu.tu_residual_act_flag); - tu.QP[1] = GetQpCb(cu.QpY - , Bs16s(pps.cb_qp_offset_list[cu.chroma_qp_offset_idx] * cu.chroma_qp_offset_flag) - + Bs16s((pps.ActQpOffsetCb + slice.act_cb_qp_offset) * tu.tu_residual_act_flag)); - tu.QP[2] = GetQpCr(cu.QpY - , Bs16s(pps.cr_qp_offset_list[cu.chroma_qp_offset_idx] * cu.chroma_qp_offset_flag) - + Bs16s((pps.ActQpOffsetCr + slice.act_cr_qp_offset) * tu.tu_residual_act_flag)); - - TLStart(TRACE_QP); - BS2_TRACE_ARR(tu.QP, 3, 0); - TLEnd(); - } - else - { - tu.QP[0] = cu.QpY; - tu.QP[1] = cu.QpCb; - tu.QP[2] = cu.QpCr; - } - - if (cbfLuma) - { - parseResidual(cu, tu, x0, y0, log2TrafoSize, 0); - } - - if (tu.log2TrafoSize > 2 || ChromaArrayType == 3) - { - bool cross_comp_pred = - pps.cross_component_prediction_enabled_flag - && cbfLuma - && (cu.PredMode == MODE_INTER || ICPM(x0, y0) == 4); - - if (cross_comp_pred) - { - BS2_SET(Log2ResScaleAbsPlus1(0), tu.log2_res_scale_abs_plus1_0); - - if (tu.log2_res_scale_abs_plus1_0) - BS2_SET(ResScaleSignFlag(0), tu.res_scale_sign_flag_0); - } - - if (tu.cbf_cb) - parseResidual(cu, tu, x0, y0, log2TrafoSizeC, 1); - - if (tu.cbf_cb1) - parseResidual(cu, tu, x0, y0 + (1 << log2TrafoSizeC), log2TrafoSizeC, 1); - - if (cross_comp_pred) - { - BS2_SET(Log2ResScaleAbsPlus1(1), tu.log2_res_scale_abs_plus1_1); - - if (tu.log2_res_scale_abs_plus1_1) - BS2_SET(ResScaleSignFlag(1), tu.res_scale_sign_flag_1); - } - - if (tu.cbf_cr) - parseResidual(cu, tu, x0, y0, log2TrafoSizeC, 2); - - if (tu.cbf_cr1) - parseResidual(cu, tu, x0, y0 + (1 << log2TrafoSizeC), log2TrafoSizeC, 2); - } - else if (blkIdx == 3) - { - if (tuBase.cbf_cb) - parseResidual(cu, tuBase, xBase, yBase, log2TrafoSizeC, 1); - - if (tuBase.cbf_cb1) - parseResidual(cu, tuBase, xBase, yBase + (1 << log2TrafoSizeC), log2TrafoSizeC, 1); - - if (tuBase.cbf_cr) - parseResidual(cu, tuBase, xBase, yBase, log2TrafoSizeC, 2); - - if (tuBase.cbf_cr1) - parseResidual(cu, tuBase, xBase, yBase + (1 << log2TrafoSizeC), log2TrafoSizeC, 2); - } -} - -const Bs8u ctxIdxMap[15] = { 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8 }; - -void SDParser::parseResidual(CU& cu, TU& tu, Bs16u x0, Bs16u y0, Bs16u log2TrafoSize, Bs16u cIdx) -{ - TLAuto tl(*this, TRACE_RESIDUAL); - auto& sps = *m_cSlice->sps; - auto& pps = *m_cSlice->pps; - bool transform_skip_flag = false - , explicit_rdpcm_flag = false - , explicit_rdpcm_dir_flag - , coded_sub_block_flag[16][16] = {} - , sig_coeff_flag - ; - Bs32s LastSignificantCoeffX - , LastSignificantCoeffY - , predModeIntra = -1 - , xS - , yS - , xC - , yC - , scanIdx = 0 - , lastScanPos - , lastSubBlock - ; - Bs32s sig_coeff[16], nSC; - - TLStart(TRACE_RESIDUAL | TRACE_COEF); - BS2_TRACE(x0, x0); - BS2_TRACE(y0, y0); - BS2_TRACE(log2TrafoSize, log2TrafoSize); - BS2_TRACE(cIdx, cIdx); - TLEnd(); - - Bs32s* pTCLevels = nullptr; - Bs16u nCoeff = 1 << (2 * log2TrafoSize); - - if (report_TCLevels && cIdx == 0) - { - pTCLevels = tu.tc_levels_luma = Alloc(nCoeff); - } - else - { - TCLevels.resize(nCoeff); - std::fill(std::begin(TCLevels), std::end(TCLevels), 0); - - pTCLevels = TCLevels.data(); - } - - if ( cu.PredMode == MODE_INTRA - && (log2TrafoSize == 2 || (log2TrafoSize == 3 && (cIdx == 0 || ChromaArrayType == 3)))) - { - bool icpmX = (x0 - cu.x) >= (1 << (cu.log2CbSize - 1)); - bool icpmY = (y0 - cu.y) >= (1 << (cu.log2CbSize - 1)); - - predModeIntra = cIdx ? cu.IntraPredModeC[icpmX][icpmY] : cu.IntraPredModeY[icpmX][icpmY]; - - BS2_SETM(predModeIntra, predModeIntra, IntraPredModeTraceMap); - - if(predModeIntra >= 6 && predModeIntra <= 14) - scanIdx = 2; - else if(predModeIntra >= 22 && predModeIntra <= 30) - scanIdx = 1; - } - - if ( pps.transform_skip_enabled_flag - && !cu.transquant_bypass_flag - && (log2TrafoSize <= (pps.log2_max_transform_skip_block_size_minus2 + 2))) - { - BS2_SET(TransformSkipFlag(cIdx), transform_skip_flag); - - if (transform_skip_flag) - tu.transform_skip_flag |= (1 << cIdx); - } - - if ( cu.PredMode == MODE_INTER - && sps.explicit_rdpcm_enabled_flag - && (transform_skip_flag || cu.transquant_bypass_flag)) - { - BS2_SET(ExplicitRdpcmFlag(cIdx), explicit_rdpcm_flag); - - if (explicit_rdpcm_flag) - BS2_SET(ExplicitRdpcmDirFlag(cIdx), explicit_rdpcm_dir_flag); - } - - BS2_SET(LastSigCoeffXPrefix(cIdx, log2TrafoSize), LastSignificantCoeffX); - BS2_SET(LastSigCoeffYPrefix(cIdx, log2TrafoSize), LastSignificantCoeffY); - - if (LastSignificantCoeffX > 3) - BS2_SET((1 << ((LastSignificantCoeffX >> 1) - 1)) * (2 + (LastSignificantCoeffX & 1)) - + LastSigCoeffXSuffix((Bs16u)LastSignificantCoeffX), LastSignificantCoeffX); - - - if (LastSignificantCoeffY > 3) - BS2_SET((1 << ((LastSignificantCoeffY >> 1) - 1)) * (2 + (LastSignificantCoeffY & 1)) - + LastSigCoeffYSuffix((Bs16u)LastSignificantCoeffY), LastSignificantCoeffY); - - if (2 == scanIdx) - std::swap(LastSignificantCoeffX, LastSignificantCoeffY); - - bool escapeDataPresent = false; - bool signHiddenON = - !( cu.transquant_bypass_flag - || ( cu.PredMode == MODE_INTRA - && sps.implicit_rdpcm_enabled_flag - && transform_skip_flag - && (predModeIntra == 10 || predModeIntra == 26)) - || explicit_rdpcm_flag); - const Bs8u *pSO, *pSO2 = ScanOrder2[scanIdx][0]; - -#define ScanOrder(_p0, _p1) pSO[((_p0) << 1) + (_p1)] -#define ScanOrder_2(_p0, _p1) pSO2[((_p0) << 1) + (_p1)] - - lastScanPos = ScanPos2[scanIdx][LastSignificantCoeffX & 3][LastSignificantCoeffY & 3]; - - if (log2TrafoSize == 4) - { - pSO = ScanOrder2[scanIdx][0]; - lastSubBlock = ScanPos2[scanIdx][LastSignificantCoeffX >> 2][LastSignificantCoeffY >> 2]; - } - else if (log2TrafoSize == 5) - { - pSO = ScanOrder3[scanIdx][0]; - lastSubBlock = ScanPos3[scanIdx][LastSignificantCoeffX >> 2][LastSignificantCoeffY >> 2]; - } - else if (log2TrafoSize == 3) - { - pSO = ScanOrder1[scanIdx][0]; - lastSubBlock = ScanPos1[scanIdx][LastSignificantCoeffX >> 2][LastSignificantCoeffY >> 2]; - } - else/* if (log2TrafoSize == 2)*/ - { - pSO = ScanOrder1[scanIdx][0]; - lastSubBlock = 0; - } - - for (Bs32s i = lastSubBlock; i >= 0; i--) - { - bool coeff_abs_level_greater1_flag[16] = {}; - bool coeff_abs_level_greater2_flag[16] = {}; - bool coeff_sign_flag[16] = {}; - bool inferSbDcSigCoeffFlag = false; - bool signHidden; - - nSC = 0; - - xS = ScanOrder(i, 0); - yS = ScanOrder(i, 1); - - if ((i < lastSubBlock) && (i > 0)) - { - Bs16u csbfCtx = 0; - - if (xS < (1 << (log2TrafoSize - 2)) - 1) - csbfCtx += coded_sub_block_flag[xS + 1][yS]; - if (yS < (1 << (log2TrafoSize - 2)) - 1) - csbfCtx += coded_sub_block_flag[xS][yS + 1]; - - BS2_SET(CodedSubBlockFlag(BS_MIN(csbfCtx, 1) + 2 * !!cIdx), coded_sub_block_flag[xS][yS]); - inferSbDcSigCoeffFlag = true; - } - else - coded_sub_block_flag[xS][yS] = !(xS || yS) - || ((xS == (LastSignificantCoeffX >> 2)) && (yS == (LastSignificantCoeffY >> 2))); - - for (Bs32s n = 15; n >= 0; n--) - { - xC = (xS << 2) + ScanOrder2[scanIdx][n][0]; - yC = (yS << 2) + ScanOrder2[scanIdx][n][1]; - - if ( ((i != lastSubBlock) || n <= (lastScanPos - 1)) - && coded_sub_block_flag[xS][yS] - && (n > 0 || !inferSbDcSigCoeffFlag)) - { - Bs16u sigCtx; - - if (sps.transform_skip_context_enabled_flag && (transform_skip_flag || cu.transquant_bypass_flag)) - sigCtx = (cIdx == 0) ? 42 : 16; - else if (log2TrafoSize == 2) - sigCtx = ctxIdxMap[(yC << 2) + xC]; - else if (xC + yC == 0) - sigCtx = 0; - else - { - Bs16u prevCsbf = 0; - Bs16u xP = (xC & 3); - Bs16u yP = (yC & 3); - - if (xS < (1 << (log2TrafoSize - 2)) - 1) - prevCsbf += coded_sub_block_flag[xS + 1][yS]; - if (yS < (1 << (log2TrafoSize - 2)) - 1) - prevCsbf += ((Bs16u)coded_sub_block_flag[xS][yS + 1] << 1); - - if (prevCsbf == 0) - sigCtx = (xP + yP == 0) ? 2 : (xP + yP < 3) ? 1: 0; - else if (prevCsbf == 1) - sigCtx = (yP == 0) ? 2 : (yP == 1) ? 1 : 0; - else if (prevCsbf == 2) - sigCtx = (xP == 0) ? 2 : (xP == 1) ? 1 : 0; - else - sigCtx = 2; - - if (cIdx == 0) - { - if (xS + yS) - sigCtx += 3; - - if (log2TrafoSize == 3) - sigCtx += (scanIdx == 0) ? 9 : 15; - else - sigCtx += 21; - } - else - { - if (log2TrafoSize == 3) - sigCtx += 9; - else - sigCtx += 12; - } - } - - BS2_SET(SigCoeffFlag(cIdx ? 27 + sigCtx : sigCtx), sig_coeff_flag); - - if (sig_coeff_flag) - { - inferSbDcSigCoeffFlag = false; - sig_coeff[nSC++] = n; - } - } - else if ((xC == LastSignificantCoeffX && yC == LastSignificantCoeffY) - || (!((xC & 3) || (yC & 3)) && inferSbDcSigCoeffFlag && coded_sub_block_flag[xS][yS])) - sig_coeff[nSC++] = n; - } - - Bs32s firstSigScanPos = 16; - Bs32s lastSigScanPos = -1; - Bs32s numGreater1Flag = 0; - Bs32s lastGreater1ScanPos = -1; - - for (Bs32s ii = 0; ii < nSC; ii++) - { - auto n = sig_coeff[ii]; - - if (numGreater1Flag < 8) - { - BS2_SET(CoeffAbsLevelGreater1Flag(cIdx, i), coeff_abs_level_greater1_flag[n]); - - numGreater1Flag++; - - if (coeff_abs_level_greater1_flag[n] && lastGreater1ScanPos == -1) - lastGreater1ScanPos = n; - else if (coeff_abs_level_greater1_flag[n]) - escapeDataPresent = true; - } - else - escapeDataPresent = true; - - if (lastSigScanPos == -1) - lastSigScanPos = n; - firstSigScanPos = n; - } - - signHidden = signHiddenON && (lastSigScanPos - firstSigScanPos > 3); - - if (lastGreater1ScanPos != -1) - { - BS2_SET(CoeffAbsLevelGreater2Flag(cIdx), coeff_abs_level_greater2_flag[lastGreater1ScanPos]); - - if (coeff_abs_level_greater2_flag[lastGreater1ScanPos]) - escapeDataPresent = true; - } - - for (Bs32s ii = 0; ii < nSC; ii++) - { - auto n = sig_coeff[ii]; - - if ( !pps.sign_data_hiding_enabled_flag - || !signHidden - || (n != firstSigScanPos)) - { - BS2_SET(CoeffSignFlag(), coeff_sign_flag[n]); - } - } - - Bs32s numSigCoeff = 0; - Bs32s sumAbsLevel = 0; - - for (Bs32s ii = 0; ii < nSC; ii++) - { - auto n = sig_coeff[ii]; - Bs32s coeff_abs_level_remaining = 0; - Bs16u baseLevel = 1 + coeff_abs_level_greater1_flag[n] + coeff_abs_level_greater2_flag[n]; - - if (baseLevel == ((numSigCoeff < 8) ? ((n == lastGreater1ScanPos) ? 3 : 2) : 1)) - { - BS2_SET(CoeffAbsLevelRemaining(i, baseLevel, cIdx, cu, tu), coeff_abs_level_remaining); - } - - if ((report_TCLevels && cIdx == 0) || TLTest(TRACE_COEF)) - { - xC = (xS << 2) + ScanOrder_2(n, 0); - yC = (yS << 2) + ScanOrder_2(n, 1); - - auto& TransCoeffLevel = pTCLevels[(yC << log2TrafoSize) + xC]; - TransCoeffLevel = (coeff_abs_level_remaining + baseLevel) * (1 - 2 * coeff_sign_flag[n]); - - if (pps.sign_data_hiding_enabled_flag && signHidden) - { - sumAbsLevel += (coeff_abs_level_remaining + baseLevel); - - if ((n == firstSigScanPos) && ((sumAbsLevel % 2) == 1)) - TransCoeffLevel *= -1; - } - - BS2_TRACE(TransCoeffLevel, TransCoeffLevel); - } - - numSigCoeff++; - } - } - - TLStart(TRACE_COEF); - if (Trace()) - { - auto TransCoeffLevel = pTCLevels; - Bs16u side = (1 << log2TrafoSize); - Bs16u size = side * side; - BS2_TRACE_ARR_F(TransCoeffLevel, size, side, "%4i "); - } - TLEnd(); -} - -template -class ArrayWrap -{ -protected: - U* pBase; - Bs32u offset; - Bs32u n; - std::vector d; - - inline void DD(U& _Base) - { - pBase = &_Base; - d.push_back(1); - } - - template - inline void DD(T(&_pBase)[N]) - { - d.push_back(N); - DD(_pBase[0]); - } - -public: - ArrayWrap() { offset = 0; n = 0; pBase = nullptr; } - - template - inline ArrayWrap& operator=(T(&_pBase)[N]) - { - offset = 0; - n = 0; - d.resize(0); - DD(_pBase); - return *this; - } - - inline ArrayWrap& operator[] (Bs32u x) - { - if (!n) - offset = 0; - offset += x * d[++n]; - return *this; - } - - inline operator U() { n = 0; return pBase[offset]; } -}; - -void SDParser::parsePC(CU& cu) -{ - TLAuto tl(*this, TRACE_RESIDUAL); - auto& sps = *m_cSlice->sps; - Bs16u NumPredictedPaletteEntries = 0 - , num_signalled_palette_entries = 0 - , CurrentPaletteSize - , numComps = (ChromaArrayType == 0) ? 1 : 3 - , i, cIdx - , palette_escape_val_present_flag = 1 - , num_palette_indices = 1 - , palette_transpose_flag = 0 - , log2BlockSize = cu.log2CbSize - , nCbS = (1 << cu.log2CbSize) - , xC, yC, xR, yR - , xcPrev = 0, ycPrev = 0 - //, x0 = cu.x - //, y0 = cu.y - , PaletteRun - , currNumIndices - , CurrPaletteIndex - , palette_run_prefix - , palette_run_suffix - , runPos, sPos - , adjustedRefPaletteIndex; - Bs16s MaxPaletteIndex - , remainingNumIndices - , PaletteScanPos - , PaletteMaxRun; - bool copy_above_indices_for_final_run_flag = false; - auto& newPredictorPaletteEntries = CurrentPaletteEntries; - auto& newPredictorPaletteSize = CurrentPaletteSize; - ArrayWrap::type> ScanOrder3; - - std::fill(PalettePredictorEntryReuseFlags.begin(), PalettePredictorEntryReuseFlags.end(), 0); - - for (Bs16u predictorEntryIdx = 0; - predictorEntryIdx < PredictorPaletteSize - && NumPredictedPaletteEntries < sps.palette_max_size; - predictorEntryIdx++) - { - Bs16u palette_predictor_run; - BS2_SET(PalettePredictorRun(), palette_predictor_run); - - if (palette_predictor_run != 1) - { - if (palette_predictor_run > 1) - predictorEntryIdx += palette_predictor_run - 1; - PalettePredictorEntryReuseFlags[predictorEntryIdx] = 1; - - for (cIdx = 0; cIdx < numComps; cIdx++) - CurrentPaletteEntries[cIdx][NumPredictedPaletteEntries] - = PredictorPaletteEntries[cIdx][predictorEntryIdx]; - - NumPredictedPaletteEntries++; - } - else - break; - } - - if (NumPredictedPaletteEntries < sps.palette_max_size) - BS2_SET(NumSignalledPaletteEntries(), num_signalled_palette_entries); - - CurrentPaletteSize = NumPredictedPaletteEntries + num_signalled_palette_entries; - - for (cIdx = 0; cIdx < numComps; cIdx++) - for (i = 0; i < num_signalled_palette_entries; i++) - BS2_TRACE(CurrentPaletteEntries[cIdx][NumPredictedPaletteEntries + i] - = NewPaletteEntries(cIdx), new_palette_entries[cIdx][i]); - - if (CurrentPaletteSize != 0) - BS2_SET(PaletteEscapeValPresentFlag(), palette_escape_val_present_flag); - - MaxPaletteIndex = CurrentPaletteSize - 1 + palette_escape_val_present_flag; - - if (MaxPaletteIndex > 0) - { - BS2_SET(NumPaletteIndices(MaxPaletteIndex), num_palette_indices); - - std::fill_n(Info::PaletteIndexIdc, num_palette_indices, 0); - - Bs16u adjust = 0; - - for (i = 0; i < num_palette_indices; i++) - { - if (MaxPaletteIndex - adjust > 0) - BS2_TRACE(Info::PaletteIndexIdc[i] = CABAC::PaletteIndexIdc(MaxPaletteIndex), palette_index_idc); - - adjust = 1; - } - BS2_TRACE_ARR(Info::PaletteIndexIdc, num_palette_indices, 32); - BS2_SET(CopyAboveIndicesForFinalRunFlag(), copy_above_indices_for_final_run_flag); - BS2_SET(PaletteTransposeFlag(), palette_transpose_flag); - } - else - std::fill_n(Info::PaletteIndexIdc, num_palette_indices, 0); - - if (palette_escape_val_present_flag) - { - parseDQP(cu); - if (!cu.transquant_bypass_flag) - parseCQPO(cu); - } - - remainingNumIndices = num_palette_indices; - PaletteScanPos = 0; - CurrPaletteIndex = 0; - - switch (log2BlockSize) - { - case 5: ScanOrder3 = BS_HEVC2::ScanTraverse5; break; - case 4: ScanOrder3 = BS_HEVC2::ScanTraverse4; break; - case 3: ScanOrder3 = BS_HEVC2::ScanOrder3[3]; break; - case 2: ScanOrder3 = BS_HEVC2::ScanOrder2[3]; break; - case 1: ScanOrder3 = BS_HEVC2::ScanOrder1[3]; break; - default: throw InvalidSyntax(); - } - - while (PaletteScanPos < nCbS * nCbS) - { - xC = /*x0 + */ScanOrder3[PaletteScanPos][0]; - yC = /*y0 + */ScanOrder3[PaletteScanPos][1]; - if (PaletteScanPos > 0) - { - xcPrev = /*x0 + */ScanOrder3[PaletteScanPos - 1][0]; - ycPrev = /*y0 + */ScanOrder3[PaletteScanPos - 1][1]; - } - - PaletteRun = nCbS * nCbS - PaletteScanPos - 1; - CopyAboveIndicesFlag[xC][yC] = 0; - - if (MaxPaletteIndex > 0) - { - if (PaletteScanPos >= nCbS && CopyAboveIndicesFlag[xcPrev][ycPrev] == 0) - { - if (remainingNumIndices > 0 && PaletteScanPos < nCbS * nCbS - 1) - BS2_TRACE(CopyAboveIndicesFlag[xC][yC] = CABAC::CopyAbovePaletteIndicesFlag(), - copy_above_palette_indices_flag) - else if (PaletteScanPos == nCbS * nCbS - 1 && remainingNumIndices > 0) - CopyAboveIndicesFlag[xC][yC] = 0; - else - CopyAboveIndicesFlag[xC][yC] = 1; - } - } - - if (CopyAboveIndicesFlag[xC][yC] == 0) - { - currNumIndices = num_palette_indices - remainingNumIndices; - CurrPaletteIndex = Info::PaletteIndexIdc[currNumIndices]; - } - - if (MaxPaletteIndex > 0) - { - if (CopyAboveIndicesFlag[xC][yC] == 0) - remainingNumIndices -= 1; - - PaletteMaxRun = nCbS * nCbS - PaletteScanPos - 1 - remainingNumIndices - copy_above_indices_for_final_run_flag; - - if (remainingNumIndices > 0 || CopyAboveIndicesFlag[xC][yC] != copy_above_indices_for_final_run_flag) - { - if (PaletteMaxRun > 0) - { - BS2_SET(PaletteRunPrefix(PaletteMaxRun, CopyAboveIndicesFlag[xC][yC], CurrPaletteIndex), palette_run_prefix); - - if ((palette_run_prefix > 1)) - { - PaletteRun = 1 << (palette_run_prefix - 1); - - if ((PaletteMaxRun != PaletteRun)) - { - BS2_SET(PaletteRunSuffix(PaletteMaxRun, PaletteRun), palette_run_suffix); - PaletteRun += palette_run_suffix; - } - } - else - PaletteRun = palette_run_prefix; - } - } - else - PaletteMaxRun += copy_above_indices_for_final_run_flag; - - PaletteRun = BS_MIN(PaletteRun, PaletteMaxRun); - } - - if (CopyAboveIndicesFlag[xC][yC] == 0) - { - adjustedRefPaletteIndex = MaxPaletteIndex + 1; - - if (PaletteScanPos > 0) - { - if (CopyAboveIndicesFlag[xcPrev][ycPrev] == 0) - adjustedRefPaletteIndex = PaletteIndexMap[xcPrev][ycPrev]; - else - adjustedRefPaletteIndex = PaletteIndexMap[xC][yC - 1]; - } - - if (CurrPaletteIndex >= adjustedRefPaletteIndex) - CurrPaletteIndex++; - } - - runPos = 0; - while (runPos <= PaletteRun) - { - xR = /*x0 + */ScanOrder3[PaletteScanPos][0]; - yR = /*y0 + */ScanOrder3[PaletteScanPos][1]; - - if (CopyAboveIndicesFlag[xC][yC] == 0) - { - CopyAboveIndicesFlag[xR][yR] = 0; - PaletteIndexMap[xR][yR] = CurrPaletteIndex; - } - else - { - CopyAboveIndicesFlag[xR][yR] = 1; - PaletteIndexMap[xR][yR] = PaletteIndexMap[xR][yR - 1]; - } - runPos++; - PaletteScanPos++; - } - } - - if (palette_escape_val_present_flag) - { - for (cIdx = 0; cIdx < numComps; cIdx++) - { - for (sPos = 0; sPos < nCbS * nCbS; sPos++) - { - xC = /*x0 + */ScanOrder3[sPos][0]; - yC = /*y0 + */ScanOrder3[sPos][1]; - - if (PaletteIndexMap[xC][yC] == MaxPaletteIndex) - { - if (cIdx == 0 - || (xC % 2 == 0 && yC % 2 == 0 && ChromaArrayType == 1) - || (xC % 2 == 0 && !palette_transpose_flag && ChromaArrayType == 2) - || (yC % 2 == 0 && palette_transpose_flag && ChromaArrayType == 2) - || ChromaArrayType == 3) - { - BS2_TRACE(PaletteEscapeVal(cIdx, cu.transquant_bypass_flag), palette_escape_val); - //PaletteEscapeVal[cIdx][xC][yC] = palette_escape_val; - } - } - } - } - } - - TLStart(TRACE_COEF); - if (Trace()) - { -#ifdef __BS_TRACE__ - const char* fmt = (CurrentPaletteSize > 10) ? "%2i " : "%i "; -#endif - BS2_TRACE_ARR_F(CurrentPaletteEntries[0], CurrentPaletteSize, 0, "%5i "); - BS2_TRACE_ARR_F(CurrentPaletteEntries[1], CurrentPaletteSize, 0, "%5i "); - BS2_TRACE_ARR_F(CurrentPaletteEntries[2], CurrentPaletteSize, 0, "%5i "); - - if (palette_transpose_flag) - { - for (i = 0; i < nCbS; i++) - BS2_TRACE_ARR_F(PaletteIndexMap[i], nCbS, 0, fmt); - } - else - { - for (i = 0; i < nCbS; i++) - BS2_TRACE_ARR_VF(PaletteIndexMap[_i][i], PaletteIndexMap[i], nCbS, 0, fmt); - } - } - TLEnd(); - - newPredictorPaletteSize = BS_MIN(newPredictorPaletteSize, PaletteMaxPredictorSize); - - for (i = 0; i < PredictorPaletteSize && newPredictorPaletteSize < PaletteMaxPredictorSize; i++) - { - if (!PalettePredictorEntryReuseFlags[i]) - { - for (cIdx = 0; cIdx < numComps; cIdx++) - newPredictorPaletteEntries[cIdx][newPredictorPaletteSize] = PredictorPaletteEntries[cIdx][i]; - newPredictorPaletteSize++; - } - } - - for (cIdx = 0; cIdx < numComps; cIdx++) - { - PredictorPaletteEntries[cIdx].swap(newPredictorPaletteEntries[cIdx]); - PredictorPaletteSize = newPredictorPaletteSize; - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_trace.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_trace.cpp deleted file mode 100644 index 5016c12..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc2_trace.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc2_trace.h" -#include "hevc2_struct.h" -#include - -namespace BS_HEVC2 -{ - -const char NaluTraceMap[64][16] = -{ - "TRAIL_N", "TRAIL_R", "TSA_N", "TSA_R", - "STSA_N", "STSA_R", "RADL_N", "RADL_R", - "RASL_N", "RASL_R", "RSV_VCL_N10", "RSV_VCL_R11", - "RSV_VCL_N12", "RSV_VCL_R13", "RSV_VCL_N14", "RSV_VCL_R15", - "BLA_W_LP", "BLA_W_RADL", "BLA_N_LP", "IDR_W_RADL", - "IDR_N_LP", "CRA_NUT", "RSV_IRAP_VCL22", "RSV_IRAP_VCL23", - "RSV_VCL24", "RSV_VCL25", "RSV_VCL26", "RSV_VCL27", - "RSV_VCL28", "RSV_VCL29", "RSV_VCL30", "RSV_VCL31", - "VPS_NUT", "SPS_NUT", "PPS_NUT", "AUD_NUT", - "EOS_NUT", "EOB_NUT", "FD_NUT", "PREFIX_SEI_NUT", - "SUFFIX_SEI_NUT", "RSV_NVCL41", "RSV_NVCL42", "RSV_NVCL43", - "RSV_NVCL44", "RSV_NVCL45", "RSV_NVCL46", "RSV_NVCL47", - "UNSPEC48", "UNSPEC49", "UNSPEC50", "UNSPEC51", - "UNSPEC52", "UNSPEC53", "UNSPEC54", "UNSPEC55", - "UNSPEC56", "UNSPEC57", "UNSPEC58", "UNSPEC59", - "UNSPEC60", "UNSPEC61", "UNSPEC62", "UNSPEC63" -}; - -const char PicTypeTraceMap[3][4] = -{ - "I", "PI", "BPI" -}; - -const char ProfileTraceMap::map[11][12] = -{ - "UNKNOWN", "MAIN", "MAIN_10", "MAIN_SP", - "REXT", "REXT_HT", "MAIN_SV", "MAIN_SC", - "MAIN_3D", "SCC", "REXT_SC" -}; - -const char* ProfileTraceMap::operator[] (unsigned int i) -{ - return map[(i < (sizeof(map) / sizeof(map[0]))) ? i : 0]; -} - -const char ChromaFormatTraceMap[4][12] = -{ - "CHROMA_400", "CHROMA_420", "CHROMA_422", "CHROMA_444" -}; - -const char ARIdcTraceMap::map[19][16] = -{ - "Unspecified", - "1:1", "12:11", "10:11", "16:11", - "40:33", "24:11", "20:11", "32:11", - "80:33", "18:11", "15:11", "64:33", - "160:99", "4:3", "3:2", "2:1", - "Reserved", - "Extended_SAR" -}; - -const char* ARIdcTraceMap::operator[] (unsigned int i) -{ - if (i < 17) - return map[i]; - if (i == Extended_SAR) - return map[18]; - return map[17]; -} - -const char VideoFormatTraceMap[6][12] = -{ - "Component", "PAL", "NTSC", "SECAM", "MAC", "Unspecified" -}; - -const char* SEITypeTraceMap::operator[] (unsigned int i) -{ - switch (i) - { - case SEI_BUFFERING_PERIOD : return "SEI_BUFFERING_PERIOD"; - case SEI_PICTURE_TIMING : return "SEI_PICTURE_TIMING"; - case SEI_PAN_SCAN_RECT : return "SEI_PAN_SCAN_RECT"; - case SEI_FILLER_PAYLOAD : return "SEI_FILLER_PAYLOAD"; - case SEI_USER_DATA_REGISTERED_ITU_T_T35 : return "SEI_USER_DATA_REGISTERED_ITU_T_T35"; - case SEI_USER_DATA_UNREGISTERED : return "SEI_USER_DATA_UNREGISTERED"; - case SEI_RECOVERY_POINT : return "SEI_RECOVERY_POINT"; - case SEI_SCENE_INFO : return "SEI_SCENE_INFO"; - case SEI_FULL_FRAME_SNAPSHOT : return "SEI_FULL_FRAME_SNAPSHOT"; - case SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START: return "SEI_PROGRESSIVE_REFINEMENT_SEGMENT_START"; - case SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END : return "SEI_PROGRESSIVE_REFINEMENT_SEGMENT_END"; - case SEI_FILM_GRAIN_CHARACTERISTICS : return "SEI_FILM_GRAIN_CHARACTERISTICS"; - case SEI_POST_FILTER_HINT : return "SEI_POST_FILTER_HINT"; - case SEI_TONE_MAPPING_INFO : return "SEI_TONE_MAPPING_INFO"; - case SEI_FRAME_PACKING : return "SEI_FRAME_PACKING"; - case SEI_DISPLAY_ORIENTATION : return "SEI_DISPLAY_ORIENTATION"; - case SEI_SOP_DESCRIPTION : return "SEI_SOP_DESCRIPTION"; - case SEI_ACTIVE_PARAMETER_SETS : return "SEI_ACTIVE_PARAMETER_SETS"; - case SEI_DECODING_UNIT_INFO : return "SEI_DECODING_UNIT_INFO"; - case SEI_TEMPORAL_LEVEL0_INDEX : return "SEI_TEMPORAL_LEVEL0_INDEX"; - case SEI_DECODED_PICTURE_HASH : return "SEI_DECODED_PICTURE_HASH"; - case SEI_SCALABLE_NESTING : return "SEI_SCALABLE_NESTING"; - case SEI_REGION_REFRESH_INFO : return "SEI_REGION_REFRESH_INFO"; - case SEI_NO_DISPLAY : return "SEI_NO_DISPLAY"; - case SEI_TIME_CODE : return "SEI_TIME_CODE"; - case SEI_MASTERING_DISPLAY_COLOUR_VOLUME : return "SEI_MASTERING_DISPLAY_COLOUR_VOLUME"; - case SEI_SEGM_RECT_FRAME_PACKING : return "SEI_SEGM_RECT_FRAME_PACKING"; - case SEI_TEMP_MOTION_CONSTRAINED_TILE_SETS : return "SEI_TEMP_MOTION_CONSTRAINED_TILE_SETS"; - case SEI_CHROMA_RESAMPLING_FILTER_HINT : return "SEI_CHROMA_RESAMPLING_FILTER_HINT"; - case SEI_KNEE_FUNCTION_INFO : return "SEI_KNEE_FUNCTION_INFO"; - case SEI_COLOUR_REMAPPING_INFO : return "SEI_COLOUR_REMAPPING_INFO"; - default : return "Unknown"; - } -} - -const char PicStructTraceMap[13][12] = -{ - "FRAME", "TOP", "BOT", "TOP_BOT", - "BOT_TOP", "TOP_BOT_TOP", "BOT_TOP_BOT", "FRAME_x2", - "FRAME_x3", "TOP_PREVBOT", "BOT_PREVTOP", "TOP_NEXTBOT", - "BOT_NEXTTOP" -}; - -const char ScanTypeTraceMap[4][12] = -{ - "INTERLACED", "PROGRESSIVE", "UNKNOWN", "RESERVED" -}; - -const char SliceTypeTraceMap[4][2] = -{ - "B", "P", "I", "?" -}; - -const char* RPLTraceMap::operator[] (const RefPic& r) -{ -#ifdef __GNUC__ - sprintf -#else - sprintf_s -#endif - (m_buf, "POC: %4d LT: %d Used: %d Lost: %d", r.POC, r.long_term, r.used, r.lost); - return m_buf; -} - -const char PredModeTraceMap[3][6] = -{ - "INTER", "INTRA", "SKIP" -}; - -const char PartModeTraceMap[8][12] = -{ - "PART_2Nx2N", - "PART_2NxN", - "PART_Nx2N", - "PART_NxN", - "PART_2NxnU", - "PART_2NxnD", - "PART_nLx2N", - "PART_nRx2N" -}; - -const char IntraPredModeTraceMap[35][9] = -{ - "Planar", "DC", - "225\xF8", "230.625\xF8", "236.25\xF8", "241.875\xF8", "247.5\xF8", "253.125\xF8", "258.75\xF8", "264.375\xF8", - "270\xF8", "275.625\xF8", "281.25\xF8", "286.875\xF8", "292.5\xF8", "298.125\xF8", "303.75\xF8", "309.375\xF8", - "315\xF8", "320.625\xF8", "326.25\xF8", "331.875\xF8", "337.5\xF8", "343.125\xF8", "348.75\xF8", "354.375\xF8", - "0\xF8", "5.625\xF8", "11.25\xF8", " 16.875\xF8", "22.5\xF8", "28.125\xF8", "33.75\xF8", "39.375\xF8", - "45\xF8" -}; - -const char SAOTypeTraceMap[3][5] = -{ - "N/A", "Band", "Edge" -}; - -const char EOClassTraceMap[4][5] = -{ - "0\xF8", "90\xF8", "135\xF8", "45\xF8" -}; - - -}; diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac.cpp deleted file mode 100644 index 997f094..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac.cpp +++ /dev/null @@ -1,577 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc_cabac.h" - -using namespace BS_HEVC; - -HEVC_CABAC::HEVC_CABAC() - : m_decPar(0) - , m_lastGreater1Ctx(0) - , m_ctxSet(0) - , m_pCtx(NULL) - , m_cAbsLevel(0) - , m_cRiceParam(0) - , m_cSBIdx(-1) - , ivlCurrRange(510) - , ivlOffset(0) -{ - memset(CtxState, 0, sizeof(CtxState)); - initBins(); - -#ifdef HEVC_CABAC_STATE_TRACE - m_cnt = 0; - m_n = 0; - flog = fopen(HEVC_CABAC_STATE_TRACE, "w"); -#endif //HEVC_CABAC_STATE_TRACE -}; - -void HEVC_CABAC::initBins(){ - //m_binFL1.clear(); - m_binFL1.push_back(Bin(0,1)); - m_binFL1.push_back(Bin(1,1)); - - //m_binFL3.clear(); - m_binFL3.push_back(Bin(0,2)); - m_binFL3.push_back(Bin(1,2)); - m_binFL3.push_back(Bin(2,2)); - m_binFL3.push_back(Bin(3,2)); - - //m_binFL31.clear(); - for(Bs32u synVal = 0; synVal <= 31; synVal++) - m_binFL31.push_back(Bin(synVal, 5)); - - for(Bs32u cMax = 0; cMax < binTRx0Size; cMax++){ - for(Bs32u synVal = 0; synVal <= cMax; synVal++) - m_binTRx0[cMax].push_back(TR(synVal, cMax, 0)); - } - - //m_binICPM.clear(); - m_binICPM.push_back(Bin(4, 3)); - m_binICPM.push_back(Bin(5, 3)); - m_binICPM.push_back(Bin(6, 3)); - m_binICPM.push_back(Bin(7, 3)); - m_binICPM.push_back(Bin(0, 1)); - - //m_binIPIDC0.clear(); - m_binIPIDC0.push_back(Bin(0, 2)); - m_binIPIDC0.push_back(Bin(1, 2)); - m_binIPIDC0.push_back(Bin(1, 1)); -} - -#define Clip3(_min, _max, _x) BS_MIN(BS_MAX(_min, _x), _max) - -void HEVC_CABAC::init_ctx(){ - Slice& slice = *m_pCtx->slice; - Bs16u initType = 0; - Bs16u SliceQpY = 26 + slice.pps->init_qp_minus26 + slice.slice_qp_delta; - - if( slice.type == I ) - initType = 0; - else if( slice.type == P ) - initType = slice.cabac_init_flag ? 2 : 1; - else - initType = slice.cabac_init_flag ? 1 : 2; - - for(Bs16u idx = 0; idx < CtxTblSize; idx++){ - Bs16s initValue = CtxInitTbl[initType][idx]; - Bs16s m = (initValue >> 4) * 5 - 45; - Bs16s n = ( (initValue & 15) << 3 ) - 16; - Bs16s preCtxState = Clip3( 1, 126, ( ( m * Clip3( 0, 51, SliceQpY ) ) >> 4 ) + n ); - Bs8u valMps = ( preCtxState <= 63 ) ? 0 : 1; - CtxState[idx] = ((valMps ? ( preCtxState - 64 ) : ( 63 - preCtxState )) << 1) | valMps; - } -} - -void HEVC_CABAC::init_ade(){ - ivlCurrRange = 510; - ivlOffset = read_bits(9); -} - -HEVC_CABAC::Bin HEVC_CABAC::TR(Bs32s synVal, Bs32u cMax, Bs32u cRiceParam){ - Bin bin(0, 0); - Bs32u prefixVal = synVal >> cRiceParam; - Bs32u suffixVal = synVal - ( ( prefixVal ) << cRiceParam ); - Bs32u cLen = (cMax >> cRiceParam); - - if(prefixVal < cLen){ - bin.put(0xFFFFFFFF, prefixVal); - bin.put(0); - } else { - bin.put(0xFFFFFFFF, cLen); - } - if(cRiceParam && cMax > (Bs32u)synVal) - bin.put(suffixVal, cRiceParam); - - return bin; -} - -HEVC_CABAC::Bin HEVC_CABAC::EGk(Bs32s synVal, Bs32u k){ - Bin bin(0, 0); - Bs32u absV = BS_ABS(synVal); - Bs8u stopLoop = 0; - - do { - if( absV >= Bs32u( 1 << k ) ) { - bin.put( 1 ); - absV = absV - ( 1 << k ); - k++; - } else { - bin.put( 0 ); - while( k-- ) - bin.put( ( absV >> k ) & 1 ); - stopLoop = 1; - } - } while( !stopLoop ); - - return bin; -} - -HEVC_CABAC::Bin HEVC_CABAC::FL(Bs32s synVal, Bs32u cMax){ - Bs32u fixedLength = CeilLog2( cMax + 1 ); - Bin bin(synVal, fixedLength); - return bin; -} - -HEVC_CABAC::Bins& HEVC_CABAC::PartModeBin(bool isIntra, Bs32u log2CbSize){ - Bins& b = m_binDefault; - SPS& sps = *m_pCtx->slice->sps; - - b.clear(); - b.push_back(Bin(1, 1)); - - if(isIntra){ - b.push_back(Bin(0, 1)); - } else { - bool isMinSz = (log2CbSize == (sps.log2_min_luma_coding_block_size_minus3 + 3)); - - if(!isMinSz && sps.amp_enabled_flag){ - b.push_back(Bin(3, 3)); - } else { - b.push_back(Bin(1, 2)); - } - - if( (isMinSz && log2CbSize == 3) - || (!isMinSz && !sps.amp_enabled_flag)){ - b.push_back(Bin(0, 2)); - } else { - b.push_back(Bin(1, 3)); - } - if(isMinSz && log2CbSize > 3){ - b.push_back(Bin(0, 3)); - } else { - b.push_back(Bin(0xFF, 16));//invalid - } - b.push_back(Bin(4, 4)); - b.push_back(Bin(5, 4)); - b.push_back(Bin(0, 4)); - b.push_back(Bin(1, 4)); - } - - return b; -} - -HEVC_CABAC::Bins& HEVC_CABAC::CUQPDAbsBin (){ - Bins& b = m_binDefault; - Bs32s maxVal = 26 + ((6 * m_pCtx->slice->sps->bit_depth_luma_minus8) / 2); - - b.clear(); - - for(Bs32s i = 0; i <= maxVal; i++){ - Bs32u val = BS_MIN(i, 5); - b.push_back( TR( val, 5, 0 ) ); - - if(val > 4){ - val = i - 5; - Bin suffix = EGk(val, 0); - b.back().put(suffix.get(), suffix.n); - } - } - - return b; -} - -Bs32u HEVC_CABAC::decCAbsLvlR(Bs32s i, Bs32s baseLevel){ - Bs32u synVal = 0; - Bin v(0,0); - - if(i != m_cSBIdx){ - m_cAbsLevel = 0; - m_cRiceParam = 0; - m_cSBIdx = i; - } - - m_cRiceParam = BS_MIN( m_cRiceParam + ( m_cAbsLevel > ( 3 * ( 1 << m_cRiceParam ) ) ? 1 : 0 ), 4 ); - Bs32u cMax = (4 << m_cRiceParam); - - while(v.n <= Bin::capacity){ - Bin b = TR( BS_MIN(cMax, synVal), cMax, m_cRiceParam ); - - if(b.n == 4 && b.get() == 0x0F){ - Bin suffix = EGk( synVal - cMax, m_cRiceParam + 1); - b.put(suffix.get(), suffix.n); - } - - while(v.n < b.n){ - v.put(DecodeBypass()); - } - - if(v.get() == b.get()){ - m_cAbsLevel = baseLevel + synVal; - return synVal; - } - - synVal ++; - } - - return last_err = BS_ERR_UNKNOWN; -} - -Bs32u HEVC_CABAC::decAbsMvdMinus2(){ - Bin v(0,0); - - for(Bs32u synVal = 0; synVal <= ((1<<15) - 2); synVal++){ - Bin b = EGk(synVal, 1); - - while(v.n < b.n) - v.put(DecodeBypass()); - - if(v.get() == b.get()) - return synVal; - } - - return last_err = BS_ERR_UNKNOWN; -} - -#define FL1(_bins, _val, _cmax) _bins.clear(); _bins.push_back( FL(_val, _cmax) ); -#define FL_FLAG(_bins) _bins.clear(); FL1(_bins, 0, 1); FL1(_bins, 1, 1); -#define FL_RANGE(_bins, _max) _bins.clear(); for(Bs32s _i = 0; _i <= (_max); _i++){ _bins.push_back( FL(_i, (_max)) ); } -#define TR_RANGE(_bins, _max, _rice) _bins.clear(); for(Bs32s _i = 0; _i <= (_max); _i++){ _bins.push_back( TR(_i, (_max), (_rice)) ); } -#define EGK_RANGE(_bins, _max, _k) _bins.clear(); for(Bs32s _i = 0; _i <= (_max); _i++){ _bins.push_back( EGk(_i, (_k)) ); } -#define TR_RANGE0(_bins, _max) if((Bs32s)(_max) < (Bs32s)binTRx0Size){ return m_binTRx0[(_max)]; } TR_RANGE(_bins, _max, 0) - -HEVC_CABAC::Bins& HEVC_CABAC::GetBinarization(Bs16u se){ - Bins& b = m_binDefault; - - switch(se){ - case END_OF_SLICE_SEGMENT_FLAG : - case SAO_MERGE_LEFT_FLAG : - /* = SAO_MERGE_UP_FLAG */ - case SAO_OFFSET_SIGN : - case SPLIT_CU_FLAG : - case CU_TRANSQUANT_BYPASS_FLAG : - case CU_SKIP_FLAG : - case PRED_MODE_FLAG : - case PCM_FLAG : - case RQT_ROOT_CBF : - case PREV_INTRA_LUMA_PRED_FLAG : - case MERGE_FLAG : - case MVP_LX_FLAG : - case SPLIT_TRANSFORM_FLAG : - case CBF_LUMA : - case CBF_CX : - case ABS_MVD_GREATER0_FLAG : - case ABS_MVD_GREATER1_FLAG : - case MVD_SIGN_FLAG : - case CU_QP_DELTA_SIGN_FLAG : - case TRANSFORM_SKIP_FLAG0 : - case TRANSFORM_SKIP_FLAG1 : - case CODED_SUB_BLOCK_FLAG : - case SIG_COEFF_FLAG : - case COEFF_ABS_LEVEL_GREATER1_FLAG : - case COEFF_ABS_LEVEL_GREATER2_FLAG : - case COEFF_SIGN_FLAG : return m_binFL1; - case SAO_EO_CLASS_LUMA : - /* = SAO_EO_CLASS_CHROMA */ return m_binFL3; - case SAO_TYPE_IDX_LUMA : - /* = SAO_TYPE_IDX_CHROMA */ - case MPM_IDX : return m_binTRx0[2]; - case SAO_BAND_POSITION : - case REM_INTRA_LUMA_PRED_MODE : return m_binFL31; - case INTRA_CHROMA_PRED_MODE : return m_binICPM; - case INTER_PRED_IDC : return (m_decPar&1) ? m_binFL1 : m_binIPIDC0; //9.3.3.7 m_decPar = (( nPbW + nPbH ) == 12) - case SAO_OFFSET_ABS : TR_RANGE0(b, ( 1 << ( BS_MIN( m_decPar/*bitDepth*/, 10 ) - 5 ) ) - 1); break; - case MERGE_IDX : TR_RANGE0(b, m_decPar/*MaxNumMergeCand*/ - 1); break; - case REF_IDX_LX : TR_RANGE0(b, m_decPar/*num_ref_idx_lx_active_minus1*/); break; - case ABS_MVD_MINUS2 : EGK_RANGE(b, (1<<15) - 2, 1); break; - case LAST_SIG_COEFF_X_PREFIX : TR_RANGE0(b, ((m_decPar>>2)/*log2TrafoSize*/<<1) - 1); break; - case LAST_SIG_COEFF_Y_PREFIX : TR_RANGE0(b, ((m_decPar>>2)/*log2TrafoSize*/<<1) - 1); break; - case LAST_SIG_COEFF_X_SUFFIX : FL_RANGE(b, (1<<((m_decPar/*last_sig_coeff_x_prefix*/>>1) - 1)) - 1); break; - case LAST_SIG_COEFF_Y_SUFFIX : FL_RANGE(b, (1<<((m_decPar/*last_sig_coeff_y_prefix*/>>1) - 1)) - 1); break; - case PART_MODE : return PartModeBin(!!(m_decPar&1), (m_decPar>>1)); //9.3.3.5 ( xCb, yCb ) = ( x0, y0), log2CbSize - case CU_QP_DELTA_ABS : return CUQPDAbsBin(); //9.3.3.8 - //case COEFF_ABS_LEVEL_REMAINING : return CAbsLvlRBin( (m_decPar>>2), (m_decPar&3) ); //9.3.3.9 current sub-block scan index i, baseLevel - case END_OF_SUB_STREAM_ONE_BIT : FL1(b, 1, 1); break; - default: - last_err = BS_ERR_NOT_IMPLEMENTED; - } - - return b; -}; - -Bs8s HEVC_CABAC::ctxInc(Bs16u se, Bs16u binIdx){ - Bs8s inc = CtxIncTbl[se][BS_MIN(binIdx, 5)]; - - if(EXTERNAL == inc){ - switch(se){ - case SPLIT_CU_FLAG : - case CU_SKIP_FLAG : { - Bs16u x0 = Bs16u(m_decPar&0xFFFF); - Bs16u y0 = Bs16u(m_decPar >> 16); - bool availableL = m_pCtx->zAvailableN( x0, y0, x0 - 1, y0 ); - bool availableA = m_pCtx->zAvailableN( x0, y0, x0, y0 - 1 ); - - if(se == SPLIT_CU_FLAG){ - CQT* c0 = m_pCtx->get(x0, y0); - return (( availableL && (m_pCtx->get(x0 - 1, y0)->CtDepth > c0->CtDepth) ) - + ( availableA && (m_pCtx->get(x0, y0 - 1)->CtDepth > c0->CtDepth) )); - } else /*if(se == CU_SKIP_FLAG)*/{ - return (( availableL && (m_pCtx->get(x0 - 1, y0)->cu_skip_flag) ) - + ( availableA && (m_pCtx->get(x0, y0 - 1)->cu_skip_flag) )); - } - } - case PART_MODE : - return (3 - (/*log2CbSize*/(m_decPar>>1) == m_pCtx->MinCbLog2SizeY)); - case INTER_PRED_IDC : - return (m_decPar&1) ? 4 : (m_decPar>>1); - //return ERROR; //( nPbW + nPbH ) != 12 ? CtDepth[ x0 ][ y0 ] : 4 - case SPLIT_TRANSFORM_FLAG : - return (5 - m_decPar/*log2TrafoSize*/); - case CBF_LUMA : - return !m_decPar/*trafoDepth*/; - case CBF_CX : - return BS_MIN(m_decPar/*trafoDepth*/,5); - case LAST_SIG_COEFF_X_PREFIX : - case LAST_SIG_COEFF_Y_PREFIX : { - //9.3.4.2.3 - Bs32u cIdx = (m_decPar & 3); - Bs32u log2TrafoSize = (m_decPar>>2); - if(!cIdx) - return ( binIdx >> (( log2TrafoSize + 1 ) >> 2) ) + ( 3 * ( log2TrafoSize - 2 ) + ( ( log2TrafoSize - 1 ) >> 2 ) ); - return ( binIdx >> ( log2TrafoSize - 2 ) ) + 15; - } - case CODED_SUB_BLOCK_FLAG : - case SIG_COEFF_FLAG : return m_decPar; - case COEFF_ABS_LEVEL_GREATER1_FLAG :{ - //9.3.4.2.6 - Bs16u i = (m_decPar&15); - //Bs16u n = ((m_decPar>>4)&15); - Bs16u cIdx = ((m_decPar>>8)&3); - bool is1stSB = ((m_decPar>>10)&1); - bool is1stTB = ((m_decPar>>11)&1); - bool lastGreater1Flag = ((m_decPar>>12)&1); - Bs16u lastGreater1Ctx = 0; - - if(is1stSB){ - m_ctxSet = 0; - if(i && !cIdx){ - m_ctxSet = 2; - } - if(is1stTB){ - lastGreater1Ctx = 1; - } else { - lastGreater1Ctx = m_lastGreater1Ctx; - if(lastGreater1Ctx){ - if(lastGreater1Flag){ - lastGreater1Ctx = 0; - } else { - lastGreater1Ctx ++; - } - } - } - m_ctxSet += (lastGreater1Ctx == 0); - m_lastGreater1Ctx = 1; - } else { - if(m_lastGreater1Ctx){ - if(lastGreater1Flag){ - m_lastGreater1Ctx = 0; - } else { - m_lastGreater1Ctx ++; - } - } - } - return (( m_ctxSet * 4 ) + BS_MIN( 3, m_lastGreater1Ctx ) + 16 * !!cIdx); - } - case COEFF_ABS_LEVEL_GREATER2_FLAG : - //9.3.4.2.7 - //Bs16u cIdx = m_decPar&3; - return (m_ctxSet + 4 * !!m_decPar); - default: return ERROR; - } - } - - return inc; -} - -Bs8u HEVC_CABAC::DecodeDecision(Bs8u* ctxTable, Bs16u ctxIdx){ - Bs8u pStateIdx = (ctxTable[ctxIdx] >> 1); - Bs8u valMps = (ctxTable[ctxIdx] & 1); - Bs8u qRangeIdx = ((ivlCurrRange >> 6) & 3); - Bs8u ivlLpsRange = rangeTabLpsT[ qRangeIdx ][ pStateIdx ]; - Bs8u binVal = 0; - - ivlCurrRange -= ivlLpsRange; - - if(ivlOffset >= ivlCurrRange){ - binVal = !valMps; - ivlOffset -= ivlCurrRange; - ivlCurrRange = ivlLpsRange; - - if( pStateIdx == 0 ) - valMps = !valMps; - - pStateIdx = transIdxLps[pStateIdx]; - } else { - binVal = valMps; - pStateIdx = transIdxMps[pStateIdx]; - } - -#ifdef HEVC_CABAC_STATE_TRACE - fprintf(flog, "%3d -> %3d;\n", /*ctxIdx,*/ ctxTable[ctxIdx], ((pStateIdx << 1) | valMps)); - fflush(flog); -#endif // HEVC_CABAC_STATE_TRACE - - ctxTable[ctxIdx] = ((pStateIdx << 1) | valMps); - - RenormD(); - - trace(binVal); - - return binVal; -} - -Bs8u HEVC_CABAC::DecodeBypass(){ - ivlOffset = ((ivlOffset << 1) | read_1_bit()); - m_pCtx->RawBits ++; - - if(ivlOffset >= ivlCurrRange){ - ivlOffset -= ivlCurrRange; - trace(1); - return 1; - } - - trace(0); - return 0; -} - - -Bs8u HEVC_CABAC::DecodeTerminate(){ - ivlCurrRange -= 2; - - if(ivlOffset >= ivlCurrRange){ - trace(1); - return 1; - } - - RenormD(); - - trace(0); - return 0; -} - - -Bs8u HEVC_CABAC::DecodeBin(Bs8u* ctxTable, Bs16u ctxIdx, bool bypassFlag){ - if(bypassFlag) - return DecodeBypass(); - - if(ctxTable == 0) - return DecodeTerminate(); - - return DecodeDecision( ctxTable, ctxIdx ); -} - - Bs32u HEVC_CABAC::ae( Bs16u se, Bs32s par) { - m_decPar = par; - - if(se == COEFF_ABS_LEVEL_REMAINING) - return decCAbsLvlR( (m_decPar>>2), (m_decPar&3) ); - else if(se == ABS_MVD_MINUS2) - return decAbsMvdMinus2(); - - Bin v(0,0); - Bins& b = GetBinarization(se); - Bins::iterator it, begin = b.begin(), end = b.end(); - Bs32u synValBase = 0; - - for(Bs32s binIdx = 0; binIdx <= Bin::capacity; binIdx++){ - Bs32u synValInc = 0; - Bs8s inc = ctxInc(se, binIdx); - - switch(inc){ - case ERROR: - last_err = BS_ERR_UNKNOWN; - return -1; - case BYPASS: - v.put(DecodeBypass()); - break; - case TERMINATE: - v.put(DecodeTerminate()); - break; - default: - v.put(DecodeDecision(CtxState+idxStart(se), inc)); - break; - } - - it = begin; - while(it != end && it->n < v.n){ it++; synValBase++; } - begin = it; - while(it != end && !(it->n == v.n && it->b.to_ulong() == v.b.to_ulong())){ it++; synValInc++; } - - if(end != it){ - return synValBase + synValInc; - } - } - - last_err = BS_ERR_UNKNOWN; - return -2; - } - -void HEVC_CABAC::Init(SDecCtx& ctx, Bs32s CtbAddrInRs){ - m_pCtx = &ctx; - Bs16u CtbAddrInTs = ctx.CtbAddrRsToTs[CtbAddrInRs]; - - if( CtbAddrInTs && ctx.TileId[CtbAddrInTs] != ctx.TileId[CtbAddrInTs-1] ){ //first coding tree unit in a tile - init_ctx(); - } else if(m_pCtx->slice->pps->entropy_coding_sync_enabled_flag && 0 == (CtbAddrInRs % m_pCtx->PicWidthInCtbsY) ){ - Bs16s x0 = ( CtbAddrInRs % m_pCtx->PicWidthInCtbsY ) << m_pCtx->CtbLog2SizeY; - Bs16s y0 = ( CtbAddrInRs / m_pCtx->PicWidthInCtbsY ) << m_pCtx->CtbLog2SizeY; - - if( m_pCtx->zAvailableN(x0, y0, x0 + m_pCtx->CtbLog2SizeY, y0 - m_pCtx->CtbLog2SizeY) ){ - sync(CtxStateWpp); - } else { - init_ctx(); - } - } else if(m_pCtx->slice->dependent_slice_segment_flag && CtbAddrInRs == (Bs32s)m_pCtx->slice->segment_address){ - sync(CtxStateDs); - } else { - init_ctx(); - } - init_ade(); -} - -void HEVC_CABAC::Store(bool is2ndCtuInRow, bool endOfSliceSegment){ - if(is2ndCtuInRow && m_pCtx->slice->pps->entropy_coding_sync_enabled_flag){ - store(CtxStateWpp); - } - - if(m_pCtx->slice->pps->dependent_slice_segments_enabled_flag && endOfSliceSegment){ - store(CtxStateDs); - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac_tables.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac_tables.cpp deleted file mode 100644 index 9e39045..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_cabac_tables.cpp +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc_cabac.h" - -namespace BS_HEVC -{ - -const Bs8u CtxOffset[num_SE+1] = { -/*SAO_MERGE_LEFT_FLAG */ 0, -/*SAO_TYPE_IDX_LUMA */ 1, -/*SPLIT_CU_FLAG */ 2, -/*CU_TRANSQUANT_BYPASS_FLAG */ 5, -/*CU_SKIP_FLAG */ 6, -/*PRED_MODE_FLAG */ 9, -/*PART_MODE */ 10, -/*PREV_INTRA_LUMA_PRED_FLAG */ 14, -/*INTRA_CHROMA_PRED_MODE */ 15, -/*RQT_ROOT_CBF */ 16, -/*MERGE_FLAG */ 17, -/*MERGE_IDX */ 18, -/*INTER_PRED_IDC */ 19, -/*REF_IDX_LX */ 24, -/*MVP_LX_FLAG */ 26, -/*SPLIT_TRANSFORM_FLAG */ 27, -/*CBF_LUMA */ 30, -/*CBF_CX */ 32, -/*ABS_MVD_GREATER0_FLAG */ 36 + 1, -/*ABS_MVD_GREATER1_FLAG */ 37 + 1, -/*CU_QP_DELTA_ABS */ 38 + 1, -/*TRANSFORM_SKIP_FLAG0 */ 40 + 1, -/*TRANSFORM_SKIP_FLAG1 */ 41 + 1, -/*LAST_SIG_COEFF_X_PREFIX */ 42 + 1, -/*LAST_SIG_COEFF_Y_PREFIX */ 60 + 1, -/*CODED_SUB_BLOCK_FLAG */ 78 + 1, -/*SIG_COEFF_FLAG */ 82 + 1, -/*COEFF_ABS_LEVEL_GREATER1_FLAG*/ 124 + 1 + 2, -/*COEFF_ABS_LEVEL_GREATER2_FLAG*/ 148 + 1 + 2, -/*CU_CHROMA_QP_OFFSET_FLAG */ 154 + 1 + 2, -/*CU_CHROMA_QP_OFFSET_IDX */ 155 + 1 + 2, -/*LOG2_RES_SCALE_ABS_PLUS1 */ 156 + 1 + 2, -/*RES_SCALE_SIGN_FLAG */ 164 + 1 + 2, -/*EXPLICIT_RDPCM_FLAG */ 166 + 1 + 2, -/*EXPLICIT_RDPCM_DIR_FLAG */ 168 + 1 + 2, -/*PALETTE_MODE_FLAG */170 + 1 + 2, -/*TU_RESIDUAL_ACT_FLAG */171 + 1 + 2, -/*PALETTE_RUN_PREFIX */172 + 1 + 2, -/*COPY_ABOVE_PALETTE_INDICES_FLAG */180 + 1 + 2, -/*COPY_ABOVE_INDICES_FOR_FINAL_RUN_FLAG*/180 + 1 + 2, -/*PALETTE_TRANSPOSE_FLAG */181 + 1 + 2, -/* */ CtxTblSize -}; - -const Bs8u CtxInitTbl[3][CtxTblSize] = -{ - { - 12 + 141, 59 + 141, 88 + 51, 39 + 102, 99 + 58, 98 + 56, 140 + 14, 91 + 63, 36 + 118, 101 + 53, - 113 + 71, 145 + 9, 46 + 108, 80 + 74, 120 + 64, 40 + 23, 25 + 129, 128 + 26, 71 + 83, 141 + 13, - 29 + 125, 5 + 149, 118 + 36, 152 + 2, 17 + 137, 43 + 111, 85 + 69, 83 + 70, 114 + 24, 121 + 17, - 89 + 22, 111 + 30, 17 + 77, 9 + 129, 39 + 143, 33 + 121, 90 + 64, 140 + 14, 127 + 27, 126 + 28, - 88 + 66, 10 + 129, 61 + 78, 49 + 61, 30 + 80, 41 + 83, 61 + 64, 4 + 136, 116 + 37, 95 + 30, - 125 + 2, 6 + 134, 75 + 34, 31 + 80, 32 + 111, 67 + 60, 2 + 109, 62 + 17, 93 + 15, 57 + 66, - 31 + 32, 28 + 82, 99 + 11, 30 + 94, 1 + 124, 113 + 27, 26 + 127, 49 + 76, 108 + 19, 14 + 126, - 25 + 84, 67 + 44, 113 + 30, 41 + 86, 97 + 14, 23 + 56, 100 + 8, 103 + 20, 36 + 27, 9 + 82, - 109 + 62, 16 + 118, 92 + 49, 64 + 47, 70 + 41, 3 + 122, 85 + 25, 55 + 55, 74 + 20, 85 + 39, - 91 + 17, 55 + 69, 62 + 45, 58 + 67, 138 + 3, 76 + 103, 138 + 15, 73 + 52, 3 + 104, 14 + 111, - 129 + 12, 57 + 122, 11 + 142, 102 + 23, 21 + 86, 88 + 37, 15 + 126, 165 + 14, 148 + 5, 8 + 117, - 90 + 50, 32 + 107, 141 + 41, 122 + 60, 8 + 144, 63 + 73, 12 + 140, 20 + 116, 109 + 44, 119 + 17, - 86 + 53, 97 + 14, 107 + 29, 109 + 30, 105 + 6, 85 + 56, 106 + 5, 51 + 89, 10 + 82, 97 + 40, - 32 + 106, 137 + 3, 62 + 90, 22 + 116, 21 + 118, 73 + 80, 28 + 46, 116 + 33, 2 + 90, 32 + 107, - 57 + 50, 20 + 102, 28 + 124, 55 + 85, 66 + 113, 55 + 111, 51 + 131, 46 + 94, 79 + 148, 5 + 117, - 16 + 181, 79 + 59, 111 + 42, 54 + 82, 56 + 111, 120 + 32, 45 + 107, 5 + 149, 56 + 98, 128 + 26, - 125 + 29, 141 + 13, 142 + 12, 73 + 81, 62 + 92, 42 + 112, 125 + 29, 21 + 133, 98 + 56, 103 + 36, - 25 + 114, 34 + 105, 57 + 82, 76 + 78, 111 + 43, 27 + 127, 80 + 74, 135 + 19, 76 + 78, 121 + 33, - 4 + 150, 129 + 25, 141 + 13, 139 + 15, 38 + 116 - }, - { - 99 + 54, 181 + 4, 106 + 1, 3 + 136, 105 + 21, 133 + 21, 196 + 1, 92 + 93, 168 + 33, 5 + 144, - 143 + 11, 78 + 61, 46 + 108, 12 + 142, 110 + 44, 89 + 63, 5 + 74, 47 + 63, 74 + 48, 29 + 66, - 63 + 16, 21 + 42, 15 + 16, 15 + 16, 54 + 99, 89 + 64, 1 + 167, 102 + 22, 102 + 36, 11 + 83, - 65 + 88, 106 + 5, 94 + 55, 87 + 20, 81 + 86, 83 + 71, 132 + 22, 41 + 99, 10 + 188, 101 + 53, - 60 + 94, 95 + 44, 6 + 133, 34 + 91, 14 + 96, 13 + 81, 62 + 48, 59 + 36, 20 + 59, 124 + 1, - 93 + 18, 20 + 90, 36 + 42, 84 + 26, 33 + 78, 52 + 59, 82 + 13, 57 + 37, 31 + 77, 56 + 67, - 47 + 61, 124 + 1, 61 + 49, 27 + 67, 20 + 90, 0 + 95, 9 + 70, 51 + 74, 82 + 29, 103 + 7, - 74 + 4, 98 + 12, 30 + 81, 80 + 31, 92 + 3, 74 + 20, 91 + 17, 46 + 77, 28 + 80, 20 + 101, - 96 + 44, 17 + 44, 87 + 67, 5 + 150, 149 + 5, 138 + 1, 40 + 113, 115 + 24, 103 + 20, 45 + 78, - 59 + 4, 136 + 17, 7 + 159, 96 + 87, 124 + 16, 86 + 50, 5 + 148, 67 + 87, 71 + 95, 12 + 171, - 109 + 31, 92 + 44, 66 + 87, 80 + 74, 162 + 4, 102 + 81, 125 + 15, 98 + 38, 97 + 56, 115 + 39, - 35 + 135, 150 + 3, 44 + 79, 65 + 58, 55 + 52, 76 + 45, 71 + 36, 111 + 10, 105 + 62, 105 + 46, - 54 + 129, 75 + 65, 89 + 62, 143 + 40, 92 + 48, 105 + 35, 89 + 51, 17 + 137, 91 + 105, 89 + 107, - 45 + 122, 89 + 65, 118 + 34, 73 + 94, 116 + 66, 103 + 79, 27 + 107, 83 + 66, 87 + 49, 132 + 21, - 119 + 2, 89 + 47, 94 + 43, 40 + 129, 50 + 144, 86 + 80, 74 + 93, 96 + 58, 108 + 59, 56 + 81, - 133 + 49, 38 + 69, 22 + 145, 32 + 59, 16 + 106, 88 + 19, 96 + 71, 29 + 125, 151 + 3, 92 + 62, - 135 + 19, 58 + 96, 30 + 124, 117 + 37, 66 + 88, 50 + 104, 111 + 43, 27 + 127, 98 + 56, 100 + 39, - 111 + 28, 120 + 19, 50 + 89, 49 + 105, 59 + 95, 81 + 73, 137 + 17, 97 + 57, 24 + 130, 118 + 36, - 33 + 121, 132 + 22, 71 + 83, 47 + 107, 109 + 45 - }, - { - 61 + 92, 48 + 112, 89 + 18, 73 + 66, 12 + 114, 49 + 105, 129 + 68, 127 + 58, 81 + 120, 17 + 117, - 153 + 1, 133 + 6, 105 + 49, 27 + 127, 119 + 64, 64 + 88, 60 + 19, 34 + 120, 43 + 94, 35 + 60, - 55 + 24, 50 + 13, 19 + 12, 12 + 19, 73 + 80, 9 + 144, 18 + 150, 160 + 64, 39 + 128, 88 + 34, - 73 + 80, 98 + 13, 32 + 117, 34 + 58, 10 + 157, 25 + 129, 140 + 14, 100 + 69, 48 + 150, 68 + 86, - 50 + 104, 83 + 56, 38 + 101, 88 + 37, 53 + 57, 51 + 73, 30 + 80, 49 + 46, 36 + 58, 2 + 123, - 52 + 59, 90 + 21, 58 + 21, 124 + 1, 115 + 11, 108 + 3, 6 + 105, 36 + 43, 64 + 44, 16 + 107, - 80 + 13, 44 + 81, 59 + 51, 67 + 57, 29 + 81, 46 + 49, 10 + 84, 83 + 42, 88 + 23, 82 + 29, - 62 + 17, 6 + 119, 123 + 3, 10 + 101, 56 + 55, 44 + 35, 33 + 75, 73 + 50, 54 + 39, 79 + 42, - 135 + 5, 55 + 6, 83 + 71, 150 + 20, 54 + 100, 41 + 98, 111 + 42, 18 + 121, 39 + 84, 65 + 58, - 21 + 42, 31 + 93, 127 + 39, 114 + 69, 98 + 42, 33 + 103, 130 + 23, 121 + 33, 133 + 33, 104 + 79, - 131 + 9, 60 + 76, 131 + 22, 128 + 26, 135 + 31, 172 + 11, 5 + 135, 113 + 23, 102 + 51, 115 + 39, - 69 + 101, 0 + 153, 73 + 65, 23 + 115, 102 + 20, 17 + 104, 20 + 102, 60 + 61, 140 + 27, 7 + 144, - 27 + 156, 99 + 41, 122 + 29, 73 + 110, 85 + 55, 113 + 27, 93 + 47, 47 + 107, 165 + 31, 56 + 111, - 38 + 129, 87 + 67, 128 + 24, 9 + 158, 162 + 20, 136 + 46, 120 + 14, 62 + 87, 33 + 103, 6 + 147, - 0 + 121, 61 + 75, 9 + 113, 120 + 49, 169 + 39, 37 + 129, 22 + 145, 143 + 11, 146 + 6, 162 + 5, - 65 + 117, 17 + 90, 122 + 45, 80 + 11, 27 + 80, 51 + 56, 103 + 64, 21 + 133, 86 + 68, 26 + 128, - 105 + 49, 59 + 95, 115 + 39, 130 + 24, 150 + 4, 26 + 128, 99 + 55, 97 + 57, 44 + 110, 133 + 6, - 8 + 131, 133 + 6, 22 + 117, 116 + 38, 109 + 45, 16 + 138, 86 + 68, 53 + 101, 8 + 146, 72 + 82, - 15 + 139, 48 + 106, 6 + 148, 95 + 59, 2 + 152 - } -}; - -const Bs8s HEVC_CABAC::CtxIncTbl[num_SE_full][6] = { -/*SAO_MERGE_LEFT_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*SAO_TYPE_IDX_LUMA */ { 0, BYPASS, ERROR, ERROR, ERROR, ERROR }, -/*SPLIT_CU_FLAG */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CU_TRANSQUANT_BYPASS_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CU_SKIP_FLAG */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*PRED_MODE_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*PART_MODE */ { 0, 1, EXTERNAL, BYPASS, ERROR, ERROR }, -/*PREV_INTRA_LUMA_PRED_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*INTRA_CHROMA_PRED_MODE */ { 0, BYPASS, BYPASS, ERROR, ERROR, ERROR }, -/*RQT_ROOT_CBF */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*MERGE_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*MERGE_IDX */ { 0, BYPASS, BYPASS, BYPASS, ERROR, ERROR }, -/*INTER_PRED_IDC */ { EXTERNAL, 4, ERROR, ERROR, ERROR, ERROR }, -/*REF_IDX_LX */ { 0, 1, BYPASS, BYPASS, BYPASS, BYPASS }, -/*MVP_LX_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*SPLIT_TRANSFORM_FLAG */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CBF_LUMA */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CBF_CX */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*ABS_MVD_GREATER0_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*ABS_MVD_GREATER1_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CU_QP_DELTA_ABS */ { 0, 1, 1, 1, 1, BYPASS }, -/*TRANSFORM_SKIP_FLAG0 */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*TRANSFORM_SKIP_FLAG1 */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*LAST_SIG_COEFF_X_PREFIX */ { EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL }, -/*LAST_SIG_COEFF_Y_PREFIX */ { EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL }, -/*CODED_SUB_BLOCK_FLAG */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*SIG_COEFF_FLAG */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*COEFF_ABS_LEVEL_GREATER1_FLAG*/ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*COEFF_ABS_LEVEL_GREATER2_FLAG*/ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CU_QP_DELTA_ABS */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CU_QP_DELTA_ABS */ { 0, 0, 0, 0, 0, ERROR }, -/*LOG2_RES_SCALE_ABS_PLUS1 */ { EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, ERROR, ERROR }, -/*RES_SCALE_SIGN_FLAG */ { EXTERNAL, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*EXPLICIT_RDPCM_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*EXPLICIT_RDPCM_DIR_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*PALETTE_MODE_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*TU_RESIDUAL_ACT_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*PALETTE_RUN_PREFIX */ { EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL, EXTERNAL }, -/*COPY_ABOVE_PALETTE_INDICES_FL*/ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*COPY_ABOVE_INDICES_FOR_FINAL_*/ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*PALETTE_TRANSPOSE_FLAG */ { 0, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*END_OF_SLICE_SEGMENT_FLAG */ { TERMINATE, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*END_OF_SUB_STREAM_ONE_BIT */ { TERMINATE, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*SAO_OFFSET_ABS */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*SAO_OFFSET_SIGN */ { BYPASS, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*SAO_BAND_POSITION */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*SAO_EO_CLASS_LUMA */ { BYPASS, BYPASS, BYPASS, ERROR, ERROR, ERROR }, -/*MPM_IDX */ { BYPASS, BYPASS, ERROR, ERROR, ERROR, ERROR }, -/*REM_INTRA_LUMA_PRED_MODE */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*ABS_MVD_MINUS2 */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*MVD_SIGN_FLAG */ { BYPASS, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*CU_QP_DELTA_SIGN_FLAG */ { BYPASS, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*LAST_SIG_COEFF_X_SUFFIX */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*LAST_SIG_COEFF_Y_SUFFIX */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*COEFF_ABS_LEVEL_REMAINING */ { BYPASS, BYPASS, BYPASS, BYPASS, BYPASS, BYPASS }, -/*COEFF_SIGN_FLAG */ { BYPASS, ERROR, ERROR, ERROR, ERROR, ERROR }, -/*PCM_FLAG */ { TERMINATE, ERROR, ERROR, ERROR, ERROR, ERROR }, -}; - -const Bs8u rangeTabLpsT[4][64] = { - { 15 + 113, 100 + 28, 74 + 54, 6 + 117, 103 + 13, 57 + 54, 60 + 45, 24 + 76, 61 + 34, 81 + 9, 27 + 58, 1 + 80, 29 + 48, 29 + 44, 36 + 33, 62 + 4, 49 + 13, 52 + 7, 0 + 56, 24 + 29, 20 + 31, 4 + 44, 33 + 13, 2 + 41, 35 + 6, 14 + 25, 21 + 16, 20 + 15, 3 + 30, 24 + 8, 6 + 24, 1 + 28, 9 + 18, 10 + 16, 14 + 10, 8 + 15, 6 + 16, 8 + 13, 10 + 10, 7 + 12, 6 + 12, 16 + 1, 6 + 10, 10 + 5, 3 + 11, 2 + 12, 0 + 13, 3 + 9, 10 + 2, 7 + 4, 5 + 6, 7 + 3, 7 + 3, 8 + 1, 6 + 3, 0 + 8, 5 + 3, 2 + 5, 2 + 5, 4 + 3, 0 + 6, 4 + 2, 3 + 3, 0 + 2 }, - { 151 + 25, 125 + 42, 68 + 90, 50 + 100, 132 + 10, 77 + 58, 66 + 62, 94 + 28, 61 + 55, 42 + 68, 64 + 40, 7 + 92, 47 + 47, 52 + 37, 50 + 35, 72 + 8, 22 + 54, 13 + 59, 36 + 33, 31 + 34, 16 + 46, 57 + 2, 45 + 11, 39 + 14, 34 + 16, 30 + 18, 11 + 34, 7 + 36, 7 + 34, 25 + 14, 15 + 22, 11 + 24, 18 + 15, 18 + 13, 20 + 10, 23 + 5, 10 + 17, 4 + 22, 0 + 24, 20 + 3, 11 + 11, 6 + 15, 1 + 19, 4 + 15, 12 + 6, 6 + 11, 11 + 5, 5 + 10, 10 + 4, 2 + 12, 6 + 7, 4 + 8, 0 + 12, 9 + 2, 5 + 6, 1 + 9, 3 + 6, 3 + 6, 3 + 6, 4 + 4, 1 + 7, 6 + 1, 5 + 2, 0 + 2 }, - { 164 + 44, 117 + 80, 146 + 41, 92 + 86, 61 + 108, 136 + 24, 50 + 102, 111 + 33, 0 + 137, 105 + 25, 69 + 54, 75 + 42, 9 + 102, 68 + 37, 31 + 69, 65 + 30, 43 + 47, 62 + 24, 67 + 14, 34 + 43, 19 + 54, 22 + 47, 62 + 4, 46 + 17, 20 + 39, 9 + 47, 23 + 31, 40 + 11, 46 + 2, 8 + 38, 28 + 15, 2 + 39, 0 + 39, 4 + 33, 3 + 32, 31 + 2, 28 + 4, 8 + 22, 22 + 7, 25 + 2, 18 + 8, 23 + 2, 20 + 3, 20 + 2, 4 + 17, 8 + 12, 18 + 1, 8 + 10, 13 + 4, 13 + 3, 10 + 5, 5 + 10, 9 + 5, 2 + 11, 9 + 3, 1 + 11, 2 + 9, 8 + 3, 4 + 6, 4 + 6, 6 + 3, 4 + 5, 3 + 5, 1 + 1 }, - { 135 + 105, 102 + 125, 100 + 116, 145 + 60, 163 + 32, 157 + 28, 114 + 61, 24 + 142, 23 + 135, 63 + 87, 59 + 83, 99 + 36, 113 + 15, 25 + 97, 102 + 14, 60 + 50, 73 + 31, 79 + 20, 21 + 73, 0 + 89, 30 + 55, 32 + 48, 13 + 63, 65 + 7, 40 + 29, 20 + 45, 13 + 49, 51 + 8, 41 + 15, 33 + 20, 47 + 3, 1 + 47, 40 + 5, 25 + 18, 20 + 21, 38 + 1, 17 + 20, 2 + 33, 20 + 13, 14 + 17, 28 + 2, 11 + 17, 23 + 4, 23 + 2, 7 + 17, 13 + 10, 11 + 11, 7 + 14, 7 + 13, 7 + 12, 6 + 12, 1 + 16, 12 + 4, 7 + 8, 8 + 6, 0 + 14, 4 + 9, 6 + 6, 9 + 3, 5 + 6, 10 + 1, 5 + 5, 7 + 2, 0 + 2 }, -}; - -const Bs8u transIdxLps[64] = { - 104 - 104, 62 - 62, 0 + 1, 1 + 1, 0 + 2, 0 + 4, 0 + 4, 2 + 3, 3 + 3, 5 + 2, 0 + 8, 3 + 6, 3 + 6, 0 + 11, 10 + 1, 8 + 4, - 3 + 10, 1 + 12, 4 + 11, 7 + 8, 1 + 15, 2 + 14, 1 + 17, 3 + 15, 10 + 9, 2 + 17, 3 + 18, 10 + 11, 2 + 20, 18 + 4, 10 + 13, 14 + 10, - 4 + 20, 3 + 22, 21 + 5, 15 + 11, 14 + 13, 18 + 9, 15 + 13, 10 + 19, 2 + 27, 6 + 24, 27 + 3, 18 + 12, 15 + 16, 9 + 23, 5 + 27, 9 + 24, - 16 + 17, 22 + 11, 14 + 20, 0 + 34, 5 + 30, 31 + 4, 19 + 16, 27 + 9, 13 + 23, 16 + 20, 23 + 14, 19 + 18, 23 + 14, 30 + 8, 0 + 38, 43 + 20 -}; - -const Bs8u transIdxMps[64] = { - 0 + 1, 0 + 2, 0 + 3, 2 + 2, 2 + 3, 5 + 1, 2 + 5, 7 + 1, 0 + 9, 2 + 8, 9 + 2, 6 + 6, 8 + 5, 10 + 4, 12 + 3, 12 + 4, - 10 + 7, 9 + 9, 13 + 6, 13 + 7, 16 + 5, 15 + 7, 14 + 9, 1 + 23, 8 + 17, 10 + 16, 26 + 1, 16 + 12, 19 + 10, 7 + 23, 4 + 27, 27 + 5, - 6 + 27, 5 + 29, 16 + 19, 20 + 16, 34 + 3, 33 + 5, 1 + 38, 13 + 27, 13 + 28, 4 + 38, 20 + 23, 20 + 24, 15 + 30, 23 + 23, 17 + 30, 7 + 41, - 4 + 45, 4 + 46, 50 + 1, 3 + 49, 5 + 48, 27 + 27, 22 + 33, 35 + 21, 47 + 10, 31 + 27, 50 + 9, 5 + 55, 39 + 22, 0 + 62, 41 + 21, 6 + 57 -}; - -}; diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_sdec_ctx.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_sdec_ctx.cpp deleted file mode 100644 index 40c51d4..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/src/hevc_sdec_ctx.cpp +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "hevc_cabac.h" - -using namespace BS_HEVC; - -template class fill_vector -{ -public: - fill_vector ( const Type& _val ) : val ( _val ) {} - void operator () ( std::vector& el ) const { std::fill(el.begin(), el.end(), val); } -private: - Type val; -}; - -void SDecCtx::update(Slice& s){ - Bs32s i = 0, j = 0, x = 0, y = 0, p = 0, m = 0, tileIdx = 0; - - MaxNumMergeCand = 5 - s.five_minus_max_num_merge_cand; - QpYprev = SliceQpY = 26 + s.pps->init_qp_minus26 + s.slice_qp_delta; - - if( slice - && slice->sps == s.sps - && slice->pps == s.pps){ - bool newPicture = (slice->pic_order_cnt_lsb != s.pic_order_cnt_lsb); - slice = &s; - - if(newPicture){ - std::for_each(vIntraPredModeY.begin(), vIntraPredModeY.end(), fill_vector(-1)); - std::fill(vSliceAddrRs.begin(), vSliceAddrRs.end(), -1); - } - return; - } - slice = &s; - ctu = NULL; - - MinCbLog2SizeY = s.sps->log2_min_luma_coding_block_size_minus3 + 3; - CtbLog2SizeY = MinCbLog2SizeY + s.sps->log2_diff_max_min_luma_coding_block_size; - CtbSizeY = (1 << CtbLog2SizeY); - PicWidthInCtbsY = (s.sps->pic_width_in_luma_samples + CtbSizeY - 1) / CtbSizeY; - PicHeightInCtbsY = (s.sps->pic_height_in_luma_samples + CtbSizeY - 1) / CtbSizeY; - MinCbSizeY = (1 << MinCbLog2SizeY); - PicWidthInMinCbsY = s.sps->pic_width_in_luma_samples / MinCbSizeY; - PicHeightInMinCbsY = s.sps->pic_height_in_luma_samples / MinCbSizeY; - PicSizeInMinCbsY = PicWidthInMinCbsY * PicHeightInMinCbsY; - PicSizeInCtbsY = PicWidthInCtbsY * PicHeightInCtbsY; - PicSizeInSamplesY = s.sps->pic_width_in_luma_samples * s.sps->pic_height_in_luma_samples; - PicWidthInSamplesC = s.sps->pic_width_in_luma_samples / SubWidthC[s.sps->chroma_format_idc + s.sps->separate_colour_plane_flag]; - PicHeightInSamplesC = s.sps->pic_height_in_luma_samples / SubHeightC[s.sps->chroma_format_idc + s.sps->separate_colour_plane_flag]; - Log2MinTrafoSize = s.sps->log2_min_transform_block_size_minus2 + 2; - Log2MaxTrafoSize = Log2MinTrafoSize + s.sps->log2_diff_max_min_transform_block_size; - Log2MinIpcmCbSizeY = s.sps->log2_min_pcm_luma_coding_block_size_minus3 + 3; - Log2MaxIpcmCbSizeY = Log2MinIpcmCbSizeY + s.sps->log2_diff_max_min_pcm_luma_coding_block_size; - Log2MinCuQpDeltaSize= CtbLog2SizeY - s.pps->diff_cu_qp_delta_depth; - IsCuQpDeltaCoded = 0; - - vIntraPredModeY.resize(((s.sps->pic_width_in_luma_samples+64) >> Log2MinTrafoSize), - std::vector (((s.sps->pic_height_in_luma_samples+64) >> Log2MinTrafoSize), -1)); - std::for_each(vIntraPredModeY.begin(), vIntraPredModeY.end(), fill_vector(-1)); - - colWidth.resize(s.pps->num_tile_columns_minus1+1); - if( s.pps->uniform_spacing_flag ){ - for( i = 0; i <= s.pps->num_tile_columns_minus1; i++ ){ - colWidth[ i ] = ( ( i + 1 ) * PicWidthInCtbsY ) / ( s.pps->num_tile_columns_minus1 + 1 ) - - ( i * PicWidthInCtbsY ) / ( s.pps->num_tile_columns_minus1 + 1 ); - } - } else { - colWidth[ s.pps->num_tile_columns_minus1 ] = PicWidthInCtbsY; - for( i = 0; i < s.pps->num_tile_columns_minus1; i++ ) { - colWidth[ i ] = s.pps->column_width_minus1[ i ] + 1; - colWidth[ s.pps->num_tile_columns_minus1 ] -= colWidth[ i ]; - } - } - - rowHeight.resize(s.pps->num_tile_rows_minus1+1); - if( s.pps->uniform_spacing_flag ){ - for( j = 0; j <= s.pps->num_tile_rows_minus1; j++ ){ - rowHeight[ j ] = ( ( j + 1 ) * PicHeightInCtbsY ) / ( s.pps->num_tile_rows_minus1 + 1 ) - - ( j * PicHeightInCtbsY ) / ( s.pps->num_tile_rows_minus1 + 1 ); - } - } else { - rowHeight[ s.pps->num_tile_rows_minus1 ] = PicHeightInCtbsY; - for( j = 0; j < s.pps->num_tile_rows_minus1; j++ ) {; - rowHeight[ j ] = s.pps->row_height_minus1[ j ] + 1; - rowHeight[ s.pps->num_tile_rows_minus1 ] -= rowHeight[ j ]; - } - } - - colBd.resize(s.pps->num_tile_columns_minus1+2); - for( colBd[ 0 ] = 0, i = 0; i <= s.pps->num_tile_columns_minus1; i++ ) - colBd[ i + 1 ] = colBd[ i ] + colWidth[ i ]; - - rowBd.resize(s.pps->num_tile_rows_minus1+2); - for( rowBd[ 0 ] = 0, j = 0; j <= s.pps->num_tile_rows_minus1; j++ ) - rowBd[ j + 1 ] = rowBd[ j ] + rowHeight[ j ]; - - CtbAddrRsToTs.resize(PicSizeInCtbsY); - for( Bs16u ctbAddrRs = 0; ctbAddrRs < PicSizeInCtbsY; ctbAddrRs++ ) { - Bs16u tbX = ctbAddrRs % PicWidthInCtbsY; - Bs16u tbY = ctbAddrRs / PicWidthInCtbsY; - Bs16u tileX = 0; - Bs16u tileY = 0; - - for( i = 0; i <= s.pps->num_tile_columns_minus1; i++ ) - if( tbX >= colBd[ i ] ) - tileX = i; - - for( j = 0; j <= s.pps->num_tile_rows_minus1; j++ ) - if( tbY >= rowBd[ j ] ) - tileY = j; - - CtbAddrRsToTs[ ctbAddrRs ] = 0; - - for( i = 0; i < tileX; i++ ) - CtbAddrRsToTs[ ctbAddrRs ] += rowHeight[ tileY ] * colWidth[ i ]; - - for( j = 0; j < tileY; j++ ) - CtbAddrRsToTs[ ctbAddrRs ] += PicWidthInCtbsY * rowHeight[ j ]; - - CtbAddrRsToTs[ ctbAddrRs ] += ( tbY - rowBd[ tileY ] ) * colWidth[ tileX ] + tbX - colBd[ tileX ]; - } - - CtbAddrTsToRs.resize(PicSizeInCtbsY); - for(Bs16u ctbAddrRs = 0; ctbAddrRs < PicSizeInCtbsY; ctbAddrRs++ ) - CtbAddrTsToRs[ CtbAddrRsToTs[ ctbAddrRs ] ] = ctbAddrRs; - - - TileId.resize(PicSizeInCtbsY); - for( j = 0, tileIdx = 0; j <= s.pps->num_tile_rows_minus1; j++ ) - for( i = 0; i <= s.pps->num_tile_columns_minus1; i++, tileIdx++ ) - for( y = rowBd[ j ]; y < rowBd[ j + 1 ]; y++ ) - for( x = colBd[ i ]; x < colBd[ i + 1 ]; x++ ) - TileId[ CtbAddrRsToTs[ y * PicWidthInCtbsY+ x ] ] = tileIdx; - - - MinTbAddrZs.resize( - ( PicWidthInCtbsY << ( CtbLog2SizeY - Log2MinTrafoSize ) ), - std::vector(( PicHeightInCtbsY << ( CtbLog2SizeY - Log2MinTrafoSize ) )) - ); - for( y = 0; y < ( PicHeightInCtbsY << ( CtbLog2SizeY - Log2MinTrafoSize ) ); y++ ){ - for( x = 0; x < ( PicWidthInCtbsY << ( CtbLog2SizeY - Log2MinTrafoSize ) ); x++) { - Bs32u tbX = ( x << Log2MinTrafoSize ) >> CtbLog2SizeY; - Bs32u tbY = ( y << Log2MinTrafoSize ) >> CtbLog2SizeY; - Bs32u ctbAddrRs = PicWidthInCtbsY * tbY + tbX; - - MinTbAddrZs[ x ][ y ] = CtbAddrRsToTs[ ctbAddrRs ] << ( ( CtbLog2SizeY - Log2MinTrafoSize ) * 2 ); - for( i = 0, p = 0; i < ( CtbLog2SizeY - Log2MinTrafoSize ); i++ ) { - m = 1 << i; - p += ( m & x ? m * m : 0 ) + ( m & y ? 2 * m * m : 0 ); - } - MinTbAddrZs[ x ][ y ] += p; - } - } - - vSliceAddrRs.resize(PicSizeInCtbsY, -1); - std::fill(vSliceAddrRs.begin(), vSliceAddrRs.end(), -1); - - for(i = 0; i < 3; i++) - Sao[i].resize(PicWidthInCtbsY, std::vector(PicHeightInCtbsY)); - - for(Bs16u log2BlockSize = 0; log2BlockSize < 4; log2BlockSize ++){ - Bs16u blkSize = ( 1 << log2BlockSize ); - Bs16u sz = blkSize * blkSize; - - ScanOrder[log2BlockSize][0].resize(sz); - i = 0; x = 0; y = 0; - while( 1 ) { - while( y >= 0 ) { - if( x < blkSize && y < blkSize ) { - ScanOrder[log2BlockSize][0][ i ][ 0 ] = x; - ScanOrder[log2BlockSize][0][ i ][ 1 ] = y; - i++; - } - y--; - x++; - } - y = x; - x = 0; - if( i >= sz ) - break; - } - - ScanOrder[log2BlockSize][1].resize(sz); - i = 0; - for( y = 0; y < blkSize; y++ ){ - for( x = 0; x < blkSize; x++ ) { - ScanOrder[log2BlockSize][1][ i ][ 0 ] = x; - ScanOrder[log2BlockSize][1][ i ][ 1 ] = y; - i++; - } - } - - ScanOrder[log2BlockSize][2].resize(sz); - i = 0; - for( x = 0; x < blkSize; x++ ){ - for( y = 0; y < blkSize; y++ ) { - ScanOrder[log2BlockSize][2][ i ][ 0 ] = x; - ScanOrder[log2BlockSize][2][ i ][ 1 ] = y; - i++; - } - } - } -} - - -bool SDecCtx::zAvailableN(Bs16s xCurr, Bs16s yCurr, Bs16s xNbY, Bs16s yNbY){ - Bs32s minBlockAddrCurr = MinTbAddrZs[ xCurr >> Log2MinTrafoSize ][ yCurr >> Log2MinTrafoSize ]; - Bs32s minBlockAddrN = -1; - Bs32u CtbAddrInTsCurr = CtbAddrRsToTs[(yCurr>>CtbLog2SizeY)*PicWidthInCtbsY + (xCurr>>CtbLog2SizeY)]; - Bs32u CtbAddrInTsN = 0; - - if( xNbY >= 0 && yNbY >= 0 - && xNbY < (Bs32s)slice->sps->pic_width_in_luma_samples - && yNbY < (Bs32s)slice->sps->pic_height_in_luma_samples){ - minBlockAddrN = MinTbAddrZs[ xNbY >> Log2MinTrafoSize ][ yNbY >> Log2MinTrafoSize ]; - CtbAddrInTsN = CtbAddrRsToTs[(yNbY>>CtbLog2SizeY)*PicWidthInCtbsY + (xNbY>>CtbLog2SizeY)]; - } - - if ( minBlockAddrN < 0 - || minBlockAddrN > minBlockAddrCurr - || vSliceAddrRs[CtbAddrInTsN] != vSliceAddrRs[CtbAddrInTsCurr] - || TileId[CtbAddrInTsN] != TileId[CtbAddrInTsCurr]) - return false; - - return true; -} - - -template T* get_unit(T& cqt, Bs16u x, Bs16u y){ - if(cqt.split){ - T* res = 0; - - for(Bs16u i = 0; i < 4; i++){ - T* t = get_unit(cqt.split[i], x, y); - - if(t->x > x || t->y > y){ - continue; - } - - res = t; - } - - if(res){ - return res; - } - } - return &cqt; -} - -CQT* SDecCtx::get(Bs16u x, Bs16u y){ - Bs16u CtbAddrInRs = (y>>CtbLog2SizeY)*PicWidthInCtbsY + (x>>CtbLog2SizeY); - return get_unit(ctu[CtbAddrInRs].cqt, x, y); -} - -TransTree* SDecCtx::getTU(Bs16u x, Bs16u y) { - CQT* cqt = get(x, y); - if (!cqt || !cqt->tu) - return 0; - return get_unit(*cqt->tu, x, y); -} - -void SDecCtx::updateIntraPredModeY(CQT& cqt){ - Bs16u nCbS = ( 1 << (CtbLog2SizeY - cqt.CtDepth) ); - Bs16u pbOffset = ( PartMode(cqt) == PART_NxN ) ? ( nCbS / 2 ) : nCbS; - - for(Bs16u j = 0; j < nCbS/pbOffset; j ++ ){ - for(Bs16u i = 0; i < nCbS/pbOffset; i ++ ){ - Bs16u x0 = cqt.x + j*pbOffset; - Bs16u y0 = cqt.y + i*pbOffset; - Bs8s mode = IntraPredModeY(x0, y0, &cqt); - - for(Bs16u xIdx = (x0>>Log2MinTrafoSize); xIdx < ((x0>>Log2MinTrafoSize) + (pbOffset>>Log2MinTrafoSize)); xIdx++){ - for(Bs16u yIdx = (y0>>Log2MinTrafoSize); yIdx < ((y0>>Log2MinTrafoSize) + (pbOffset>>Log2MinTrafoSize)); yIdx++){ - vIntraPredModeY[xIdx][yIdx] = mode; - } - } - } - } - -} - -Bs8u SDecCtx::IntraPredModeY(Bs16u xPb, Bs16u yPb, CQT* _cqt){ - Bs8s& IntraPredModeY = vIntraPredModeY[xPb >> Log2MinTrafoSize][yPb >> Log2MinTrafoSize]; - - if(IntraPredModeY >= 0){ - return IntraPredModeY; - } - - CQT* cqt = _cqt ? _cqt : get(xPb, yPb); - Bs16u nCbS = ( 1 << (CtbLog2SizeY - cqt->CtDepth) ); - Bs16u pbOffset = ( PartMode(*cqt) == PART_NxN ) ? ( nCbS / 2 ) : nCbS; - Bs8u xIdx = (xPb - cqt->x) / pbOffset; - Bs8u yIdx = (yPb - cqt->y) / pbOffset; - CQT::LumaPred& lp = cqt->luma_pred[xIdx][yIdx]; - bool availableX[2] = { zAvailableN(xPb, yPb, xPb - 1, yPb), zAvailableN(xPb, yPb, xPb, yPb - 1) }; - Bs8u candIntraPredModeX[2] = {0,}; - Bs8u candModeList[3] = {0,}; - - for(Bs16u i = 0; i < 2; i++){ - if(!availableX[i]){ - candIntraPredModeX[i] = 1; - } else { - CQT* cqtX = get(xPb - !i, yPb - i); - if(CuPredMode(*cqtX) != MODE_INTRA || cqtX->pcm_flag ){ - candIntraPredModeX[i] = 1; - } else if(i && ((yPb - i) < (( yPb >> CtbLog2SizeY ) << CtbLog2SizeY ))){ - candIntraPredModeX[i] = 1; - } else { - candIntraPredModeX[i] = this->IntraPredModeY(xPb - !i, yPb - i, cqtX); - } - } - } - - if(candIntraPredModeX[0] == candIntraPredModeX[1]){ - if(candIntraPredModeX[0] < 2){ - candModeList[0] = 0; - candModeList[1] = 1; - candModeList[2] = 26; - } else { - candModeList[0] = candIntraPredModeX[0]; - candModeList[1] = 2 + ( ( candIntraPredModeX[0] + 29 ) % 32 ); - candModeList[2] = 2 + ( ( candIntraPredModeX[0] - 2 + 1 ) % 32 ); - } - } else { - candModeList[0] = candIntraPredModeX[0]; - candModeList[1] = candIntraPredModeX[1]; - - if(candModeList[0] != 0 && candModeList[1] != 0){ - candModeList[2] = 0; - } else if(candModeList[0] != 1 && candModeList[1] != 1){ - candModeList[2] = 1; - } else { - candModeList[2] = 26; - } - } - - if(lp.prev_intra_luma_pred_flag) - return IntraPredModeY = candModeList[lp.mpm_idx]; - - if(candModeList[0] > candModeList[1]) - std::swap(candModeList[0], candModeList[1]); - - if(candModeList[0] > candModeList[2]) - std::swap(candModeList[0], candModeList[2]); - - if(candModeList[1] > candModeList[2]) - std::swap(candModeList[1], candModeList[2]); - - IntraPredModeY = lp.rem_intra_luma_pred_mode; - for(Bs16u i = 0; i < 3; i++) - IntraPredModeY += (IntraPredModeY >= candModeList[i]); - - return IntraPredModeY; -} - -static const Bs8s PredModeY2C[5][5] = { - { 0, 34, 0, 0, 0}, - {26, 26, 34, 26, 26}, - {10, 10, 10, 34, 10}, - { 1, 1, 1, 1, 34}, - {-1, 0, 26, 10, 1} -}; - -inline Bs8u IntraPredModeC(Bs8u IntraPredModeY, Bs8u intra_chroma_pred_mode){ - Bs8s IntraPredModeC = PredModeY2C[intra_chroma_pred_mode][ - 1 * (IntraPredModeY == 0) - + 2 * (IntraPredModeY == 26) - + 3 * (IntraPredModeY == 10) - + 4 * (IntraPredModeY == 1) - ]; - return (IntraPredModeC < 0) ? IntraPredModeY : IntraPredModeC; -} - -Bs8u SDecCtx::IntraPredModeC(Bs16u xPb, Bs16u yPb, CQT* _cqt){ - CQT* cqt = _cqt ? _cqt : get(xPb, yPb); - bool xShift = (2 == SubWidthC[slice->sps->chroma_format_idc]); - bool yShift = (2 == SubHeightC[slice->sps->chroma_format_idc]); - - return ::IntraPredModeC( - IntraPredModeY(xShift ? cqt->x : xPb, yShift ? cqt->y : yPb, cqt), //FIXME: map luma (xPb, yPb) to chroma - cqt->intra_chroma_pred_mode ); -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/CMakeLists.txt b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/CMakeLists.txt deleted file mode 100644 index 2926bc0..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -find_path( FEI_INCLUDE mfxfeihevc.h PATHS ${MFX_INCLUDE} ) - -include_directories ( - ${CMAKE_CURRENT_SOURCE_DIR}/../../include -) - -list( APPEND LIBS bs_parser_hevc_static ) - -set( defs " -DMFX_VERSION_USE_LATEST " ) -set(DEPENDENCIES pthread) - -make_executable( shortname universal ) - -install( TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -set( defs "" ) diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj deleted file mode 100644 index cdfc583..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {11CDD87B-B0B9-4BA3-BC68-6501053C28A7} - Win32Proj - 10.0.17134.0 - - - - Application - true - v141 - true - - - Application - false - v141 - true - - - Application - true - v141 - true - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - - - false - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - - - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - - - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\ - $(OutDir)..\objs\$(ProjectName)\ - false - - - - MFX_VERSION_USE_LATEST;WIN32;_WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - $(ProjectDir)\..\..\..\..\api\include;$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) - true - - - MachineX86 - true - Console - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);%(AdditionalLibraryDirectories) - bs_parser_hevc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - MFX_VERSION_USE_LATEST;WIN32;_WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - Level3 - ProgramDatabase - $(ProjectDir)\..\..\..\..\api\include;$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) - true - true - true - - - MachineX86 - true - Console - true - true - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);$(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\;%(AdditionalLibraryDirectories) - bs_parser_hevc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - $(ProjectDir)\..\..\..\..\api\include;$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) - - - - - ProgramDatabase - - - - - Level3 - true - true - MFX_VERSION_USE_LATEST;WIN64;_WIN64;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);%(AdditionalLibraryDirectories) - bs_parser_hevc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - true - Console - UseFastLinkTimeCodeGeneration - - - - - $(ProjectDir)\..\..\..\..\api\include;$(ProjectDir)\..\..\include;%(AdditionalIncludeDirectories) - true - Level3 - true - true - MFX_VERSION_USE_LATEST;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - $(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\lib\;$(INTELMEDIASDKROOT)\lib\$(Platform);$(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\;%(AdditionalLibraryDirectories) - Console - true - true - UseFastLinkTimeCodeGeneration - bs_parser_hevc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - xcopy /y /d "$(ProjectDir)..\..\..\..\..\build\win_$(Platform)\$(Configuration)\bin\bs_parser_hevc.dll" "$(OutDir)" - - - - - - - - {6a44b0b8-2d21-4d64-9f0a-d73a2bbb3103} - - - - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj.filters b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj.filters deleted file mode 100644 index ddc083e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/hevc_fei_extractor.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/src/main.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/src/main.cpp deleted file mode 100644 index 0a7e56f..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/bs_parser_hevc/tools/hevc_fei_extractor/src/main.cpp +++ /dev/null @@ -1,678 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "mfxvideo.h" - -#include - -#if MFX_VERSION >= MFX_VERSION_NEXT - -#include -#include -#include -#include -#include -#include -#include -#include "mfxfeihevc.h" - -#define MAX_PU_NUM 4 - -struct CUBlock -{ - Bs32u m_AdrX = 0; - Bs32u m_AdrY = 0; - Bs32u m_Log2CbSize = 0; - - CUBlock(Bs32u adrX, Bs32u adrY, Bs32u log2CbSize) : - m_AdrX(adrX), - m_AdrY(adrY), - m_Log2CbSize(log2CbSize) - {}; -}; - -class FileHandler -{ -private: - bool m_errorSts = false; - FILE* m_pFile = nullptr; - -public: - FileHandler(char const* fileName, char const* mode) - { - if (!fileName) { - printf("\nERROR: Unable to read file name with CU/CTU structures\n"); - m_errorSts = true;// Error sts - return; - } - - if (!mode) { - printf("\nERROR: Unable to read file open mode\n"); - m_errorSts = true;// Error sts - return; - } - - if ((m_pFile = fopen(fileName, mode)) == nullptr) { - printf("\nERROR: Unable to open the %s file in the FileHandler::FileHandler\n", fileName); - m_errorSts = true;// Error sts - return; - } - }; - - ~FileHandler() - { - if (m_pFile != nullptr) - fclose(m_pFile); - }; - - bool CheckStatus() - { - return m_errorSts; - }; - - template< class T > void Write(T& structure) - { - size_t elementsWritten = fwrite(&structure, sizeof(structure), 1, m_pFile); - if (elementsWritten != 1) { - printf("\nERROR: File wasn't written in the FileHandler::WriteFile\n"); - m_errorSts = true;// Error sts - } - }; -}; - -using namespace BS_HEVC2; - -inline bool IsHEVCSlice(Bs32u nut) { return (nut <= 21) && ((nut < 10) || (nut > 15)); } - -#define CHECK_STATUS(code,sts)\ - bs_sts = (code);\ - if(bs_sts != (sts)){\ - printf("FAILED in %s at %s: %i\nReturn code = %i\n", #code, __FILE__, __LINE__, bs_sts);\ - return bs_sts;\ - } - -#define ALIGN(value, alignment) (alignment) * ( (value) / (alignment) + (((value) % (alignment)) ? 1 : 0)) - -int printUsage(char* argv[]) -{ - printf("Parser for HEVC bit-streams dumps fei-specific information.\n"); - printf("Usage: %s \n", argv[0]); - printf(" or: %s -pic_file \n", argv[0]); - printf(" or: %s -multi_pak_str \n", argv[0]); - return 1; -} - -BSErr ConvertPredModeToFeiPredMode(Bs16u const predModeParser/*in*/, mfxFeiHevcPakCuRecordV0& pakCuRecorderV0/*out*/) -{ - switch (predModeParser) { - case MODE_INTER: - pakCuRecorderV0.PredMode = (1 & 0x01); - break; - case MODE_INTRA: - pakCuRecorderV0.PredMode = (0 & 0x01); - break; - case MODE_SKIP: - pakCuRecorderV0.PredMode = (1 & 0x01); - break; - default: - return BS_ERR_INVALID_PARAMS; - } - return BS_ERR_NONE; -} - -mfxU32 GetIntraChromaModeFEI(Bs8u intraPredModeC_0_0) -{ - switch (intraPredModeC_0_0) - { - case 0://Planar - return 2; - case 1://DC - return 5; - case 10://Horiz - return 4; - case 26://Vertic - return 3; - default://DM - return 0; - } -} - -void SetIntraPredModeFEI(const CU* pCU, mfxFeiHevcPakCuRecordV0& pakCuRecorderV0) -{ - if(pCU == nullptr) - throw std::string("ERROR: SetIntraPredModeFEI: pCU is equal to nullptr"); - - // Luma - if (pCU->IntraPredModeY[0][0] > 34 - || pCU->IntraPredModeY[1][0] > 34 - || pCU->IntraPredModeY[0][1] > 34 - || pCU->IntraPredModeY[1][1] > 34) - { - throw std::string("ERROR: SetIntraPredModeFEI: incorrect IntraPredModeY[X][X]\n"); - } - - pakCuRecorderV0.IntraMode0 = pCU->IntraPredModeY[0][0]; - pakCuRecorderV0.IntraMode1 = pCU->IntraPredModeY[1][0]; - pakCuRecorderV0.IntraMode2 = pCU->IntraPredModeY[0][1]; - pakCuRecorderV0.IntraMode3 = pCU->IntraPredModeY[1][1]; - - // Chroma - // For ChromaArrayType != 3 (4:4:4) all elements of the array intra_chroma_pred_mode[2][2] are equal - // Table 7.3.8.5 from ITU-T H.265 (V4) - // HEVC FEI ENCODE on SKL supports 4:2:0 mode only - if (pCU->IntraPredModeC[0][0] > 34) - { - throw std::string("ERROR: SetIntraPredModeFEI: incorrect IntraPredModeC[0][0]"); - } - - pakCuRecorderV0.IntraChromaMode = GetIntraChromaModeFEI(pCU->IntraPredModeC[0][0]); -} - -void SetLevel2(mfxFeiHevcPakCtuRecordV0& pakCtuRecordV0, Bs32u& startShift, Bs32u ctbLog2SizeY, Bs32u log2CbSize, Bs32u idxQuadTreeLevel2, Bs32u idxQuadTreeLevel1) -{ - if (log2CbSize == ctbLog2SizeY - 2) - { - startShift++; - } - else if (log2CbSize == ctbLog2SizeY - 3) - { - switch (idxQuadTreeLevel1) - { - case 0: - pakCtuRecordV0.SplitLevel2Part0 |= 1 << idxQuadTreeLevel2; - break; - case 1: - pakCtuRecordV0.SplitLevel2Part1 |= 1 << idxQuadTreeLevel2; - break; - case 2: - pakCtuRecordV0.SplitLevel2Part2 |= 1 << idxQuadTreeLevel2; - break; - case 3: - pakCtuRecordV0.SplitLevel2Part3 |= 1 << idxQuadTreeLevel2; - break; - } - startShift += 4; - } - return; -} - -void SetLevel1(mfxFeiHevcPakCtuRecordV0& pakCtuRecordV0, Bs32u& startShift, Bs32u ctbLog2SizeY, const std::vector& vecCUs, Bs32u idxQuadTreeLevel1) -{ - Bs32u log2CbSize = vecCUs.at(startShift).m_Log2CbSize; - - if (log2CbSize == ctbLog2SizeY - 1) - { - startShift++; - } - else if ((log2CbSize == ctbLog2SizeY - 2) || (log2CbSize == ctbLog2SizeY - 3)) - { - pakCtuRecordV0.SplitLevel1 |= 1 << idxQuadTreeLevel1; - - for (Bs32u idxQuadTreeLevel2 = 0; idxQuadTreeLevel2 < 4; ++idxQuadTreeLevel2) - { - SetLevel2(pakCtuRecordV0, startShift, ctbLog2SizeY, vecCUs.at(startShift).m_Log2CbSize, idxQuadTreeLevel2, idxQuadTreeLevel1); - } - } - else - throw std::string("ERROR: SetLevel1: incorrect Cb size"); - - return; -} - -bool IsInQuarter(Bs32u idxQuadTreeLevel1, CUBlock cu, Bs32u ctbLog2SizeY) -{ - Bs32u ctuSize = 1 << ctbLog2SizeY; - Bs32u ctuQuarterLog2SizeY = ctbLog2SizeY - 1; - Bs32u adrXInsideCTU = cu.m_AdrX % ctuSize; - Bs32u adrYInsideCTU = cu.m_AdrY % ctuSize; - - return (((adrYInsideCTU >> ctuQuarterLog2SizeY) << 1) + (adrXInsideCTU >> ctuQuarterLog2SizeY)) == idxQuadTreeLevel1; -} - -void SetLevel0(mfxFeiHevcPakCtuRecordV0& pakCtuRecordV0, Bs32u ctbLog2SizeY, const std::vector& vecCUs) -{ - Bs32u startShift = 0; - if (vecCUs.at(startShift).m_Log2CbSize == ctbLog2SizeY) - return; - else - { - pakCtuRecordV0.SplitLevel0 = 1; - // If we have 4 parts of the CTU, we need to check each part in the loop - for (Bs32u idxQuadTreeLevel1 = 0; idxQuadTreeLevel1 < 4; ++idxQuadTreeLevel1) - { - // This check is needed for work with different resolution. - // If last CTU in the line hasn't got right quarters - // or CTU in the last line hasn't got bottom quarters. - // Function will be called only for first CU in quarter of the CTU - if (startShift >= vecCUs.size() || !IsInQuarter(idxQuadTreeLevel1, vecCUs.at(startShift), ctbLog2SizeY)) - continue; - SetLevel1(pakCtuRecordV0, startShift, ctbLog2SizeY, vecCUs, idxQuadTreeLevel1); - } - return; - } -} - -inline void SetInterpredIdc(mfxFeiHevcPakCuRecordV0& pakCuRecordV0, Bs16u interpredIdc, Bs32u countPU) -{ - if (interpredIdc >= 3) - throw std::string("ERROR: SetInterpredIdc: unsupported value for InterpredIdc"); - else - pakCuRecordV0.InterpredIdc |= interpredIdc << (2 * countPU); -} - -inline void SetPURefIdx(mfxFeiHevcPakCuRecordV0& pakCuRecordV0, PU* pPU, Bs32u countPU) -{ - switch (countPU) - { - case 0: - pakCuRecordV0.RefIdx[0].Ref0 = pPU->ref_idx_l0; - pakCuRecordV0.RefIdx[1].Ref0 = pPU->ref_idx_l1; - break; - case 1: - pakCuRecordV0.RefIdx[0].Ref1 = pPU->ref_idx_l0; - pakCuRecordV0.RefIdx[1].Ref1 = pPU->ref_idx_l1; - break; - case 2: - pakCuRecordV0.RefIdx[0].Ref2 = pPU->ref_idx_l0; - pakCuRecordV0.RefIdx[1].Ref2 = pPU->ref_idx_l1; - break; - case 3: - pakCuRecordV0.RefIdx[0].Ref3 = pPU->ref_idx_l0; - pakCuRecordV0.RefIdx[1].Ref3 = pPU->ref_idx_l1; - break; - } -} - -int DumpPicStruct(BS_HEVC2_parser& parser, const char* name) -{ - std::ofstream ofs(name, std::ofstream::out); - if (!ofs.is_open()) - return 1; - - //common with asg-hevc - struct PictureInfo - { - Bs32s orderCount = -1; // display order - Bs32s codingOrder = -1; - Bs32u type = 0; // IPB, IDR - Bs32u picStruct = 0; // TF/BF - }; - - struct RefState - { - PictureInfo picture; - std::vector DPB; // stores FrameOrder (POC) - std::vector RefListActive[2]; // (POC), any from DPB, can be repeated - }; - - Bs32u recordsWritten = 0; - Bs32s dispOrderIDR = 0; - - while (true) - { - BS_HEVC2::NALU* pNALU = nullptr; - BSErr bs_sts = parser.parse_next_au(pNALU); - - if (bs_sts == BS_ERR_NOT_IMPLEMENTED) - continue; - if (bs_sts != BS_ERR_NONE) - break; - - RefState record; - record.DPB.reserve(16); - record.RefListActive[0].reserve(8); - record.RefListActive[1].reserve(8); - record.picture.type = 0; // updated in different nalu - record.picture.picStruct = MFX_PICSTRUCT_PROGRESSIVE; // for if no SEI PT - - bool isFirstSlice = true; - for (auto pNALUIdx = pNALU; pNALUIdx != nullptr; pNALUIdx = pNALUIdx->next) - { - if (IsHEVCSlice(pNALUIdx->nal_unit_type) && isFirstSlice) // slice - { - if (pNALUIdx->nal_unit_type == NALU_TYPE::IDR_W_RADL || pNALUIdx->nal_unit_type == NALU_TYPE::IDR_N_LP) // IDR, REF - { - dispOrderIDR = recordsWritten; // assume IDR POC == codingOrder - record.picture.type |= MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF; - } - if (pNALUIdx->nal_unit_type >= NALU_TYPE::BLA_W_LP && pNALUIdx->nal_unit_type <= NALU_TYPE::CRA_NUT) // other IRAP -> REF - { - record.picture.type |= MFX_FRAMETYPE_REF; - } - else if (pNALUIdx->nal_unit_type <= NALU_TYPE::RASL_R && (pNALUIdx->nal_unit_type & 1)) // !IRAP, REF - record.picture.type |= MFX_FRAMETYPE_REF; - - record.picture.orderCount = pNALUIdx->slice->POC + dispOrderIDR; - if (pNALUIdx->slice->pps->curr_pic_ref_enabled_flag) // check - record.picture.type |= MFX_FRAMETYPE_REF; - - record.picture.type |= (pNALUIdx->slice->type == SLICE_TYPE::I) ? MFX_FRAMETYPE_I : - ((pNALUIdx->slice->type == SLICE_TYPE::P) ? MFX_FRAMETYPE_P : MFX_FRAMETYPE_B); - for (Bs32u i = 0; i < pNALUIdx->slice->strps.NumDeltaPocs; i++) // ignore LT - record.DPB.push_back(pNALUIdx->slice->DPB[i].POC + dispOrderIDR); - for (Bs32u i = 0; i < pNALUIdx->slice->num_ref_idx_l0_active; i++) - record.RefListActive[0].push_back(pNALUIdx->slice->L0[i].POC + dispOrderIDR); - for (Bs32u i = 0; i < pNALUIdx->slice->num_ref_idx_l1_active; i++) - record.RefListActive[1].push_back(pNALUIdx->slice->L1[i].POC + dispOrderIDR); - isFirstSlice = false; // use only first slice, others must provide equal parameters - } - - if (pNALUIdx->nal_unit_type != NALU_TYPE::PREFIX_SEI_NUT) // not SEI - continue; - - for (auto sei = pNALUIdx->sei; sei != nullptr; sei = sei->next) - { - if (sei->payloadType != SEI_TYPE::SEI_PICTURE_TIMING) // not Picture Timing - continue; - switch (sei->pt->pic_struct) - { - case PIC_STRUCT::TOP: case PIC_STRUCT::TOP_PREVBOT: case PIC_STRUCT::TOP_NEXTBOT: - record.picture.picStruct = MFX_PICSTRUCT_FIELD_TOP; - break; - case PIC_STRUCT::BOT: case PIC_STRUCT::BOT_PREVTOP: case PIC_STRUCT::BOT_NEXTTOP: - record.picture.picStruct = MFX_PICSTRUCT_FIELD_BOTTOM; - break; - default: - break; // progressive - } - } - } - - if (record.picture.orderCount != -1 && record.picture.type != 0) - { - record.picture.codingOrder = recordsWritten; - - const char separator = '|'; - ofs << std::setw(3) << record.picture.orderCount << ' ' - << std::hex << std::showbase << std::setw(3 + 2) << record.picture.type << ' ' - << std::setw(3 + 2) << record.picture.picStruct << std::dec; - if (ofs.fail()) - throw std::string("ERROR: PicStruct buffer writing failed"); - for (Bs32u list = 0; list < 2; list++) - { - ofs << ' ' << separator; - for (Bs32u i = 0; i < 8; i++) - ofs << ' ' << std::setw(3) << (i < record.RefListActive[list].size() ? record.RefListActive[list][i] : -1); - } - std::sort(record.DPB.begin(), record.DPB.end()); // to simplify matching - ofs << ' ' << separator; - for (Bs32u i = 0; i < 16; i++) - ofs << ' ' << std::setw(3) << (i < record.DPB.size() ? record.DPB[i] : -1); - ofs << std::endl; - recordsWritten ++; - } - } - - ofs.close(); - - if (recordsWritten==0) - printf("\nERROR: NO picture structure info in stream\n"); - - return (recordsWritten==0); // 0 for OK -} - -struct sMultiPak -{ - Bs32u NumBytesInNalUnit; - Bs8u SliceQP; -}; - -int DumpMultiPassPak(BS_HEVC2_parser& parser, const char* name) -{ - FILE *fMultiPak = nullptr; - if ((fMultiPak = fopen(name, "wb")) == nullptr) - throw std::string("ERROR: Opening multipasspak file failed"); - - sMultiPak multiPakInfo; - BSErr bs_sts = BS_ERR_NONE; - BS_HEVC2::NALU* pNALU = nullptr; - - while (true) - { - bs_sts = parser.parse_next_au(pNALU); - - if (bs_sts == BS_ERR_NOT_IMPLEMENTED) - continue; - if (bs_sts) - break; - - multiPakInfo.NumBytesInNalUnit = 0; - for (; pNALU; pNALU = pNALU->next) - { - if (!IsHEVCSlice(pNALU->nal_unit_type)) - continue; - - if (!pNALU->slice) - throw std::string("ERROR: Invalid parser pointer"); - - multiPakInfo.SliceQP = 0xFF; //0xFF indicates skipping - for (auto pCTU = pNALU->slice->ctu; pCTU; pCTU = pCTU->Next) - { - for (auto pCU = pCTU->Cu; pCU; pCU = pCU->Next) - { - if (pCU->palette_mode_flag) - { - multiPakInfo.SliceQP = (Bs8u)pCU->QpY; - break; - } - - for (auto pTU = pCU->Tu; pTU; pTU = pTU->Next) - { - if (pTU->cbf_luma - || pTU->cbf_cb - || pTU->cbf_cb1 - || pTU->cbf_cr - || pTU->cbf_cr1) - { - multiPakInfo.SliceQP = (Bs8u)pCU->QpY; - break; - } - } - - if (multiPakInfo.SliceQP != 0xFF) - break; - } - - if (multiPakInfo.SliceQP != 0xFF) - break; - } - - multiPakInfo.NumBytesInNalUnit += pNALU->NumBytesInNalUnit; - } - - //Write into the Multi-pass PAK file - size_t sizeWrite = 0; - sizeWrite = fwrite(&multiPakInfo, sizeof(sMultiPak), 1, fMultiPak); - if (sizeWrite != 1) - { - fclose(fMultiPak); - throw std::string("ERROR: Writing to multipasspak file failed"); - } - } - - fclose(fMultiPak); - - CHECK_STATUS(bs_sts, BS_ERR_MORE_DATA); - - return 0; -} - -#endif // MFX_VERSION - -int main(int argc, char* argv[]) { - -#if MFX_VERSION < MFX_VERSION_NEXT - std::cout << "ERROR: For correct work minimal API MFX_VERSION_NEXT version is required" << std::endl; - return -1; -#else - try - { - if (argc < 4) { - return printUsage(argv); - } - BSErr bs_sts = BS_ERR_NONE; - - BS_HEVC2_parser parser(PARSE_SSD); - - CHECK_STATUS(parser.open(argv[1]), BS_ERR_NONE); - - if (strcmp(argv[2], "-pic_file") == 0) - { - return DumpPicStruct(parser, argv[3]); - } - - if (strcmp(argv[2], "-multi_pak_str") == 0) - { - return DumpMultiPassPak(parser, argv[3]); - } - - // Opening of the file for CTU - FileHandler handlerCTU(argv[2], "wb"); - if (handlerCTU.CheckStatus()) - throw std::string("ERROR: main: issue with file opening"); - - // Opening of the file for CU - FileHandler handlerCU(argv[3], "wb"); - if (handlerCU.CheckStatus()) - throw std::string("ERROR: main: issue with file opening"); - - // CTU information - mfxFeiHevcPakCtuRecordV0 pakCtuRecordV0; - memset(&pakCtuRecordV0, 0, sizeof(pakCtuRecordV0)); - - // CU information - mfxFeiHevcPakCuRecordV0 pakCuRecordV0; - memset(&pakCuRecordV0, 0, sizeof(pakCuRecordV0)); - - BS_HEVC2::NALU* pNALU = nullptr; - - while (true) - { - bs_sts = parser.parse_next_au(pNALU); - - if (bs_sts == BS_ERR_NOT_IMPLEMENTED) - continue; - if (bs_sts) - break; - - for (auto pNALUIdx = pNALU; pNALUIdx; pNALUIdx = pNALUIdx->next) - { - if (!IsHEVCSlice(pNALUIdx->nal_unit_type)) - continue; - - auto& slice = *pNALUIdx->slice; - - // CTB_Y size calculating - Bs32u minCbLog2SizeY = slice.sps->log2_min_luma_coding_block_size_minus3 + 3; - Bs32u ctbLog2SizeY = minCbLog2SizeY + slice.sps->log2_diff_max_min_luma_coding_block_size; - Bs32u ctbSizeY = 1 << ctbLog2SizeY; - - // Parameters for FEI compatibility - Bs32u maxNumCuInCtu = (1 << (slice.sps->log2_diff_max_min_luma_coding_block_size + slice.sps->log2_diff_max_min_luma_coding_block_size)); - - // Number CTB_Y in the line - Bs32u widthInCTU = ALIGN(slice.sps->pic_width_in_luma_samples, ctbSizeY) >> ctbLog2SizeY; - - Bs32u countCTU = 0; - for (auto pCTU = slice.ctu; pCTU; pCTU = pCTU->Next, ++countCTU) - { - // pakCtuRecordV0 cleaning - memset(&pakCtuRecordV0, 0, sizeof(pakCtuRecordV0)); - - std::vector vecCUs; - vecCUs.reserve(maxNumCuInCtu); - - Bs16u countCU = 0; - for (auto pCU = pCTU->Cu; pCU; pCU = pCU->Next, ++countCU) - { - // pakCuRecordV0 cleaning - memset(&pakCuRecordV0, 0, sizeof(pakCuRecordV0)); - - vecCUs.emplace_back((Bs32u)pCU->x, (Bs32u)pCU->y, (Bs32u)pCU->log2CbSize); - - // Set information about prediction and partition mode - CHECK_STATUS(ConvertPredModeToFeiPredMode(pCU->PredMode, pakCuRecordV0), BS_ERR_NONE); - pakCuRecordV0.PartMode = pCU->PartMode;// need to investigate - - // Set information about Intra prediction mode - if (pCU->PredMode == MODE_INTRA) - SetIntraPredModeFEI(pCU, pakCuRecordV0); - - // Set information about MVs - Bs32u countPU = 0; - for (auto pPU = pCU->Pu; pPU; pPU = pPU->Next, ++countPU) - { - if (countPU >= MAX_PU_NUM) // CU can't include more than 4 PUs - throw std::string("ERROR: main: Number of PUs more than 4"); - - SetInterpredIdc(pakCuRecordV0, pPU->inter_pred_idc, countPU); - - for (Bs32u listIdx = 0; listIdx < 2; listIdx++) - { - pakCuRecordV0.MVs[listIdx].x[countPU] = pPU->MvLX[listIdx][0]; - pakCuRecordV0.MVs[listIdx].y[countPU] = pPU->MvLX[listIdx][1]; - } - - SetPURefIdx(pakCuRecordV0, pPU, countPU); - } - - // Writing CU information into file - handlerCU.Write(pakCuRecordV0); - if (handlerCU.CheckStatus()) - throw std::string("ERROR: main: issue with file writing"); - }// End for (auto pCU = pCTU->Cu; pCU; pCU = pCU->Next, ++countCU) - - if (countCU < maxNumCuInCtu) - { - // Alignment with zero-padding for FEI CU buffer - memset(&pakCuRecordV0, 0, sizeof(pakCuRecordV0)); - - for (Bs32u idxEmptyCU = countCU; idxEmptyCU < maxNumCuInCtu; ++idxEmptyCU) - { - // Writing zero CU information into file - handlerCU.Write(pakCuRecordV0); - if (handlerCU.CheckStatus()) - throw std::string("ERROR: main: issue with file writing"); - } - } - - SetLevel0(pakCtuRecordV0, ctbLog2SizeY, vecCUs); - - pakCtuRecordV0.CuCountMinus1 = countCU - 1; - pakCtuRecordV0.CtuAddrX = countCTU % widthInCTU; - pakCtuRecordV0.CtuAddrY = countCTU / widthInCTU; - - // Writing CTU information into file - handlerCTU.Write(pakCtuRecordV0); - if (handlerCTU.CheckStatus()) - throw std::string("ERROR: main: issue with file writing"); - } // End for (auto pCTU = slice.ctu; pCTU; pCTU = pCTU->Next) - }// End for (auto pNALUIdx = pNALU; pNALUIdx; pNALUIdx = pNALUIdx->next) - }// End while(1) - CHECK_STATUS(bs_sts, BS_ERR_MORE_DATA); - } - catch (std::string & e) { - std::cout << e << std::endl; - return 1; - } - return 0; - -#endif // MFX_VERSION -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/CMakeLists.txt b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/CMakeLists.txt deleted file mode 100644 index 7c3b988..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -add_subdirectory(tools/configure) - -set (TRACER_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -include_directories( - "$ENV{MFX_HOME}/include" - "${TRACER_DIR}" - ) - -set(headers - "${TRACER_DIR}/config/config.h" - "${TRACER_DIR}/dumps/dump.h" - "${TRACER_DIR}/loggers/ilog.h" - "${TRACER_DIR}/loggers/log.h" - "${TRACER_DIR}/loggers/log_console.h" - "${TRACER_DIR}/loggers/log_etw_events.h" - "${TRACER_DIR}/loggers/log_file.h" - "${TRACER_DIR}/loggers/log_syslog.h" - "${TRACER_DIR}/loggers/timer.h" - "${TRACER_DIR}/loggers/thread_info.h" - "${TRACER_DIR}/tracer/tracer.h" - "${TRACER_DIR}/tracer/functions_table.h" - "${TRACER_DIR}/tracer/bits/mfxfunctions.h" - "${TRACER_DIR}/wrappers/mfx_structures.h" - ) - -set(sources - "${TRACER_DIR}/config/config.cpp" - "${TRACER_DIR}/dumps/dump.cpp" - "${TRACER_DIR}/dumps/dump_mfxbrc.cpp" - "${TRACER_DIR}/dumps/dump_mfxcommon.cpp" - "${TRACER_DIR}/dumps/dump_mfxdefs.cpp" - "${TRACER_DIR}/dumps/dump_mfxenc.cpp" - "${TRACER_DIR}/dumps/dump_mfxplugin.cpp" - "${TRACER_DIR}/dumps/dump_mfxsession.cpp" - "${TRACER_DIR}/dumps/dump_mfxstructures.cpp" - "${TRACER_DIR}/dumps/dump_mfxvideo.cpp" - "${TRACER_DIR}/dumps/dump_mfxfei.cpp" - "${TRACER_DIR}/dumps/dump_mfxla.cpp" - "${TRACER_DIR}/dumps/dump_mfxvp8.cpp" - "${TRACER_DIR}/loggers/log.cpp" - "${TRACER_DIR}/loggers/log_console.cpp" - "${TRACER_DIR}/loggers/log_etw_events.cpp" - "${TRACER_DIR}/loggers/log_file.cpp" - "${TRACER_DIR}/loggers/log_syslog.cpp" - "${TRACER_DIR}/tracer/tracer.cpp" - "${TRACER_DIR}/tracer/tracer_linux.cpp" - "${TRACER_DIR}/tracer/tracer_windows.cpp" - "${TRACER_DIR}/wrappers/mfx_core.cpp" - "${TRACER_DIR}/wrappers/mfx_video_core.cpp" - "${TRACER_DIR}/wrappers/mfx_video_decode.cpp" - "${TRACER_DIR}/wrappers/mfx_video_enc.cpp" - "${TRACER_DIR}/wrappers/mfx_video_encode.cpp" - "${TRACER_DIR}/wrappers/mfx_video_user.cpp" - "${TRACER_DIR}/wrappers/mfx_video_vpp.cpp" - "${TRACER_DIR}/wrappers/mfx_video_fei.cpp" - ) - -if( NOT DEFINED MFX_MODULES_DIR ) - set( MFX_MODULES_DIR ${CMAKE_INSTALL_FULL_LIBDIR} ) -endif( ) -add_definitions( -DMFX_MODULES_DIR="${MFX_MODULES_DIR}" ) - -make_library(mfx-tracer none shared) - -set_target_properties( mfx-tracer PROPERTIES LINK_FLAGS - "${LINK_FLAGS} -Wl,--version-script=${CMAKE_HOME_DIRECTORY}/api/mfx_dispatch/linux/libmfx.map" ) - -get_mfx_version(mfx_version_major mfx_version_minor) -set_target_properties(mfx-tracer PROPERTIES VERSION ${mfx_version_major}.${mfx_version_minor}) -set_target_properties(mfx-tracer PROPERTIES SOVERSION ${mfx_version_major}) - -target_link_libraries( mfx-tracer ${CMAKE_DL_LIBS}) -target_compile_options(mfx-tracer PRIVATE -Wno-deprecated-declarations) - -install(TARGETS mfx-tracer LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -set(defs "") diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/README.md b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/README.md deleted file mode 100644 index 189dcf6..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# Media SDK Tracer - -## Overview - -**Media SDK Tracer** is a tool which permits to dump logging information from the calls -of the application to the Media SDK library. Trace log obtained from this tool is a -recommended information to provide to Media SDK team on submitting questions and -issues. - -## Installation - -Use the following sequence to generate config file for the tracer: - -Generate default config file: -``` -# $INSTALLDIR/bin/mfx-tracer-config --default -``` -Set API level coverage: -``` -# $INSTALLDIR/bin/mfx-tracer-config core.level full -``` -Set trace type: -``` -# $INSTALLDIR/bin/mfx-tracer-config core.type file -``` -Set log file: -``` -# $INSTALLDIR/bin/mfx-tracer-config core.log ~/mfxtracer.log -``` - -Following this procedure you will generate a configuration file called `~/.mfxtracer` and set the tracer to dump -logs to `~/mfxtracer_.log` files. You may adjust your configuration with **mfx-tracer-config** tool. -Run `mfx-tracer-config -h` to get full list of supported options. - -## Running - -For use the tracer, run the application with **LD_PRELOAD**: - -``` -LD_PRELOAD=libmfx-tracer.so.1.34 <./some_application> -``` - -Make sure that the tracer library is added to the search path: - -``` -export LD_LIBRARY_PATH=$INSTALLDIR/lib:$LD_LIBRARY_PATH -``` - -After each run of some Media SDK based application you should see traces in the configured log files. -Note that the tracer library reads settings from `~/.mfxtracer` located in the home directory of a current user. -If you need to run application with 'sudo', copy `~/.mfxtracer` file to a home directory of the root user. - -## Known issues & limitations - -- This is prototype release of the tracer - not all functionality can be available -- Syslog logger is not supported -- Some API functions may not be covered by the tracing \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.cpp deleted file mode 100644 index 312e691..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: config.cpp - -\* ****************************************************************************** */ - -#include -#include -#include -#include - -#include "config.h" - -#if defined(_WIN32) || defined(_WIN64) -#include -const char* get_path_reg() - { - char* path = new char[128]; - DWORD size = sizeof(char)*128; - DWORD sts = RegGetValue(HKEY_LOCAL_MACHINE, (LPCTSTR)("Software\\Intel\\MediaSDK\\Dispatch\\tracer"), (LPCTSTR)("_conf"), RRF_RT_REG_SZ, (LPDWORD)0, (PVOID)path, (LPDWORD)&size); - size_t len = strnlen_s(path, 128); - - if (sts == ERROR_SUCCESS) - { - for (size_t i = 0; i < len; i++) - { - if (path[i] == '\\') - path[i] = '/'; - } - - } - else - { - GetCurrentDirectory(128, path); - len = strnlen_s(path, 128); - for (size_t i = 0; i < len; i++) - { - if (path[i] == '\\') - path[i] = '/'; - } - } - return path; - } -#endif - -Config* Config::conf = NULL; - -Config::Config() -{ - const char* home = -#if defined(_WIN32) || defined(_WIN64) - get_path_reg(); -#else - getenv("HOME"); -#endif - if (home) { - _file_path = std::string(home) + "/.mfxtracer"; - - if(!_file.is_open()){ - _file.open(_file_path.c_str(), std::ifstream::binary); - } - } - - Init(); -} - -Config::~Config() -{ - if(_file.is_open()) - _file.close(); - - //delete ini; -} - -void Config::Init() -{ - //delete tabs and spaces - //delete comments - //parse sections - //parse params in sections - - if(_file.is_open()){ - //TODO parse - std::string curent_section; - std::map section_params; - for (;;) { - std::string inistr; - getline(_file, inistr); - - //delete tabs and spaces - size_t firstQuote = inistr.find("\""); - size_t secondQuote = inistr.find_last_of("\""); - std::string firstPart=""; - std::string secondPart=""; - std::string quotePart=""; - if ((firstQuote != std::string::npos) && firstQuote < secondQuote) - { - firstPart = inistr.substr(0,firstQuote); - if (secondQuote != std::string::npos) - { - secondPart = inistr.substr(secondQuote+1); - quotePart = inistr.substr(firstQuote+1, secondQuote-firstQuote-1); - } - - firstPart.erase(std::remove_if(firstPart.begin(), firstPart.end(), &::isspace),firstPart.end()); - secondPart.erase(std::remove_if(secondPart.begin(), secondPart.end(), &::isspace),secondPart.end()); - inistr = firstPart + quotePart + secondPart; - } - else - { - inistr.erase(std::remove_if(inistr.begin(), inistr.end(), &::isspace),inistr.end()); - } - - //delete comments - std::basic_string ::size_type n1 = inistr.find("#"); - std::basic_string ::size_type n2 = inistr.find(";"); - - if(n1 != std::string::npos && n2 != std::string::npos) - n1>=n2 ? inistr.erase(n1, inistr.length()) : inistr.erase(n2, inistr.length()); - else if (n1 != std::string::npos) - inistr.erase(n1, inistr.length()); - else if(n2 != std::string::npos) - inistr.erase(n2, inistr.length()); - - - std::basic_string ::size_type s1 = inistr.find("["); - std::basic_string ::size_type s2 = inistr.find("]"); - if(s1 != std::string::npos && s2 != std::string::npos) { - inistr.erase(s1, s1+1); - inistr.erase(s2-1, s2); - curent_section = inistr; - section_params.clear(); - - ini.insert(std::pair >(inistr, section_params)); - - continue; - } - - if(!curent_section.empty()){ - std::vector key_val = split(inistr, '='); - if(key_val.size() == 2){ - ini[curent_section].insert(std::pair(key_val[0], key_val[1])); - } - } - - if(_file.eof()) - break; - } - - } - else { - //TODO add init default config - } -} - -std::vector &Config::split(const std::string &s, char delim, std::vector &elems) { - std::stringstream ss(s); - std::string item; - while (std::getline(ss, item, delim)) { - elems.push_back(item); - } - return elems; -} - -std::vector Config::split(const std::string &s, char delim) { - std::vector elems; - split(s, delim, elems); - return elems; -} - -std::string Config::GetParam(std::string section, std::string key) -{ - if(!conf) - conf = new Config(); - - return conf->ini[section][key]; -} - - diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.h deleted file mode 100644 index 4d008f8..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/config/config.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018-2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef CONFIG_H_ -#define CONFIG_H_ - -#include -#include -#include -#include - -class Config -{ -public: - static std::string GetParam(std::string section, std::string key); - -private: - static Config *conf; - Config(); - ~Config(); - - std::string _file_path; - std::ifstream _file; - - std::map > ini; - - void Init(); - std::vector &split(const std::string &s, char delim, std::vector &elems); - std::vector split(const std::string &s, char delim); -}; - -#endif //CONFIG_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.cpp deleted file mode 100644 index 949c470..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.cpp +++ /dev/null @@ -1,476 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump.cpp - -\* ****************************************************************************** */ - -#include "dump.h" -#if defined(_WIN32) || defined(_WIN64) - #include "windows.h" -#else - #include "unistd.h" -#endif - -std::string pVoidToHexString(void* x) -{ - std::ostringstream result; - result << std::setw(16) << std::setfill('0') << std::hex <= MFX_VERSION_NEXT) - TABLE_ENTRY(MFX_EXTBUFF_VP9_SEGMENTATION), - TABLE_ENTRY(MFX_EXTBUFF_VP9_TEMPORAL_LAYERS), - TABLE_ENTRY(MFX_EXTBUFF_VP9_PARAM) -#endif -}; - -static IdTable tbl_impl[] = { - TABLE_ENTRY(MFX_IMPL_SOFTWARE), - TABLE_ENTRY(MFX_IMPL_HARDWARE), - TABLE_ENTRY(MFX_IMPL_AUTO_ANY), - TABLE_ENTRY(MFX_IMPL_HARDWARE_ANY), - TABLE_ENTRY(MFX_IMPL_HARDWARE2), - TABLE_ENTRY(MFX_IMPL_HARDWARE3), - TABLE_ENTRY(MFX_IMPL_HARDWARE4), - TABLE_ENTRY(MFX_IMPL_RUNTIME), - TABLE_ENTRY(MFX_IMPL_VIA_ANY), - TABLE_ENTRY(MFX_IMPL_VIA_D3D9), - TABLE_ENTRY(MFX_IMPL_VIA_D3D11), - TABLE_ENTRY(MFX_IMPL_VIA_VAAPI), - TABLE_ENTRY(MFX_IMPL_AUDIO) -}; - -static IdTable tbl_fourcc[] = { - TABLE_ENTRY(MFX_FOURCC_NV12), - TABLE_ENTRY(MFX_FOURCC_YV12), - TABLE_ENTRY(MFX_FOURCC_NV16), - TABLE_ENTRY(MFX_FOURCC_YUY2), - TABLE_ENTRY(MFX_FOURCC_RGB3), - TABLE_ENTRY(MFX_FOURCC_RGB4), - TABLE_ENTRY(MFX_FOURCC_P8), - TABLE_ENTRY(MFX_FOURCC_P8_TEXTURE), - TABLE_ENTRY(MFX_FOURCC_P010), -#if (MFX_VERSION >= MFX_VERSION_NEXT) - TABLE_ENTRY(MFX_FOURCC_P016), -#endif - TABLE_ENTRY(MFX_FOURCC_P210), - TABLE_ENTRY(MFX_FOURCC_BGR4), - TABLE_ENTRY(MFX_FOURCC_A2RGB10), - TABLE_ENTRY(MFX_FOURCC_ARGB16), - TABLE_ENTRY(MFX_FOURCC_R16), - TABLE_ENTRY(MFX_FOURCC_ABGR16), - TABLE_ENTRY(MFX_FOURCC_AYUV), - TABLE_ENTRY(MFX_FOURCC_AYUV_RGB4), - TABLE_ENTRY(MFX_FOURCC_UYVY), -#if (MFX_VERSION >= 1027) - TABLE_ENTRY(MFX_FOURCC_Y210), - TABLE_ENTRY(MFX_FOURCC_Y410), -#endif - TABLE_ENTRY(MFX_FOURCC_NV21), - TABLE_ENTRY(MFX_FOURCC_IYUV), - TABLE_ENTRY(MFX_FOURCC_I010), -#if (MFX_VERSION >= MFX_VERSION_NEXT) - TABLE_ENTRY(MFX_FOURCC_Y216), - TABLE_ENTRY(MFX_FOURCC_Y416), - TABLE_ENTRY(MFX_FOURCC_RGBP), -#endif -}; - -static IdTable tbl_sts[] = { - TABLE_ENTRY(MFX_ERR_NONE), - TABLE_ENTRY(MFX_ERR_UNKNOWN), - TABLE_ENTRY(MFX_ERR_NULL_PTR), - TABLE_ENTRY(MFX_ERR_UNSUPPORTED), - TABLE_ENTRY(MFX_ERR_MEMORY_ALLOC), - TABLE_ENTRY(MFX_ERR_NOT_ENOUGH_BUFFER), - TABLE_ENTRY(MFX_ERR_INVALID_HANDLE), - TABLE_ENTRY(MFX_ERR_LOCK_MEMORY), - TABLE_ENTRY(MFX_ERR_NOT_INITIALIZED), - TABLE_ENTRY(MFX_ERR_NOT_FOUND), - TABLE_ENTRY(MFX_ERR_MORE_DATA), - TABLE_ENTRY(MFX_ERR_MORE_SURFACE), - TABLE_ENTRY(MFX_ERR_ABORTED), - TABLE_ENTRY(MFX_ERR_DEVICE_LOST), - TABLE_ENTRY(MFX_ERR_INCOMPATIBLE_VIDEO_PARAM), - TABLE_ENTRY(MFX_ERR_INVALID_VIDEO_PARAM), - TABLE_ENTRY(MFX_ERR_UNDEFINED_BEHAVIOR), - TABLE_ENTRY(MFX_ERR_DEVICE_FAILED), - TABLE_ENTRY(MFX_ERR_MORE_BITSTREAM), - TABLE_ENTRY(MFX_ERR_INCOMPATIBLE_AUDIO_PARAM), - TABLE_ENTRY(MFX_ERR_INVALID_AUDIO_PARAM), - TABLE_ENTRY(MFX_WRN_IN_EXECUTION), - TABLE_ENTRY(MFX_WRN_DEVICE_BUSY), - TABLE_ENTRY(MFX_WRN_VIDEO_PARAM_CHANGED), - TABLE_ENTRY(MFX_WRN_PARTIAL_ACCELERATION), - TABLE_ENTRY(MFX_WRN_INCOMPATIBLE_VIDEO_PARAM), - TABLE_ENTRY(MFX_WRN_VALUE_NOT_CHANGED), - TABLE_ENTRY(MFX_WRN_OUT_OF_RANGE), - TABLE_ENTRY(MFX_WRN_FILTER_SKIPPED), - TABLE_ENTRY(MFX_WRN_INCOMPATIBLE_AUDIO_PARAM), - TABLE_ENTRY(MFX_TASK_DONE), - TABLE_ENTRY(MFX_TASK_WORKING), - TABLE_ENTRY(MFX_TASK_BUSY), - TABLE_ENTRY(MFX_ERR_NONE_PARTIAL_OUTPUT) -}; - -static IdTable tbl_codecid[] = { - TABLE_ENTRY(MFX_CODEC_AVC), - TABLE_ENTRY(MFX_CODEC_HEVC), - TABLE_ENTRY(MFX_CODEC_MPEG2), - TABLE_ENTRY(MFX_CODEC_VC1), - TABLE_ENTRY(MFX_CODEC_CAPTURE), - TABLE_ENTRY(MFX_CODEC_VP9), - TABLE_ENTRY(MFX_CODEC_AV1) -}; - -static IdTable tbl_iopattern[] = { - TABLE_ENTRY(MFX_IOPATTERN_IN_VIDEO_MEMORY), - TABLE_ENTRY(MFX_IOPATTERN_IN_SYSTEM_MEMORY), - TABLE_ENTRY(MFX_IOPATTERN_IN_OPAQUE_MEMORY), - TABLE_ENTRY(MFX_IOPATTERN_OUT_VIDEO_MEMORY), - TABLE_ENTRY(MFX_IOPATTERN_OUT_SYSTEM_MEMORY), - TABLE_ENTRY(MFX_IOPATTERN_OUT_OPAQUE_MEMORY) -}; - - -const char* DumpContext::get_bufferid_str(mfxU32 bufferid) -{ - for (size_t i = 0; i < GET_ARRAY_SIZE(g_BufferIdTable); ++i) - { - if (g_BufferIdTable[i].id == static_cast(bufferid)) - { - return g_BufferIdTable[i].str; - } - } - return NULL; -} - -std::string GetmfxIMPL(mfxIMPL impl) { - - std::basic_stringstream stream; - std::string name = "UNKNOWN"; - - for (unsigned int i = 0; i < (sizeof(tbl_impl) / sizeof(tbl_impl[0])); i++) - if (tbl_impl[i].id == (impl & (MFX_IMPL_VIA_ANY - 1))) - name = tbl_impl[i].str; - stream << name; - - int via_flag = impl & ~(MFX_IMPL_VIA_ANY - 1); - - if (0 != via_flag) - { - stream << "|"; - name = "UNKNOWN"; - for (unsigned int i = 0; i < (sizeof(tbl_impl) / sizeof(tbl_impl[0])); i++) - if (tbl_impl[i].id == via_flag) - name = tbl_impl[i].str; - stream << name; - } - return stream.str(); -} - -std::string GetFourCC(mfxU32 fourcc) { - - std::basic_stringstream stream; - std::string name = "UNKNOWN"; - int j = 0; - for (unsigned int i = 0; i < (sizeof(tbl_fourcc) / sizeof(tbl_fourcc[0])); i++) - { - if (tbl_fourcc[i].id == static_cast(fourcc)) - { - name = ""; - while (tbl_fourcc[i].str[j + 11] != '\0') - { - name = name + tbl_fourcc[i].str[j + 11]; - j++; - } - name = name + "\0"; - break; - } - } - stream< stream; - std::string name = "UNKNOWN_STATUS"; - for (unsigned int i = 0; i < (sizeof(tbl_sts) / sizeof(tbl_sts[0])); i++) - { - if (tbl_sts[i].id == sts) - { - name = tbl_sts[i].str; - break; - } - - } - stream< stream; - std::string name = "UNKNOWN"; - for (unsigned int i = 0; i < (sizeof(tbl_codecid) / sizeof(tbl_codecid[0])); i++) - { - if (tbl_codecid[i].id == static_cast(id)) - { - name = tbl_codecid[i].str; - break; - } - - } - stream< stream; - std::string name; - for (unsigned int i = 0; i < (sizeof(tbl_iopattern) / sizeof(tbl_iopattern[0])); i++) - { - if (tbl_iopattern[i].id & static_cast(io)) - { - name += tbl_iopattern[i].str; - name += "; "; - } - - } - if (!name.length()) - { - name = "UNKNOWN"; - name += "(" + ToString(io) + ")"; - } - stream<= 0) - { - bool tmp = (write(fb[1], ptr, size) <= 0); - close(fb[0]); - close(fb[1]); - return tmp; - } - return true; -#endif -} - -//mfxcommon -DEFINE_GET_TYPE_DEF(mfxBitstream); -DEFINE_GET_TYPE_DEF(mfxExtBuffer); -DEFINE_GET_TYPE_DEF(mfxIMPL); -DEFINE_GET_TYPE_DEF(mfxInitParam); -DEFINE_GET_TYPE_DEF(mfxPriority); -DEFINE_GET_TYPE_DEF(mfxVersion); -DEFINE_GET_TYPE_DEF(mfxSyncPoint); - -//mfxenc -DEFINE_GET_TYPE_DEF(mfxENCInput); -DEFINE_GET_TYPE_DEF(mfxENCOutput); - -//mfxplugin -DEFINE_GET_TYPE_DEF(mfxPlugin); - -//mfxstructures -DEFINE_GET_TYPE_DEF(mfxDecodeStat); -DEFINE_GET_TYPE_DEF(mfxEncodeCtrl); -DEFINE_GET_TYPE_DEF(mfxEncodeStat); -DEFINE_GET_TYPE_DEF(mfxExtCodingOption); -DEFINE_GET_TYPE_DEF(mfxExtCodingOption2); -DEFINE_GET_TYPE_DEF(mfxExtCodingOption3); -DEFINE_GET_TYPE_DEF(mfxExtEncoderResetOption); -DEFINE_GET_TYPE_DEF(mfxExtVppAuxData); -DEFINE_GET_TYPE_DEF(mfxFrameAllocRequest); -DEFINE_GET_TYPE_DEF(mfxFrameData); -DEFINE_GET_TYPE_DEF(mfxFrameId); -DEFINE_GET_TYPE_DEF(mfxFrameInfo); -DEFINE_GET_TYPE_DEF(mfxFrameSurface1); -DEFINE_GET_TYPE_DEF(mfxHandleType); -DEFINE_GET_TYPE_DEF(mfxInfoMFX); -DEFINE_GET_TYPE_DEF(mfxInfoVPP); -DEFINE_GET_TYPE_DEF(mfxPayload); -DEFINE_GET_TYPE_DEF(mfxSkipMode); -DEFINE_GET_TYPE_DEF(mfxVideoParam); -DEFINE_GET_TYPE_DEF(mfxVPPStat); -DEFINE_GET_TYPE_DEF(mfxExtVPPDoNotUse); -DEFINE_GET_TYPE_DEF(mfxExtCodingOptionVPS); -DEFINE_GET_TYPE_DEF(mfxExtVPPRotation); -DEFINE_GET_TYPE_DEF(mfxExtEncodedSlicesInfo); -DEFINE_GET_TYPE_DEF(mfxExtVPPScaling); -DEFINE_GET_TYPE_DEF(mfxExtVPPMirroring); -DEFINE_GET_TYPE_DEF(mfxExtMVOverPicBoundaries); -DEFINE_GET_TYPE_DEF(mfxExtVPPColorFill); -DEFINE_GET_TYPE_DEF(mfxExtEncoderIPCMArea); -DEFINE_GET_TYPE_DEF(mfxExtInsertHeaders); - -//mfxsession -DEFINE_GET_TYPE_DEF(mfxSession); - -//mfxvideo -DEFINE_GET_TYPE_DEF(mfxBufferAllocator); -DEFINE_GET_TYPE_DEF(mfxFrameAllocator); - -//mfxfei -DEFINE_GET_TYPE_DEF(mfxExtFeiPreEncCtrl); -DEFINE_GET_TYPE_DEF(mfxExtFeiPreEncMV); -DEFINE_GET_TYPE_DEF(mfxExtFeiPreEncMBStat); -DEFINE_GET_TYPE_DEF(mfxExtFeiEncFrameCtrl); -DEFINE_GET_TYPE_DEF(mfxExtFeiEncMVPredictors); -DEFINE_GET_TYPE_DEF(mfxExtFeiEncQP); -DEFINE_GET_TYPE_DEF(mfxExtFeiEncMBCtrl); -DEFINE_GET_TYPE_DEF(mfxExtFeiEncMV); -DEFINE_GET_TYPE_DEF(mfxExtFeiEncMBStat); -DEFINE_GET_TYPE_DEF(mfxFeiPakMBCtrl); -DEFINE_GET_TYPE_DEF(mfxExtFeiPakMBCtrl); -DEFINE_GET_TYPE_DEF(mfxExtFeiParam); -DEFINE_GET_TYPE_DEF(mfxPAKInput); -DEFINE_GET_TYPE_DEF(mfxPAKOutput); -DEFINE_GET_TYPE_DEF(mfxExtFeiSPS); -DEFINE_GET_TYPE_DEF(mfxExtFeiPPS); -DEFINE_GET_TYPE_DEF(mfxExtFeiSliceHeader); -DEFINE_GET_TYPE_DEF(mfxExtFeiCodingOption); -DEFINE_GET_TYPE_DEF(mfxExtFeiRepackCtrl); -DEFINE_GET_TYPE_DEF(mfxFeiDecStreamOutMBCtrl); -DEFINE_GET_TYPE_DEF(mfxExtFeiDecStreamOut); - - diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.h deleted file mode 100644 index b1fd11e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump.h +++ /dev/null @@ -1,714 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump.h - -\* ****************************************************************************** */ - -#ifndef DUMP_H_ -#define DUMP_H_ - -#include -#include -#include -#include -#include -#include "mfxstructures.h" -#include "mfxvideo.h" -#include "mfxplugin.h" -#include "mfxenc.h" -#include "mfxfei.h" -#include "mfxla.h" -#include "mfxvp8.h" -#include "mfxcamera.h" -#include "mfxjpeg.h" -#include "mfxmvc.h" -#include "mfxbrc.h" - - - -std::string pVoidToHexString(void* x); -std::string GetStatusString(mfxStatus sts); -std::string GetmfxIMPL(mfxIMPL impl); -std::string GetFourCC(mfxU32 fourcc); -std::string GetCodecIdString (mfxU32 id); -std::string GetIOPattern (mfxU32 io); -bool _IsBadReadPtr(void *ptr, size_t size); - -#define GET_ARRAY_SIZE(x) sizeof(x)/sizeof(x[0]) -#define DUMP_RESERVED_ARRAY(r) dump_reserved_array(&(r[0]), GET_ARRAY_SIZE(r)) - -#define DUMP_FIELD(_field) \ - str += structName + "." #_field "=" + ToString(_struct._field) + "\n"; - -#define DUMP_FIELD_RESERVED(_field) \ - str += structName + "." #_field "[]=" + DUMP_RESERVED_ARRAY(_struct._field) + "\n"; - - #define ToString( x ) static_cast< std::ostringstream const & >( \ - ( std::ostringstream() << std::dec << x ) ).str() - - #define TimeToString( x ) static_cast< std::ostringstream const & >( \ - ( std::ostringstream() << std::left << std::setw(4) << std::dec << x <<" msec") ).str() - - /* - #define ToHexFormatString( x ) static_cast< std::ostringstream const & >( \ - ( std::ostringstream() << std::hex << x ) ).str() - */ - - #define ToHexFormatString( x ) (static_cast< std::ostringstream const & >( \ - ( std::ostringstream() << std::hex << pVoidToHexString((void*)x) ) ).str() ) -/* -#define DEFINE_GET_TYPE(type) \ - template<> \ - inline const char* get_type(){ return #type; }; -*/ - -#define DEFINE_GET_TYPE(type) \ - template<> \ - const char* get_type(); - -#define DEFINE_GET_TYPE_DEF(type) \ - template<> const char* DumpContext::get_type(){ return #type; } - -#define DEFINE_DUMP_FUNCTION(type) \ - std::string dump(const std::string structName, const type & var); - -enum eDumpContect { - DUMPCONTEXT_MFX, - DUMPCONTEXT_VPP, - DUMPCONTEXT_ALL, -}; - -enum eDumpFormat { - DUMP_DEC, - DUMP_HEX -}; - -class DumpContext -{ -public: - eDumpContect context; - - DumpContext(void) { - context = DUMPCONTEXT_ALL; - }; - ~DumpContext(void) {}; - - template - inline std::string toString( T x, eDumpFormat format = DUMP_DEC){ - return static_cast< std::ostringstream const & >( - ( std::ostringstream() << ((format == DUMP_DEC) ? std::dec : std::hex) << x )).str(); - } - - const char* get_bufferid_str(mfxU32 bufferid); - - template - std::string dump_reserved_array(T* data, size_t size) - { - std::stringstream result; - - result << "{ "; - for (size_t i = 0; i < size; ++i) { - result << data[i]; - if (i < (size-1)) result << ", "; - } - result << " }"; - return result.str(); - } - - template - std::string dump_array_with_cast(T0* data, size_t size) - { - std::stringstream result; - - result << "{ "; - for (size_t i = 0; i < size; ++i) { - result << (T1)data[i]; - if (i < (size - 1)) result << ", "; - } - result << " }"; - return result.str(); - } - - template - std::string dump_hex_array(T* data, size_t size) - { - std::stringstream result; - result << "{ " << std::hex << std::uppercase; - for (size_t i = 0; i < size; ++i) - result << std::setw(sizeof(T) * 2) << std::setfill('0') << (mfxU64)data[i]; - result << " }"; - return result.str(); - } - template - inline std::string dump_hex_array(T (&data)[N]) { return dump_hex_array(data, N); } - - - template - inline const char* get_type(){ return typeid(T).name(); } - - template - std::string dump(const std::string structName, const T *_struct) - { - std::string str = get_type(); - str += "* " + structName + "=" + ToHexFormatString(_struct) + "\n"; - if (_struct) str += dump(" " + structName, *_struct); - return str; - } - std::string dump(const std::string structName, const void *_struct) - { - std::string str = "void"; - str += "* " + structName + "=" + ToHexFormatString(_struct) + "\n"; - return str; - } - - template - inline std::string dump_mfxExtParams(const std::string structName, const T& _struct) - { - std::string str; - std::string name; - - str += structName + ".NumExtParam=" + ToString(_struct.NumExtParam) + "\n"; - str += structName + ".ExtParam=" + ToString(_struct.ExtParam) + "\n"; - - if (_struct.ExtParam) { - for (mfxU16 i = 0; i < _struct.NumExtParam; ++i) - { - if ((!_IsBadReadPtr(_struct.ExtParam, sizeof(mfxExtBuffer**))) && (!_IsBadReadPtr(_struct.ExtParam[i], sizeof(mfxExtBuffer*)))) - { - name = structName + ".ExtParam[" + ToString(i) + "]"; - str += name + "=" + ToString(_struct.ExtParam[i]) + "\n"; - switch (_struct.ExtParam[i]->BufferId) - { - case MFX_EXTBUFF_CODING_OPTION: - str += dump(name, *((mfxExtCodingOption*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_CODING_OPTION2: - str += dump(name, *((mfxExtCodingOption2*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_CODING_OPTION3: - str += dump(name, *((mfxExtCodingOption3*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODER_RESET_OPTION: - str += dump(name, *((mfxExtEncoderResetOption*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_GAMMA_CORRECTION: - str += dump(name, *((mfxExtCamGammaCorrection*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_WHITE_BALANCE: - str += dump(name, *((mfxExtCamWhiteBalance*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_HOT_PIXEL_REMOVAL: - str += dump(name, *((mfxExtCamHotPixelRemoval*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_BLACK_LEVEL_CORRECTION: - str += dump(name, *((mfxExtCamBlackLevelCorrection*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_VIGNETTE_CORRECTION: - str += dump(name, *((mfxExtCamVignetteCorrection*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_BAYER_DENOISE: - str += dump(name, *((mfxExtCamBayerDenoise*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_COLOR_CORRECTION_3X3: - str += dump(name, *((mfxExtCamColorCorrection3x3*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_PADDING: - str += dump(name, *((mfxExtCamPadding*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_PIPECONTROL: - str += dump(name, *((mfxExtCamPipeControl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_FORWARD_GAMMA_CORRECTION: - str += dump(name, *((mfxExtCamFwdGamma*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION: - str += dump(name, *((mfxExtCamLensGeomDistCorrection*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL: - str += dump(name, *((mfxExtCamTotalColorControl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUF_CAM_CSC_YUV_RGB: - str += dump(name, *((mfxExtCamCscYuvRgb*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_LOOKAHEAD_CTRL: - str += dump(name, *((mfxExtLAControl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_LOOKAHEAD_STAT: - str += dump(name, *((mfxExtLAFrameStatistics*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_AVC_REFLIST_CTRL: - str += dump(name, *((mfxExtAVCRefListCtrl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_AVC_TEMPORAL_LAYERS: - str += dump(name, *((mfxExtAvcTemporalLayers*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODED_FRAME_INFO: - str += dump(name, *((mfxExtAVCEncodedFrameInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_AVC_REFLISTS: - str += dump(name, *((mfxExtAVCRefLists*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_JPEG_QT: - str += dump(name, *((mfxExtJPEGQuantTables*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_JPEG_HUFFMAN: - str += dump(name, *((mfxExtJPEGHuffmanTables*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MVC_SEQ_DESC: - str += dump(name, *((mfxExtMVCSeqDesc*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MVC_TARGET_VIEWS: - str += dump(name, *((mfxExtMVCTargetViews*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION: - str += dump(name, *((mfxExtOpaqueSurfaceAlloc*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_DENOISE: - str += dump(name, *((mfxExtVPPDenoise*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_DETAIL: - str += dump(name, *((mfxExtVPPDetail*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_PROCAMP: - str += dump(name, *((mfxExtVPPProcAmp*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_CODING_OPTION_SPSPPS: - str += dump(name, *((mfxExtCodingOptionSPSPPS*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VIDEO_SIGNAL_INFO: - str += dump(name, *((mfxExtVideoSignalInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_DOUSE: - str += dump(name, *((mfxExtVPPDoUse*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_PICTURE_TIMING_SEI: - str += dump(name, *((mfxExtPictureTimingSEI*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_COMPOSITE: - str += dump(name, *((mfxExtVPPComposite*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO: - str += dump(name, *((mfxExtVPPVideoSignalInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_DEINTERLACING: - str += dump(name, *((mfxExtVPPDeinterlacing*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_HEVC_TILES: - str += dump(name, *((mfxExtHEVCTiles*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_HEVC_PARAM: - str += dump(name, *((mfxExtHEVCParam*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_HEVC_REGION: - str += dump(name, *((mfxExtHEVCRegion*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_DECODED_FRAME_INFO: - str += dump(name, *((mfxExtDecodedFrameInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_TIME_CODE: - str += dump(name, *((mfxExtTimeCode*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_PRED_WEIGHT_TABLE: - str += dump(name, *((mfxExtPredWeightTable*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODER_CAPABILITY: - str += dump(name, *((mfxExtEncoderCapability*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_DIRTY_RECTANGLES: - str += dump(name, *((mfxExtDirtyRect*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MOVING_RECTANGLES: - str += dump(name, *((mfxExtMoveRect*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION: - str += dump(name, *((mfxExtVPPFrameRateConversion*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_IMAGE_STABILIZATION: - str += dump(name, *((mfxExtVPPImageStab*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODER_ROI: - str += dump(name, *((mfxExtEncoderROI*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PARAM: - str += dump(name, *((mfxExtFeiParam*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PREENC_CTRL: - str += dump(name, *((mfxExtFeiPreEncCtrl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PREENC_MV_PRED: - str += dump(name, *((mfxExtFeiPreEncMVPredictors*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_ENC_QP: - str += dump(name, *((mfxExtFeiEncQP*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PREENC_MV: - str += dump(name, *((mfxExtFeiPreEncMV*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PREENC_MB: - str += dump(name, *((mfxExtFeiPreEncMBStat*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_ENC_CTRL: - str += dump(name, *((mfxExtFeiEncFrameCtrl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_ENC_MV_PRED: - str += dump(name, *((mfxExtFeiEncMVPredictors*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_ENC_MB: - str += dump(name, *((mfxExtFeiEncMBCtrl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_ENC_MV: - str += dump(name, *((mfxExtFeiEncMV*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_ENC_MB_STAT: - str += dump(name, *((mfxExtFeiEncMBStat*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PAK_CTRL: - str += dump(name, *((mfxFeiPakMBCtrl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_SPS: - str += dump(name, *((mfxExtFeiSPS*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_PPS: - str += dump(name, *((mfxExtFeiPPS*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_SLICE: - str += dump(name, *((mfxExtFeiSliceHeader*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_CODING_OPTION_VPS: - str += dump(name, *((mfxExtCodingOptionVPS*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_ROTATION: - str += dump(name, *(( mfxExtVPPRotation*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODED_SLICES_INFO: - str += dump(name, *((mfxExtEncodedSlicesInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_SCALING: - str += dump(name, *((mfxExtVPPScaling*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_CODING_OPTION: - str += dump(name, *((mfxExtFeiCodingOption*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_DEC_STREAM_OUT: - str += dump(name, *((mfxExtFeiDecStreamOut*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_FEI_REPACK_CTRL: - str += dump(name, *((mfxExtFeiRepackCtrl*)_struct.ExtParam[i])) + "\n"; - break; -#if (MFX_VERSION >= 1025) - case MFX_EXTBUFF_FEI_REPACK_STAT: - str += dump(name, *((mfxExtFeiRepackStat*)_struct.ExtParam[i])) + "\n"; - break; -#endif - case MFX_EXTBUFF_VPP_MIRRORING: - str += dump(name, *((mfxExtVPPMirroring*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES: - str += dump(name, *((mfxExtMVOverPicBoundaries*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_COLORFILL: - str += dump(name, *((mfxExtVPPColorFill*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_DEC_VIDEO_PROCESSING: - str += dump(name, *((mfxExtDecVideoProcessing*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_BRC: - str += dump(name, *((mfxExtBRC*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MBQP: - str += dump(name, *((mfxExtMBQP*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODER_IPCM_AREA: - str += dump(name, *((mfxExtEncoderIPCMArea*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_INSERT_HEADERS: - str += dump(name, *((mfxExtInsertHeaders*)_struct.ExtParam[i])) + "\n"; - break; -#if (MFX_VERSION >= 1025) - case MFX_EXTBUFF_DECODE_ERROR_REPORT: - str += dump(name, *((mfxExtDecodeErrorReport*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME: - str += dump(name, *((mfxExtMasteringDisplayColourVolume*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO: - str += dump(name, *((mfxExtContentLightLevelInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MULTI_FRAME_PARAM: - str += dump(name, *((mfxExtMultiFrameParam*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_MULTI_FRAME_CONTROL: - str += dump(name, *((mfxExtMultiFrameControl*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_ENCODED_UNITS_INFO: - str += dump(name, *((mfxExtEncodedUnitsInfo*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VPP_COLOR_CONVERSION: - str += dump(name, *((mfxExtColorConversion*)_struct.ExtParam[i])) + "\n"; - break; -#endif -#if (MFX_VERSION >= 1026) - case MFX_EXTBUFF_VPP_MCTF: - str += dump(name, *((mfxExtVppMctf*)_struct.ExtParam[i])) + "\n"; - break; -#endif - -#if (MFX_VERSION >= 1026) - case MFX_EXTBUFF_VP9_SEGMENTATION: - str += dump(name, *((mfxExtVP9Segmentation*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VP9_TEMPORAL_LAYERS: - str += dump(name, *((mfxExtVP9TemporalLayers*)_struct.ExtParam[i])) + "\n"; - break; - case MFX_EXTBUFF_VP9_PARAM: - str += dump(name, *((mfxExtVP9Param*)_struct.ExtParam[i])) + "\n"; - break; -#endif - default: - str += dump(name, *(_struct.ExtParam[i])) + "\n"; - break; - }; - } - else - { - str += "WARNING: Can't read from ExtParam[" + ToString(i) + "]!\n"; - return str; - } - - } - } - return str; - } - - //mfxdefs - std::string dump_mfxU32(const std::string structName, mfxU32 u32); - std::string dump_mfxU64(const std::string structName, mfxU64 u64); - std::string dump_mfxHDL(const std::string structName, const mfxHDL *hdl); - std::string dump_mfxStatus(const std::string structName, mfxStatus status); - - //mfxcommon - DEFINE_DUMP_FUNCTION(mfxBitstream); - DEFINE_DUMP_FUNCTION(mfxExtBuffer); - DEFINE_DUMP_FUNCTION(mfxIMPL); - DEFINE_DUMP_FUNCTION(mfxInitParam); - DEFINE_DUMP_FUNCTION(mfxPriority); - DEFINE_DUMP_FUNCTION(mfxVersion); - DEFINE_DUMP_FUNCTION(mfxSyncPoint); - DEFINE_DUMP_FUNCTION(mfxExtThreadsParam); - DEFINE_DUMP_FUNCTION(mfxPlatform); - - //mfxenc - DEFINE_DUMP_FUNCTION(mfxENCInput); - DEFINE_DUMP_FUNCTION(mfxENCOutput); - - //mfxplugin - DEFINE_DUMP_FUNCTION(mfxPlugin); - DEFINE_DUMP_FUNCTION(mfxCoreParam); - DEFINE_DUMP_FUNCTION(mfxPluginParam); - DEFINE_DUMP_FUNCTION(mfxCoreInterface); - - //mfxstructures - DEFINE_DUMP_FUNCTION(mfxDecodeStat); - DEFINE_DUMP_FUNCTION(mfxEncodeCtrl); - DEFINE_DUMP_FUNCTION(mfxEncodeStat); - DEFINE_DUMP_FUNCTION(mfxExtCodingOption); - DEFINE_DUMP_FUNCTION(mfxExtCodingOption2); - DEFINE_DUMP_FUNCTION(mfxExtCodingOption3); - DEFINE_DUMP_FUNCTION(mfxExtEncoderResetOption); - DEFINE_DUMP_FUNCTION(mfxExtVppAuxData); - DEFINE_DUMP_FUNCTION(mfxFrameAllocRequest); - DEFINE_DUMP_FUNCTION(mfxFrameAllocResponse); - DEFINE_DUMP_FUNCTION(mfxFrameData); - DEFINE_DUMP_FUNCTION(mfxFrameId); - DEFINE_DUMP_FUNCTION(mfxFrameInfo); - DEFINE_DUMP_FUNCTION(mfxFrameSurface1); - DEFINE_DUMP_FUNCTION(mfxHandleType); - DEFINE_DUMP_FUNCTION(mfxInfoMFX); - DEFINE_DUMP_FUNCTION(mfxInfoVPP); - DEFINE_DUMP_FUNCTION(mfxPayload); - DEFINE_DUMP_FUNCTION(mfxSkipMode); - DEFINE_DUMP_FUNCTION(mfxVideoParam); - DEFINE_DUMP_FUNCTION(mfxVPPStat); - DEFINE_DUMP_FUNCTION(mfxExtVPPDoNotUse); - DEFINE_DUMP_FUNCTION(mfxExtAVCRefListCtrl); - DEFINE_DUMP_FUNCTION(mfxExtAvcTemporalLayers); - DEFINE_DUMP_FUNCTION(mfxExtAVCEncodedFrameInfo); - DEFINE_DUMP_FUNCTION(mfxExtAVCRefLists); - DEFINE_DUMP_FUNCTION(mfxExtOpaqueSurfaceAlloc); - DEFINE_DUMP_FUNCTION(mfxExtVPPDenoise); - DEFINE_DUMP_FUNCTION(mfxExtVPPDetail); - DEFINE_DUMP_FUNCTION(mfxExtVPPProcAmp); - DEFINE_DUMP_FUNCTION(mfxExtCodingOptionSPSPPS); - DEFINE_DUMP_FUNCTION(mfxExtVideoSignalInfo); - DEFINE_DUMP_FUNCTION(mfxExtVPPDoUse); - DEFINE_DUMP_FUNCTION(mfxExtPictureTimingSEI); - DEFINE_DUMP_FUNCTION(mfxVPPCompInputStream); - DEFINE_DUMP_FUNCTION(mfxExtVPPComposite); - DEFINE_DUMP_FUNCTION(mfxExtVPPVideoSignalInfo); - DEFINE_DUMP_FUNCTION(mfxExtVPPDeinterlacing); - DEFINE_DUMP_FUNCTION(mfxExtHEVCTiles); - DEFINE_DUMP_FUNCTION(mfxExtHEVCParam); - DEFINE_DUMP_FUNCTION(mfxExtHEVCRegion); - DEFINE_DUMP_FUNCTION(mfxExtDecodedFrameInfo); - DEFINE_DUMP_FUNCTION(mfxExtTimeCode); - DEFINE_DUMP_FUNCTION(mfxExtPredWeightTable); - DEFINE_DUMP_FUNCTION(mfxExtEncoderCapability); - DEFINE_DUMP_FUNCTION(mfxExtDirtyRect); - DEFINE_DUMP_FUNCTION(mfxExtMoveRect); - DEFINE_DUMP_FUNCTION(mfxExtVPPFrameRateConversion); - DEFINE_DUMP_FUNCTION(mfxExtVPPImageStab); - DEFINE_DUMP_FUNCTION(mfxExtEncoderROI); - DEFINE_DUMP_FUNCTION(mfxExtCodingOptionVPS); - DEFINE_DUMP_FUNCTION(mfxExtVPPRotation); - DEFINE_DUMP_FUNCTION(mfxExtEncodedSlicesInfo); - DEFINE_DUMP_FUNCTION(mfxExtVPPScaling); - DEFINE_DUMP_FUNCTION(mfxExtVPPMirroring); - DEFINE_DUMP_FUNCTION(mfxExtMVOverPicBoundaries); - DEFINE_DUMP_FUNCTION(mfxExtVPPColorFill); - DEFINE_DUMP_FUNCTION(mfxExtDecVideoProcessing); - DEFINE_DUMP_FUNCTION(mfxExtMBQP); - DEFINE_DUMP_FUNCTION(mfxExtEncoderIPCMArea); - DEFINE_DUMP_FUNCTION(mfxExtInsertHeaders); -#if (MFX_VERSION >= 1025) - DEFINE_DUMP_FUNCTION(mfxExtDecodeErrorReport); - DEFINE_DUMP_FUNCTION(mfxExtMasteringDisplayColourVolume); - DEFINE_DUMP_FUNCTION(mfxExtContentLightLevelInfo); - DEFINE_DUMP_FUNCTION(mfxExtMultiFrameParam); - DEFINE_DUMP_FUNCTION(mfxExtMultiFrameControl); - DEFINE_DUMP_FUNCTION(mfxExtEncodedUnitsInfo); - DEFINE_DUMP_FUNCTION(mfxExtColorConversion); -#endif -#if (MFX_VERSION >= 1026) - DEFINE_DUMP_FUNCTION(mfxExtVppMctf); -#endif - -#if (MFX_VERSION >= 1026) - - DEFINE_DUMP_FUNCTION(mfxVP9SegmentParam); - DEFINE_DUMP_FUNCTION(mfxExtVP9Segmentation); - DEFINE_DUMP_FUNCTION(mfxVP9TemporalLayer); - DEFINE_DUMP_FUNCTION(mfxExtVP9TemporalLayers); - DEFINE_DUMP_FUNCTION(mfxExtVP9Param); -#endif - -#if (MFX_VERSION >= 1034) - DEFINE_DUMP_FUNCTION(mfxExtAV1FilmGrainParam); -#endif - - //mfxsession - DEFINE_DUMP_FUNCTION(mfxSession); - - //mfxvideo - DEFINE_DUMP_FUNCTION(mfxBufferAllocator); - DEFINE_DUMP_FUNCTION(mfxFrameAllocator); - - //mfxla - DEFINE_DUMP_FUNCTION(mfxExtLAControl); - DEFINE_DUMP_FUNCTION(mfxExtLAControl::mfxStream); - DEFINE_DUMP_FUNCTION(mfxLAFrameInfo); - DEFINE_DUMP_FUNCTION(mfxExtLAFrameStatistics); - - //mfxfei - DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncCtrl); - DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncMVPredictors); - DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncMV); - DEFINE_DUMP_FUNCTION(mfxExtFeiPreEncMBStat); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncFrameCtrl); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMVPredictors); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMVPredictors::mfxExtFeiEncMVPredictorsMB); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncQP); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBCtrl); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBCtrl::mfxExtFeiEncMBCtrlMB); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMV); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBStat); - DEFINE_DUMP_FUNCTION(mfxExtFeiEncMBStat::mfxExtFeiEncMBStatMB); - DEFINE_DUMP_FUNCTION(mfxFeiPakMBCtrl); - DEFINE_DUMP_FUNCTION(mfxExtFeiPakMBCtrl); - DEFINE_DUMP_FUNCTION(mfxExtFeiRepackCtrl); -#if (MFX_VERSION >= 1025) - DEFINE_DUMP_FUNCTION(mfxExtFeiRepackStat); -#endif - DEFINE_DUMP_FUNCTION(mfxExtFeiParam); - DEFINE_DUMP_FUNCTION(mfxPAKInput); - DEFINE_DUMP_FUNCTION(mfxPAKOutput); - DEFINE_DUMP_FUNCTION(mfxExtFeiSPS); - DEFINE_DUMP_FUNCTION(mfxExtFeiPPS); - DEFINE_DUMP_FUNCTION(mfxExtFeiSliceHeader); - DEFINE_DUMP_FUNCTION(mfxExtFeiSliceHeader::mfxSlice); - DEFINE_DUMP_FUNCTION(mfxExtFeiCodingOption); - DEFINE_DUMP_FUNCTION(mfxExtFeiDecStreamOut); - DEFINE_DUMP_FUNCTION(mfxFeiDecStreamOutMBCtrl); - - - //mfxvp8 - DEFINE_DUMP_FUNCTION(mfxExtVP8CodingOption) - - //mfxcamera - DEFINE_DUMP_FUNCTION(mfxExtCamGammaCorrection); - DEFINE_DUMP_FUNCTION(mfxExtCamWhiteBalance); - DEFINE_DUMP_FUNCTION(mfxExtCamHotPixelRemoval); - DEFINE_DUMP_FUNCTION(mfxExtCamBlackLevelCorrection); - DEFINE_DUMP_FUNCTION(mfxCamVignetteCorrectionParam); - DEFINE_DUMP_FUNCTION(mfxExtCamVignetteCorrection); - DEFINE_DUMP_FUNCTION(mfxExtCamBayerDenoise); - DEFINE_DUMP_FUNCTION(mfxExtCamColorCorrection3x3); - DEFINE_DUMP_FUNCTION(mfxExtCamPadding); - DEFINE_DUMP_FUNCTION(mfxExtCamPipeControl); - DEFINE_DUMP_FUNCTION(mfxCamFwdGammaSegment); - DEFINE_DUMP_FUNCTION(mfxExtCamFwdGamma); - DEFINE_DUMP_FUNCTION(mfxExtCamLensGeomDistCorrection); - DEFINE_DUMP_FUNCTION(mfxExtCamTotalColorControl); - DEFINE_DUMP_FUNCTION(mfxExtCamCscYuvRgb); - - //mfxjpeg - DEFINE_DUMP_FUNCTION(mfxExtJPEGQuantTables); - DEFINE_DUMP_FUNCTION(mfxExtJPEGHuffmanTables); - - //mfxmvc - DEFINE_DUMP_FUNCTION(mfxMVCViewDependency); - DEFINE_DUMP_FUNCTION(mfxMVCOperationPoint); - DEFINE_DUMP_FUNCTION(mfxExtMVCSeqDesc); - DEFINE_DUMP_FUNCTION(mfxExtMVCTargetViews); - - //mfxbrc - DEFINE_DUMP_FUNCTION(mfxExtBRC); - DEFINE_DUMP_FUNCTION(mfxBRCFrameParam); - DEFINE_DUMP_FUNCTION(mfxBRCFrameCtrl); - DEFINE_DUMP_FUNCTION(mfxBRCFrameStatus); - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - //custom scaling matrices - DEFINE_DUMP_FUNCTION(mfxExtAVCScalingMatrix); -#endif - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - //partial output - DEFINE_DUMP_FUNCTION(mfxExtPartialBitstreamParam); -#endif -}; -#endif //DUMP_H_ - diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxbrc.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxbrc.cpp deleted file mode 100644 index 884da3a..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxbrc.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2017-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump_mfxbrc.cpp - -\* ****************************************************************************** */ - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxExtBRC &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - - DUMP_FIELD(pthis); - DUMP_FIELD(Init); - DUMP_FIELD(Reset); - DUMP_FIELD(Close); - DUMP_FIELD(GetFrameCtrl); - DUMP_FIELD(Update); - - DUMP_FIELD_RESERVED(reserved1); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxBRCFrameParam &_struct) -{ - std::string str; - - DUMP_FIELD_RESERVED(reserved); - - DUMP_FIELD(EncodedOrder); - DUMP_FIELD(DisplayOrder); - DUMP_FIELD(CodedFrameSize); - DUMP_FIELD(FrameType); - DUMP_FIELD(PyramidLayer); - DUMP_FIELD(NumRecode); - dump_mfxExtParams(structName, _struct); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxBRCFrameCtrl &_struct) -{ - std::string str; - - DUMP_FIELD(QpY); -#if (MFX_VERSION >= 1029) - DUMP_FIELD(InitialCpbRemovalDelay); - DUMP_FIELD(InitialCpbRemovalOffset); - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(MaxFrameSize); - DUMP_FIELD(DeltaQP); - DUMP_FIELD(MaxNumRepak); - dump_mfxExtParams(structName, _struct); -#else - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(reserved2); -#endif - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxBRCFrameStatus &_struct) -{ - std::string str; - - DUMP_FIELD(MinFrameSize); - DUMP_FIELD(BRCStatus); - DUMP_FIELD_RESERVED(reserved); - DUMP_FIELD(reserved1); - - return str; -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxcommon.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxcommon.cpp deleted file mode 100644 index d748d01..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxcommon.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump_mfxcommon.cpp - -\* ****************************************************************************** */ - -#include "dump.h" -#include "../loggers/log.h" - -std::string DumpContext::dump(const std::string structName, const mfxBitstream &bitstream) -{ - std::string str; - str += structName + ".EncryptedData=" + ToString(bitstream.EncryptedData) + "\n"; - str += dump_mfxExtParams(structName, bitstream) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(bitstream.reserved) + "\n"; - str += structName + ".DecodeTimeStamp=" + ToString(bitstream.DecodeTimeStamp) + "\n"; - str += structName + ".TimeStamp=" + ToString(bitstream.TimeStamp) + "\n"; - if (Log::GetLogLevel() == LOG_LEVEL_FULL) { - str += structName + ".Data=" + ToHexFormatString(bitstream.Data) + "\n"; - } - str += structName + ".DataOffset=" + ToString(bitstream.DataOffset) + "\n"; - str += structName + ".DataLength=" + ToString(bitstream.DataLength) + "\n"; - str += structName + ".MaxLength=" + ToString(bitstream.MaxLength) + "\n"; - str += structName + ".PicStruct=" + ToString(bitstream.PicStruct) + "\n"; - str += structName + ".FrameType=" + ToString(bitstream.FrameType) + "\n"; - str += structName + ".DataFlag=" + ToString(bitstream.DataFlag) + "\n"; - str += structName + ".reserved2=" + ToString(bitstream.reserved2); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtBuffer &extBuffer) -{ - std::string str; - const char* bufid_str = get_bufferid_str(extBuffer.BufferId); - if (bufid_str) - str += structName + ".BufferId=" + std::string(bufid_str) + "\n"; - else - str += structName + ".BufferId=" + ToString(extBuffer.BufferId) + "\n"; - str += structName + ".BufferSz=" + ToString(extBuffer.BufferSz); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxIMPL &impl) -{ - return std::string("mfxIMPL " + structName + "=" + GetmfxIMPL(impl)); -} - -std::string DumpContext::dump(const std::string structName, const mfxPriority &priority) -{ - return std::string("mfxPriority " + structName + "=" + ToString(priority)); -} - -std::string DumpContext::dump(const std::string structName, const mfxInitParam &_struct) -{ - std::string str; - - str += structName + ".Implementation=" + GetmfxIMPL(_struct.Implementation) + "\n"; - str += dump(structName + ".Version", _struct.Version) + "\n"; - DUMP_FIELD(ExternalThreads); - DUMP_FIELD(NumExtParam); - str += structName + ".ExtParam=" + ToHexFormatString(_struct.ExtParam) + "\n"; - str += structName + ".reserved2[]=" + DUMP_RESERVED_ARRAY(_struct.reserved2) + "\n"; - str += structName + ".GPUCopy=" + ToString(_struct.GPUCopy) + "\n"; - DUMP_FIELD_RESERVED(reserved); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxSyncPoint &syncPoint) -{ - return std::string("mfxSyncPoint* " + structName + "=" + ToString(syncPoint)); -} - -std::string DumpContext::dump(const std::string structName, const mfxVersion &version) -{ - std::string str; - str += structName + ".Major=" + ToString(version.Major) + "\n"; - str += structName + ".Minor=" + ToString(version.Minor) + "\n"; - str += structName + ".Version=" + ToString(version.Version); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxPlatform &platform) -{ - std::string str; - str += structName + ".CodeName=" + ToString(platform.CodeName) + "\n"; - str += structName + ".DeviceId=" + ToString(platform.DeviceId) + "\n"; - return str; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxdefs.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxdefs.cpp deleted file mode 100644 index 50058d1..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxdefs.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "dump.h" - -std::string DumpContext::dump_mfxU32(const std::string structName, mfxU32 u32) -{ - return std::string("mfxU32 " + structName + "=" + ToString(u32)); -} - -std::string DumpContext::dump_mfxU64(const std::string structName, mfxU64 u64) -{ - return std::string("mfxU64 " + structName + "=" + ToString(u64)); -} - -std::string DumpContext::dump_mfxHDL(const std::string structName, const mfxHDL *hdl) -{ - return std::string("mfxHDL* " + structName + "=" + ToString(hdl)); -} - -std::string DumpContext::dump_mfxStatus(const std::string structName, mfxStatus status) -{ - return std::string(structName + "=" + GetStatusString(status)); -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxenc.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxenc.cpp deleted file mode 100644 index f8eeee7..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxenc.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxENCInput &encIn) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(encIn.reserved) + "\n"; - str += structName + ".InSurface=" + ToString(encIn.InSurface) + "\n"; - str += structName + ".NumFrameL0=" + ToString(encIn.NumFrameL0) + "\n"; - str += structName + ".L0Surface=" + ToString(encIn.L0Surface) + "\n"; - str += structName + ".NumFrameL1=" + ToString(encIn.NumFrameL1) + "\n"; - str += structName + ".L1Surface=" + ToString(encIn.L1Surface) + "\n"; - str += dump_mfxExtParams(structName, encIn); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxENCOutput &encOut) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(encOut.reserved) + "\n"; - str += dump_mfxExtParams(structName, encOut); - return str; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxfei.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxfei.cpp deleted file mode 100644 index 12e0047..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxfei.cpp +++ /dev/null @@ -1,802 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// -// INTEL CORPORATION PROPRIETARY INFORMATION -// This software is supplied under the terms of a license agreement or -// nondisclosure agreement with Intel Corporation and may not be copied -// or disclosed except in accordance with the terms of that agreement. -// Copyright(c) 2015-2020 Intel Corporation. All Rights Reserved. -// -*/ -#include "dump.h" - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiPreEncCtrl &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(Qp); - DUMP_FIELD(LenSP); - DUMP_FIELD(SearchPath); - DUMP_FIELD(SubMBPartMask); - DUMP_FIELD(SubPelMode); - DUMP_FIELD(InterSAD); - DUMP_FIELD(IntraSAD); - DUMP_FIELD(AdaptiveSearch); - DUMP_FIELD(MVPredictor); - DUMP_FIELD(MBQp); - DUMP_FIELD(FTEnable); - DUMP_FIELD(IntraPartMask); - DUMP_FIELD(RefWidth); - DUMP_FIELD(RefHeight); - DUMP_FIELD(SearchWindow); - DUMP_FIELD(DisableMVOutput); - DUMP_FIELD(DisableStatisticsOutput); - DUMP_FIELD(Enable8x8Stat); - DUMP_FIELD(PictureType); - DUMP_FIELD(DownsampleInput); - DUMP_FIELD(RefPictureType[0]); - DUMP_FIELD(RefPictureType[1]); - DUMP_FIELD(DownsampleReference[0]); - DUMP_FIELD(DownsampleReference[1]); - DUMP_FIELD(RefFrame[0]); - DUMP_FIELD(RefFrame[1]); - DUMP_FIELD_RESERVED(reserved); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiPreEncMVPredictors &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += "{ L0: {" + ToString(_struct.MB[i].MV[0].x) + "," + ToString(_struct.MB[i].MV[0].y) - + "}, L1: {" + ToString(_struct.MB[i].MV[1].x) + "," + ToString(_struct.MB[i].MV[1].y) - + "}}\n"; - } - str += "}\n"; - } - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiPreEncMV &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += "{\n"; - for (unsigned int j = 0; j < GET_ARRAY_SIZE(_struct.MB[i].MV); j++) - { - str += "{ L0: {" + ToString(_struct.MB[i].MV[j][0].x) + "," + ToString(_struct.MB[i].MV[j][0].y) - + "}, L1: {" + ToString(_struct.MB[i].MV[j][1].x) + "," + ToString(_struct.MB[i].MV[j][1].y) - + "}}, "; - } - str += "}\n"; - } - str += "}\n"; - } - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiPreEncMBStat &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - std::string prefix = structName + ".MB[" + ToString(i) + "]"; - str += prefix + ".Inter[0].BestDistortion=" + ToString(_struct.MB[i].Inter[0].BestDistortion) + "\n"; - str += prefix + ".Inter[0].Mode=" + ToString(_struct.MB[i].Inter[0].Mode) + "\n"; - str += prefix + ".Inter[1].BestDistortion=" + ToString(_struct.MB[i].Inter[1].BestDistortion) + "\n"; - str += prefix + ".Inter[1].Mode=" + ToString(_struct.MB[i].Inter[1].Mode) + "\n"; - str += prefix + ".BestIntraDistortion=" + ToString(_struct.MB[i].BestIntraDistortion) + "\n"; - str += prefix + ".IntraMode=" + ToString(_struct.MB[i].IntraMode) + "\n"; - str += prefix + ".NumOfNonZeroCoef=" + ToString(_struct.MB[i].NumOfNonZeroCoef) + "\n"; - str += prefix + ".reserved1=" + ToString(_struct.MB[i].reserved1) + "\n"; - str += prefix + ".SumOfCoef=" + ToString(_struct.MB[i].SumOfCoef) + "\n"; - str += prefix + ".reserved2=" + ToString(_struct.MB[i].reserved2) + "\n"; - str += prefix + ".Variance16x16=" + ToString(_struct.MB[i].Variance16x16) + "\n"; - str += prefix + ".Variance8x8[0]=" + ToString(_struct.MB[i].Variance8x8[0]) + "\n"; - str += prefix + ".Variance8x8[1]=" + ToString(_struct.MB[i].Variance8x8[1]) + "\n"; - str += prefix + ".Variance8x8[2]=" + ToString(_struct.MB[i].Variance8x8[2]) + "\n"; - str += prefix + ".Variance8x8[3]=" + ToString(_struct.MB[i].Variance8x8[3]) + "\n"; - str += prefix + ".PixelAverage16x16=" + ToString(_struct.MB[i].PixelAverage16x16) + "\n"; - str += prefix + ".PixelAverage8x8[0]=" + ToString(_struct.MB[i].PixelAverage8x8[0]) + "\n"; - str += prefix + ".PixelAverage8x8[1]=" + ToString(_struct.MB[i].PixelAverage8x8[1]) + "\n"; - str += prefix + ".PixelAverage8x8[2]=" + ToString(_struct.MB[i].PixelAverage8x8[2]) + "\n"; - str += prefix + ".PixelAverage8x8[3]=" + ToString(_struct.MB[i].PixelAverage8x8[3]) + "\n"; - } - } - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncFrameCtrl &_struct) -{ - std::string str; - - DUMP_FIELD(SearchPath); - DUMP_FIELD(LenSP); - DUMP_FIELD(SubMBPartMask); - DUMP_FIELD(IntraPartMask); - DUMP_FIELD(MultiPredL0); - DUMP_FIELD(MultiPredL1); - DUMP_FIELD(SubPelMode); - DUMP_FIELD(InterSAD); - DUMP_FIELD(IntraSAD); - DUMP_FIELD(DistortionType); - DUMP_FIELD(RepartitionCheckEnable); - DUMP_FIELD(AdaptiveSearch); - DUMP_FIELD(MVPredictor); - DUMP_FIELD(NumMVPredictors[0]); - DUMP_FIELD(NumMVPredictors[1]); - DUMP_FIELD(PerMBQp); - DUMP_FIELD(PerMBInput); - DUMP_FIELD(MBSizeCtrl); - DUMP_FIELD(RefWidth); - DUMP_FIELD(RefHeight); - DUMP_FIELD(SearchWindow); - DUMP_FIELD(ColocatedMbDistortion); - DUMP_FIELD_RESERVED(reserved); - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMVPredictors &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += dump("", _struct.MB[i]) + ",\n"; - } - str += "}\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMVPredictors::mfxExtFeiEncMVPredictorsMB &_struct) -{ - std::string str; - - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.RefIdx); i++) - { - str += structName + ".RefIdx[" + ToString(i) + "].RefL0=" + ToString(_struct.RefIdx[i].RefL0) + "\n"; - str += structName + ".RefIdx[" + ToString(i) + "].RefL1=" + ToString(_struct.RefIdx[i].RefL1) + "\n"; - } - - DUMP_FIELD(reserved); - - // mfxI16Pair MV[4][2]; /* first index is predictor number, second is 0 for L0 and 1 for L1 */ - - str += structName + ".MV[]={\n"; - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.MV); i++) - { - str += "{ L0: {" + ToString(_struct.MV[i][0].x) + "," + ToString(_struct.MV[i][0].y) - + "}, L1: {" + ToString(_struct.MV[i][1].x) + "," + ToString(_struct.MV[i][1].y) - + "}}, "; - } - str += "}\n"; - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncQP &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); /* size of allocated memory in number of QPs value*/ - DUMP_FIELD_RESERVED(reserved2); - - str += structName + ".QP[]=" + dump_reserved_array(_struct.MB, _struct.NumMBAlloc) + "\n"; - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMBCtrl &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += dump("", _struct.MB[i]) + ",\n"; - } - str += "}\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMBCtrl::mfxExtFeiEncMBCtrlMB &_struct) -{ - std::string str; - - DUMP_FIELD(ForceToIntra); - DUMP_FIELD(ForceToSkip); - DUMP_FIELD(ForceToNoneSkip); -#if (MFX_VERSION >= 1025) - DUMP_FIELD(DirectBiasAdjustment); - DUMP_FIELD(GlobalMotionBiasAdjustment); - DUMP_FIELD(MVCostScalingFactor); -#endif - DUMP_FIELD(reserved1); - - DUMP_FIELD(reserved2); - DUMP_FIELD(reserved3); - - DUMP_FIELD(reserved4); - DUMP_FIELD(TargetSizeInWord); - DUMP_FIELD(MaxSizeInWord); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMV &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += "{\n"; - for (unsigned int j = 0; j < GET_ARRAY_SIZE(_struct.MB[i].MV); j++) - { - str += "{ L0: {" + ToString(_struct.MB[i].MV[j][0].x) + "," + ToString(_struct.MB[i].MV[j][0].y) - + "}, L1: {" + ToString(_struct.MB[i].MV[j][1].x) + "," + ToString(_struct.MB[i].MV[j][1].y) - + "}}, "; - } - str += "}\n"; - } - str += "}\n"; - } - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMBStat &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += dump("", _struct.MB[i]) + ",\n"; - } - str += "}\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiEncMBStat::mfxExtFeiEncMBStatMB &_struct) -{ - std::string str; - - DUMP_FIELD_RESERVED(InterDistortion); - DUMP_FIELD(BestInterDistortion); - DUMP_FIELD(BestIntraDistortion); - DUMP_FIELD(ColocatedMbDistortion); - DUMP_FIELD(reserved); - DUMP_FIELD_RESERVED(reserved1); - - return str; -} - - - -std::string DumpContext::dump(const std::string structName, const mfxFeiPakMBCtrl &_struct) -{ - std::string str; - - DUMP_FIELD(Header); - DUMP_FIELD(MVDataLength); - DUMP_FIELD(MVDataOffset); - DUMP_FIELD(InterMbMode); - DUMP_FIELD(MBSkipFlag); - DUMP_FIELD(Reserved00); - DUMP_FIELD(IntraMbMode); - DUMP_FIELD(Reserved01); - DUMP_FIELD(FieldMbPolarityFlag); - DUMP_FIELD(MbType); - DUMP_FIELD(IntraMbFlag); - DUMP_FIELD(FieldMbFlag); - DUMP_FIELD(Transform8x8Flag); - DUMP_FIELD(Reserved02); - DUMP_FIELD(DcBlockCodedCrFlag); - DUMP_FIELD(DcBlockCodedCbFlag); - DUMP_FIELD(DcBlockCodedYFlag); - DUMP_FIELD(MVFormat); - DUMP_FIELD(Reserved03); - DUMP_FIELD(ExtendedFormat); - DUMP_FIELD(HorzOrigin); - DUMP_FIELD(VertOrigin); - DUMP_FIELD(CbpY); - DUMP_FIELD(CbpCb); - DUMP_FIELD(CbpCr); - DUMP_FIELD(QpPrimeY); - DUMP_FIELD(Reserved30); - DUMP_FIELD(MbSkipConvDisable); - DUMP_FIELD(IsLastMB); - DUMP_FIELD(EnableCoefficientClamp); - DUMP_FIELD(Direct8x8Pattern); - - if (_struct.IntraMbMode) - { - //dword 7,8 - str += structName + ".IntraMB.LumaIntraPredModes[]=" + DUMP_RESERVED_ARRAY(_struct.IntraMB.LumaIntraPredModes) + "\n"; - //dword 9 - str += structName + ".IntraMB.ChromaIntraPredMode=" + ToString(_struct.IntraMB.ChromaIntraPredMode) + "\n"; - str += structName + ".IntraMB.IntraPredAvailFlags=" + ToString(_struct.IntraMB.IntraPredAvailFlags) + "\n"; - str += structName + ".IntraMB.Reserved60=" + ToString(_struct.IntraMB.Reserved60) + "\n"; - } - - if (_struct.InterMbMode) - { - //dword 7 - str += structName + ".InterMB.SubMbShapes=" + ToString(_struct.InterMB.SubMbShapes) + "\n"; - str += structName + ".InterMB.SubMbPredModes=" + ToString(_struct.InterMB.SubMbPredModes) + "\n"; - str += structName + ".InterMB.Reserved40=" + ToString(_struct.InterMB.Reserved40) + "\n"; - //dword 8, 9 - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.InterMB.RefIdx); i++) - { - for (unsigned int j = 0; j < GET_ARRAY_SIZE(_struct.InterMB.RefIdx[0]); j++) - { - str += structName + ".InterMB.RefIdx[" + ToString(i) + "][" + ToString(j) + "]=" + ToString(_struct.InterMB.RefIdx[i][j]) + "\n"; - } - } - } - - //dword 10 - DUMP_FIELD(Reserved70); - DUMP_FIELD(TargetSizeInWord); - DUMP_FIELD(MaxSizeInWord); - - DUMP_FIELD_RESERVED(reserved2); - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiPakMBCtrl &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += dump("", _struct.MB[i]) + ",\n"; - } - str += "}\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiRepackCtrl &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(MaxFrameSize); - DUMP_FIELD(NumPasses); - DUMP_FIELD_RESERVED(reserved); - DUMP_FIELD_RESERVED(DeltaQP); - - return str; -} - -#if (MFX_VERSION >= 1025) -std::string DumpContext::dump(const std::string structName, const mfxExtFeiRepackStat &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(NumPasses); - DUMP_FIELD_RESERVED(reserved); - return str; -} -#endif - -std::string DumpContext::dump(const std::string structName, const mfxFeiDecStreamOutMBCtrl &_struct) -{ - std::string str; - - //dword 0 - DUMP_FIELD(InterMbMode); - DUMP_FIELD(MBSkipFlag); - DUMP_FIELD(Reserved00); - DUMP_FIELD(IntraMbMode); - DUMP_FIELD(Reserved01); - DUMP_FIELD(FieldMbPolarityFlag); - DUMP_FIELD(MbType); - DUMP_FIELD(IntraMbFlag); - DUMP_FIELD(FieldMbFlag); - DUMP_FIELD(Transform8x8Flag); - DUMP_FIELD(Reserved02); - DUMP_FIELD(DcBlockCodedCrFlag); - DUMP_FIELD(DcBlockCodedCbFlag); - DUMP_FIELD(DcBlockCodedYFlag); - DUMP_FIELD(Reserved03); - //dword 1 - DUMP_FIELD(HorzOrigin); - DUMP_FIELD(VertOrigin); - //dword 2 - DUMP_FIELD(CbpY); - DUMP_FIELD(CbpCb); - DUMP_FIELD(CbpCr); - DUMP_FIELD(Reserved20); - DUMP_FIELD(IsLastMB); - DUMP_FIELD(ConcealMB); - //dword 3 - DUMP_FIELD(QpPrimeY); - DUMP_FIELD(Reserved30); - DUMP_FIELD(Reserved31); - DUMP_FIELD(NzCoeffCount); - DUMP_FIELD(Reserved32); - DUMP_FIELD(Direct8x8Pattern); - - if (_struct.IntraMbMode) - { - //dword 4, 5 - str += structName + ".IntraMB.LumaIntraPredModes[]=" + DUMP_RESERVED_ARRAY(_struct.IntraMB.LumaIntraPredModes) + "\n"; - //dword 6 - str += structName + ".IntraMB.ChromaIntraPredMode=" + ToString(_struct.IntraMB.ChromaIntraPredMode) + "\n"; - str += structName + ".IntraMB.IntraPredAvailFlags=" + ToString(_struct.IntraMB.IntraPredAvailFlags) + "\n"; - str += structName + ".IntraMB.Reserved60=" + ToString(_struct.IntraMB.Reserved60) + "\n"; - } - - if (_struct.InterMbMode) - { - //dword 4 - str += structName + ".InterMB.SubMbShapes=" + ToString(_struct.InterMB.SubMbShapes) + "\n"; - str += structName + ".InterMB.SubMbPredModes=" + ToString(_struct.InterMB.SubMbPredModes) + "\n"; - str += structName + ".InterMB.Reserved40=" + ToString(_struct.InterMB.Reserved40) + "\n"; - //dword 5, 6 - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.InterMB.RefIdx); i++) - { - for (unsigned int j = 0; j < GET_ARRAY_SIZE(_struct.InterMB.RefIdx[0]); j++) - { - str += structName + ".InterMB.RefIdx[" + ToString(i) + "][" + ToString(j) + "]=" + ToString(_struct.InterMB.RefIdx[i][j]) + "\n"; - } - } - } - - //dword 7 - DUMP_FIELD(Reserved70); - - //dword 8-15 - str += structName + ".MV[]={\n"; - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.MV); i++) - { - str += "{ L0: {" + ToString(_struct.MV[i][0].x) + "," + ToString(_struct.MV[i][0].y) - + "}, L1: {" + ToString(_struct.MV[i][1].x) + "," + ToString(_struct.MV[i][1].y) - + "}}, "; - } - str += "}\n"; - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiDecStreamOut &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD_RESERVED(reserved1); - DUMP_FIELD(NumMBAlloc); - DUMP_FIELD(RemapRefIdx); - DUMP_FIELD(PicStruct); - DUMP_FIELD_RESERVED(reserved2); - if (_struct.MB) - { - str += structName + ".MB[]={\n"; - for (unsigned int i = 0; i < _struct.NumMBAlloc; i++) - { - str += dump("", _struct.MB[i]) + ",\n"; - } - str += "}\n"; - } - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiParam &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(Func); - DUMP_FIELD(SingleFieldProcessing); - DUMP_FIELD_RESERVED(reserved); - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxPAKInput &_struct) -{ - std::string str; - - DUMP_FIELD_RESERVED(reserved); - - if (_struct.InSurface) - { - str += dump(structName + ".InSurface", *_struct.InSurface) + "\n"; - } - else - { - str += structName + ".InSurface=NULL\n"; - } - DUMP_FIELD(NumFrameL0); - if (_struct.L0Surface) - { - for (int i = 0; i < _struct.NumFrameL0; i++) - { - if (_struct.L0Surface[i]) - { - str += dump(structName + ".L0Surface[" + ToString(i) + "]", *_struct.L0Surface[i]) + "\n"; - } - else - { - str += structName + ".L0Surface[" + ToString(i) + "]=NULL\n"; - } - } - } - DUMP_FIELD(NumFrameL1); - if (_struct.L1Surface) - { - for (int i = 0; i < _struct.NumFrameL1; i++) - { - if (_struct.L1Surface[i]) - { - str += dump(structName + ".L1Surface[" + ToString(i) + "]", *_struct.L1Surface[i]) + "\n"; - } - else - { - str += structName + ".L1Surface[" + ToString(i) + "]=NULL\n"; - } - } - } - str += dump_mfxExtParams(structName, _struct) + "\n"; - DUMP_FIELD(NumPayload); - if (_struct.Payload) - { - for (int i = 0; i < _struct.NumPayload; i++) - { - if (_struct.Payload[i]) - { - str += dump(structName + ".Payload[" + ToString(i) + "]", *_struct.Payload[i]) + "\n"; - } - else - { - str += structName + ".Payload[" + ToString(i) +"]=NULL\n"; - } - } - } - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxPAKOutput &_struct) -{ - std::string str; - - DUMP_FIELD_RESERVED(reserved); - - if (_struct.Bs) - { - str += dump(structName + ".Bs", *_struct.Bs) + "\n"; - } - else - { - str += structName + ".Bs=NULL\n"; - } - - if (_struct.OutSurface) - { - str += dump(structName + ".OutSurface", *_struct.OutSurface) + "\n"; - } - else - { - str += structName + ".OutSurface=NULL\n"; - } - - str += dump_mfxExtParams(structName, _struct) + "\n"; - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiSPS &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(SPSId); - DUMP_FIELD(PicOrderCntType); - DUMP_FIELD(Log2MaxPicOrderCntLsb); - DUMP_FIELD_RESERVED(reserved); - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiPPS &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(SPSId); - DUMP_FIELD(PPSId); - DUMP_FIELD(PictureType); - DUMP_FIELD(FrameType); - DUMP_FIELD(PicInitQP); - DUMP_FIELD(NumRefIdxL0Active); - DUMP_FIELD(NumRefIdxL1Active); - DUMP_FIELD(ChromaQPIndexOffset); - DUMP_FIELD(SecondChromaQPIndexOffset); - DUMP_FIELD(Transform8x8ModeFlag); - DUMP_FIELD_RESERVED(reserved); - - str += structName + ".DpbBefore[]={\n"; - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.DpbBefore); i++) - { - str += " [" + ToString(i) + "]\n"; - str += " {\n"; - str += " .Index" + ToString(_struct.DpbBefore[i].Index) + "\n"; - str += " .PicType" + ToString(_struct.DpbBefore[i].PicType) + "\n"; - str += " .FrameNumWrap" + ToString(_struct.DpbBefore[i].FrameNumWrap) + "\n"; - str += " .LongTermFrameIdx" + ToString(_struct.DpbBefore[i].LongTermFrameIdx) + "\n"; - str += " .reserved[0]" + ToString(_struct.DpbBefore[i].reserved[0]) + "\n"; - str += " .reserved[1]" + ToString(_struct.DpbBefore[i].reserved[1]) + "\n"; - str += " .reserved[2]" + ToString(_struct.DpbBefore[i].reserved[2]) + "\n"; - str += " }\n"; - } - str += "}\n"; - - str += structName + ".DpbAfter[]={\n"; - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.DpbAfter); i++) - { - str += " [" + ToString(i) + "]\n"; - str += " {\n"; - str += " .Index" + ToString(_struct.DpbAfter[i].Index) + "\n"; - str += " .PicType" + ToString(_struct.DpbAfter[i].PicType) + "\n"; - str += " .FrameNumWrap" + ToString(_struct.DpbAfter[i].FrameNumWrap) + "\n"; - str += " .LongTermFrameIdx" + ToString(_struct.DpbAfter[i].LongTermFrameIdx) + "\n"; - str += " }\n"; - } - str += "}\n"; - - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiSliceHeader &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD(NumSlice); - DUMP_FIELD_RESERVED(reserved); - - if (_struct.Slice) - { - str += structName + ".Slice[]={\n"; - for (int i = 0; i < _struct.NumSlice; i++) - { - str += dump("", _struct.Slice[i]) + ",\n"; - } - str += "}\n"; - } - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiSliceHeader::mfxSlice &_struct) -{ - std::string str; - - DUMP_FIELD(MBAddress); - DUMP_FIELD(NumMBs); - DUMP_FIELD(SliceType); - DUMP_FIELD(PPSId); - DUMP_FIELD(IdrPicId); - DUMP_FIELD(CabacInitIdc); - DUMP_FIELD(NumRefIdxL0Active); - DUMP_FIELD(NumRefIdxL1Active); - DUMP_FIELD(SliceQPDelta); - DUMP_FIELD(DisableDeblockingFilterIdc); - DUMP_FIELD(SliceAlphaC0OffsetDiv2); - DUMP_FIELD(SliceBetaOffsetDiv2); - DUMP_FIELD_RESERVED(reserved); - - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.RefL0); i++) - { - str += structName + ".RefL0[" + ToString(i) + "].PictureType=" + ToString(_struct.RefL0[i].PictureType) + "\n"; - str += structName + ".RefL0[" + ToString(i) + "].Index=" + ToString(_struct.RefL0[i].Index) + "\n"; - str += structName + ".RefL0[" + ToString(i) + "].reserved[0]=" + ToString(_struct.RefL0[i].reserved[0]) + "\n"; - str += structName + ".RefL0[" + ToString(i) + "].reserved[1]=" + ToString(_struct.RefL0[i].reserved[1]) + "\n"; - } - - for (unsigned int i = 0; i < GET_ARRAY_SIZE(_struct.RefL1); i++) - { - str += structName + ".RefL1[" + ToString(i) + "].PictureType=" + ToString(_struct.RefL1[i].PictureType) + "\n"; - str += structName + ".RefL1[" + ToString(i) + "].Index=" + ToString(_struct.RefL1[i].Index) + "\n"; - str += structName + ".RefL1[" + ToString(i) + "].reserved[0]=" + ToString(_struct.RefL1[i].reserved[0]) + "\n"; - str += structName + ".RefL1[" + ToString(i) + "].reserved[1]=" + ToString(_struct.RefL1[i].reserved[1]) + "\n"; - } - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtFeiCodingOption &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD(DisableHME); - DUMP_FIELD(DisableSuperHME); - DUMP_FIELD(DisableUltraHME); - DUMP_FIELD_RESERVED(reserved); - return str; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxla.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxla.cpp deleted file mode 100644 index 5d538db..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxla.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxExtLAControl &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(LookAheadDepth); - DUMP_FIELD(DependencyDepth); - DUMP_FIELD(DownScaleFactor); - DUMP_FIELD(BPyramid); - - DUMP_FIELD_RESERVED(reserved1); - - DUMP_FIELD(NumOutStream); - - str += structName + ".OutStream[]={\n"; - for (int i = 0; i < _struct.NumOutStream; i++) - { - str += dump("", _struct.OutStream[i]) + ",\n"; - } - str += "}\n"; - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtLAControl::mfxStream &_struct) -{ - std::string str; - - DUMP_FIELD(Width); - DUMP_FIELD(Height); - - DUMP_FIELD_RESERVED(reserved2); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxLAFrameInfo &_struct) -{ - std::string str; - - DUMP_FIELD(Width); - DUMP_FIELD(Height); - - DUMP_FIELD(FrameType); - DUMP_FIELD(FrameDisplayOrder); - DUMP_FIELD(FrameEncodeOrder); - - DUMP_FIELD(IntraCost); - DUMP_FIELD(InterCost); - DUMP_FIELD(DependencyCost); - DUMP_FIELD(Layer); - DUMP_FIELD_RESERVED(reserved); - - DUMP_FIELD_RESERVED(EstimatedRate); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtLAFrameStatistics &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - - DUMP_FIELD(NumAlloc); - DUMP_FIELD(NumStream); - DUMP_FIELD(NumFrame); - - - str += structName + ".FrameStat[]={\n"; - for (int i = 0; i < _struct.NumStream; i++) - { - str += dump("", _struct.FrameStat[i]) + ",\n"; - } - str += "}\n"; - - - if (_struct.OutSurface) - { - str += dump(structName + ".OutSurface", *_struct.OutSurface) + "\n"; - } - else - { - str += structName + ".OutSurface=NULL\n"; - } - - return str; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxplugin.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxplugin.cpp deleted file mode 100644 index 3078635..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxplugin.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump_mfxplugin.cpp - -\* ****************************************************************************** */ - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxPlugin &plugin) -{ - std::string str; - str += structName + ".pthis=" + ToString(plugin.pthis) + "\n"; - str += structName + ".PluginInit=" + ToString(plugin.PluginInit) + "\n"; - str += structName + ".PluginClose=" + ToString(plugin.PluginClose) + "\n"; - str += structName + ".GetPluginParam=" + ToString(plugin.GetPluginParam) + "\n"; - str += structName + ".Submit=" + ToString(plugin.Submit) + "\n"; - str += structName + ".Execute=" + ToString(plugin.Execute) + "\n"; - str += structName + ".FreeResources=" + ToString(plugin.FreeResources) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(plugin.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxCoreParam &CoreParam) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CoreParam.reserved) + "\n"; - str += structName + ".Impl=" + GetmfxIMPL(CoreParam.Impl) + "\n"; - str += dump(structName + ".Version=", CoreParam.Version) + "\n"; - str += structName + ".NumWorkingThread=" + ToString(CoreParam.NumWorkingThread) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxPluginParam &PluginParam) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(PluginParam.reserved) + "\n"; - str += structName + ".reserved1=" + ToString(PluginParam.reserved1) + "\n"; - str += structName + ".PluginVersion=" + ToString(PluginParam.PluginVersion) + "\n"; - str += dump(structName + ".APIVersion=", PluginParam.APIVersion) + "\n"; - str += structName + ".PluginUID=" + dump_hex_array(PluginParam.PluginUID.Data) + "\n"; - str += structName + ".Type=" + ToString(PluginParam.Type) + "\n"; - str += structName + ".CodecId=" + GetCodecIdString(PluginParam.CodecId) + "\n"; - str += structName + ".ThreadPolicy=" + ToString(PluginParam.ThreadPolicy) + "\n"; - str += structName + ".MaxThreadNum=" + ToString(PluginParam.MaxThreadNum) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxCoreInterface &_struct) -{ - std::string str; - - DUMP_FIELD(pthis); - DUMP_FIELD_RESERVED(reserved1); - str += dump(structName + ".FrameAllocator", _struct.FrameAllocator) + "\n"; - DUMP_FIELD(GetCoreParam); - DUMP_FIELD(GetHandle); - DUMP_FIELD(IncreaseReference); - DUMP_FIELD(DecreaseReference); - DUMP_FIELD(CopyFrame); - DUMP_FIELD(CopyBuffer); - DUMP_FIELD(MapOpaqueSurface); - DUMP_FIELD(UnmapOpaqueSurface); - DUMP_FIELD(GetRealSurface); - DUMP_FIELD(GetOpaqueSurface); - DUMP_FIELD(CreateAccelerationDevice); - DUMP_FIELD(GetFrameHandle); - DUMP_FIELD(GetFrameHandle); - DUMP_FIELD(QueryPlatform); - DUMP_FIELD_RESERVED(reserved4); - - return str; -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxsession.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxsession.cpp deleted file mode 100644 index 6c9e59b..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxsession.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxSession &session) -{ - return std::string("mfxSession " + structName + "=" + ToString(session)); -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxstructures.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxstructures.cpp deleted file mode 100644 index b625e0d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxstructures.cpp +++ /dev/null @@ -1,1633 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump_mfxstructures.cpp - -\* ****************************************************************************** */ - -#include "dump.h" -#include "../loggers/log.h" - -std::string DumpContext::dump(const std::string structName, const mfxDecodeStat &decodeStat) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(decodeStat.reserved) + "\n"; - str += structName + ".NumFrame=" + ToString(decodeStat.NumFrame) + "\n"; - str += structName + ".NumSkippedFrame=" + ToString(decodeStat.NumSkippedFrame) + "\n"; - str += structName + ".NumError=" + ToString(decodeStat.NumError) + "\n"; - str += structName + ".NumCachedFrame=" + ToString(decodeStat.NumCachedFrame); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxEncodeCtrl &EncodeCtrl) -{ - std::string str; - str += dump(structName + ".Header", EncodeCtrl.Header) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(EncodeCtrl.reserved) + "\n"; -#if (MFX_VERSION >= 1025) - str += structName + ".reserved1=" + ToString(EncodeCtrl.reserved1) + "\n"; - str += structName + ".MfxNalUnitType=" + ToString(EncodeCtrl.MfxNalUnitType) + "\n"; -#endif - str += structName + ".SkipFrame=" + ToString(EncodeCtrl.SkipFrame) + "\n"; - str += structName + ".QP=" + ToString(EncodeCtrl.QP) + "\n"; - str += structName + ".FrameType=" + ToString(EncodeCtrl.FrameType) + "\n"; - str += structName + ".NumPayload=" + ToString(EncodeCtrl.NumPayload) + "\n"; - str += structName + ".reserved2=" + ToString(EncodeCtrl.reserved2) + "\n"; - str += dump_mfxExtParams(structName, EncodeCtrl) + "\n"; - str += structName + ".Payload=" + ToString(EncodeCtrl.Payload); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxEncodeStat &encodeStat) -{ - std::string str; - str += structName + ".NumBit=" + ToString(encodeStat.NumBit) + "\n"; - str += structName + ".NumCachedFrame=" + ToString(encodeStat.NumCachedFrame) + "\n"; - str += structName + ".NumFrame=" + ToString(encodeStat.NumFrame) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(encodeStat.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCodingOption &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".reserved1=" + ToString(_struct.reserved1) + "\n"; - str += structName + ".RateDistortionOpt=" + ToString(_struct.RateDistortionOpt) + "\n"; - str += structName + ".MECostType=" + ToString(_struct.MECostType) + "\n"; - str += structName + ".MESearchType=" + ToString(_struct.MESearchType) + "\n"; - str += structName + ".MVSearchWindow.x=" + ToString(_struct.MVSearchWindow.x) + "\n"; - str += structName + ".MVSearchWindow.y=" + ToString(_struct.MVSearchWindow.y) + "\n"; - - str += structName + ".EndOfSequence=" + ToString(_struct.EndOfSequence) + "\n"; - str += structName + ".FramePicture=" + ToString(_struct.FramePicture) + "\n"; - - str += structName + ".CAVLC=" + ToString(_struct.CAVLC) + "\n"; - str += structName + ".reserved2[]=" + DUMP_RESERVED_ARRAY(_struct.reserved2) + "\n"; - str += structName + ".RecoveryPointSEI=" + ToString(_struct.RecoveryPointSEI) + "\n"; - str += structName + ".ViewOutput=" + ToString(_struct.ViewOutput) + "\n"; - str += structName + ".NalHrdConformance=" + ToString(_struct.NalHrdConformance) + "\n"; - str += structName + ".SingleSeiNalUnit=" + ToString(_struct.SingleSeiNalUnit) + "\n"; - str += structName + ".VuiVclHrdParameters=" + ToString(_struct.VuiVclHrdParameters) + "\n"; - - str += structName + ".RefPicListReordering=" + ToString(_struct.RefPicListReordering) + "\n"; - str += structName + ".ResetRefList=" + ToString(_struct.ResetRefList) + "\n"; - str += structName + ".RefPicMarkRep=" + ToString(_struct.RefPicMarkRep) + "\n"; - str += structName + ".FieldOutput=" + ToString(_struct.FieldOutput) + "\n"; - - str += structName + ".IntraPredBlockSize=" + ToString(_struct.IntraPredBlockSize) + "\n"; - str += structName + ".InterPredBlockSize=" + ToString(_struct.InterPredBlockSize) + "\n"; - str += structName + ".MVPrecision=" + ToString(_struct.MVPrecision) + "\n"; - str += structName + ".MaxDecFrameBuffering=" + ToString(_struct.MaxDecFrameBuffering) + "\n"; - - str += structName + ".AUDelimiter=" + ToString(_struct.AUDelimiter) + "\n"; - str += structName + ".EndOfStream=" + ToString(_struct.EndOfStream) + "\n"; - str += structName + ".PicTimingSEI=" + ToString(_struct.PicTimingSEI) + "\n"; - str += structName + ".VuiNalHrdParameters=" + ToString(_struct.VuiNalHrdParameters) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCodingOption2 &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(IntRefType); - DUMP_FIELD(IntRefCycleSize); - DUMP_FIELD(IntRefQPDelta); - - DUMP_FIELD(MaxFrameSize); - DUMP_FIELD(MaxSliceSize); - - DUMP_FIELD(BitrateLimit); - DUMP_FIELD(MBBRC); - DUMP_FIELD(ExtBRC); - DUMP_FIELD(LookAheadDepth); - DUMP_FIELD(Trellis); - DUMP_FIELD(RepeatPPS); - DUMP_FIELD(BRefType); - DUMP_FIELD(AdaptiveI); - DUMP_FIELD(AdaptiveB); - DUMP_FIELD(LookAheadDS); - DUMP_FIELD(NumMbPerSlice); - DUMP_FIELD(SkipFrame); - DUMP_FIELD(MinQPI); - DUMP_FIELD(MaxQPI); - DUMP_FIELD(MinQPP); - DUMP_FIELD(MaxQPP); - DUMP_FIELD(MinQPB); - DUMP_FIELD(MaxQPB); - DUMP_FIELD(FixedFrameRate); - DUMP_FIELD(DisableDeblockingIdc); - DUMP_FIELD(DisableVUI); - DUMP_FIELD(BufferingPeriodSEI); - DUMP_FIELD(EnableMAD); - DUMP_FIELD(UseRawRef); - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCodingOption3 &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(NumSliceI); - DUMP_FIELD(NumSliceP); - DUMP_FIELD(NumSliceB); - - DUMP_FIELD(WinBRCMaxAvgKbps); - DUMP_FIELD(WinBRCSize); - - DUMP_FIELD(QVBRQuality); - DUMP_FIELD(EnableMBQP); - DUMP_FIELD(IntRefCycleDist); - DUMP_FIELD(DirectBiasAdjustment); /* tri-state option */ - DUMP_FIELD(GlobalMotionBiasAdjustment); /* tri-state option */ - DUMP_FIELD(MVCostScalingFactor); - DUMP_FIELD(MBDisableSkipMap); /* tri-state option */ - DUMP_FIELD(WeightedPred); - DUMP_FIELD(WeightedBiPred); - DUMP_FIELD(AspectRatioInfoPresent); - DUMP_FIELD(OverscanInfoPresent); - DUMP_FIELD(OverscanAppropriate); - DUMP_FIELD(TimingInfoPresent); - DUMP_FIELD(BitstreamRestriction); - DUMP_FIELD(LowDelayHrd); /* tri-state option */ - DUMP_FIELD(MotionVectorsOverPicBoundaries); /* tri-state option */ -#if (MFX_VERSION >= MFX_VERSION_NEXT) - DUMP_FIELD(Log2MaxMvLengthHorizontal); /* 0..16 */ - DUMP_FIELD(Log2MaxMvLengthVertical); /* 0..16 */ -#else - DUMP_FIELD_RESERVED(reserved1); -#endif - - DUMP_FIELD(ScenarioInfo); - DUMP_FIELD(ContentInfo); - DUMP_FIELD(PRefType); - DUMP_FIELD(FadeDetection); -#if (MFX_VERSION >= MFX_VERSION_NEXT) - DUMP_FIELD(DeblockingAlphaTcOffset); - DUMP_FIELD(DeblockingBetaOffset); -#else - DUMP_FIELD_RESERVED(reserved2); -#endif - DUMP_FIELD(GPB); - DUMP_FIELD(MaxFrameSizeI); - DUMP_FIELD(MaxFrameSizeP); - DUMP_FIELD(EnableQPOffset); - DUMP_FIELD_RESERVED(QPOffset); - DUMP_FIELD_RESERVED(NumRefActiveP); - DUMP_FIELD_RESERVED(NumRefActiveBL0); - DUMP_FIELD_RESERVED(NumRefActiveBL1); - DUMP_FIELD(BRCPanicMode); -#if (MFX_VERSION >= MFX_VERSION_NEXT) - DUMP_FIELD(ConstrainedIntraPredFlag); -#endif -#if (MFX_VERSION >= 1026) - DUMP_FIELD(TransformSkip); -#endif -#if (MFX_VERSION >= 1027) - DUMP_FIELD(TargetChromaFormatPlus1); /* Minus 1 specifies target encoding chroma format (see ColorFormat enum). May differ from input one. */ - DUMP_FIELD(TargetBitDepthLuma); /* Target encoding bit depth for luma samples. May differ from input one. */ - DUMP_FIELD(TargetBitDepthChroma); /* Target encoding bit depth for chroma samples. May differ from input one. */ -#else - DUMP_FIELD_RESERVED(reserved4); -#endif - DUMP_FIELD(EnableMBForceIntra); - DUMP_FIELD(AdaptiveMaxFrameSize); - DUMP_FIELD(RepartitionCheckEnable); -#if (MFX_VERSION >= MFX_VERSION_NEXT) - DUMP_FIELD(QuantScaleType); - DUMP_FIELD(IntraVLCFormat); - DUMP_FIELD(ScanType); -#endif -#if ((MFX_VERSION < MFX_VERSION_NEXT) && (MFX_VERSION >= 1025)) - DUMP_FIELD_RESERVED(reserved5); -#endif -#if (MFX_VERSION >= 1025) - DUMP_FIELD(EncodedUnitsInfo); - DUMP_FIELD(EnableNalUnitType); -#endif -#if (MFX_VERSION >= 1026) - DUMP_FIELD(ExtBrcAdaptiveLTR) -#endif - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtEncoderResetOption &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(StartNewSequence); - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPDoNotUse &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - // TODO dump list of algs - DUMP_FIELD(NumAlg); - DUMP_FIELD(AlgList); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVppAuxData &extVppAuxData) -{ - std::string str; - str += dump(structName + ".Header", extVppAuxData.Header) + "\n"; - str += structName + ".SpatialComplexity=" + ToString(extVppAuxData.SpatialComplexity) + "\n"; - str += structName + ".TemporalComplexity=" + ToString(extVppAuxData.TemporalComplexity) + "\n"; - str += structName + ".PicStruct=" + ToString(extVppAuxData.PicStruct) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(extVppAuxData.reserved) + "\n"; - str += structName + ".SceneChangeRate=" + ToString(extVppAuxData.SceneChangeRate) + "\n"; - str += structName + ".RepeatedFrame=" + ToString(extVppAuxData.RepeatedFrame); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxFrameAllocRequest &frameAllocRequest) -{ - std::string str; - str += structName + ".AllocId=" + ToString(frameAllocRequest.AllocId) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(frameAllocRequest.reserved) + "\n"; - str += structName + ".reserved3[]=" + DUMP_RESERVED_ARRAY(frameAllocRequest.reserved3) + "\n"; - str += dump(structName+".Info", frameAllocRequest.Info) + "\n"; - str += structName + ".Type=" + ToString(frameAllocRequest.Type) + "\n"; - str += structName + ".NumFrameMin=" + ToString(frameAllocRequest.NumFrameMin) + "\n"; - str += structName + ".NumFrameSuggested=" + ToString(frameAllocRequest.NumFrameSuggested) + "\n"; - str += structName + ".reserved2=" + ToString(frameAllocRequest.reserved2); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxFrameAllocResponse &frameAllocResponse) -{ - std::string str; - str += structName + ".AllocId=" + ToString(frameAllocResponse.AllocId) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(frameAllocResponse.reserved) + "\n"; - if (frameAllocResponse.mids) - str += structName + ".mids=" + ToString(frameAllocResponse.mids) + "\n"; - else - str += structName + ".mids=" + "NULL" + "\n"; - str += structName + ".NumFrameActual=" + ToString(frameAllocResponse.NumFrameActual) + "\n"; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - str += structName + ".MemType=" + ToString(frameAllocResponse.MemType) + "\n"; -#else - str += structName + ".reserved2=" + ToString(frameAllocResponse.reserved2) + "\n"; -#endif - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxFrameData &frameData) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(frameData.reserved) + "\n"; - str += structName + ".PitchHigh=" + ToString(frameData.PitchHigh) + "\n"; - str += structName + ".TimeStamp=" + ToString(frameData.TimeStamp) + "\n"; - str += structName + ".FrameOrder=" + ToString(frameData.FrameOrder) + "\n"; - str += structName + ".Locked=" + ToString(frameData.Locked) + "\n"; - str += structName + ".Pitch=" + ToString(frameData.Pitch) + "\n"; - str += structName + ".PitchLow=" + ToString(frameData.PitchLow) + "\n"; - if (Log::GetLogLevel() == LOG_LEVEL_FULL) { - str += structName + ".Y=" + ToHexFormatString(frameData.Y) + "\n"; - str += structName + ".R=" + ToHexFormatString(frameData.R) + "\n"; - str += structName + ".UV=" + ToHexFormatString(frameData.UV) + "\n"; - str += structName + ".VU=" + ToHexFormatString(frameData.VU) + "\n"; - str += structName + ".CbCr=" + ToHexFormatString(frameData.CbCr) + "\n"; - str += structName + ".CrCb=" + ToHexFormatString(frameData.CrCb) + "\n"; - str += structName + ".Cb=" + ToHexFormatString(frameData.Cb) + "\n"; - str += structName + ".U=" + ToHexFormatString(frameData.U) + "\n"; - str += structName + ".G=" + ToHexFormatString(frameData.G) + "\n"; -#if (MFX_VERSION >= 1027) - str += structName + ".Y410=" + ToHexFormatString(frameData.Y410) + "\n"; -#endif - str += structName + ".Cr=" + ToHexFormatString(frameData.Cr) + "\n"; - str += structName + ".V=" + ToHexFormatString(frameData.V) + "\n"; - str += structName + ".B=" + ToHexFormatString(frameData.B) + "\n"; - str += structName + ".A=" + ToHexFormatString(frameData.A) + "\n"; -#if (MFX_VERSION >= 1025) - str += structName + ".A2RGB10=" + ToString(frameData.A2RGB10) + "\n"; -#endif - } - str += structName + ".MemId=" + ToString(frameData.MemId) + "\n"; - str += structName + ".Corrupted=" + ToString(frameData.Corrupted) + "\n"; - str += structName + ".DataFlag=" + ToString(frameData.DataFlag) + "\n"; - str += dump_mfxExtParams(structName, frameData); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxFrameId &frame) -{ - std::string str; - str += structName + ".TemporalId=" + ToString(frame.TemporalId) + "\n"; - str += structName + ".PriorityId=" + ToString(frame.PriorityId) + "\n"; - str += structName + ".DependencyId=" + ToString(frame.DependencyId) + "\n"; - str += structName + ".QualityId=" + ToString(frame.QualityId) + "\n"; - str += structName + ".ViewId=" + ToString(frame.ViewId); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxFrameInfo &info) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(info.reserved) + "\n"; - str += structName + ".reserved4=" + ToString(info.reserved4) + "\n"; - str += structName + ".BitDepthLuma=" + ToString(info.BitDepthLuma) + "\n"; - str += structName + ".BitDepthChroma=" + ToString(info.BitDepthChroma) + "\n"; - str += structName + ".Shift=" + ToString(info.Shift) + "\n"; - str += dump(structName + ".mfxFrameId", info.FrameId) + "\n"; - str += structName + ".FourCC=" + GetFourCC(info.FourCC) + "\n"; - str += structName + ".Width=" + ToString(info.Width) + "\n"; - str += structName + ".Height=" + ToString(info.Height) + "\n"; - str += structName + ".CropX=" + ToString(info.CropX) + "\n"; - str += structName + ".CropY=" + ToString(info.CropY) + "\n"; - str += structName + ".CropW=" + ToString(info.CropW) + "\n"; - str += structName + ".CropH=" + ToString(info.CropH) + "\n"; - str += structName + ".BufferSize=" + ToString(info.BufferSize) + "\n"; - str += structName + ".reserved5=" + ToString(info.reserved5) + "\n"; - str += structName + ".FrameRateExtN=" + ToString(info.FrameRateExtN) + "\n"; - str += structName + ".FrameRateExtD=" + ToString(info.FrameRateExtD) + "\n"; - str += structName + ".reserved3=" + ToString(info.reserved3) + "\n"; - str += structName + ".AspectRatioW=" + ToString(info.AspectRatioW) + "\n"; - str += structName + ".AspectRatioH=" + ToString(info.AspectRatioH) + "\n"; - str += structName + ".PicStruct=" + ToString(info.PicStruct) + "\n"; - str += structName + ".ChromaFormat=" + ToString(info.ChromaFormat) + "\n"; - str += structName + ".reserved2=" + ToString(info.reserved2); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxFrameSurface1 &frameSurface1) -{ - std::string str; - str += dump(structName + ".Data", frameSurface1.Data) + "\n"; - str += dump(structName + ".Info", frameSurface1.Info) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(frameSurface1.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxHandleType &handleType) -{ - return std::string("mfxHandleType " + structName + "=" + ToString(handleType)); -} - -std::string DumpContext::dump(const std::string structName, const mfxInfoMFX &mfx) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(mfx.reserved) + "\n"; - str += structName + ".LowPower=" + ToString(mfx.LowPower) + "\n"; - str += structName + ".BRCParamMultiplier=" + ToString(mfx.BRCParamMultiplier) + "\n"; - str += dump(structName + ".FrameInfo", mfx.FrameInfo) + "\n"; - str += structName + ".CodecId=" + GetCodecIdString(mfx.CodecId) + "\n"; - str += structName + ".CodecProfile=" + ToString(mfx.CodecProfile) + "\n"; - str += structName + ".CodecLevel=" + ToString(mfx.CodecLevel) + "\n"; - str += structName + ".NumThread=" + ToString(mfx.NumThread) + "\n"; - str += structName + ".TargetUsage=" + ToString(mfx.TargetUsage) + "\n"; - str += structName + ".GopPicSize=" + ToString(mfx.GopPicSize) + "\n"; - str += structName + ".GopRefDist=" + ToString(mfx.GopRefDist) + "\n"; - str += structName + ".GopOptFlag=" + ToString(mfx.GopOptFlag) + "\n"; - str += structName + ".IdrInterval=" + ToString(mfx.IdrInterval) + "\n"; - str += structName + ".RateControlMethod=" + ToString(mfx.RateControlMethod) + "\n"; - str += structName + ".InitialDelayInKB=" + ToString(mfx.InitialDelayInKB) + "\n"; - str += structName + ".QPI=" + ToString(mfx.QPI) + "\n"; - str += structName + ".Accuracy=" + ToString(mfx.Accuracy) + "\n"; - str += structName + ".BufferSizeInKB=" + ToString(mfx.BufferSizeInKB) + "\n"; - str += structName + ".TargetKbps=" + ToString(mfx.TargetKbps) + "\n"; - str += structName + ".QPP=" + ToString(mfx.QPP) + "\n"; - str += structName + ".ICQQuality=" + ToString(mfx.ICQQuality) + "\n"; - str += structName + ".MaxKbps=" + ToString(mfx.MaxKbps) + "\n"; - str += structName + ".QPB=" + ToString(mfx.QPB) + "\n"; - str += structName + ".Convergence=" + ToString(mfx.Convergence) + "\n"; - str += structName + ".NumSlice=" + ToString(mfx.NumSlice) + "\n"; - str += structName + ".NumRefFrame=" + ToString(mfx.NumRefFrame) + "\n"; - str += structName + ".EncodedOrder=" + ToString(mfx.EncodedOrder) + "\n"; - str += structName + ".DecodedOrder=" + ToString(mfx.DecodedOrder) + "\n"; - str += structName + ".ExtendedPicStruct=" + ToString(mfx.ExtendedPicStruct) + "\n"; - str += structName + ".TimeStampCalc=" + ToString(mfx.TimeStampCalc) + "\n"; - str += structName + ".SliceGroupsPresent=" + ToString(mfx.SliceGroupsPresent) + "\n"; - str += structName + ".MaxDecFrameBuffering=" + ToString(mfx.MaxDecFrameBuffering) + "\n"; - str += structName + ".EnableReallocRequest=" + ToString(mfx.EnableReallocRequest) + "\n"; -#if (MFX_VERSION >= 1034) - str += structName + ".IgnoreLevelConstrain=" + ToString(mfx.IgnoreLevelConstrain) + "\n"; -#endif - str += structName + ".reserved2[]=" + DUMP_RESERVED_ARRAY(mfx.reserved2) + "\n"; - str += structName + ".JPEGChromaFormat=" + ToString(mfx.JPEGChromaFormat) + "\n"; - str += structName + ".Rotation=" + ToString(mfx.Rotation) + "\n"; - str += structName + ".JPEGColorFormat=" + ToString(mfx.JPEGColorFormat) + "\n"; - str += structName + ".InterleavedDec=" + ToString(mfx.InterleavedDec) + "\n"; - str += structName + ".reserved3[]=" + DUMP_RESERVED_ARRAY(mfx.reserved3) + "\n"; - str += structName + ".Interleaved=" + ToString(mfx.Interleaved) + "\n"; - str += structName + ".Quality=" + ToString(mfx.Quality) + "\n"; - str += structName + ".RestartInterval=" + ToString(mfx.RestartInterval) + "\n"; - str += structName + ".reserved5[]=" + DUMP_RESERVED_ARRAY(mfx.reserved5) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxInfoVPP &vpp) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(vpp.reserved) + "\n"; - str += dump(structName + ".In", vpp.In) + "\n" + - str += dump(structName + ".Out", vpp.Out); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxPayload &payload) -{ - std::string str; - str += structName + ".CtrlFlags=" + ToString(payload.CtrlFlags) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(payload.reserved) + "\n"; - str += structName + ".Data=" + ToString(payload.Data) + "\n"; - str += structName + ".NumBit=" + ToString(payload.NumBit) + "\n"; - str += structName + ".Type=" + ToString(payload.Type) + "\n"; - str += structName + ".BufSize=" + ToString(payload.BufSize); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxSkipMode &skipMode) -{ - return std::string("mfxSkipMode " + structName + "=" + ToString(skipMode)); -} - -std::string DumpContext::dump(const std::string structName, const mfxVideoParam& videoParam) -{ - std::string str; - str += structName + ".AllocId=" + ToString(videoParam.AllocId) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(videoParam.reserved) + "\n"; - str += structName + ".AsyncDepth=" + ToString(videoParam.AsyncDepth) + "\n"; - if(context == DUMPCONTEXT_MFX) - str += dump(structName + ".mfx", videoParam.mfx) + "\n"; - else if(context == DUMPCONTEXT_VPP) - str += dump(structName + ".vpp", videoParam.vpp) + "\n"; - else if(context == DUMPCONTEXT_ALL){ - str += dump(structName + ".mfx", videoParam.mfx) + "\n"; - str += dump(structName + ".vpp", videoParam.vpp) + "\n"; - } - str += structName + ".Protected=" + ToString(videoParam.Protected) + "\n"; - str += structName + ".IOPattern=" + GetIOPattern(videoParam.IOPattern) + "\n"; - str += dump_mfxExtParams(structName, videoParam) + "\n"; - str += structName + ".reserved2=" + ToString(videoParam.reserved2); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxVPPStat &vppStat) -{ - std::string str; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(vppStat.reserved) + "\n"; - str += structName + ".NumFrame=" + ToString(vppStat.NumFrame) + "\n"; - str += structName + ".NumCachedFrame=" + ToString(vppStat.NumCachedFrame); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtDecodedFrameInfo &ExtDecodedFrameInfo) -{ - std::string str; - str += dump(structName + ".Header", ExtDecodedFrameInfo.Header) + "\n"; - str += structName + ".FrameType=" + ToString(ExtDecodedFrameInfo.FrameType) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtDecodedFrameInfo.reserved) + "\n"; - return str; -} - -#if (MFX_VERSION >= 1025) -std::string DumpContext::dump(const std::string structName, const mfxExtDecodeErrorReport &ExtDecodeErrorReport) -{ - std::string str; - str += dump(structName + ".Header", ExtDecodeErrorReport.Header) + "\n"; - str += structName + ".ErrorTypes=" + toString(ExtDecodeErrorReport.ErrorTypes, DUMP_HEX) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtDecodeErrorReport.reserved) + "\n"; - return str; -} -#endif - -std::string DumpContext::dump(const std::string structName, const mfxExtTimeCode &ExtTimeCode) -{ - std::string str; - str += dump(structName + ".Header", ExtTimeCode.Header) + "\n"; - str += structName + ".DropFrameFlag=" + ToString(ExtTimeCode.DropFrameFlag) + "\n"; - str += structName + ".TimeCodeHours=" + ToString(ExtTimeCode.TimeCodeHours) + "\n"; - str += structName + ".TimeCodeMinutes=" + ToString(ExtTimeCode.TimeCodeMinutes) + "\n"; - str += structName + ".TimeCodeSeconds=" + ToString(ExtTimeCode.TimeCodeSeconds) + "\n"; - str += structName + ".TimeCodePictures=" + ToString(ExtTimeCode.TimeCodePictures) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtTimeCode.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtEncoderCapability &ExtEncoderCapability) -{ - std::string str; - str += dump(structName + ".Header", ExtEncoderCapability.Header) + "\n"; - str += structName + ".MBPerSec=" + ToString(ExtEncoderCapability.MBPerSec) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtEncoderCapability.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtDirtyRect &ExtDirtyRect) -{ - std::string str; - str += dump(structName + ".Header", ExtDirtyRect.Header) + "\n"; - str += structName + ".NumRect=" + ToString(ExtDirtyRect.NumRect) + "\n"; - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtDirtyRect.reserved1) + "\n"; - str += structName + ".Rect=" + ToString(ExtDirtyRect.Rect) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMoveRect &ExtMoveRect) -{ - std::string str; - str += dump(structName + ".Header", ExtMoveRect.Header) + "\n"; - str += structName + ".NumRect=" + ToString(ExtMoveRect.NumRect) + "\n"; - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtMoveRect.reserved1) + "\n"; - str += structName + ".Rect=" + ToString(ExtMoveRect.Rect) + "\n"; - return str; -} - -//camera -std::string DumpContext::dump(const std::string structName, const mfxExtCamGammaCorrection &CamGammaCorrection) -{ - std::string str; - str += dump(structName + ".Header", CamGammaCorrection.Header) + "\n"; - str += structName + ".Mode=" + ToString(CamGammaCorrection.Mode) + "\n"; - str += structName + ".reserved1=" + ToString(CamGammaCorrection.reserved1) + "\n"; - str += structName + ".GammaValue=" + ToString(CamGammaCorrection.GammaValue) + "\n"; - str += structName + ".reserved2[]=" + DUMP_RESERVED_ARRAY(CamGammaCorrection.reserved2) + "\n"; - str += structName + ".NumPoints=" + ToString(CamGammaCorrection.NumPoints) + "\n"; - str += structName + ".GammaPoint=" + ToString(CamGammaCorrection.GammaPoint) + "\n"; - str += structName + ".GammaCorrected=" + ToString(CamGammaCorrection.GammaCorrected) + "\n"; - str += structName + ".reserved3[]=" + DUMP_RESERVED_ARRAY(CamGammaCorrection.reserved3) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamWhiteBalance &CamWhiteBalance) -{ - std::string str; - str += dump(structName + ".Header", CamWhiteBalance.Header) + "\n"; - str += structName + ".Mode=" + ToString(CamWhiteBalance.Mode) + "\n"; - str += structName + ".R=" + ToString(CamWhiteBalance.R) + "\n"; - str += structName + ".G0=" + ToString(CamWhiteBalance.G0) + "\n"; - str += structName + ".B=" + ToString(CamWhiteBalance.B) + "\n"; - str += structName + ".G1=" + ToString(CamWhiteBalance.G1) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamWhiteBalance.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamHotPixelRemoval &CamHotPixelRemoval) -{ - std::string str; - str += dump(structName + ".Header", CamHotPixelRemoval.Header) + "\n"; - str += structName + ".PixelThresholdDifference=" + ToString(CamHotPixelRemoval.PixelThresholdDifference) + "\n"; - str += structName + ".PixelCountThreshold=" + ToString(CamHotPixelRemoval.PixelCountThreshold) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamBlackLevelCorrection &CamBlackLevelCorrection) -{ - std::string str; - str += dump(structName + ".Header", CamBlackLevelCorrection.Header) + "\n"; - str += structName + ".R=" + ToString(CamBlackLevelCorrection.R) + "\n"; - str += structName + ".G0=" + ToString(CamBlackLevelCorrection.G0) + "\n"; - str += structName + ".B=" + ToString(CamBlackLevelCorrection.B) + "\n"; - str += structName + ".G1=" + ToString(CamBlackLevelCorrection.G1) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamBlackLevelCorrection.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxCamVignetteCorrectionParam &VignetteCorrectionParams) -{ - std::string str; - //need to clarify SKL HW alignment with VPG - str += structName + ".R=" + ToString(VignetteCorrectionParams.R.integer)+"."+ToString(VignetteCorrectionParams.R.mantissa) + "\n"; - str += structName + ".G0=" + ToString(VignetteCorrectionParams.G0.integer)+"."+ToString(VignetteCorrectionParams.G0.mantissa) + "\n"; - str += structName + ".B=" + ToString(VignetteCorrectionParams.G1.integer)+"."+ToString(VignetteCorrectionParams.G1.mantissa) + "\n"; - str += structName + ".G1=" + ToString(VignetteCorrectionParams.B.integer)+"."+ToString(VignetteCorrectionParams.B.mantissa) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamVignetteCorrection &CamVignetteCorrection) -{ - std::string str; - str += dump(structName + ".Header", CamVignetteCorrection.Header) + "\n"; - str += structName + ".Width=" + ToString(CamVignetteCorrection.Width) + "\n"; - str += structName + ".Height=" + ToString(CamVignetteCorrection.Height) + "\n"; - str += structName + ".Pitch=" + ToString(CamVignetteCorrection.Pitch) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamVignetteCorrection.reserved) + "\n"; - if (CamVignetteCorrection.CorrectionMap) - { - str += dump(structName + ".CorrectionMap", *(CamVignetteCorrection.CorrectionMap)) + "\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamBayerDenoise &CamBayerDenoise) -{ - std::string str; - str += dump(structName + ".Header", CamBayerDenoise.Header) + "\n"; - str += structName + ".Threshold=" + ToString(CamBayerDenoise.Threshold) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamBayerDenoise.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamColorCorrection3x3 &CamColorCorrection3x3) -{ - std::string str; - str += dump(structName + ".Header", CamColorCorrection3x3.Header) + "\n"; - str += structName + ".CCM=" + ToString(CamColorCorrection3x3.CCM) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamColorCorrection3x3.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamPadding &CamPadding) -{ - std::string str; - str += dump(structName + ".Header", CamPadding.Header) + "\n"; - str += structName + ".Top=" + ToString(CamPadding.Top) + "\n"; - str += structName + ".Bottom=" + ToString(CamPadding.Bottom) + "\n"; - str += structName + ".Left=" + ToString(CamPadding.Left) + "\n"; - str += structName + ".Right=" + ToString(CamPadding.Right) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamPadding.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamPipeControl &CamPipeControl) -{ - std::string str; - str += dump(structName + ".Header", CamPipeControl.Header) + "\n"; - str += structName + ".RawFormat=" + ToString(CamPipeControl.RawFormat) + "\n"; - str += structName + ".reserved1=" + ToString(CamPipeControl.reserved1) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamPipeControl.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxCamFwdGammaSegment &CamFwrGammaSegment) -{ - std::string str; - str += structName + ".Pixel=" + ToString(CamFwrGammaSegment.Pixel) + "\n"; - str += structName + ".Red=" + ToString(CamFwrGammaSegment.Red) + "\n"; - str += structName + ".Green=" + ToString(CamFwrGammaSegment.Green) + "\n"; - str += structName + ".Blue=" + ToString(CamFwrGammaSegment.Blue) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamFwdGamma &CamFwrGamma) -{ - std::string str; - str += dump(structName + ".Header", CamFwrGamma.Header) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamFwrGamma.reserved) + "\n"; - str += structName + ".NumSegments=" + ToString(CamFwrGamma.NumSegments) + "\n"; - if (CamFwrGamma.Segment) - { - for (int i = 0; i < CamFwrGamma.NumSegments; i++) - { - str += dump((structName + ".Segment[" + ToString(i) + "]"), CamFwrGamma.Segment[i]) + "\n"; - } - } - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtCamLensGeomDistCorrection &CamLensGeomDistCorrection) -{ - std::string str; - str += dump(structName + ".Header", CamLensGeomDistCorrection.Header) + "\n"; - for (int i = 0; i < 3; i++) - str += structName + ".a[" + ToString(i) + "]=" + ToString(CamLensGeomDistCorrection.a[i]) + "\n"; - for (int i = 0; i < 3; i++) - str += structName + ".b[" + ToString(i) + "]=" + ToString(CamLensGeomDistCorrection.b[i]) + "\n"; - for (int i = 0; i < 3; i++) - str += structName + ".c[" + ToString(i) + "]=" + ToString(CamLensGeomDistCorrection.c[i]) + "\n"; - for (int i = 0; i < 3; i++) - str += structName + ".d[" + ToString(i) + "]=" + ToString(CamLensGeomDistCorrection.d[i]) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(CamLensGeomDistCorrection.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamTotalColorControl &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(R); - DUMP_FIELD(G); - DUMP_FIELD(B); - - DUMP_FIELD(C); - DUMP_FIELD(M); - DUMP_FIELD(Y); - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCamCscYuvRgb &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".PreOffset=" + ToString(_struct.PreOffset) + "\n"; - str += structName + ".Matrix=" + ToString(_struct.Matrix) + "\n"; - str += structName + ".PreOffset=" + ToString(_struct.PostOffset) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtAVCRefListCtrl &ExtAVCRefListCtrl) -{ - std::string str; - str += dump(structName + ".Header", ExtAVCRefListCtrl.Header) + "\n"; - str += structName + ".NumRefIdxL0Active=" + ToString(ExtAVCRefListCtrl.NumRefIdxL0Active) + "\n"; - str += structName + ".NumRefIdxL1Active=" + ToString(ExtAVCRefListCtrl.NumRefIdxL1Active) + "\n"; - str += structName + ".PreferredRefList=" + ToString(ExtAVCRefListCtrl.PreferredRefList) + "\n"; - str += structName + ".RejectedRefList=" + ToString(ExtAVCRefListCtrl.RejectedRefList) + "\n"; - str += structName + ".LongTermRefList=" + ToString(ExtAVCRefListCtrl.LongTermRefList) + "\n"; - str += structName + ".ApplyLongTermIdx=" + ToString(ExtAVCRefListCtrl.ApplyLongTermIdx) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtAVCRefListCtrl.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtAvcTemporalLayers &ExtAvcTemporalLayers) -{ - std::string str; - str += dump(structName + ".Header", ExtAvcTemporalLayers.Header) + "\n"; - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtAvcTemporalLayers.reserved1) + "\n"; - str += structName + ".reserved2=" + ToString(ExtAvcTemporalLayers.reserved2) + "\n"; - str += structName + ".BaseLayerPID=" + ToString(ExtAvcTemporalLayers.BaseLayerPID) + "\n"; - str += structName + ".Layer=" + ToString(ExtAvcTemporalLayers.Layer) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtAVCEncodedFrameInfo &ExtAVCEncodedFrameInfo) -{ - std::string str; - str += dump(structName + ".Header", ExtAVCEncodedFrameInfo.Header) + "\n"; - str += structName + ".FrameOrder=" + ToString(ExtAVCEncodedFrameInfo.FrameOrder) + "\n"; - str += structName + ".PicStruct=" + ToString(ExtAVCEncodedFrameInfo.PicStruct) + "\n"; - str += structName + ".LongTermIdx=" + ToString(ExtAVCEncodedFrameInfo.LongTermIdx) + "\n"; - str += structName + ".MAD=" + ToString(ExtAVCEncodedFrameInfo.MAD) + "\n"; - str += structName + ".BRCPanicMode=" + ToString(ExtAVCEncodedFrameInfo.BRCPanicMode) + "\n"; - str += structName + ".QP=" + ToString(ExtAVCEncodedFrameInfo.QP) + "\n"; - str += structName + ".SecondFieldOffset=" + ToString(ExtAVCEncodedFrameInfo.SecondFieldOffset) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtAVCEncodedFrameInfo.reserved) + "\n"; - str += structName + ".UsedRefListL0=" + ToHexFormatString(ExtAVCEncodedFrameInfo.UsedRefListL0) + "\n"; - str += structName + ".UsedRefListL1=" + ToHexFormatString(ExtAVCEncodedFrameInfo.UsedRefListL1) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtAVCRefLists &ExtAVCRefLists) -{ - std::string str; - str += dump(structName + ".Header", ExtAVCRefLists.Header) + "\n"; - str += structName + ".NumRefIdxL0Active=" + ToString(ExtAVCRefLists.NumRefIdxL0Active) + "\n"; - str += structName + ".NumRefIdxL1Active=" + ToString(ExtAVCRefLists.NumRefIdxL1Active) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtAVCRefLists.reserved) + "\n"; - str += structName + ".RefPicList0=" + ToString(ExtAVCRefLists.RefPicList0) + "\n"; - str += structName + ".RefPicList1=" + ToString(ExtAVCRefLists.RefPicList1) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPMirroring &ExtVPPMirroring) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPMirroring.Header) + "\n"; - str += structName + ".Type=" + ToString(ExtVPPMirroring.Type) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtVPPMirroring.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMVOverPicBoundaries &ExtMVOverPicBoundaries) -{ - std::string str; - str += dump(structName + ".Header", ExtMVOverPicBoundaries.Header) + "\n"; - str += structName + ".StickTop=" + ToString(ExtMVOverPicBoundaries.StickTop) + "\n"; - str += structName + ".StickBottom=" + ToString(ExtMVOverPicBoundaries.StickBottom) + "\n"; - str += structName + ".StickLeft=" + ToString(ExtMVOverPicBoundaries.StickLeft) + "\n"; - str += structName + ".StickRight=" + ToString(ExtMVOverPicBoundaries.StickRight) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtMVOverPicBoundaries.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPColorFill &ExtVPPColorFill) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPColorFill.Header) + "\n"; - str += structName + ".Enable=" + ToString(ExtVPPColorFill.Enable) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtVPPColorFill.reserved) + "\n"; - return str; -} - -//mfxjpeg -std::string DumpContext::dump(const std::string structName, const mfxExtJPEGQuantTables &ExtJPEGQuantTables) -{ - std::string str; - str += dump(structName + ".Header", ExtJPEGQuantTables.Header) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtJPEGQuantTables.reserved) + "\n"; - str += structName + ".NumTable=" + ToString(ExtJPEGQuantTables.NumTable) + "\n"; - for (int i = 0; i < 4; i++) - { - str += structName + ".Qm[" + ToString(i) + "][]=" + DUMP_RESERVED_ARRAY(ExtJPEGQuantTables.Qm[i]) + "\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtJPEGHuffmanTables &ExtJPEGHuffmanTables) -{ - std::string str; - str += dump(structName + ".Header", ExtJPEGHuffmanTables.Header) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtJPEGHuffmanTables.reserved) + "\n"; - str += structName + ".NumDCTable=" + ToString(ExtJPEGHuffmanTables.NumDCTable) + "\n"; - str += structName + ".NumACTable=" + ToString(ExtJPEGHuffmanTables.NumACTable) + "\n"; - for (int i = 0; i < 4; i++) - { - str += structName + ".DCTables[" + ToString(i) + "].Bits[]=" + DUMP_RESERVED_ARRAY(ExtJPEGHuffmanTables.DCTables[i].Bits) + "\n"; - str += structName + ".DCTables[" + ToString(i) + "].Values[]=" + DUMP_RESERVED_ARRAY(ExtJPEGHuffmanTables.DCTables[i].Values) + "\n"; - } - for (int i = 0; i < 4; i++) - { - str += structName + ".ACTables[" + ToString(i) + "].Bits[]=" + DUMP_RESERVED_ARRAY(ExtJPEGHuffmanTables.ACTables[i].Bits) + "\n"; - str += structName + ".ACTables[" + ToString(i) + "].Values[]=" + DUMP_RESERVED_ARRAY(ExtJPEGHuffmanTables.ACTables[i].Values) + "\n"; - } - return str; -} - -//mfxmvc -std::string DumpContext::dump(const std::string structName, const mfxMVCViewDependency &MVCViewDependency) -{ - std::string str; - str += structName + ".ViewId=" + ToString(MVCViewDependency.ViewId) + "\n"; - str += structName + ".NumAnchorRefsL0=" + ToString(MVCViewDependency.NumAnchorRefsL0) + "\n"; - str += structName + ".NumAnchorRefsL1=" + ToString(MVCViewDependency.NumAnchorRefsL1) + "\n"; - str += structName + ".AnchorRefL0[]=" + DUMP_RESERVED_ARRAY(MVCViewDependency.AnchorRefL0) + "\n"; - str += structName + ".AnchorRefL1[]=" + DUMP_RESERVED_ARRAY(MVCViewDependency.AnchorRefL1) + "\n"; - str += structName + ".NumNonAnchorRefsL0=" + ToString(MVCViewDependency.NumNonAnchorRefsL0) + "\n"; - str += structName + ".NumNonAnchorRefsL1=" + ToString(MVCViewDependency.NumNonAnchorRefsL1) + "\n"; - str += structName + ".NonAnchorRefL0[]=" + DUMP_RESERVED_ARRAY(MVCViewDependency.NonAnchorRefL0) + "\n"; - str += structName + ".NonAnchorRefL1[]=" + DUMP_RESERVED_ARRAY(MVCViewDependency.NonAnchorRefL1) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxMVCOperationPoint &MVCOperationPoint) -{ - std::string str; - str += structName + ".TemporalId=" + ToString(MVCOperationPoint.TemporalId) + "\n"; - str += structName + ".LevelIdc=" + ToString(MVCOperationPoint.LevelIdc) + "\n"; - str += structName + ".NumViews=" + ToString(MVCOperationPoint.NumViews) + "\n"; - str += structName + ".NumTargetViews=" + ToString(MVCOperationPoint.NumTargetViews) + "\n"; - str += structName + ".TargetViewId=" + ToHexFormatString(MVCOperationPoint.TargetViewId) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMVCSeqDesc &ExtMVCSeqDesc) -{ - std::string str; - str += dump(structName + ".Header", ExtMVCSeqDesc.Header) + "\n"; - str += structName + ".NumView=" + ToString(ExtMVCSeqDesc.NumView) + "\n"; - if (ExtMVCSeqDesc.View) - { - str += dump(structName + ".View", *(ExtMVCSeqDesc.View)) + "\n"; - } - str += structName + ".NumViewId=" + ToString(ExtMVCSeqDesc.NumViewId) + "\n"; - str += structName + ".NumViewIdAlloc=" + ToString(ExtMVCSeqDesc.NumViewIdAlloc) + "\n"; - str += structName + ".ViewId=" + ToString(ExtMVCSeqDesc.ViewId) + "\n"; - str += structName + ".NumOP=" + ToString(ExtMVCSeqDesc.NumOP) + "\n"; - str += structName + ".NumOPAlloc=" + ToString(ExtMVCSeqDesc.NumOPAlloc) + "\n"; - if (ExtMVCSeqDesc.OP) - { - str += dump(structName + ".OP", *(ExtMVCSeqDesc.OP)) + "\n"; - } - str += structName + ".NumRefsTotal=" + ToString(ExtMVCSeqDesc.NumRefsTotal) + "\n"; - str += structName + ".Reserved[]=" + DUMP_RESERVED_ARRAY(ExtMVCSeqDesc.Reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMVCTargetViews &ExtMVCTargetViews) -{ - std::string str; - str += dump(structName + ".Header", ExtMVCTargetViews.Header) + "\n"; - str += structName + ".TemporalId=" + ToString(ExtMVCTargetViews.TemporalId) + "\n"; - str += structName + ".NumView=" + ToString(ExtMVCTargetViews.NumView) + "\n"; - str += structName + ".ViewId[]=" + DUMP_RESERVED_ARRAY(ExtMVCTargetViews.ViewId) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtOpaqueSurfaceAlloc &ExtOpaqueSurfaceAlloc) -{ - std::string str; - str += dump(structName + ".Header", ExtOpaqueSurfaceAlloc.Header) + "\n"; - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtOpaqueSurfaceAlloc.reserved1) + "\n"; - str += structName + ".In.NumSurface=" + ToString(ExtOpaqueSurfaceAlloc.In.NumSurface) + "\n"; - str += structName + ".In.Surfaces=" + ToHexFormatString(ExtOpaqueSurfaceAlloc.In.Surfaces) + "\n"; - str += structName + ".In.Type=" + ToString(ExtOpaqueSurfaceAlloc.In.Type) + "\n"; - str += structName + ".In.reserved2[]=" + DUMP_RESERVED_ARRAY(ExtOpaqueSurfaceAlloc.In.reserved2) + "\n"; - str += structName + ".Out.NumSurface=" + ToString(ExtOpaqueSurfaceAlloc.Out.NumSurface) + "\n"; - str += structName + ".Out.Surfaces=" + ToHexFormatString(ExtOpaqueSurfaceAlloc.Out.Surfaces) + "\n"; - str += structName + ".Out.Type=" + ToString(ExtOpaqueSurfaceAlloc.Out.Type) + "\n"; - str += structName + ".Out.reserved2[]=" + DUMP_RESERVED_ARRAY(ExtOpaqueSurfaceAlloc.Out.reserved2) + "\n"; - return str; -} - -//mfxvpp -std::string DumpContext::dump(const std::string structName, const mfxExtVPPDenoise &ExtVPPDenoise) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPDenoise.Header) + "\n"; - str += structName + ".DenoiseFactor=" + ToString(ExtVPPDenoise.DenoiseFactor) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPDetail &ExtVPPDetail) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPDetail.Header) + "\n"; - str += structName + ".DetailFactor=" + ToString(ExtVPPDetail.DetailFactor) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPProcAmp &ExtVPPProcAmp) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPProcAmp.Header) + "\n"; - str += structName + ".Brightness=" + ToString(ExtVPPProcAmp.Brightness) + "\n"; - str += structName + ".Contrast=" + ToString(ExtVPPProcAmp.Contrast) + "\n"; - str += structName + ".Hue=" + ToString(ExtVPPProcAmp.Hue) + "\n"; - str += structName + ".Saturation=" + ToString(ExtVPPProcAmp.Saturation) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCodingOptionSPSPPS &ExtCodingOptionSPSPPS) -{ - std::string str; - str += dump(structName + ".Header", ExtCodingOptionSPSPPS.Header) + "\n"; - str += structName + ".SPSBuffer=" + ToHexFormatString(ExtCodingOptionSPSPPS.SPSBuffer) + "\n"; - str += structName + ".PPSBuffer=" + ToHexFormatString(ExtCodingOptionSPSPPS.PPSBuffer) + "\n"; - str += structName + ".SPSBufSize=" + ToString(ExtCodingOptionSPSPPS.SPSBufSize) + "\n"; - str += structName + ".PPSBufSize=" + ToString(ExtCodingOptionSPSPPS.PPSBufSize) + "\n"; - str += structName + ".SPSId=" + ToString(ExtCodingOptionSPSPPS.SPSId) + "\n"; - str += structName + ".PPSId=" + ToString(ExtCodingOptionSPSPPS.PPSId) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtCodingOptionVPS &ExtCodingOptionVPS) -{ - std::string str; - str += dump(structName + ".Header", ExtCodingOptionVPS.Header) + "\n"; - str += structName + ".VPSBuffer=" + ToHexFormatString(ExtCodingOptionVPS.VPSBuffer) + "\n"; - str += structName + ".reserved1=" + ToString(ExtCodingOptionVPS.reserved1) + "\n"; - str += structName + ".VPSBufSize=" + ToString(ExtCodingOptionVPS.VPSBufSize) + "\n"; - str += structName + ".VPSId=" + ToString(ExtCodingOptionVPS.VPSId) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtCodingOptionVPS.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVideoSignalInfo &ExtVideoSignalInfo) -{ - std::string str; - str += dump(structName + ".Header", ExtVideoSignalInfo.Header) + "\n"; - str += structName + ".VideoFormat=" + ToString(ExtVideoSignalInfo.VideoFormat) + "\n"; - str += structName + ".VideoFullRange=" + ToString(ExtVideoSignalInfo.VideoFullRange) + "\n"; - str += structName + ".ColourDescriptionPresent=" + ToString(ExtVideoSignalInfo.ColourDescriptionPresent) + "\n"; - str += structName + ".ColourPrimaries=" + ToString(ExtVideoSignalInfo.ColourPrimaries) + "\n"; - str += structName + ".TransferCharacteristics=" + ToString(ExtVideoSignalInfo.TransferCharacteristics) + "\n"; - str += structName + ".MatrixCoefficients=" + ToString(ExtVideoSignalInfo.MatrixCoefficients) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPDoUse &ExtVPPDoUse) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPDoUse.Header) + "\n"; - str += structName + ".NumAlg=" + ToString(ExtVPPDoUse.NumAlg) + "\n"; - str += structName + ".AlgList=" + ToHexFormatString(ExtVPPDoUse.AlgList) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxVPPCompInputStream &VPPCompInputStream) -{ - std::string str; - str += structName + ".DstX=" + ToString(VPPCompInputStream.DstX) + "\n"; - str += structName + ".DstY=" + ToString(VPPCompInputStream.DstY) + "\n"; - str += structName + ".DstW=" + ToString(VPPCompInputStream.DstW) + "\n"; - str += structName + ".DstH=" + ToString(VPPCompInputStream.DstH) + "\n"; - str += structName + ".LumaKeyEnable=" + ToString(VPPCompInputStream.LumaKeyEnable) + "\n"; - str += structName + ".LumaKeyMin=" + ToString(VPPCompInputStream.LumaKeyMin) + "\n"; - str += structName + ".LumaKeyMax=" + ToString(VPPCompInputStream.LumaKeyMax) + "\n"; - str += structName + ".GlobalAlphaEnable=" + ToString(VPPCompInputStream.GlobalAlphaEnable) + "\n"; - str += structName + ".GlobalAlphae=" + ToString(VPPCompInputStream.GlobalAlpha) + "\n"; - str += structName + ".PixelAlphaEnable=" + ToString(VPPCompInputStream.PixelAlphaEnable) + "\n"; - str += structName + ".TileId=" + ToString(VPPCompInputStream.TileId) + "\n"; - str += structName + ".reserved2[]=" + DUMP_RESERVED_ARRAY(VPPCompInputStream.reserved2) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPComposite &ExtVPPComposite) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPComposite.Header) + "\n"; - str += structName + ".Y=" + ToString(ExtVPPComposite.Y) + "\n"; - str += structName + ".R=" + ToString(ExtVPPComposite.R) + "\n"; - str += structName + ".U=" + ToString(ExtVPPComposite.U) + "\n"; - str += structName + ".G=" + ToString(ExtVPPComposite.G) + "\n"; - str += structName + ".V=" + ToString(ExtVPPComposite.V) + "\n"; - str += structName + ".B=" + ToString(ExtVPPComposite.B) + "\n"; - str += structName + ".NumTiles=" + ToString(ExtVPPComposite.NumTiles) + "\n"; - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtVPPComposite.reserved1) + "\n"; - str += structName + ".NumInputStream=" + ToString(ExtVPPComposite.NumInputStream) + "\n"; - str += structName + ".InputStream=" + ToHexFormatString(ExtVPPComposite.InputStream) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPVideoSignalInfo &ExtVPPVideoSignalInfo) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPVideoSignalInfo.Header) + "\n"; - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtVPPVideoSignalInfo.reserved1) + "\n"; - str += structName + ".In.TransferMatrix=" + ToString(ExtVPPVideoSignalInfo.In.TransferMatrix) + "\n"; - str += structName + ".In.NominalRange=" + ToString(ExtVPPVideoSignalInfo.In.NominalRange) + "\n"; - str += structName + ".In.reserved2[]=" + DUMP_RESERVED_ARRAY(ExtVPPVideoSignalInfo.In.reserved2) + "\n"; - str += structName + ".Out.TransferMatrix=" + ToString(ExtVPPVideoSignalInfo.Out.TransferMatrix) + "\n"; - str += structName + ".Out.NominalRange=" + ToString(ExtVPPVideoSignalInfo.Out.NominalRange) + "\n"; - str += structName + ".Out.reserved2[]=" + DUMP_RESERVED_ARRAY(ExtVPPVideoSignalInfo.Out.reserved2) + "\n"; - str += structName + ".TransferMatrix=" + ToString(ExtVPPVideoSignalInfo.TransferMatrix) + "\n"; - str += structName + ".NominalRange=" + ToString(ExtVPPVideoSignalInfo.NominalRange) + "\n"; - str += structName + ".reserved3[]=" + DUMP_RESERVED_ARRAY(ExtVPPVideoSignalInfo.reserved3) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPDeinterlacing &ExtVPPDeinterlacing) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPDeinterlacing.Header) + "\n"; - str += structName + ".Mode=" + ToString(ExtVPPDeinterlacing.Mode) + "\n"; - str += structName + ".TelecinePattern=" + ToString(ExtVPPDeinterlacing.TelecinePattern) + "\n"; - str += structName + ".TelecineLocation=" + ToString(ExtVPPDeinterlacing.TelecineLocation) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtVPPDeinterlacing.reserved) + "\n"; - return str; -} - -//mfxSEI -std::string DumpContext::dump(const std::string structName, const mfxExtPictureTimingSEI &ExtPictureTimingSEI) -{ - std::string str; - str += dump(structName + ".Header", ExtPictureTimingSEI.Header) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtPictureTimingSEI.reserved) + "\n"; - str += structName + ".TimeStamp[0].ClockTimestampFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].ClockTimestampFlag) + "\n"; - str += structName + ".TimeStamp[0].CtType=" + ToString(ExtPictureTimingSEI.TimeStamp[0].CtType) + "\n"; - str += structName + ".TimeStamp[0].NuitFieldBasedFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].NuitFieldBasedFlag) + "\n"; - str += structName + ".TimeStamp[0].CountingType=" + ToString(ExtPictureTimingSEI.TimeStamp[0].CountingType) + "\n"; - str += structName + ".TimeStamp[0].FullTimestampFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].FullTimestampFlag) + "\n"; - str += structName + ".TimeStamp[0].DiscontinuityFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].DiscontinuityFlag) + "\n"; - str += structName + ".TimeStamp[0].CntDroppedFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].CntDroppedFlag) + "\n"; - str += structName + ".TimeStamp[0].NFrames=" + ToString(ExtPictureTimingSEI.TimeStamp[0].NFrames) + "\n"; - str += structName + ".TimeStamp[0].SecondsFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].SecondsFlag) + "\n"; - str += structName + ".TimeStamp[0].MinutesFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].MinutesFlag) + "\n"; - str += structName + ".TimeStamp[0].HoursFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[0].HoursFlag) + "\n"; - str += structName + ".TimeStamp[0].SecondsValue=" + ToString(ExtPictureTimingSEI.TimeStamp[0].SecondsValue) + "\n"; - str += structName + ".TimeStamp[0].MinutesValue=" + ToString(ExtPictureTimingSEI.TimeStamp[0].MinutesValue) + "\n"; - str += structName + ".TimeStamp[0].HoursValue=" + ToString(ExtPictureTimingSEI.TimeStamp[0].HoursValue) + "\n"; - str += structName + ".TimeStamp[0].TimeOffset=" + ToString(ExtPictureTimingSEI.TimeStamp[0].TimeOffset) + "\n"; - str += structName + ".TimeStamp[1].ClockTimestampFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].ClockTimestampFlag) + "\n"; - str += structName + ".TimeStamp[1].CtType=" + ToString(ExtPictureTimingSEI.TimeStamp[1].CtType) + "\n"; - str += structName + ".TimeStamp[1].NuitFieldBasedFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].NuitFieldBasedFlag) + "\n"; - str += structName + ".TimeStamp[1].CountingType=" + ToString(ExtPictureTimingSEI.TimeStamp[1].CountingType) + "\n"; - str += structName + ".TimeStamp[1].FullTimestampFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].FullTimestampFlag) + "\n"; - str += structName + ".TimeStamp[1].DiscontinuityFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].DiscontinuityFlag) + "\n"; - str += structName + ".TimeStamp[1].CntDroppedFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].CntDroppedFlag) + "\n"; - str += structName + ".TimeStamp[1].NFrames=" + ToString(ExtPictureTimingSEI.TimeStamp[1].NFrames) + "\n"; - str += structName + ".TimeStamp[1].SecondsFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].SecondsFlag) + "\n"; - str += structName + ".TimeStamp[1].MinutesFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].MinutesFlag) + "\n"; - str += structName + ".TimeStamp[1].HoursFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[1].HoursFlag) + "\n"; - str += structName + ".TimeStamp[1].SecondsValue=" + ToString(ExtPictureTimingSEI.TimeStamp[1].SecondsValue) + "\n"; - str += structName + ".TimeStamp[1].MinutesValue=" + ToString(ExtPictureTimingSEI.TimeStamp[1].MinutesValue) + "\n"; - str += structName + ".TimeStamp[1].HoursValue=" + ToString(ExtPictureTimingSEI.TimeStamp[1].HoursValue) + "\n"; - str += structName + ".TimeStamp[1].TimeOffset=" + ToString(ExtPictureTimingSEI.TimeStamp[1].TimeOffset) + "\n"; - str += structName + ".TimeStamp[2].ClockTimestampFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].ClockTimestampFlag) + "\n"; - str += structName + ".TimeStamp[2].CtType=" + ToString(ExtPictureTimingSEI.TimeStamp[2].CtType) + "\n"; - str += structName + ".TimeStamp[2].NuitFieldBasedFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].NuitFieldBasedFlag) + "\n"; - str += structName + ".TimeStamp[2].CountingType=" + ToString(ExtPictureTimingSEI.TimeStamp[2].CountingType) + "\n"; - str += structName + ".TimeStamp[2].FullTimestampFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].FullTimestampFlag) + "\n"; - str += structName + ".TimeStamp[2].DiscontinuityFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].DiscontinuityFlag) + "\n"; - str += structName + ".TimeStamp[2].CntDroppedFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].CntDroppedFlag) + "\n"; - str += structName + ".TimeStamp[2].NFrames=" + ToString(ExtPictureTimingSEI.TimeStamp[2].NFrames) + "\n"; - str += structName + ".TimeStamp[2].SecondsFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].SecondsFlag) + "\n"; - str += structName + ".TimeStamp[2].MinutesFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].MinutesFlag) + "\n"; - str += structName + ".TimeStamp[2].HoursFlag=" + ToString(ExtPictureTimingSEI.TimeStamp[2].HoursFlag) + "\n"; - str += structName + ".TimeStamp[2].SecondsValue=" + ToString(ExtPictureTimingSEI.TimeStamp[2].SecondsValue) + "\n"; - str += structName + ".TimeStamp[2].MinutesValue=" + ToString(ExtPictureTimingSEI.TimeStamp[2].MinutesValue) + "\n"; - str += structName + ".TimeStamp[2].HoursValue=" + ToString(ExtPictureTimingSEI.TimeStamp[2].HoursValue) + "\n"; - str += structName + ".TimeStamp[2].TimeOffset=" + ToString(ExtPictureTimingSEI.TimeStamp[2].TimeOffset) + "\n"; - return str; -} - -//mfxHEVC -std::string DumpContext::dump(const std::string structName, const mfxExtHEVCTiles &ExtHEVCTiles) -{ - std::string str; - str += dump(structName + ".Header", ExtHEVCTiles.Header) + "\n"; - str += structName + ".NumTileRows=" + ToString(ExtHEVCTiles.NumTileRows) + "\n"; - str += structName + ".NumTileColumns=" + ToString(ExtHEVCTiles.NumTileColumns) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtHEVCTiles.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtHEVCParam &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD(PicWidthInLumaSamples); - DUMP_FIELD(PicHeightInLumaSamples); - DUMP_FIELD(GeneralConstraintFlags); -#if (MFX_VERSION >= 1026) - DUMP_FIELD(SampleAdaptiveOffset); - DUMP_FIELD(LCUSize); -#endif - - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(_struct.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtHEVCRegion &ExtHEVCRegion) -{ - std::string str; - str += dump(structName + ".Header", ExtHEVCRegion.Header) + "\n"; - str += structName + ".RegionId=" + ToString(ExtHEVCRegion.RegionId) + "\n"; - str += structName + ".RegionType=" + ToString(ExtHEVCRegion.RegionType) + "\n"; - str += structName + ".RegionEncoding=" + ToString(ExtHEVCRegion.RegionEncoding) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtHEVCRegion.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtPredWeightTable &ExtPredWeightTable) -{ - std::string str; - str += dump(structName + ".Header", ExtPredWeightTable.Header) + "\n"; - str += structName + ".LumaLog2WeightDenom=" + ToString(ExtPredWeightTable.LumaLog2WeightDenom) + "\n"; - str += structName + ".ChromaLog2WeightDenom=" + ToString(ExtPredWeightTable.ChromaLog2WeightDenom) + "\n"; - for (int i = 0; i < 2; i++) - str += structName + ".LumaWeightFlag[" + ToString(i) + "][]=" + DUMP_RESERVED_ARRAY(ExtPredWeightTable.LumaWeightFlag[i]) + "\n"; - for (int i = 0; i < 2; i++) - str += structName + ".ChromaWeightFlag[" + ToString(i) + "][]=" + DUMP_RESERVED_ARRAY(ExtPredWeightTable.ChromaWeightFlag[i]) + "\n"; - for (int i = 0; i < 2; i++) - for (int j = 0; j < 32; j++) - for (int k = 0; k < 3; k++) - str += structName + ".ChromaWeightFlag[" + ToString(i) + "][" + ToString(j) + "][" + ToString(k) + "][]=" + DUMP_RESERVED_ARRAY(ExtPredWeightTable.Weights[i][j][k]) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtPredWeightTable.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPFrameRateConversion &ExtVPPFrameRateConversion) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPFrameRateConversion.Header) + "\n"; - str += structName + ".Algorithm=" + ToString(ExtVPPFrameRateConversion.Algorithm) + "\n"; - str += structName + ".reserved=" + ToString(ExtVPPFrameRateConversion.reserved) + "\n"; - str += structName + ".reserved2[]=" + DUMP_RESERVED_ARRAY(ExtVPPFrameRateConversion.reserved2) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPImageStab &ExtVPPImageStab) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPImageStab.Header) + "\n"; - str += structName + ".Mode=" + ToString(ExtVPPImageStab.Mode) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtVPPImageStab.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtEncoderROI &ExtEncoderROI) -{ - std::string str; - str += dump(structName + ".Header", ExtEncoderROI.Header) + "\n"; - str += structName + ".NumROI=" + ToString(ExtEncoderROI.NumROI) + "\n"; - str += structName + ".ROIMode=" + ToString(ExtEncoderROI.ROIMode) + "\n"; - for (int i = 0; i < ExtEncoderROI.NumROI; i++) { - str += structName + ".ROI[" + ToString(i) + "].Left=" + ToString(ExtEncoderROI.ROI[i].Left) + "\n"; - str += structName + ".ROI[" + ToString(i) + "].Top=" + ToString(ExtEncoderROI.ROI[i].Top) + "\n"; - str += structName + ".ROI[" + ToString(i) + "].Right=" + ToString(ExtEncoderROI.ROI[i].Right) + "\n"; - str += structName + ".ROI[" + ToString(i) + "].Bottom=" + ToString(ExtEncoderROI.ROI[i].Bottom) + "\n"; - if (ExtEncoderROI.ROIMode == MFX_ROI_MODE_QP_DELTA) { - str += structName + ".ROI[" + ToString(i) + "].DeltaQP=" + ToString(ExtEncoderROI.ROI[i].DeltaQP) + "\n"; - } else { - str += structName + ".ROI[" + ToString(i) + "].Priority=" + ToString(ExtEncoderROI.ROI[i].Priority) + "\n"; - } - str += structName + ".ROI[" + ToString(i) + "].reserved2[]=" + DUMP_RESERVED_ARRAY(ExtEncoderROI.ROI[i].reserved2) + "\n"; - } - str += structName + ".reserved1[]=" + DUMP_RESERVED_ARRAY(ExtEncoderROI.reserved1) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPRotation &ExtVPPRotation) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPRotation.Header) + "\n"; - str += structName + "Angle.=" + ToString(ExtVPPRotation.Angle) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtVPPRotation.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtEncodedSlicesInfo &ExtEncodedSlicesInfo) -{ - std::string str; - str += dump(structName + ".Header", ExtEncodedSlicesInfo.Header) + "\n"; - str += structName + "SliceSizeOverflow.=" + ToString(ExtEncodedSlicesInfo.SliceSizeOverflow) + "\n"; - str += structName + "NumSliceNonCopliant.=" + ToString(ExtEncodedSlicesInfo.NumSliceNonCopliant) + "\n"; - str += structName + "NumEncodedSlice.=" + ToString(ExtEncodedSlicesInfo.NumEncodedSlice) + "\n"; - str += structName + "NumSliceSizeAlloc.=" + ToString(ExtEncodedSlicesInfo.NumSliceSizeAlloc) + "\n"; - str += structName + "SliceSize.=" + ToHexFormatString(ExtEncodedSlicesInfo.SliceSize) + "\n"; - str += structName + "reserved1.=" + ToString(ExtEncodedSlicesInfo.reserved1) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtEncodedSlicesInfo.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVPPScaling &ExtVPPScaling) -{ - std::string str; - str += dump(structName + ".Header", ExtVPPScaling.Header) + "\n"; - str += structName + "ScalingMode.=" + ToString(ExtVPPScaling.ScalingMode) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtVPPScaling.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtDecVideoProcessing &ExtDecVideoProcessing) -{ - std::string str; - /* IN structures */ - str += dump(structName + ".Header", ExtDecVideoProcessing.Header) + "\n"; - str += structName + "In.CropX=" + ToString(ExtDecVideoProcessing.In.CropX) + "\n"; - str += structName + "In.CropY=" + ToString(ExtDecVideoProcessing.In.CropY) + "\n"; - str += structName + "In.CropW=" + ToString(ExtDecVideoProcessing.In.CropW) + "\n"; - str += structName + "In.CropH=" + ToString(ExtDecVideoProcessing.In.CropH) + "\n"; - str += structName + "In.reserved[]=" + DUMP_RESERVED_ARRAY(ExtDecVideoProcessing.In.reserved) + "\n"; - /* Out structures */ - str += structName + "Out.FourCC=" + ToString(ExtDecVideoProcessing.Out.FourCC) + "\n"; - str += structName + "Out.ChromaFormat=" + ToString(ExtDecVideoProcessing.Out.ChromaFormat) + "\n"; - str += structName + "Out.reserved1=" + ToString(ExtDecVideoProcessing.Out.reserved1) + "\n"; - str += structName + "Out.Width=" + ToString(ExtDecVideoProcessing.Out.Width) + "\n"; - str += structName + "Out.Height=" + ToString(ExtDecVideoProcessing.Out.Height) + "\n"; - str += structName + "OutCropX.=" + ToString(ExtDecVideoProcessing.Out.CropX) + "\n"; - str += structName + "OutCropY.=" + ToString(ExtDecVideoProcessing.Out.CropY) + "\n"; - str += structName + "OutCropW.=" + ToString(ExtDecVideoProcessing.Out.CropW) + "\n"; - str += structName + "OutCropH.=" + ToString(ExtDecVideoProcessing.Out.CropH) + "\n"; - str += structName + "Out.reserved[]=" + DUMP_RESERVED_ARRAY(ExtDecVideoProcessing.Out.reserved) + "\n"; - - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtDecVideoProcessing.reserved) + "\n"; - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMBQP &ExtMBQP) -{ - std::string str; - str += dump(structName + ".Header", ExtMBQP.Header) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtMBQP.reserved) + "\n"; - str += structName + ".Mode=" + ToString(ExtMBQP.Mode) + "\n"; - str += structName + ".BlockSize=" + ToString(ExtMBQP.BlockSize) + "\n"; - str += structName + ".NumQPAlloc=" + ToString(ExtMBQP.NumQPAlloc) + "\n"; - str += structName + ".QP=" + ToString(ExtMBQP.QP) + "\n"; - str += structName + ".DeltaQP=" + ToString(ExtMBQP.DeltaQP) + "\n"; - str += structName + "reserverd2=" + ToString(ExtMBQP.reserved2) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtEncoderIPCMArea &ExtEncoderIPCMArea) -{ - std::string str; - str += dump(structName + ".Header", ExtEncoderIPCMArea.Header) + "\n"; - str += structName + ".reserve1[]=" + DUMP_RESERVED_ARRAY(ExtEncoderIPCMArea.reserve1) + "\n"; - str += structName + ".NumArea=" + ToString(ExtEncoderIPCMArea.NumArea) + "\n"; - // dump Area - if (ExtEncoderIPCMArea.Areas == nullptr) - { - str += structName + ".Areas = nullptr \n"; - return str; - } - - for (mfxU16 i = 0; i < ExtEncoderIPCMArea.NumArea; i++) { - str += structName + ".Areas[" + ToString(i) + "].Left=" + ToString(ExtEncoderIPCMArea.Areas[i].Left) + "\n"; - str += structName + ".Areas[" + ToString(i) + "].Top=" + ToString(ExtEncoderIPCMArea.Areas[i].Top) + "\n"; - str += structName + ".Areas[" + ToString(i) + "].Right=" + ToString(ExtEncoderIPCMArea.Areas[i].Right) + "\n"; - str += structName + ".Areas[" + ToString(i) + "].Bottom=" + ToString(ExtEncoderIPCMArea.Areas[i].Bottom) + "\n"; - str += structName + ".Areas[" + ToString(i) + "].reserved2=" + DUMP_RESERVED_ARRAY(ExtEncoderIPCMArea.Areas[i].reserved2) + "\n"; - } - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtInsertHeaders& ExtInsertHeaders) -{ - std::string str; - str += dump(structName + ".Header", ExtInsertHeaders.Header) + "\n"; - str += structName + ".SPS=" + ToString(ExtInsertHeaders.SPS) + "\n"; - str += structName + ".PPS=" + ToString(ExtInsertHeaders.PPS) + "\n"; - return str; -} - -#if (MFX_VERSION >= 1025) -std::string DumpContext::dump(const std::string structName, const mfxExtMasteringDisplayColourVolume &_struct) { - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".InsertPayloadToggle=" + ToString(_struct.InsertPayloadToggle) + "\n"; - for (int i = 0; i < 3; i++) { - str += structName + ".DisplayPrimariesX[" + ToString(i) + "]=" + ToString(_struct.DisplayPrimariesX[i]) + "\n"; - str += structName + ".DisplayPrimariesY[" + ToString(i) + "]=" + ToString(_struct.DisplayPrimariesY[i]) + "\n"; - } - str += structName + ".WhitePointX=" + ToString(_struct.WhitePointX) + "\n"; - str += structName + ".WhitePointY=" + ToString(_struct.WhitePointY) + "\n"; - str += structName + ".MaxDisplayMasteringLuminance=" + ToString(_struct.MaxDisplayMasteringLuminance) + "\n"; - str += structName + ".MinDisplayMasteringLuminance=" + ToString(_struct.MinDisplayMasteringLuminance) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtContentLightLevelInfo &_struct) { - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".InsertPayloadToggle=" + ToString(_struct.InsertPayloadToggle) + "\n"; - str += structName + ".MaxContentLightLevel=" + ToString(_struct.MaxContentLightLevel) + "\n"; - str += structName + ".MaxPicAverageLightLevel=" + ToString(_struct.MaxPicAverageLightLevel) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMultiFrameParam &_struct) { - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".MFMode=" + ToString(_struct.MFMode) + "\n"; - str += structName + ".MaxNumFrames=" + ToString(_struct.MaxNumFrames) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtMultiFrameControl &_struct) { - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".Timeout=" + ToString(_struct.Timeout) + "\n"; - str += structName + ".Flush=" + ToString(_struct.Flush) + "\n"; - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtEncodedUnitsInfo &_struct) { - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".NumUnitsAlloc=" + ToString(_struct.NumUnitsAlloc) + "\n"; - str += structName + ".NumUnitsEncoded=" + ToString(_struct.NumUnitsEncoded) + "\n"; - - if (_struct.UnitInfo != NULL) - { - int count = min(_struct.NumUnitsEncoded, _struct.NumUnitsAlloc); - for (int i = 0; i < count; i++) - { - str += structName + ".UnitInfo[" + ToString(i) + "].Type=" + ToString(_struct.UnitInfo[i].Type) + "\n"; - str += structName + ".UnitInfo[" + ToString(i) + "].Offset=" + ToString(_struct.UnitInfo[i].Offset) + "\n"; - str += structName + ".UnitInfo[" + ToString(i) + "].Size=" + ToString(_struct.UnitInfo[i].Size) + "\n"; - } - } - else - { - str += structName + ".UnitInfo=NULL\n"; - } - - DUMP_FIELD_RESERVED(reserved); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtColorConversion &ExtColorConversion) { - std::string str; - str += dump(structName + ".Header", ExtColorConversion.Header) + "\n"; - str += structName + ".ChromaSiting=" + ToString(ExtColorConversion.ChromaSiting) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(ExtColorConversion.reserved) + "\n"; - return str; -} - -#endif - -#if (MFX_VERSION >= 1026) -std::string DumpContext::dump(const std::string structName, const mfxExtVppMctf &_struct) { - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - str += structName + ".FilterStrength=" + ToString(_struct.FilterStrength) + "\n"; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - str += structName + ".Overlap=" + ToString(_struct.Overlap) + "\n"; - str += structName + ".BitsPerPixelx100k=" + ToString(_struct.BitsPerPixelx100k) + "\n"; - str += structName + ".Deblocking=" + ToString(_struct.Deblocking) + "\n"; - str += structName + ".TemporalMode=" + ToString(_struct.TemporalMode) + "\n"; - str += structName + ".MVPrecision=" + ToString(_struct.MVPrecision) + "\n"; -#endif - DUMP_FIELD_RESERVED(reserved); - return str; -} - -#endif - -#if (MFX_VERSION >= 1026) - -std::string DumpContext::dump(const std::string structName, const mfxVP9SegmentParam &_struct) -{ - std::string str; - DUMP_FIELD(FeatureEnabled); - DUMP_FIELD(QIndexDelta); - DUMP_FIELD(LoopFilterLevelDelta); - DUMP_FIELD(ReferenceFrame); - return str; -} - - -std::string DumpContext::dump(const std::string structName, const mfxExtVP9Segmentation &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(NumSegments); - - for (mfxU16 i = 0; i < 8 && i < _struct.NumSegments; i++) - { - str += dump(structName + ".Segment[" + ToString(i) + "]", _struct.Segment[i]) + "\n"; - } - - DUMP_FIELD(SegmentIdBlockSize); - DUMP_FIELD(NumSegmentIdAlloc); - - if (_struct.SegmentId) - { - str += dump_array_with_cast(_struct.SegmentId, _struct.NumSegmentIdAlloc); - } - else - { - DUMP_FIELD(SegmentId); - } - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxVP9TemporalLayer &_struct) -{ - std::string str; - DUMP_FIELD(FrameRateScale); - DUMP_FIELD(TargetKbps); - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVP9TemporalLayers &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - - for (mfxU16 i = 0; i < 8; i++) - { - str += dump(structName + ".Layer[" + ToString(i) + "]", _struct.Layer[i]) + "\n"; - } - - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxExtVP9Param &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD(FrameWidth); - DUMP_FIELD(FrameHeight); - DUMP_FIELD(WriteIVFHeaders); -#if (MFX_VERSION >= MFX_VERSION_NEXT) - str += structName + ".LoopFilterRefDelta[4]=" + DUMP_RESERVED_ARRAY(_struct.LoopFilterRefDelta) + "\n"; - str += structName + ".LoopFilterModeDelta[2]=" + DUMP_RESERVED_ARRAY(_struct.LoopFilterModeDelta) + "\n"; -#endif - DUMP_FIELD(QIndexDeltaLumaDC); - DUMP_FIELD(QIndexDeltaChromaAC); - DUMP_FIELD(QIndexDeltaChromaDC); -#if (MFX_VERSION >= 1029) - DUMP_FIELD(NumTileRows); - DUMP_FIELD(NumTileColumns); -#endif - return str; -} - -#endif - -#if (MFX_VERSION >= 1034) -std::string DumpContext::dump(const std::string structName, const mfxExtAV1FilmGrainParam &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(FilmGrainFlags); - DUMP_FIELD(GrainSeed); - DUMP_FIELD(RefIdx); - DUMP_FIELD(NumYPoints); - DUMP_FIELD(NumCbPoints); - DUMP_FIELD(NumCrPoints); - - for (mfxU16 i = 0; i < 14 && i < _struct.NumYPoints; i++) - { - str += dump(structName + ".PointY[" + ToString(i) + "].Value", _struct.PointY[i].Value) + "\n"; - str += dump(structName + ".PointY[" + ToString(i) + "].Scaling", _struct.PointY[i].Scaling) + "\n"; - } - - for (mfxU16 i = 0; i < 10 && i < _struct.NumCbPoints; i++) - { - str += dump(structName + ".PointCb[" + ToString(i) + "].Value", _struct.PointCb[i].Value) + "\n"; - str += dump(structName + ".PointCb[" + ToString(i) + "].Scaling", _struct.PointCb[i].Scaling) + "\n"; - } - - for (mfxU16 i = 0; i < 10 && i < _struct.NumCrPoints; i++) - { - str += dump(structName + ".PointCr[" + ToString(i) + "].Value", _struct.PointCr[i].Value) + "\n"; - str += dump(structName + ".PointCr[" + ToString(i) + "].Scaling", _struct.PointCr[i].Scaling) + "\n"; - } - - DUMP_FIELD(GrainScalingMinus8); - DUMP_FIELD(ArCoeffLag); - - for (mfxU16 i = 0; i < 24; i++) - { - str += dump(structName + ".ArCoeffsYPlus128[" + ToString(i) + "]", _struct.ArCoeffsYPlus128[i]) + "\n"; - } - - for (mfxU16 i = 0; i < 25; i++) - { - str += dump(structName + ".ArCoeffsCbPlus128[" + ToString(i) + "]", _struct.ArCoeffsCbPlus128[i]) + "\n"; - str += dump(structName + ".ArCoeffsCrPlus128[" + ToString(i) + "]", _struct.ArCoeffsCrPlus128[i]) + "\n"; - } - - DUMP_FIELD(ArCoeffShiftMinus6); - DUMP_FIELD(GrainScaleShift); - DUMP_FIELD(CbMult); - DUMP_FIELD(CbLumaMult); - DUMP_FIELD(CbOffset); - DUMP_FIELD(CrMult); - DUMP_FIELD(CrLumaMult); - DUMP_FIELD(CrOffset); - - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(_struct.reserved) + "\n"; - - return str; -} -#endif - -#if (MFX_VERSION >= MFX_VERSION_NEXT) -std::string DumpContext::dump(const std::string structName, const mfxExtAVCScalingMatrix &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(Type); - - for (mfxU8 i = 0; i < 12; ++i) - { - str += dump(structName + ".ScalingListPresent[" + ToString(i) + "]", _struct.ScalingListPresent[i]) + "\n"; - } - - for (mfxU8 i = 0; i < 6; ++i) - { - for(mfxU8 y = 0; y < 4; ++y) - for (mfxU8 x = 0; x < 4; ++x) - { - str += dump(structName + ".ScalingList4x4[" + ToString(i) + "][" + ToString(y) + "][" + ToString(x) + "]", _struct.ScalingList4x4[i][y * 4+x]) + "\n"; - } - } - - for (mfxU8 i = 0; i < 6; ++i) - { - for (mfxU8 y = 0; y < 8; ++y) - for (mfxU8 x = 0; x < 8; ++x) - { - str += dump(structName + ".ScalingList8x8[" + ToString(i) + "][" + ToString(y) + "][" + ToString(x) + "]", _struct.ScalingList8x8[i][y * 4 + x]) + "\n"; - } - } - - return str; -} -#endif - -#if (MFX_VERSION >= MFX_VERSION_NEXT) -std::string DumpContext::dump(const std::string structName, const mfxExtPartialBitstreamParam &_struct) -{ - std::string str; - str += dump(structName + ".Header", _struct.Header) + "\n"; - DUMP_FIELD(BlockSize); - DUMP_FIELD(Granularity); - - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(_struct.reserved) + "\n"; - - return str; -} -#endif diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvideo.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvideo.cpp deleted file mode 100644 index 6dfbcb0..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvideo.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump_mfxvideo.cpp - -\* ****************************************************************************** */ - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxFrameAllocator &allocator) -{ - std::string str; - str += structName + ".pthis=" + ToHexFormatString(&allocator.pthis) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(allocator.reserved) + "\n"; - return str; -} - -std::string DumpContext::dump(const std::string structName, const mfxBufferAllocator &allocator) -{ - std::string str; - str += structName + ".pthis=" + ToHexFormatString(&allocator.pthis) + "\n"; - str += structName + ".reserved[]=" + DUMP_RESERVED_ARRAY(allocator.reserved) + "\n"; - return str; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvp8.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvp8.cpp deleted file mode 100644 index fffc22d..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/dumps/dump_mfxvp8.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: dump_mfxvp8.cpp - -\* ****************************************************************************** */ - -#include "dump.h" - -std::string DumpContext::dump(const std::string structName, const mfxExtVP8CodingOption &_struct) -{ - std::string str; - - str += dump(structName + ".Header", _struct.Header) + "\n"; - - DUMP_FIELD(Version); - DUMP_FIELD(EnableMultipleSegments); - DUMP_FIELD(LoopFilterType); - DUMP_FIELD_RESERVED(LoopFilterLevel); - DUMP_FIELD(SharpnessLevel); - DUMP_FIELD(NumTokenPartitions); - DUMP_FIELD_RESERVED(LoopFilterRefTypeDelta); - DUMP_FIELD_RESERVED(LoopFilterMbModeDelta); - DUMP_FIELD_RESERVED(SegmentQPDelta); - DUMP_FIELD_RESERVED(CoeffTypeQPDelta); - DUMP_FIELD(WriteIVFHeaders); - DUMP_FIELD(NumFramesForIVFHeader); - DUMP_FIELD(reserved); - - return str; -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/ConfigManager.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/ConfigManager.cs deleted file mode 100644 index f804602..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/ConfigManager.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2012-2020 Intel Corporation. All Rights Reserved. - -File Name: ConficManager.cs - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace msdk_analyzer -{ - class ConfigManager - { - public ConfigManager() { } - - public bool CreateConfig (string config_path, Dictionary> config) - { - FileInfo _file = new FileInfo(config_path); - StreamWriter writer = new StreamWriter(config_path); - if(_file.Exists){ - foreach (KeyValuePair> pair in config) - { - writer.WriteLine("[" + pair.Key + "]"); - - Dictionary section_params = pair.Value; - foreach (KeyValuePair ppair in section_params) - { - writer.WriteLine(" " + ppair.Key + " = " + ppair.Value); - } - - writer.Write("\n"); - } - - writer.Close(); - writer.Dispose(); - return true; - } - writer.Close(); - writer.Dispose(); - return false; - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlDataCollector.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlDataCollector.cs deleted file mode 100644 index 7cf4244..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlDataCollector.cs +++ /dev/null @@ -1,173 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: EtlDataCollector.cs - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Diagnostics; -using System.IO; -using Microsoft.Win32; - -namespace msdk_analyzer -{ - class CollectorStat - { - UInt64 m_bytesWritten; - public UInt64 KBytesWritten - { - get { return m_bytesWritten; } - set { m_bytesWritten = value; } - } - } - - interface IDataCollector - { - void SetLevel(int level); - void SetLog(string log); - void Start(); - void Stop(); - void Create(); - void Delete(); - void Query(CollectorStat stat); - bool isRunning{ get; } - string TargetFile { get; } - } - - class DataCollector - : IDisposable - , IDataCollector - { - //TODO: questionalble variable might be used to reduce collector update calls - - private bool m_bCollecting; - private int m_level; - private string m_log; - private ConfigManager m_conf = new ConfigManager(); - private string config_path = Environment.CurrentDirectory + "\\.mfxtracer"; - //temporary filename - private const string etl_file_name = "provider.etl"; - private const string etl_file_name_actual = "provider_000001.etl"; - - public DataCollector() - { - //stop because if existed collector is running we cant delete it - Stop(); - } - - public void Dispose() - { - Stop(); - Delete(); - } - private string GetSdkAnalyzerDataFolder() - { - return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) - + "\\" + Properties.Resources.app_data_folder; - } - - public string TargetFile - { - get - { - return "\""+GetSdkAnalyzerDataFolder() + etl_file_name_actual+"\""; - } - } - - private Dictionary> GetDefaultParam() - { - //set level - string level = "default"; - if (m_level == 2) - { - level = "full"; - } - else if (m_level == 1) - { - level = "default"; - } - - Dictionary tmp_default_section = new Dictionary(); - tmp_default_section.Add("level", level.ToString()); - tmp_default_section.Add("log", m_log); - tmp_default_section.Add("type", "file"); - tmp_default_section.Add("lib", "none"); - - Dictionary> tmp_default_param = new Dictionary>(); - tmp_default_param.Add("core", tmp_default_section); - return tmp_default_param; - } - - public void Create() - { - //session might exist from abnormal termination - Delete(); - - //create target folder if not exist - string path = Path.GetDirectoryName(GetSdkAnalyzerDataFolder()); - Directory.CreateDirectory(path); - - // create config file - Dictionary> default_param = GetDefaultParam(); - m_conf.CreateConfig(config_path, default_param); - - } - - public void SetLevel(int level) - { - m_level = level; - } - - public void SetLog(string log) - { - m_log = "\"" + log + "\""; - } - - public void Start() - { - //have to call to cr/eate to not spawn number of etl files - Create(); - - m_bCollecting = true; - } - - public void Stop() - { - m_bCollecting = false; - } - - public void Delete() - { - Stop(); - } - - public void Query(CollectorStat statistics) - { - EVENT_TRACE_PROPERTIES prop = new EVENT_TRACE_PROPERTIES(); - UInt64 ret; - prop.Wnode.BufferSize = 2048; - - ret = AdvApi.QueryTrace(0, Properties.Resources.msdk_analyzer_session_name, prop); - - statistics.KBytesWritten = prop.BufferSize * prop.BuffersWritten; - } - - public bool isRunning - { - get - { - return m_bCollecting; - } - } - - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlToTextConverter.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlToTextConverter.cs deleted file mode 100644 index e593805..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/EtlToTextConverter.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Runtime.InteropServices; - -namespace msdk_analyzer -{ - enum ConversionStatus - { - CONVERSION_STARTED, - CONVERSION_PROGRESS, - CONVERSION_ABORTED, - CONVERSION_COMPLETED - } - - delegate void ConversionStatusUpdated(ConversionStatus sts, int percentage); - - class EtlToTextConverter - { - uint m_percentage; - ConversionStatus m_status; - string m_etlfilename; - string m_textfilename; - - public EtlToTextConverter() - { - } - /// - /// Does Conversion from etl file to user readable text form - /// - /// - /// - public void StartConvert(string etlfilename, string textfilename) - { - m_etlfilename = etlfilename; - m_textfilename = textfilename; - ThreadPool.QueueUserWorkItem(RunConversion); - } - - private void RunConversion(object state) - { - m_status = ConversionStatus.CONVERSION_STARTED; - m_percentage = 50; - MsdkAnalyzerCpp.convert_etl_to_text(0, 0, m_etlfilename + " " + m_textfilename, 1); - m_percentage = 100; - m_status = ConversionStatus.CONVERSION_COMPLETED; - } - - public void GetConversionStatus(ref ConversionStatus sts, ref uint percentage) - { - sts = m_status; - percentage = m_percentage; - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Import.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Import.cs deleted file mode 100644 index 0a64552..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Import.cs +++ /dev/null @@ -1,186 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: Import.cs - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; - -namespace TAL -{ - class TalImport32 - { - const string mfx_tal_dll = "mpa_rt32.dll"; - - [DllImport(mfx_tal_dll, CallingConvention = CallingConvention.Cdecl)] - public static extern int MPA_SetTraceFile(char[] path); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_CreateConsumer(char[] name_guid); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_FlushLoggers(); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_DestroyAllConsumers(); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_GetProviderEvents(char[] stingedGuid); - - [DllImport(mfx_tal_dll)] - public static extern long MPA_GetProviderTimestamp(char[] stingedGuid); - - [DllImport(mfx_tal_dll)] - public static extern double MPA_GetGPUUsage(int engine, int device); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_GetGPUFrequency(int i); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_ConvertETWFile(char[] name); - - [DllImport(mfx_tal_dll)] - public unsafe static extern Int64 GetTableData(char* data, int max_data_len); - } - - //todo this shouldbe equal to talimport32 except of library name - class TalImport64 - { - const string mfx_tal_dll = "mpa_rt64.dll"; - - [DllImport(mfx_tal_dll, CallingConvention = CallingConvention.Cdecl)] - public static extern int MPA_SetTraceFile(char[] path); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_CreateConsumer(char[] name_guid); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_FlushLoggers(); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_DestroyAllConsumers(); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_GetProviderEvents(char[] stingedGuid); - - [DllImport(mfx_tal_dll)] - public static extern long MPA_GetProviderTimestamp(char[] stingedGuid); - - [DllImport(mfx_tal_dll)] - public static extern double MPA_GetGPUUsage(int engine, int device); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_GetGPUFrequency(int i); - - [DllImport(mfx_tal_dll)] - public static extern int MPA_ConvertETWFile(char[] name); - - [DllImport(mfx_tal_dll)] - public unsafe static extern Int64 GetTableData(char* data, int max_data_len); - } -} - -namespace msdk_analyzer -{ - - class MPALib - { - int m_nVer; - - public MPALib (int nBitsImplementation) - { - m_nVer = nBitsImplementation; - if (m_nVer == 32) - { - - }else if (m_nVer == 64) - { - - } - else throw new Exception("Unsupported Dll mfx_tal"+nBitsImplementation+".dll"); - } - - public void SetTraceFile(string file_name) - { - char[] s = file_name.ToCharArray(); - if (m_nVer == 32) - TAL.TalImport32.MPA_SetTraceFile(s); - else - TAL.TalImport64.MPA_SetTraceFile(s); - } - public void CreateConsumer(string guid) - { - char[] s = guid.ToCharArray(); - if (m_nVer == 32) - TAL.TalImport32.MPA_CreateConsumer(s); - else - TAL.TalImport64.MPA_CreateConsumer(s); - } - public void DestroyAllConsumers() - { - if (m_nVer == 32) - TAL.TalImport32.MPA_DestroyAllConsumers(); - else - TAL.TalImport64.MPA_DestroyAllConsumers(); - } - public void FlushLoggers() - { - if (m_nVer == 32) - TAL.TalImport32.MPA_FlushLoggers(); - else - TAL.TalImport64.MPA_FlushLoggers(); - } - public int GetProviderEvents(string provider_guid) - { - char[] s = provider_guid.ToCharArray(); - if (m_nVer == 32) - return TAL.TalImport32.MPA_GetProviderEvents(s); - else - return TAL.TalImport64.MPA_GetProviderEvents(s); - } - public long GetProviderTimestamp(string provider_guid) - { - char[] s = provider_guid.ToCharArray(); - if (m_nVer == 32) - return TAL.TalImport32.MPA_GetProviderTimestamp(s); - else - return TAL.TalImport64.MPA_GetProviderTimestamp(s); - } - public double GetGPUUsage(int engine, int device) - { - if (m_nVer == 32) - return TAL.TalImport32.MPA_GetGPUUsage(engine, device); - else - return TAL.TalImport64.MPA_GetGPUUsage(engine, device); - } - public int GetGPUFrequency(int i) - { - if (m_nVer == 32) - return TAL.TalImport32.MPA_GetGPUFrequency(i); - else - return TAL.TalImport64.MPA_GetGPUFrequency(i); - } - public int ConvertETWFile(string ETWFile) - { - char[] s = ETWFile.ToCharArray(); - //List names = new List(); - //names.Add("path"); - //names.Add(ETWFile); - //names.Count, names.ToArray()); - if (m_nVer == 32) - return TAL.TalImport32.MPA_ConvertETWFile(s); - else - return TAL.TalImport64.MPA_ConvertETWFile(s); - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/MsdkAnalyzerCpp.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/MsdkAnalyzerCpp.cs deleted file mode 100644 index 90bc69a..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/MsdkAnalyzerCpp.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2012-2020 Intel Corporation. All Rights Reserved. - -File Name: MsdkAnalyzerCpp.cs - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.Text; -using System.Runtime.InteropServices; -using System.Diagnostics.Eventing; -using Microsoft.Win32; - -namespace msdk_analyzer -{ - class MsdkAnalyzerCpp - { -#if DEBUG -#if WIN64 - const string msdk_analyzer_path = "mfx-tracer_64_d.dll"; -#else - const string msdk_analyzer_path = "mfx-tracer_32_d.dll"; -#endif -#else -#if WIN64 - const string msdk_analyzer_path = "mfx-tracer_64.dll"; -#else - const string msdk_analyzer_path = "mfx-tracer_32.dll"; -#endif -#endif - - - [DllImport(msdk_analyzer_path, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern void convert_etl_to_text - ([MarshalAs(UnmanagedType.U4)] int hwnd - , [MarshalAs(UnmanagedType.U4)] int hinst - , [MarshalAs(UnmanagedType.LPStr)]string lpszCmdLine - , int nCmdShow); - - [DllImport(msdk_analyzer_path, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern UInt32 install([MarshalAs(UnmanagedType.LPStr)] string folder_path, - [MarshalAs(UnmanagedType.LPStr)] string app_data, - [MarshalAs(UnmanagedType.LPStr)] string conf_path);//default place for log file - - [DllImport(msdk_analyzer_path, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern UInt32 uninstall(); - - [DllImport(msdk_analyzer_path, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern void start(); - - [DllImport(msdk_analyzer_path, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern void stop(); - - - } - - -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.cs deleted file mode 100644 index 576672f..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2012-2020 Intel Corporation. All Rights Reserved. - -File Name: Program.cs - -\* ****************************************************************************** */ - -using System; -using System.IO; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; -using System.Diagnostics; -using System.ComponentModel; -using System.Threading; -using System.Security.AccessControl; - -using Microsoft.Win32; -using System.Security.Principal; -using System.Runtime.InteropServices; -using System.Diagnostics.Eventing; - -namespace msdk_analyzer -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - bool bOwn; - Mutex globalLock = new Mutex(true, "mediasdk_tracer_lock", out bOwn); - if (!bOwn) - { - globalLock.Dispose(); - return; - } - - try - { - string allapplicationpackages_group = "ALL APPLICATION PACKAGES"; - using (RegistryKey rk = Registry.CurrentUser.CreateSubKey(msdk_analyzer.Properties.Resources.msdk_registry_key, RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - RegistrySecurity rs = new RegistrySecurity(); - rs.AddAccessRule(new RegistryAccessRule(allapplicationpackages_group, RegistryRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow)); - rk.SetAccessControl(rs); - - DirectoryInfo myDirectoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory()); - DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl(); - myDirectorySecurity.AddAccessRule(new FileSystemAccessRule(allapplicationpackages_group, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow)); - myDirectoryInfo.SetAccessControl(myDirectorySecurity); - } - } - catch - { - globalLock.Dispose(); - } - try - { - ////// - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - UInt32 sts = MsdkAnalyzerCpp.install(Path.GetDirectoryName(Application.ExecutablePath) - , Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + _PATH.TRACER_PATH + _PATH.TRACER_LOG - , Path.GetDirectoryName(Application.ExecutablePath)); - if (sts == 0) - { - MessageBox.Show("ERROR: Install error", "ERROR"); - - } - else - { - SdkAnalyzerForm form = new SdkAnalyzerForm(); - Application.Run(form); - } - MsdkAnalyzerCpp.uninstall(); - GC.KeepAlive(globalLock);//prevent releasing by GC if application uses long time - } - catch - { - MessageBox.Show("ERROR: Install error", "ERROR"); - globalLock.Dispose(); - } - finally - { - globalLock.Dispose(); - } - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.ico b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Program.ico deleted file mode 100644 index 3b428d8faae319989e72b79f650ea530ee69c71d..0000000000000000000000000000000000000000 GI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G%mWEPJj<~{iND*E{yit-ak_KAwVQ1pXx zA1L>K=A<5@tdt1KNIpvG2}dY3KAciw4^h&IFiMOLrG%&uiaQ=mvB!caF7g1SB*ai= zRz4*qr5<|F^U*)Go%`ry-VNSnaIAJN8;;Sf>VLef%Ate4N6wqWIdeq59L$eW^}V70 z4f6ue0^Ij_7V|{UpGWSLqKo`3Sm%K(RQF)msP@0+GNRpt<6-9`+{y@xbrE9pDh4 zq1|ob3se@do`&{pMsq%Rk+zJkPdNWiU^1|M^}_Dd+slrc?F%M-FJF4sW+j-jdVL@8@bPTgT_Yhrw;g5c;!MhHA~5% zrbl9^Nnn_`#{lc4e0@-(MveZteA#mH@pL0E>qX?YcmVCdz3r##)0CS(((vm)P!D`> z>Z85$a#|iWJ$gdC$1C2u`TCy*4H|U&bm1AQD6iC@FfAInv$~P#zka6G-~UA8Z~Q>L z#XYW3vy-`?C5m3&7sS{9^696a-aZ50?DQaGI*S+=Wr*=mnh`+G;~S9crApfM<1gg= z!(Ezydwha->4Ui|EmL!-x3@iCA1|->v^Ju>Yx@#yIxDbmaT{`VoJ{+E`h{Zd{zj32 z#}B`d$@f2#A!6gKTHK4TpP+kvl+F7jv1fjBaQyoSbg#dh<0Y==H6vhYTXLJ&h#Y3VP7afs(C#JO$ir+Z;Zk8gb+4Dt)?G(fzDpVY z3q%?F`uNs){SQHgR2%qy*$0-_dHqhyx#YZ{m$=q{U0=;T+As3}Js%86s0OrhDe*gdg diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/AssemblyInfo.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/AssemblyInfo.cs deleted file mode 100644 index 0a494b0..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: AssemblyInfo.cs - -\* ****************************************************************************** */ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SDK Tracer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Intel Corporation")] -[assembly: AssemblyProduct("SDK Tracer")] -[assembly: AssemblyCopyright("Copyright© 2011-2020 Intel Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5909b0dd-c554-4832-b941-a9fd966be434")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyInformationalVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.3.0.0")] diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.Designer.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.Designer.cs deleted file mode 100644 index de16e87..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.Designer.cs +++ /dev/null @@ -1,117 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18010 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace msdk_analyzer.Properties { - using System; - - - ///

- /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("msdk_analyzer.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Intel\Media_SDK_Analyzer\. - /// - internal static string app_data_folder { - get { - return ResourceManager.GetString("app_data_folder", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {9B540B39-3730-4cc0-B753-16302ED006D2}. - /// - internal static string msdk_analyzer_guid { - get { - return ResourceManager.GetString("msdk_analyzer_guid", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to msdk_analyzer_session. - /// - internal static string msdk_analyzer_session_name { - get { - return ResourceManager.GetString("msdk_analyzer_session_name", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Software\Intel\MediaSDK. - /// - internal static string msdk_registry_key { - get { - return ResourceManager.GetString("msdk_registry_key", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to HKEY_CURRENT_USER\Software\Intel\MediaSDK\Debug\Analyzer\. - /// - internal static string target_folder_key { - get { - return ResourceManager.GetString("target_folder_key", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Log File. - /// - internal static string target_folder_value { - get { - return ResourceManager.GetString("target_folder_value", resourceCulture); - } - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.resx b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.resx deleted file mode 100644 index 7fc2a2c..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Resources.resx +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Intel\Media_SDK_Analyzer\ - - - {9B540B39-3730-4cc0-B753-16302ED006D2} - - - msdk_analyzer_session - - - Software\Intel\MediaSDK - - - HKEY_CURRENT_USER\Software\Intel\MediaSDK\Debug\Analyzer\ - - - Log File - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.Designer.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.Designer.cs deleted file mode 100644 index 4feaee5..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17369 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace msdk_analyzer.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.settings b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.Designer.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.Designer.cs deleted file mode 100644 index 0029b1e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.Designer.cs +++ /dev/null @@ -1,189 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: SdkAnalyzerForm.Designer.cs - -\* ****************************************************************************** */ -namespace msdk_analyzer -{ - partial class SdkAnalyzerForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.label1 = new System.Windows.Forms.Label(); - this.tbxLogOutput = new System.Windows.Forms.TextBox(); - this.checkBox_PerFrame = new System.Windows.Forms.CheckBox(); - this.button_Open = new System.Windows.Forms.Button(); - this.button_Start = new System.Windows.Forms.Button(); - this.btnDeleteLog = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.lblBytesWritten = new System.Windows.Forms.Label(); - this.checkBox_Append = new System.Windows.Forms.CheckBox(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(18, 27); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(58, 13); - this.label1.TabIndex = 11; - this.label1.Text = "Output File"; - // - // tbxLogOutput - // - this.tbxLogOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tbxLogOutput.Location = new System.Drawing.Point(99, 24); - this.tbxLogOutput.Name = "tbxLogOutput"; - this.tbxLogOutput.Size = new System.Drawing.Size(390, 20); - this.tbxLogOutput.TabIndex = 10; - // - // checkBox_PerFrame - // - this.checkBox_PerFrame.AutoSize = true; - this.checkBox_PerFrame.Location = new System.Drawing.Point(82, 116); - this.checkBox_PerFrame.Name = "checkBox_PerFrame"; - this.checkBox_PerFrame.Size = new System.Drawing.Size(108, 17); - this.checkBox_PerFrame.TabIndex = 15; - this.checkBox_PerFrame.Text = "Per-frame logging"; - this.checkBox_PerFrame.UseVisualStyleBackColor = true; - // - // button_Open - // - this.button_Open.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button_Open.DialogResult = System.Windows.Forms.DialogResult.No; - this.button_Open.Location = new System.Drawing.Point(364, 109); - this.button_Open.Margin = new System.Windows.Forms.Padding(2); - this.button_Open.Name = "button_Open"; - this.button_Open.Size = new System.Drawing.Size(56, 28); - this.button_Open.TabIndex = 13; - this.button_Open.Text = "Open"; - this.button_Open.UseVisualStyleBackColor = true; - this.button_Open.Click += new System.EventHandler(this.button_Open_Click); - // - // button_Start - // - this.button_Start.Location = new System.Drawing.Point(21, 109); - this.button_Start.Margin = new System.Windows.Forms.Padding(2); - this.button_Start.Name = "button_Start"; - this.button_Start.Size = new System.Drawing.Size(56, 28); - this.button_Start.TabIndex = 1; - this.button_Start.Text = "Start"; - this.button_Start.UseVisualStyleBackColor = true; - this.button_Start.Click += new System.EventHandler(this.button_Start_Click); - // - // btnDeleteLog - // - this.btnDeleteLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnDeleteLog.DialogResult = System.Windows.Forms.DialogResult.No; - this.btnDeleteLog.Location = new System.Drawing.Point(424, 109); - this.btnDeleteLog.Margin = new System.Windows.Forms.Padding(2); - this.btnDeleteLog.Name = "btnDeleteLog"; - this.btnDeleteLog.Size = new System.Drawing.Size(65, 28); - this.btnDeleteLog.TabIndex = 13; - this.btnDeleteLog.Text = "Delete"; - this.btnDeleteLog.UseVisualStyleBackColor = true; - this.btnDeleteLog.Click += new System.EventHandler(this.btnDeleteLog_Click); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(19, 51); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(77, 13); - this.label2.TabIndex = 11; - this.label2.Text = "KBytes Written"; - // - // lblBytesWritten - // - this.lblBytesWritten.Location = new System.Drawing.Point(99, 51); - this.lblBytesWritten.Name = "lblBytesWritten"; - this.lblBytesWritten.Size = new System.Drawing.Size(91, 13); - this.lblBytesWritten.TabIndex = 16; - this.lblBytesWritten.Text = "0"; - // - // checkBox_Append - // - this.checkBox_Append.AutoSize = true; - this.checkBox_Append.Location = new System.Drawing.Point(196, 116); - this.checkBox_Append.Name = "checkBox_Append"; - this.checkBox_Append.Size = new System.Drawing.Size(129, 17); - this.checkBox_Append.TabIndex = 13; - this.checkBox_Append.Text = "Append to existing file"; - this.checkBox_Append.UseVisualStyleBackColor = true; - // - // timer1 - // - this.timer1.Tick += new System.EventHandler(this.timer1_Tick_1); - // - // SdkAnalyzerForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(501, 148); - this.Controls.Add(this.checkBox_Append); - this.Controls.Add(this.lblBytesWritten); - this.Controls.Add(this.button_Start); - this.Controls.Add(this.checkBox_PerFrame); - this.Controls.Add(this.btnDeleteLog); - this.Controls.Add(this.button_Open); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.tbxLogOutput); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.Name = "SdkAnalyzerForm"; - this.ShowIcon = false; - this.Text = "SDK Tracer"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form4_FormClosing); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox tbxLogOutput; - private System.Windows.Forms.CheckBox checkBox_PerFrame; - private System.Windows.Forms.Button button_Open; - private System.Windows.Forms.Button button_Start; - private System.Windows.Forms.Button btnDeleteLog; - private System.Windows.Forms.CheckBox checkBox_Append; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label lblBytesWritten; - private System.Windows.Forms.Timer timer1; - } -} \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.cs deleted file mode 100644 index b5be769..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.cs +++ /dev/null @@ -1,246 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: SdkAnalyzer.cs - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Diagnostics; -using System.Threading; -using System.IO; -using Microsoft.Win32; -using System.Reflection; -using System.Security.AccessControl; - -namespace msdk_analyzer -{ - public static class _PATH - { - public static string TRACER_PATH = "\\Intel\\SDK_Tracer\\"; - public static string TRACER_LOG = "tracer.log"; - }; - - public partial class SdkAnalyzerForm : Form - { - IDataCollector m_collector; - FileInfo file; - - public SdkAnalyzerForm() - { - InitializeComponent(); - m_collector = new DataCollector(); - System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + _PATH.TRACER_PATH); - tbxLogOutput.Text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + _PATH.TRACER_PATH + _PATH.TRACER_LOG; - m_collector.SetLog(tbxLogOutput.Text); - m_collector.Create(); - - FileInfo log_path = new FileInfo(tbxLogOutput.Text); - if (log_path.Exists) - { - button_Open.Enabled = true; - btnDeleteLog.Enabled = true; - } - else - { - button_Open.Enabled = false; - btnDeleteLog.Enabled = false; - } - - } - - void OnUpdateEtlFileSize(object sender, EventArgs e) - { - // - } - - void converter_ConversionUpdated(ConversionStatus sts, int percentage) - { - // - } - - private void button_Start_Click(object sender, EventArgs e) - { - //button disabled since running a collector might take significant time - - if (m_collector.isRunning) - { - - OnStop(); - } - else - { - if (checkBox_Append.Checked != true) - { - try - { - File.Delete(tbxLogOutput.Text); - lblBytesWritten.Text = "0"; - } - catch (System.Exception ex) - { - MessageBox.Show(ex.ToString()); - } - } - OnStart(); - } - } - - private void OnStart() - { - button_Start.Enabled = false; - checkBox_PerFrame.Enabled = false; - checkBox_Append.Enabled = false; - button_Open.Enabled = false; - btnDeleteLog.Enabled = false; - - try - { - int nLevel = - checkBox_PerFrame.Checked ? 2 : 1; - m_collector.SetLevel(nLevel); - m_collector.SetLog(tbxLogOutput.Text); - this.Cursor = Cursors.WaitCursor; - m_collector.Start(); - MsdkAnalyzerCpp.start(); - - this.Cursor = Cursors.Default; - button_Start.Text = "Stop"; - timer1.Enabled = true; - timer1.Start(); - - } - catch (System.Exception ex) - { - MessageBox.Show(ex.ToString()); - checkBox_PerFrame.Enabled = true; - checkBox_Append.Enabled = true; - } - button_Start.Enabled = true; - } - - private void OnStop() - { - timer1.Stop(); - timer1.Enabled = false; - button_Start.Enabled = false; - - try - { - this.Cursor = Cursors.WaitCursor; - m_collector.Stop(); - MsdkAnalyzerCpp.stop(); - RunConversionDialog(); - button_Start.Text = "Start"; - button_Start.Enabled = true; - checkBox_PerFrame.Enabled = true; - checkBox_Append.Enabled = true; - - FileInfo log_path = new FileInfo(tbxLogOutput.Text); - if (log_path.Exists) - { - button_Open.Enabled = true; - btnDeleteLog.Enabled = true; - } - else - { - button_Open.Enabled = false; - btnDeleteLog.Enabled = false; - } - this.Cursor = Cursors.Default; - - } - catch (System.Exception ex) - { - MessageBox.Show(ex.ToString()); - button_Start.Text = "Start"; - button_Start.Enabled = true; - checkBox_PerFrame.Enabled = true; - checkBox_Append.Enabled = true; - - FileInfo log_path = new FileInfo(tbxLogOutput.Text); - if (log_path.Exists) - { - button_Open.Enabled = true; - btnDeleteLog.Enabled = true; - } - else - { - button_Open.Enabled = false; - btnDeleteLog.Enabled = false; - } - this.Cursor = Cursors.Default; - } - - } - - private void button_Open_Click(object sender, EventArgs e) - { - try - { - Process.Start(tbxLogOutput.Text); - } - catch (System.Exception ex) - { - MessageBox.Show(ex.ToString()); - } - - } - - private void Form4_FormClosing(object sender, FormClosingEventArgs e) - { - m_collector.Delete(); - } - - protected void RunConversionDialog() - { - // - } - - - private void OnConvertionFinished() - { - - button_Start.Enabled = true; - button_Start.Text = "Start"; - this.Cursor = Cursors.Default; - } - - private void btnDeleteLog_Click(object sender, EventArgs e) - { - try - { - File.Delete(tbxLogOutput.Text); - button_Open.Enabled = false; - btnDeleteLog.Enabled = false; - lblBytesWritten.Text = "0"; - } - catch (System.Exception ex) - { - MessageBox.Show(ex.ToString()); - } - - } - - - private void timer1_Tick_1(object sender, EventArgs e) - { - file = new FileInfo(tbxLogOutput.Text); - if (file.Exists) - lblBytesWritten.Text = (file.Length / 1000).ToString(); - } - - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.resx b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.resx deleted file mode 100644 index d55421f..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/SdkAnalyzerForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/WinApi.cs b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/WinApi.cs deleted file mode 100644 index 523ad5e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/WinApi.cs +++ /dev/null @@ -1,136 +0,0 @@ -/* ****************************************************************************** *\ - -INTEL CORPORATION PROPRIETARY INFORMATION -This software is supplied under the terms of a license agreement or nondisclosure -agreement with Intel Corporation and may not be copied or disclosed except in -accordance with the terms of that agreement -Copyright(c) 2020 Intel Corporation. All Rights Reserved. - -File Name: WinApi.cs - -\* ****************************************************************************** */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; - -namespace msdk_analyzer -{ - static class WinApi - { - [DllImport("user32.dll")] - public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); - - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern uint RegisterWindowMessage(string lpString); - - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern bool SetWindowText(IntPtr hwnd, String lpString); - } - - static class Kernel32 - { - [DllImport("kernel32.dll")] - public static extern IntPtr LoadLibrary(string dllToLoad); - - [DllImport("kernel32.dll")] - public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); - - [DllImport("kernel32.dll")] - public static extern bool FreeLibrary(IntPtr hModule); - } - - [StructLayout(LayoutKind.Sequential)] - public struct WNODE_HEADER - { - public UInt32 BufferSize; // Size of entire buffer inclusive of this ULONG - public UInt32 ProviderId; // Provider Id of driver returning this buffer - //union - //{ - public UInt64 HistoricalContext; // Logger use - // struct - // { - // ULONG Version; // Reserved - // ULONG Linkage; // Linkage field reserved for WMI - // } DUMMYSTRUCTNAME; - //} DUMMYUNIONNAME; - - //public union DUMMYUNIONNAME2 - //{ - // //UInt32 CountLost; // Reserved - //UInt32 KernelHandle; // Kernel handle for data block - //[Marshal (UnmanagedType.LPArray)] - //public UInt32 KernelHandle; - - public UInt64 TimeStamp; - //LARGE_INTEGER TimeStamp; // Timestamp as returned in units of 100ns - // since 1/1/1601 - //} - //[MarshalAs(UnmanagedType.LPStruct.LPStruct)] - //public Guid rGuid; // Guid for data block returned with results - public UInt64 rGuidLow; - public UInt64 rGuidHi; - public UInt32 ClientContext; - public UInt32 Flags; // Flags, see below - } - - - [StructLayout(LayoutKind.Sequential)] - public struct S128 - { - public UInt64 q, w, e, r, t, y, u, i, o, p, a, s, d, f, g, h; - } - - [StructLayout(LayoutKind.Sequential)] - public struct S2048 - { - public S128 q, w, e, r, t, y, u, i, o, p, a, s, d, f, g, h; - } - - - [StructLayout(LayoutKind.Sequential)] - public class EVENT_TRACE_PROPERTIES - { - public WNODE_HEADER Wnode; - // - // data provided by caller - public UInt32 BufferSize; // buffer size for logging (kbytes) - public UInt32 MinimumBuffers; // minimum to preallocate - public UInt32 MaximumBuffers; // maximum buffers allowed - public UInt32 MaximumFileSize; // maximum logfile size (in MBytes) - public UInt32 LogFileMode; // sequential, circular - public UInt32 FlushTimer; // buffer flush timer, in seconds - public UInt32 EnableFlags; // trace enable flags - public UInt32 AgeLimit; // unused - - // data returned to caller - public UInt32 NumberOfBuffers; // no of buffers in use - public UInt32 FreeBuffers; // no of buffers free - public UInt32 EventsLost; // event records lost - public UInt32 BuffersWritten; // no of buffers written to file - public UInt32 LogBuffersLost; // no of logfile write failures - public UInt32 RealTimeBuffersLost; // no of rt delivery failures - //[MarshalAs (UnmanagedType.LPArray)] - public UInt32 LoggerThreadId; // thread id of Logger - public UInt32 LogFileNameOffset; // Offset to LogFileName - public UInt32 LoggerNameOffset; // Offset to LoggerName - - //memory reserving for buffer - S2048 need; - } - - class AdvApi - { - const string dll_path = "Advapi32.dll"; - - [DllImport(dll_path, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern UInt64 QueryTrace(UInt64 TraceHandle, - [MarshalAs(UnmanagedType.LPTStr)] string InstanceName, - [Out, MarshalAs(UnmanagedType.LPStruct)] EVENT_TRACE_PROPERTIES Properties); - } -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/app.config b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/app.config deleted file mode 100644 index 99ddf3e..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/embed_manifest.bat b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/embed_manifest.bat deleted file mode 100644 index b9b1597..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/embed_manifest.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off - -if exist "%SystemDrive%\Program Files\Microsoft SDKs\Windows\v7.1\bin\mt.exe" ( -set mt_path="%SystemDrive%\Program Files\Microsoft SDKs\Windows\v7.1\bin\mt.exe" -goto :continue -) -if exist "%SystemDrive%\Program Files\Microsoft SDKs\Windows\v7.0\bin\mt.exe" ( -set mt_path="%SystemDrive%\Program Files\Microsoft SDKs\Windows\v7.0\bin\mt.exe" -goto :continue -) -if exist "%SystemDrive%\Program Files\Microsoft SDKs\Windows\v6.1\bin\mt.exe" ( -set mt_path="%SystemDrive%\Program Files\Microsoft SDKs\Windows\v6.1\bin\mt.exe" -goto :continue -) -if exist "%SystemDrive%\Program Files\Microsoft SDKs\Windows\v6.0\bin\mt.exe" ( -set mt_path="%SystemDrive%\Program Files\Microsoft SDKs\Windows\v6.0\bin\mt.exe" -) - -:continue - -copy %2tracer.exe.manifest %3 -echo %2tracer.exe.manifest %3 - -cd %1 -%mt_path% -manifest "tracer.exe.manifest" -outputresource:"tracer.exe;#1") diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.csproj b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.csproj deleted file mode 100644 index 743fc5f..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.csproj +++ /dev/null @@ -1,152 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {54E94009-6BF9-4847-A614-1DDDC863EB3F} - WinExe - Properties - msdk_analyzer - tracer - v4.0 - 512 - - - tracer.exe.manifest - false - false - false - OnBuildSuccess - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.1.0.%2a - false - true - - - - true - full - false - ..\..\..\..\build\win_Win32\bin\ - DEBUG;TRACE - prompt - 4 - true - x86 - AllRules.ruleset - - - pdbonly - true - ..\..\..\..\build\win_Win32\bin\ - TRACE - prompt - 4 - true - x86 - AllRules.ruleset - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - Form - - - SdkAnalyzerForm.cs - - - - - SdkAnalyzerForm.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - call "$(ProjectDir)embed_manifest.bat" $(OutDir) "$(ProjectDir)" "$(TargetDir)" - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.exe.manifest b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.exe.manifest deleted file mode 100644 index 4994cf4..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer.exe.manifest +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer_vs12.csproj b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer_vs12.csproj deleted file mode 100644 index 4231037..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/gui/tracer_vs12.csproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {54E94009-6BF9-4847-A614-1DDDC863EB3F} - WinExe - Properties - msdk_analyzer - tracer - v4.0 - 512 - - - tracer.exe.manifest - false - false - false - OnBuildSuccess - - - 3.5 - - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.1.0.%2a - false - true - - - true - full - false - ..\..\..\..\build\win_Win32\bin\ - DEBUG;TRACE - prompt - 4 - true - x86 - AllRules.ruleset - - - pdbonly - true - ..\..\..\..\build\win_Win32\bin\ - TRACE - prompt - 4 - true - x86 - AllRules.ruleset - - - true - full - false - ..\..\..\..\build\win_x64\bin\ - WIN64;DEBUG;TRACE - prompt - 4 - true - x64 - AllRules.ruleset - - - pdbonly - true - ..\..\..\..\build\win_x64\bin\ - WIN64;TRACE - prompt - 4 - true - x64 - AllRules.ruleset - - - LocalIntranet - - - false - - - - - - 3.5 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - SdkAnalyzerForm.cs - - - - - SdkAnalyzerForm.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/libmfx.map b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/libmfx.map deleted file mode 100644 index bdb41d3..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/libmfx.map +++ /dev/null @@ -1,97 +0,0 @@ -LIBMFX_1.0 { - global: - MFXInit; - MFXClose; - MFXQueryIMPL; - MFXQueryVersion; - - MFXJoinSession; - MFXDisjoinSession; - MFXCloneSession; - MFXSetPriority; - MFXGetPriority; - - MFXVideoCORE_SetBufferAllocator; - MFXVideoCORE_SetFrameAllocator; - MFXVideoCORE_SetHandle; - MFXVideoCORE_GetHandle; - MFXVideoCORE_SyncOperation; - - MFXVideoENCODE_Query; - MFXVideoENCODE_QueryIOSurf; - MFXVideoENCODE_Init; - MFXVideoENCODE_Reset; - MFXVideoENCODE_Close; - MFXVideoENCODE_GetVideoParam; - MFXVideoENCODE_GetEncodeStat; - MFXVideoENCODE_EncodeFrameAsync; - - MFXVideoDECODE_Query; - MFXVideoDECODE_DecodeHeader; - MFXVideoDECODE_QueryIOSurf; - MFXVideoDECODE_Init; - MFXVideoDECODE_Reset; - MFXVideoDECODE_Close; - MFXVideoDECODE_GetVideoParam; - MFXVideoDECODE_GetDecodeStat; - MFXVideoDECODE_SetSkipMode; - MFXVideoDECODE_GetPayload; - MFXVideoDECODE_DecodeFrameAsync; - - MFXVideoVPP_Query; - MFXVideoVPP_QueryIOSurf; - MFXVideoVPP_Init; - MFXVideoVPP_Reset; - MFXVideoVPP_Close; - - MFXVideoVPP_GetVideoParam; - MFXVideoVPP_GetVPPStat; - MFXVideoVPP_RunFrameVPPAsync; - - local: - *; -}; - -LIBMFX_1.1 { - global: - MFXVideoUSER_Register; - MFXVideoUSER_Unregister; - MFXVideoUSER_ProcessFrameAsync; -} LIBMFX_1.0; - -LIBMFX_1.10 { - global: - MFXVideoENC_Query; - MFXVideoENC_QueryIOSurf; - MFXVideoENC_Init; - MFXVideoENC_Reset; - MFXVideoENC_Close; - MFXVideoENC_ProcessFrameAsync; - MFXVideoVPP_RunFrameVPPAsyncEx; - -} LIBMFX_1.1; - -LIBMFX_1.13 { - global: - MFXVideoUSER_LoadByPath; - MFXVideoPAK_Query; - MFXVideoPAK_QueryIOSurf; - MFXVideoPAK_Init; - MFXVideoPAK_Reset; - MFXVideoPAK_Close; - MFXVideoPAK_ProcessFrameAsync; -} LIBMFX_1.10; - -LIBMFX_1.14 { - global: - MFXInitEx; - MFXDoWork; -} LIBMFX_1.13; - -LIBMFX_1.19 { - global: - MFXVideoENC_GetVideoParam; - MFXVideoPAK_GetVideoParam; - MFXVideoCORE_QueryPlatform; - MFXVideoUSER_GetPlugin; -} LIBMFX_1.14; \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/ilog.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/ilog.h deleted file mode 100644 index 43d9b6f..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/ilog.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef ILOG_H_ -#define ILOG_H_ - -#include -#include "timer.h" -#include "thread_info.h" - - - -class ILog -{ -public: - virtual ~ILog(){} - virtual void WriteLog(const std::string &log) = 0; -}; - -#endif //ILOG_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.cpp deleted file mode 100644 index b913f8f..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: log.cpp - -\* ****************************************************************************** */ - -#include "log.h" - -Log* Log::_sing_log = NULL; -bool Log::useGUI = false; - -Log::Log() -{ - _log_level = LOG_LEVEL_DEFAULT; - - _logmap = { - std::pair(LOG_CONSOLE, new LogConsole()) - ,std::pair(LOG_FILE, new LogFile()) -#if defined(_WIN32) || defined(_WIN64) - ,std::pair(LOG_ETW, new LogEtwEvents()) -#else - ,std::pair(LOG_SYSLOG, new LogSyslog()) -#endif - }; - - _log = _logmap[LOG_FILE]; - - - _logmap.insert(std::pair(LOG_CONSOLE, new LogConsole())); - _logmap.insert(std::pair(LOG_FILE, new LogFile())); -#if defined(_WIN32) || defined(_WIN64) - _logmap.insert(std::pair(LOG_ETW, new LogEtwEvents())); -#else - _logmap.insert(std::pair(LOG_SYSLOG, new LogSyslog())); -#endif // _WIN32... - _log = _logmap[LOG_CONSOLE]; - -} - -Log::~Log() -{ - for(std::map::iterator it=_logmap.begin(); it!=_logmap.end(); ++it){ - delete it->second; - } - _logmap.clear(); -} - -void Log::SetLogType(eLogType type) -{ - if(!_sing_log) - _sing_log = new Log(); - - _sing_log->_log = _sing_log->_logmap[type]; -} - -void Log::SetLogLevel(eLogLevel level) -{ - if(!_sing_log) - _sing_log = new Log(); - - _sing_log->_log_level = level; -} - -eLogLevel Log::GetLogLevel() -{ - if(!_sing_log) - _sing_log = new Log(); - - return _sing_log->_log_level; -} - -void Log::clear() -{ - if (_sing_log) - { - delete _sing_log; - _sing_log = NULL; - } -} - -void Log::WriteLog(const std::string &log) -{ - -#if defined(_WIN32) || defined(_WIN64) - DWORD start_flag = 0; - DWORD size = sizeof(DWORD); - RegGetValue(HKEY_LOCAL_MACHINE, ("Software\\Intel\\MediaSDK\\Dispatch\\tracer"), ("_start"), REG_DWORD, 0, (BYTE*)&start_flag, &size); - - if ((start_flag) || (!useGUI)) -#endif - { - if(!_sing_log) - _sing_log = new Log(); - - if(_sing_log->_log_level == LOG_LEVEL_DEFAULT){ - _sing_log->_log->WriteLog(log); - } - else if(_sing_log->_log_level == LOG_LEVEL_FULL){ - _sing_log->_log->WriteLog(log); - } - else if(_sing_log->_log_level == LOG_LEVEL_SHORT){ - if(log.find("function:") != std::string::npos) - _sing_log->_log->WriteLog(log); - } - } -} - diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.h deleted file mode 100644 index 0c8ad75..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef LOGGER_H_ -#define LOGGER_H_ - -#include -#include "log_console.h" -#include "log_etw_events.h" -#include "log_file.h" -#include "log_syslog.h" - -enum eLogType{ - LOG_FILE, - LOG_CONSOLE, -#if defined(_WIN32) || defined(_WIN64) - LOG_ETW, -#else - LOG_SYSLOG, -#endif -}; - -enum eLogLevel{ - LOG_LEVEL_DEFAULT, - LOG_LEVEL_SHORT, - LOG_LEVEL_FULL, -}; - -class Log -{ -public: - static void WriteLog(const std::string &log); - static void SetLogType(eLogType type); - static void SetFilePath(std::string file_path); - static void SetLogLevel(eLogLevel level); - static eLogLevel GetLogLevel(); - static void clear(); - static bool useGUI; -private: - Log(); - ~Log(); - static Log *_sing_log; - eLogLevel _log_level; - ILog *_log; - std::map _logmap; -}; - -#endif //LOGGER_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.cpp deleted file mode 100644 index 7967bb2..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: log_console.cpp - -\* ****************************************************************************** */ - -#include -#include -#include "log_console.h" - -LogConsole::LogConsole() -{ -} - -LogConsole::~LogConsole() -{ -} - -void LogConsole::WriteLog(const std::string &log) -{ - - - std::stringstream str_stream; - str_stream << log; - std::string spase = ""; - for(;;) { - spase = ""; - std::string logstr; - getline(str_stream, logstr); - if(log.find("function:") == std::string::npos && log.find(">>") == std::string::npos) spase = " "; - std::stringstream pre_out; - if(logstr.length() > 2) pre_out << ThreadInfo::GetThreadId() << " " << Timer::GetTimeStamp() << " " << spase << logstr << std::endl; - else pre_out << logstr << "\n"; - std::cout << pre_out.str(); - if(str_stream.eof()) - break; - } - -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.h deleted file mode 100644 index 86d2292..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_console.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef LOG_CONSOLE_H_ -#define LOG_CONSOLE_H_ - -#include "ilog.h" - -class LogConsole : public ILog -{ -public: - LogConsole(); - virtual ~LogConsole(); - virtual void WriteLog(const std::string &log); -}; - -#endif //LOG_CONSOLE_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.cpp deleted file mode 100644 index e6f10fc..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: log_etw_events.cpp - -\* ****************************************************************************** */ - -#if defined(_WIN32) || defined(_WIN64) - -#include "log_etw_events.h" - -LogEtwEvents::LogEtwEvents() -{ -} - -LogEtwEvents::~LogEtwEvents() -{ -} - -void LogEtwEvents::WriteLog(const std::string &log) -{ - log; -} - -#endif // #if defined(_WIN32) || defined(_WIN64) diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.h deleted file mode 100644 index 50a1a60..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_etw_events.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef LOG_ETW_EVENTS_H_ -#define LOG_ETW_EVENTS_H_ - -#if defined(_WIN32) || defined(_WIN64) - -#include "ilog.h" - -class LogEtwEvents : public ILog -{ -public: - LogEtwEvents(); - virtual ~LogEtwEvents(); - virtual void WriteLog(const std::string &log); -}; - -#endif // #if defined(_WIN32) || defined(_WIN64) - -#endif // LOG_ETW_EVENTS_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.cpp deleted file mode 100644 index a0351bf..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: log_file.cpp - -\* ****************************************************************************** */ - -#include "log_file.h" -#include "../config/config.h" -#include "../dumps/dump.h" - -std::mutex LogFile::_file_write; - -LogFile::LogFile() -{ - std::string strproc_id = ToString(ThreadInfo::GetProcessId()); - std::string file_log = Config::GetParam("core", "log"); - if(!file_log.empty()) - _file_path = std::string(file_log); - else - _file_path = std::string("mfxtracer.log"); - - if (!Log::useGUI) - { - strproc_id = std::string("_") + strproc_id; - size_t pos = _file_path.rfind("."); - if (pos == std::string::npos) - _file_path.insert(_file_path.length(), strproc_id); - else if((_file_path.length() - pos) > std::string(".log").length()) - _file_path.insert(_file_path.length(), strproc_id); - else - _file_path.insert(pos, strproc_id); - } -} - -LogFile::~LogFile() -{ - if(_file.is_open()) - _file.close(); -} - -void LogFile::WriteLog(const std::string &log) -{ - std::unique_lock write_mutex(_file_write); - if(!_file.is_open()) - _file.open(_file_path.c_str(), std::ios_base::app); - - std::stringstream str_stream; - str_stream << log; - std::string spase = ""; - for(;;) { - spase = ""; - std::string logstr; - getline(str_stream, logstr); - if(log.find("function:") == std::string::npos && log.find(">>") == std::string::npos) spase = " "; - std::stringstream pre_out; - if(logstr.length() > 2) pre_out << ThreadInfo::GetThreadId() << " " << Timer::GetTimeStamp() << " " << spase << logstr << std::endl; - else pre_out << logstr << "\n"; - _file << pre_out.str(); - if(str_stream.eof()) - break; - } - _file.flush(); - - write_mutex.unlock(); -} - -void LogFile::SetFilePath(std::string file_path) -{ - if(_file.is_open()) - _file.close(); - - _file_path = file_path; -} diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.h deleted file mode 100644 index 001f524..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_file.h +++ /dev/null @@ -1,52 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: log_file.h - -\* ****************************************************************************** */ - -#ifndef LOG_FILE_H_ -#define LOG_FILE_H_ - -#include "ilog.h" -#include "log.h" -#include -#include - -class LogFile : public ILog -{ -public: - LogFile(); - virtual ~LogFile(); - virtual void WriteLog(const std::string &log); - void SetFilePath(std::string file_path); -private: - std::string _file_path; - std::ofstream _file; - static std::mutex _file_write; -}; - -#endif //LOG_FILE_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.cpp b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.cpp deleted file mode 100644 index 783c5b1..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#if !defined(_WIN32) && !defined(_WIN64) - -#include "log_syslog.h" - -LogSyslog::LogSyslog() -{ -} - - -LogSyslog::~LogSyslog() -{ -} - -void LogSyslog::WriteLog(const std::string &log) -{ - -} - -#endif // #if !defined(_WIN32) && !defined(_WIN64) diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.h deleted file mode 100644 index d8facae..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/log_syslog.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef LOG_SYSLOG_H_ -#define LOG_SYSLOG_H_ - -#if !defined(_WIN32) && !defined(_WIN64) - -#include "ilog.h" - -class LogSyslog : public ILog -{ -public: - LogSyslog(); - virtual ~LogSyslog(); - virtual void WriteLog(const std::string &log); -}; - -#endif // #if !defined(_WIN32) && !defined(_WIN64) -#endif // LOGSYSLOG_H_ diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/thread_info.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/thread_info.h deleted file mode 100644 index 29c3d11..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/thread_info.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2020 Intel Corporation -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -#ifndef THREAD_INFO_H_ -#define THREAD_INFO_H_ - -#if defined(_WIN32) || defined(_WIN64) -#include -#else -#include -#include -#endif - -class ThreadInfo -{ -public: - static long GetThreadId() - { - #if defined(_WIN32) || defined(_WIN64) - return (long)GetCurrentThreadId(); - #else - return (long)syscall(SYS_gettid); - #endif - }; - - static long GetProcessId() - { - #if defined(_WIN32) || defined(_WIN64) - return (long)GetCurrentProcessId(); - #else - return (long)getpid(); - #endif - } -}; - -#endif //THREAD_INFO_H_ \ No newline at end of file diff --git a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/timer.h b/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/timer.h deleted file mode 100644 index ecb2022..0000000 --- a/apk/v3.13/main/intel-media-sdk/src/MediaSDK-intel-mediasdk-21.1.3/tools/tracer/loggers/timer.h +++ /dev/null @@ -1,105 +0,0 @@ -/* ****************************************************************************** *\ - -Copyright (C) 2012-2020 Intel Corporation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -- Neither the name of Intel Corporation nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -File Name: timer.h - -\* ****************************************************************************** */ - -#ifndef TIMER_H__ -#define TIMER_H__ - -#include -#include "../dumps/dump.h" - -#if defined(_WIN32) || defined(_WIN64) -#include -#else -#include -#include -#endif - -using namespace std; - -class Timer -{ -protected: -#if defined(_WIN32) || defined(_WIN64) - LARGE_INTEGER start; -#else - struct timeval start; -#endif - -public: - Timer() - { - Restart(); - } - - static string GetTimeStamp(){ - string timestamp = "