├── .clang-format ├── .github └── workflows │ ├── build.yml │ └── release_packages.yml ├── .gitignore ├── CMakeLists.txt ├── COPYING ├── README.md ├── app ├── CMakeLists.txt ├── xeve_app.c ├── xeve_app_args.h └── xeve_app_util.h ├── cmake_uninstall.cmake.in ├── doc └── image │ ├── tos_evc_bp_vs_avc_1350kbps.jpg │ └── tos_evc_mp_vs_hevc_900kbps.jpg ├── inc └── xeve.h ├── pkgconfig ├── xeve.pc.in └── xeveb.pc.in ├── src_base ├── CMakeLists.txt ├── avx │ ├── xeve_itdq_avx.c │ ├── xeve_itdq_avx.h │ ├── xeve_mc_avx.c │ ├── xeve_mc_avx.h │ ├── xeve_sad_avx.c │ ├── xeve_sad_avx.h │ ├── xeve_tq_avx.c │ └── xeve_tq_avx.h ├── neon │ ├── sse2neon.h │ ├── xeve_itdq_neon.c │ ├── xeve_itdq_neon.h │ ├── xeve_mc_neon.c │ ├── xeve_mc_neon.h │ ├── xeve_sad_neon.c │ ├── xeve_sad_neon.h │ ├── xeve_tq_neon.c │ └── xeve_tq_neon.h ├── sse │ ├── xeve_itdq_sse.c │ ├── xeve_itdq_sse.h │ ├── xeve_mc_sse.c │ ├── xeve_mc_sse.h │ ├── xeve_sad_sse.c │ └── xeve_sad_sse.h ├── xeve.c ├── xeve_bsw.c ├── xeve_bsw.h ├── xeve_def.h ├── xeve_df.c ├── xeve_df.h ├── xeve_eco.c ├── xeve_eco.h ├── xeve_enc.c ├── xeve_enc.h ├── xeve_fcst.c ├── xeve_fcst.h ├── xeve_ipred.c ├── xeve_ipred.h ├── xeve_itdq.c ├── xeve_itdq.h ├── xeve_mc.c ├── xeve_mc.h ├── xeve_mode.c ├── xeve_mode.h ├── xeve_param_parse.c ├── xeve_param_parse.h ├── xeve_picman.c ├── xeve_picman.h ├── xeve_pinter.c ├── xeve_pintra.c ├── xeve_port.c ├── xeve_port.h ├── xeve_pred.h ├── xeve_rc.c ├── xeve_rc.h ├── xeve_recon.c ├── xeve_recon.h ├── xeve_sad.c ├── xeve_sad.h ├── xeve_tbl.c ├── xeve_tbl.h ├── xeve_thread_pool.c ├── xeve_thread_pool.h ├── xeve_tq.c ├── xeve_tq.h ├── xeve_type.h ├── xeve_util.c └── xeve_util.h └── src_main ├── CMakeLists.txt ├── avx ├── xevem_itdq_avx.c ├── xevem_itdq_avx.h ├── xevem_tq_avx.c └── xevem_tq_avx.h ├── sse ├── xevem_itdq_sse.c ├── xevem_itdq_sse.h ├── xevem_mc_sse.c └── xevem_mc_sse.h ├── xevem.c ├── xevem_alf.c ├── xevem_alf.h ├── xevem_df.c ├── xevem_df.h ├── xevem_dra.c ├── xevem_dra.h ├── xevem_eco.c ├── xevem_eco.h ├── xevem_ibc_hash.c ├── xevem_ibc_hash.h ├── xevem_ipred.c ├── xevem_ipred.h ├── xevem_itdq.c ├── xevem_itdq.h ├── xevem_mc.c ├── xevem_mc.h ├── xevem_mode.c ├── xevem_mode.h ├── xevem_pibc.c ├── xevem_picman.c ├── xevem_picman.h ├── xevem_pinter.c ├── xevem_pintra.c ├── xevem_pred.h ├── xevem_recon.c ├── xevem_recon.h ├── xevem_stat.c ├── xevem_stat.h ├── xevem_tbl.c ├── xevem_tbl.h ├── xevem_tq.c ├── xevem_tq.h ├── xevem_type.h ├── xevem_util.c └── xevem_util.h /.clang-format: -------------------------------------------------------------------------------- 1 | # .clang-format 2 | 3 | # Recommended clang-format version: 19 or higher. 4 | # Please note that alignment settings may not be supported in versions below 19. 5 | 6 | # Base style to use 7 | BasedOnStyle: Google 8 | 9 | # Indentation settings 10 | IndentWidth: 4 11 | UseTab: Never 12 | 13 | # Language: 14 | Language: Cpp 15 | 16 | # Alignment settings 17 | AlignConsecutiveDeclarations: 18 | Enabled: true 19 | AcrossEmptyLines: true 20 | AcrossComments: true 21 | 22 | AlignConsecutiveAssignments: 23 | Enabled: true 24 | AcrossEmptyLines: true 25 | AcrossComments: true 26 | 27 | AlignConsecutiveMacros: 28 | Enabled: true 29 | AcrossEmptyLines: true 30 | AcrossComments: true 31 | 32 | AlignTrailingComments: true 33 | 34 | # Break settings 35 | BreakBeforeBraces: Custom 36 | BraceWrapping: 37 | AfterFunction: true 38 | BeforeElse: true 39 | AfterExternBlock: true 40 | 41 | AllowShortFunctionsOnASingleLine: Inline 42 | AllowShortIfStatementsOnASingleLine: false 43 | AllowShortLoopsOnASingleLine: false 44 | 45 | # Comment settings 46 | CommentPragmas: Preserve 47 | SortIncludes: false 48 | 49 | # Case blocks 50 | IndentCaseBlocks: true 51 | 52 | # Space settings 53 | SpaceBeforeParens: Custom 54 | SpaceBeforeParensOptions: 55 | AfterControlStatements: false 56 | 57 | # Other settings 58 | ColumnLimit: 120 59 | 60 | # Put each one of the function paremeters on its own line. 61 | BinPackParameters: false 62 | AllowAllParametersOfDeclarationOnNextLine: false 63 | 64 | # Function call’s arguments will have one line each. 65 | BinPackArguments: false 66 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | jobs: 14 | build-baseline-linux: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: install dependencies 22 | run: | 23 | sudo apt-get update -qq && sudo apt-get -y install \ 24 | cmake 25 | 26 | - name: Build xeve baseline 27 | run: | 28 | mkdir build 29 | cd build 30 | cmake .. -DSET_PROF=BASE 31 | make 32 | 33 | - name: 'Upload executable Artifact' 34 | uses: actions/upload-artifact@v4 35 | with: 36 | name: xeveb_app-linux 37 | path: build/bin/xeveb_app 38 | retention-days: 5 39 | 40 | - name: 'Upload library Artifact' 41 | uses: actions/upload-artifact@v4 42 | with: 43 | name: libxeveb-linux 44 | path: build/lib/ 45 | retention-days: 5 46 | 47 | build-main-linux: 48 | runs-on: ubuntu-latest 49 | steps: 50 | - uses: actions/checkout@v4 51 | with: 52 | fetch-depth: 0 53 | 54 | - name: install dependencies 55 | run: | 56 | sudo apt-get update -qq && sudo apt-get -y install \ 57 | cmake 58 | 59 | - name: Build xeve main 60 | run: | 61 | mkdir build 62 | cd build 63 | cmake .. 64 | make 65 | 66 | - name: 'Upload executable Artifact' 67 | uses: actions/upload-artifact@v4 68 | with: 69 | name: xeve_app-linux 70 | path: build/bin/xeve_app 71 | retention-days: 5 72 | 73 | - name: 'Upload library Artifact' 74 | uses: actions/upload-artifact@v4 75 | with: 76 | name: libxeve-linux 77 | path: build/lib/ 78 | retention-days: 5 79 | 80 | build-baseline-windows: 81 | runs-on: windows-latest 82 | steps: 83 | - uses: actions/checkout@v4 84 | with: 85 | fetch-depth: 0 86 | 87 | - name: Build xeve baseline 88 | run: | 89 | mkdir build 90 | cd build 91 | cmake .. -G "MinGW Makefiles" -DSET_PROF=BASE 92 | make 93 | 94 | - name: 'Upload executable Artifact' 95 | uses: actions/upload-artifact@v4 96 | with: 97 | name: xeveb_app-windows 98 | path: build/bin/xeveb_app.exe 99 | retention-days: 5 100 | 101 | - name: 'Upload library Artifacts' 102 | uses: actions/upload-artifact@v4 103 | with: 104 | name: libxeveb-windows 105 | path: build/src_base/libxeveb.* 106 | retention-days: 5 107 | 108 | build-main-windows: 109 | runs-on: windows-latest 110 | steps: 111 | - uses: actions/checkout@v4 112 | with: 113 | fetch-depth: 0 114 | 115 | - name: Build xeve main 116 | run: | 117 | mkdir build 118 | cd build 119 | cmake .. -G "MinGW Makefiles" 120 | make 121 | 122 | - name: 'Upload executable Artifact' 123 | uses: actions/upload-artifact@v4 124 | with: 125 | name: xeve_app-windows 126 | path: build/bin/xeve_app.exe 127 | retention-days: 5 128 | 129 | - name: 'Upload library Artifacts' 130 | uses: actions/upload-artifact@v4 131 | with: 132 | name: libxeve-windows 133 | path: build/src_main/libxeve.* 134 | retention-days: 5 135 | 136 | build-baseline-arm: 137 | runs-on: ubuntu-latest 138 | steps: 139 | - uses: actions/checkout@v4 140 | with: 141 | fetch-depth: 0 142 | 143 | - name: install dependencies 144 | run: | 145 | sudo apt-get update -qq && sudo apt-get -y install \ 146 | cmake gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu 147 | 148 | - name: Build xeve baseline 149 | run: | 150 | mkdir build 151 | cd build 152 | cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DSET_PROF=BASE -DARM=TRUE 153 | make 154 | 155 | - name: 'Upload executable Artifact' 156 | uses: actions/upload-artifact@v4 157 | with: 158 | name: xeveb_app-arm 159 | path: build/bin/xeveb_app 160 | retention-days: 5 161 | 162 | - name: 'Upload library Artifact' 163 | uses: actions/upload-artifact@v4 164 | with: 165 | name: libxeveb-arm 166 | path: build/lib/ 167 | retention-days: 5 168 | 169 | build-main-arm: 170 | runs-on: ubuntu-latest 171 | steps: 172 | - uses: actions/checkout@v4 173 | with: 174 | fetch-depth: 0 175 | 176 | - name: install dependencies 177 | run: | 178 | sudo apt-get update -qq && sudo apt-get -y install \ 179 | cmake gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu 180 | 181 | - name: Build xeve main 182 | run: | 183 | mkdir build 184 | cd build 185 | cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DARM=TRUE 186 | make 187 | 188 | - name: 'Upload executable Artifact' 189 | uses: actions/upload-artifact@v4 190 | with: 191 | name: xeve_app-arm 192 | path: build/bin/xeve_app 193 | retention-days: 5 194 | 195 | - name: 'Upload library Artifact' 196 | uses: actions/upload-artifact@v4 197 | with: 198 | name: libxeve-arm 199 | path: build/lib/ 200 | retention-days: 5 201 | -------------------------------------------------------------------------------- /.github/workflows/release_packages.yml: -------------------------------------------------------------------------------- 1 | name: Release packages 2 | on: 3 | release: 4 | types: [published] 5 | 6 | # Allows you to run this workflow manually from the Actions tab 7 | workflow_dispatch: 8 | 9 | jobs: 10 | # Matrix job - Create packages and attach them to latest release assets. 11 | make-package: 12 | strategy: 13 | matrix: 14 | os: [ubuntu-latest, windows-latest] 15 | profile: [BASE, MAIN] 16 | build: [PC, ARM] 17 | exclude: 18 | - os: windows-latest 19 | build: ARM 20 | 21 | runs-on: ${{matrix.os}} 22 | steps: 23 | - uses: actions/checkout@v4 24 | with: 25 | fetch-depth: 0 26 | 27 | - name: Install dependencies (Linux) 28 | if: ${{matrix.os == 'ubuntu-latest' && matrix.build == 'PC'}} 29 | run: | 30 | sudo apt-get update -qq && sudo apt-get -y install \ 31 | cmake 32 | 33 | - name: Install dependencies (ARM) 34 | if: ${{matrix.os == 'ubuntu-latest' && matrix.build == 'ARM'}} 35 | run: | 36 | sudo apt-get update -qq && sudo apt-get -y install \ 37 | cmake gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu 38 | 39 | - name: Build Linux versions of xeve, generate packages and md5 40 | if: ${{matrix.os == 'ubuntu-latest' && matrix.build == 'PC'}} 41 | run: | 42 | mkdir build 43 | cd build 44 | cmake .. -DSET_PROF=${{matrix.profile}} -DBUILD_TYPE=Release 45 | make 46 | make package 47 | 48 | - name: Build Windows versions of xeve, generate packages and md5 49 | if: ${{matrix.os == 'windows-latest' && matrix.build == 'PC'}} 50 | run: | 51 | mkdir build 52 | cd build 53 | cmake .. -G "MinGW Makefiles" -DSET_PROF=${{matrix.profile}} -DBUILD_TYPE=Release 54 | make 55 | make package 56 | 57 | - name: Build ARM versions of xeve, generate packages and md5 58 | if: ${{matrix.os == 'ubuntu-latest' && matrix.build == 'ARM'}} 59 | run: | 60 | mkdir build 61 | cd build 62 | cmake .. -DSET_PROF=${{matrix.profile}} -DBUILD_TYPE=Release -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DARM=TRUE 63 | make 64 | make package 65 | 66 | - name: 'Upload Linux artifacts' 67 | if: ${{matrix.os == 'ubuntu-latest' && matrix.build == 'PC'}} 68 | uses: actions/upload-artifact@v4 69 | with: 70 | name: xeve-${{matrix.profile}}-linux-packages-${{github.event.release.tag_name}} 71 | path: | 72 | ${{ github.workspace }}/build/*.deb 73 | ${{ github.workspace }}/build/*.md5 74 | retention-days: 7 75 | 76 | - name: 'Upload Windows artifacts' 77 | if: ${{matrix.os == 'windows-latest' && matrix.build == 'PC'}} 78 | uses: actions/upload-artifact@v4 79 | with: 80 | name: xeve-${{matrix.profile}}-windows-packages-${{github.event.release.tag_name}} 81 | path: | 82 | ${{ github.workspace }}/build/*.exe 83 | ${{ github.workspace }}/build/*.md5 84 | retention-days: 7 85 | 86 | - name: 'Upload ARM artifacts' 87 | if: ${{matrix.os == 'ubuntu-latest' && matrix.build == 'ARM'}} 88 | uses: actions/upload-artifact@v4 89 | with: 90 | name: xeve-${{matrix.profile}}-arm-packages-${{github.event.release.tag_name}} 91 | path: | 92 | ${{ github.workspace }}/build/*.deb 93 | ${{ github.workspace }}/build/*.md5 94 | retention-days: 7 95 | 96 | - name: Upload assets to GitHub Release 97 | uses: xresloader/upload-to-github-release@v1 98 | env: 99 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 100 | with: 101 | file: "build/*.deb; build/*.exe; build/*.md5" 102 | update_latest_release: true 103 | draft: false 104 | overwrite: true 105 | 106 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | < 'inc' and 'src_base' folders for EVC baseline profile > 3 | ------------------------------------------------------------------------------- 4 | Copyright(c) 2020 Samsung Electronics Co., Ltd. 5 | All Rights Reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | - Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | - Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | - Neither the name of the copyright owner, nor the names of its contributors 18 | may be used to endorse or promote products derived from this software 19 | without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | 33 | ------------------------------------------------------------------------------- 34 | < 'src_main' folder for EVC main profile > 35 | ------------------------------------------------------------------------------- 36 | The copyright in this software is being made available under the BSD 37 | License, included below. This software may be subject to contributor and 38 | other third party rights, including patent rights, and no such rights are 39 | granted under this license. 40 | 41 | Copyright(c) 2020 Samsung Electronics Co., Ltd. 42 | All Rights Reserved. 43 | 44 | Redistribution and use in source and binary forms, with or without 45 | modification, are permitted provided that the following conditions are met: 46 | 47 | - Redistributions of source code must retain the above copyright notice, 48 | this list of conditions and the following disclaimer. 49 | 50 | - Redistributions in binary form must reproduce the above copyright notice, 51 | this list of conditions and the following disclaimer in the documentation 52 | and/or other materials provided with the distribution. 53 | 54 | - Neither the name of the copyright owner, nor the names of its contributors 55 | may be used to endorse or promote products derived from this software 56 | without specific prior written permission. 57 | 58 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 59 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 61 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 62 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 63 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 64 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 65 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 66 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 67 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 68 | POSSIBILITY OF SUCH DAMAGE. 69 | 70 | 71 | ------------------------------------------------------------------------------- 72 | This software is based on the official ISO/IEC essential video coding (EVC) 73 | reference software. The software is licensed as follows: 74 | ------------------------------------------------------------------------------- 75 | 76 | The copyright in this software is being made available under the BSD 77 | License, included below. This software may be subject to other third party 78 | and contributor rights, including patent rights, and no such rights are 79 | granted under this license. 80 | 81 | Copyright (c) 2019-2020, ISO/IEC 82 | All rights reserved. 83 | 84 | Redistribution and use in source and binary forms, with or without 85 | modification, are permitted provided that the following conditions are met: 86 | 87 | * Redistributions of source code must retain the above copyright notice, 88 | this list of conditions and the following disclaimer. 89 | * Redistributions in binary form must reproduce the above copyright notice, 90 | this list of conditions and the following disclaimer in the documentation 91 | and/or other materials provided with the distribution. 92 | * Neither the name of the ISO/IEC nor the names of its contributors may 93 | be used to endorse or promote products derived from this software without 94 | specific prior written permission. 95 | 96 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 97 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 98 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 99 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 100 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 101 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 102 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 103 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 104 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 105 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 106 | THE POSSIBILITY OF SUCH DAMAGE. 107 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories (${PROJECT_SOURCE_DIR}/app) 2 | include_directories (${CMAKE_BINARY_DIR}) 3 | set( EXE_NAME xeve_app ) 4 | set( EXE_NAME_BASE xeveb_app) 5 | 6 | file (GLOB ENC_SRC "*.c" ) 7 | file (GLOB ENC_INC "*.h" ) 8 | 9 | if(("${SET_PROF}" STREQUAL "MAIN")) 10 | add_executable (${EXE_NAME} ${ENC_SRC} ${ENC_INC} ) 11 | include_directories( ${EXE_NAME} PUBLIC . .. ../inc ../src_base ../src_main ${BASE_SRC_PATH}) 12 | 13 | # Comment the following line for dynamic linking 14 | target_link_libraries (${EXE_NAME} xeve) 15 | 16 | # Uncomment the following line for dynamic linking 17 | # target_link_libraries (${EXE_NAME} xeve_dynamic) 18 | 19 | set_property(TARGET ${EXE_NAME} PROPERTY FOLDER "app") 20 | set_target_properties(${EXE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 21 | 22 | if( MSVC ) 23 | target_compile_definitions( ${EXE_NAME} PUBLIC _CRT_SECURE_NO_WARNINGS ANY ) 24 | elseif( UNIX OR MINGW ) 25 | target_compile_definitions( ${EXE_NAME} PUBLIC LINUX ANY ) 26 | target_link_libraries (${EXE_NAME} m) 27 | endif() 28 | 29 | # Install rules 30 | # 31 | # Install executable to /bin 32 | include( GNUInstallDirs) 33 | install( TARGETS ${EXE_NAME} RUNTIME COMPONENT Runtime DESTINATION ${CMAKE_INSTALL_BINDIR}) 34 | 35 | endif() 36 | 37 | if(("${SET_PROF}" STREQUAL "BASE")) 38 | add_executable (${EXE_NAME_BASE} ${ENC_SRC} ${ENC_INC} ) 39 | include_directories( ${EXE_NAME_BASE} PUBLIC . .. ../inc ../src_base ../src_main ${BASE_SRC_PATH}) 40 | 41 | # Comment the following line for dynamic linking 42 | target_link_libraries (${EXE_NAME_BASE} xeveb) 43 | 44 | # Uncomment the following line for dynamic linking 45 | # target_link_libraries (${EXE_NAME_BASE} xeveb_dynamic) 46 | 47 | set_property(TARGET ${EXE_NAME_BASE} PROPERTY FOLDER "app") 48 | set_target_properties(${EXE_NAME_BASE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 49 | 50 | if( MSVC ) 51 | target_compile_definitions( ${EXE_NAME_BASE} PUBLIC _CRT_SECURE_NO_WARNINGS ANY ) 52 | elseif( UNIX OR MINGW ) 53 | target_compile_definitions( ${EXE_NAME_BASE} PUBLIC LINUX ANY ) 54 | target_link_libraries (${EXE_NAME_BASE} m) 55 | endif() 56 | 57 | # Install rules 58 | # 59 | # Install executable to /bin 60 | include( GNUInstallDirs) 61 | install( TARGETS ${EXE_NAME_BASE} RUNTIME COMPONENT Runtime DESTINATION ${CMAKE_INSTALL_BINDIR}) 62 | 63 | endif() 64 | 65 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") 3 | endif() 4 | 5 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif() 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif() 21 | endforeach() 22 | -------------------------------------------------------------------------------- /doc/image/tos_evc_bp_vs_avc_1350kbps.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpeg5/xeve/7b214663da0140f7ee66adefa6357c45070c818c/doc/image/tos_evc_bp_vs_avc_1350kbps.jpg -------------------------------------------------------------------------------- /doc/image/tos_evc_mp_vs_hevc_900kbps.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mpeg5/xeve/7b214663da0140f7ee66adefa6357c45070c818c/doc/image/tos_evc_mp_vs_hevc_900kbps.jpg -------------------------------------------------------------------------------- /pkgconfig/xeve.pc.in: -------------------------------------------------------------------------------- 1 | # --- xeve.pc.in file --- 2 | prefix=@CMAKE_INSTALL_PREFIX@ 3 | exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@/@LIB_NAME@ 6 | 7 | Name: xeve 8 | Description: eXtra-fast Essential Video Encoder (XEVE) (MAIN profile) 9 | 10 | Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ 11 | 12 | Requires: 13 | Libs: -L${libdir} -lxeve 14 | Libs.private: -lm 15 | 16 | Cflags: -I${includedir} 17 | -------------------------------------------------------------------------------- /pkgconfig/xeveb.pc.in: -------------------------------------------------------------------------------- 1 | # --- xeveb.pc.in file --- 2 | prefix=@CMAKE_INSTALL_PREFIX@ 3 | exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@/@LIB_NAME_BASE@ 6 | 7 | Name: xeveb 8 | Description: eXtra-fast Essential Video Encoder (XEVE) (BASE profile) 9 | 10 | Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ 11 | 12 | Requires: 13 | Libs: -L${libdir} -lxeveb 14 | Libs.private: -lm 15 | 16 | Cflags: -I${includedir} 17 | -------------------------------------------------------------------------------- /src_base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For shared libraries VERSION and SOVERSION can be used to specify the build version and API version respectively 2 | # see https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html 3 | # 4 | set( LIB_SOVERSION ${VERSION_MAJOR}) 5 | 6 | file (GLOB XEVE_INC "../inc/*.h") 7 | file (GLOB LIB_API_SRC "./xeve.c") 8 | file (GLOB LIB_BASE_SRC "./xeve_*.c") 9 | file (GLOB LIB_BASE_INC "./xeve_*.h" ) 10 | file (GLOB LIB_SSE_SRC "./sse/xeve_*.c") 11 | file (GLOB LIB_SSE_INC "./sse/xeve_*.h" ) 12 | file (GLOB LIB_AVX_SRC "./avx/xeve_*.c") 13 | file (GLOB LIB_AVX_INC "./avx/xeve_*.h" ) 14 | file (GLOB LIB_NEON_SRC "./neon/xeve_*.c") 15 | file (GLOB LIB_NEON_INC "./neon/xeve_*.h" ) 16 | 17 | include(GenerateExportHeader) 18 | include_directories("${CMAKE_BINARY_DIR}") 19 | 20 | 21 | if("${ARM}" STREQUAL "TRUE") 22 | add_library( ${LIB_NAME_BASE} STATIC ${LIB_API_SRC} ${XEVE_INC} ${LIB_BASE_SRC} ${LIB_BASE_INC} ${LIB_NEON_INC} ${LIB_NEON_SRC}) 23 | add_library( ${LIB_NAME_BASE}_dynamic SHARED ${LIB_API_SRC} ${XEVE_INC} ${LIB_BASE_SRC} ${LIB_BASE_INC} ${LIB_NEON_INC} ${LIB_NEON_SRC}) 24 | else() 25 | add_library( ${LIB_NAME_BASE} STATIC ${LIB_API_SRC} ${XEVE_INC} ${LIB_BASE_SRC} ${LIB_BASE_INC} ${LIB_SSE_SRC} ${LIB_SSE_INC} 26 | ${LIB_AVX_SRC} ${LIB_AVX_INC} ) 27 | add_library( ${LIB_NAME_BASE}_dynamic SHARED ${LIB_API_SRC} ${XEVE_INC} ${LIB_BASE_SRC} ${LIB_BASE_INC} ${LIB_SSE_SRC} ${LIB_SSE_INC} 28 | ${LIB_AVX_SRC} ${LIB_AVX_INC} ) 29 | endif() 30 | 31 | set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} SOVERSION ${LIB_SOVERSION}) 32 | 33 | # @todo Consider using WINDOWS_EXPORT_ALL_SYMBOLS instead of generate_export_header 34 | # @see https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html#prop_tgt:WINDOWS_EXPORT_ALL_SYMBOLS 35 | #if(MSVC) 36 | # # @see https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/ 37 | # # @see https://cmake.org/cmake/help/v3.3/module/GenerateExportHeader.html 38 | # # 39 | # set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) 40 | # set(BUILD_SHARED_LIBS TRUE) 41 | #endif() 42 | 43 | # Generate export macros for libraries 44 | generate_export_header(${LIB_NAME_BASE} 45 | BASE_NAME XEVE 46 | EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/xeve_exports.h) 47 | 48 | # This will cause the export macros to expand to nothing when building the static library. 49 | set_target_properties(${LIB_NAME_BASE} PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) 50 | 51 | source_group("base\\header" FILES ${LIB_BASE_INC} ${XEVE_INC}) 52 | source_group("base\\source" FILES ${LIB_BASE_SRC} ${LIB_API_SRC}) 53 | source_group("base\\sse\\header" FILES ${LIB_SSE_INC}) 54 | source_group("base\\sse\\source" FILES ${LIB_SSE_SRC}) 55 | source_group("base\\avx\\header" FILES ${LIB_AVX_INC}) 56 | source_group("base\\avx\\source" FILES ${LIB_AVX_SRC}) 57 | source_group("base\\neon\\header" FILES ${LIB_NEON_INC}) 58 | source_group("base\\neon\\source" FILES ${LIB_NEON_SRC}) 59 | 60 | if("${ARM}" STREQUAL "TRUE") 61 | include_directories( ${LIB_NAME_BASE} PUBLIC . .. ../inc ./neon) 62 | else() 63 | include_directories( ${LIB_NAME_BASE} PUBLIC . .. ../inc ./sse ./avx) 64 | endif() 65 | 66 | set( SSE ${BASE_INC_FILES} ${LIB_SSE_SRC}) 67 | set( AVX ${LIB_AVX_SRC} ) 68 | set( NEON ${LIB_NEON_SRC}) 69 | 70 | set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES OUTPUT_NAME ${LIB_NAME_BASE}) 71 | 72 | if( MSVC ) 73 | target_compile_definitions( ${LIB_NAME_BASE} PUBLIC ANY _CRT_SECURE_NO_WARNINGS ) 74 | target_compile_definitions( ${LIB_NAME_BASE}_dynamic PUBLIC ANY _CRT_SECURE_NO_WARNINGS ) 75 | 76 | # Since both the import library associated with DLL and the static library have the same names 77 | # they must be build in different locations to avoid overwriting. 78 | # 79 | set_target_properties(${LIB_NAME_BASE} PROPERTIES FOLDER lib 80 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/static/lib) 81 | 82 | set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES FOLDER lib 83 | ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/import/lib) 84 | 85 | elseif( UNIX OR MINGW ) 86 | if("${ARM}" STREQUAL "FALSE") 87 | set_property( SOURCE ${SSE} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) 88 | set_property( SOURCE ${AVX} APPEND PROPERTY COMPILE_FLAGS " -mavx2" ) 89 | endif() 90 | set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES FOLDER lib 91 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 92 | target_compile_definitions( ${LIB_NAME_BASE} PUBLIC ANY LINUX ) 93 | target_link_libraries(${LIB_NAME_BASE} m) 94 | endif() 95 | 96 | # Install rules 97 | # 98 | # Set DCMAKE_INSTALL_PREFIX to change default install prefix 99 | # e.g cmake .. -DSET_PROF=BASE -DCMAKE_INSTALL_PREFIX='C:\Users\name\git\xeve_internal\build-windows\install' 100 | 101 | # List the headers we want to declare as public for installation. 102 | set(XEVE_PUBLIC_HEADERS "${XEVE_INC}") 103 | set_target_properties(${LIB_NAME_BASE} PROPERTIES PUBLIC_HEADER "${XEVE_PUBLIC_HEADERS}") 104 | set_target_properties(${LIB_NAME_BASE}_dynamic PROPERTIES PUBLIC_HEADER "${XEVE_PUBLIC_HEADERS}") 105 | 106 | set(XEVE_PRIVATE_HEADERS "${LIB_BASE_INC}" "${LIB_SSE_INC}" "${LIB_AVX_INC}" "${LIB_NEON_INC}") 107 | 108 | # Install static library and public headers 109 | # 110 | # Static library (libxeveb.a or xeveb.lib) will be installed to /lib/xeveb 111 | # Public headers will be installed to /include/xeveb 112 | # 113 | include(GNUInstallDirs) 114 | install(TARGETS ${LIB_NAME_BASE} 115 | ARCHIVE COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}/${LIB_NAME_BASE} 116 | PUBLIC_HEADER COMPONENT Development DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_NAME_BASE} 117 | ) 118 | 119 | # Install shared library 120 | # 121 | # On non-DLL platforms shared library (libxeveb.so) will be installed to /lib/xeveb. 122 | # On DLL platforms the shred DLL (xeveb.dll) will be installed to /bin and its import library will be installed to /lib/xeveb/import 123 | # 124 | install(TARGETS ${LIB_NAME_BASE}_dynamic 125 | RUNTIME COMPONENT Libraries DESTINATION ${CMAKE_INSTALL_BINDIR} 126 | LIBRARY 127 | COMPONENT Libraries DESTINATION ${CMAKE_INSTALL_LIBDIR} 128 | NAMELINK_COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR} 129 | ARCHIVE COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR} 130 | PUBLIC_HEADER COMPONENT Development DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_NAME_BASE} 131 | ) 132 | 133 | install( FILES 134 | ${PROJECT_BINARY_DIR}/xeve_exports.h COMPONENT Development DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_NAME_BASE} 135 | ) 136 | 137 | configure_file( 138 | "${CMAKE_SOURCE_DIR}/pkgconfig/${LIB_NAME_BASE}.pc.in" 139 | "${CMAKE_BINARY_DIR}/${LIB_NAME_BASE}.pc" 140 | IMMEDIATE @ONLY) 141 | 142 | install( FILES 143 | "${CMAKE_BINARY_DIR}/${LIB_NAME_BASE}.pc" COMPONENT Development DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig 144 | ) 145 | -------------------------------------------------------------------------------- /src_base/avx/xeve_itdq_avx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_ITDQ_AVX_H_ 32 | #define _XEVE_ITDQ_AVX_H_ 33 | 34 | #if X86_SSE 35 | extern const XEVE_ITXB xeve_tbl_itxb_avx[MAX_TR_LOG2]; 36 | #endif /* X86_SSE */ 37 | 38 | #endif /* _XEVE_ITDQ_AVX_H_ */ 39 | -------------------------------------------------------------------------------- /src_base/avx/xeve_mc_avx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_MC_AVX_H_ 32 | #define _XEVE_MC_AVX_H_ 33 | #include 34 | 35 | #if X86_SSE 36 | #include 37 | 38 | extern const XEVE_MC_L xeve_tbl_mc_l_avx[2][2]; 39 | extern const XEVE_MC_C xeve_tbl_mc_c_avx[2][2]; 40 | #endif /* X86_SSE */ 41 | 42 | #endif /* _XEVE_MC_SSE_H_ */ 43 | -------------------------------------------------------------------------------- /src_base/avx/xeve_sad_avx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_SAD_AVX_H_ 32 | #define _XEVE_SAD_AVX_H_ 33 | 34 | #include "xeve_type.h" 35 | #include 36 | 37 | #if X86_SSE 38 | extern const XEVE_FN_SAD xeve_tbl_sad_16b_avx[8][8]; 39 | #endif /* X86_SSE */ 40 | #endif /* _XEVE_SAD_AVX_H_ */ -------------------------------------------------------------------------------- /src_base/avx/xeve_tq_avx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | // clang-format off 31 | 32 | #ifndef _XEVE_TQ_AVX_H_ 33 | #define _XEVE_TQ_AVX_H_ 34 | 35 | #if X86_SSE 36 | extern const XEVE_TXB xeve_tbl_txb_avx[MAX_TR_LOG2]; 37 | #endif /* X86_SSE */ 38 | 39 | #define CALCU_2x8(c0, c1, d0, d1) \ 40 | v0 = _mm256_madd_epi16(s0, c0); \ 41 | v1 = _mm256_madd_epi16(s1, c0); \ 42 | v2 = _mm256_madd_epi16(s2, c0); \ 43 | v3 = _mm256_madd_epi16(s3, c0); \ 44 | v4 = _mm256_madd_epi16(s0, c1); \ 45 | v5 = _mm256_madd_epi16(s1, c1); \ 46 | v6 = _mm256_madd_epi16(s2, c1); \ 47 | v7 = _mm256_madd_epi16(s3, c1); \ 48 | v0 = _mm256_hadd_epi32(v0, v1); \ 49 | v2 = _mm256_hadd_epi32(v2, v3); \ 50 | v4 = _mm256_hadd_epi32(v4, v5); \ 51 | v6 = _mm256_hadd_epi32(v6, v7); \ 52 | d0 = _mm256_hadd_epi32(v0, v2); \ 53 | d1 = _mm256_hadd_epi32(v4, v6) 54 | 55 | 56 | #define CALCU_2x8_ADD_SHIFT(d0, d1, d2, d3, add, shift)\ 57 | d0 = _mm256_add_epi32(d0, add); \ 58 | d1 = _mm256_add_epi32(d1, add); \ 59 | d2 = _mm256_add_epi32(d2, add); \ 60 | d3 = _mm256_add_epi32(d3, add); \ 61 | d0 = _mm256_srai_epi32(d0, shift); \ 62 | d1 = _mm256_srai_epi32(d1, shift); \ 63 | d2 = _mm256_srai_epi32(d2, shift); \ 64 | d3 = _mm256_srai_epi32(d3, shift); 65 | 66 | 67 | #define CALCU_2x4(c0, c1, c2, c3, d0, d1) \ 68 | v0 = _mm256_madd_epi16(s0, c0); \ 69 | v1 = _mm256_madd_epi16(s1, c0); \ 70 | v2 = _mm256_madd_epi16(s0, c1); \ 71 | v3 = _mm256_madd_epi16(s1, c1); \ 72 | v4 = _mm256_madd_epi16(s0, c2); \ 73 | v5 = _mm256_madd_epi16(s1, c2); \ 74 | v6 = _mm256_madd_epi16(s0, c3); \ 75 | v7 = _mm256_madd_epi16(s1, c3); \ 76 | v0 = _mm256_hadd_epi32(v0, v1); \ 77 | v2 = _mm256_hadd_epi32(v2, v3); \ 78 | v4 = _mm256_hadd_epi32(v4, v5); \ 79 | v6 = _mm256_hadd_epi32(v6, v7); \ 80 | d0 = _mm256_hadd_epi32(v0, v2); \ 81 | d1 = _mm256_hadd_epi32(v4, v6); \ 82 | d0 = _mm256_permute4x64_epi64(d0, 0xd8); \ 83 | d1 = _mm256_permute4x64_epi64(d1, 0xd8) 84 | 85 | #define CALCU_LINE_1x8(coeff0, dst) \ 86 | v0 = _mm256_madd_epi16(s00, coeff0); \ 87 | v1 = _mm256_madd_epi16(s01, coeff0); \ 88 | v2 = _mm256_madd_epi16(s02, coeff0); \ 89 | v3 = _mm256_madd_epi16(s03, coeff0); \ 90 | v4 = _mm256_madd_epi16(s04, coeff0); \ 91 | v5 = _mm256_madd_epi16(s05, coeff0); \ 92 | v6 = _mm256_madd_epi16(s06, coeff0); \ 93 | v7 = _mm256_madd_epi16(s07, coeff0); \ 94 | v0 = _mm256_hadd_epi32(v0, v1); \ 95 | v2 = _mm256_hadd_epi32(v2, v3); \ 96 | v4 = _mm256_hadd_epi32(v4, v5); \ 97 | v6 = _mm256_hadd_epi32(v6, v7); \ 98 | v0 = _mm256_hadd_epi32(v0, v2); \ 99 | v4 = _mm256_hadd_epi32(v4, v6); \ 100 | v1 = _mm256_permute2x128_si256(v0, v4, 0x20); \ 101 | v2 = _mm256_permute2x128_si256(v0, v4, 0x31); \ 102 | dst = _mm256_add_epi32(v1, v2) 103 | 104 | #define CALCU_LINE_1x8_ADD_SHIFT(d0, d1, d2, d3, d4, d5, d6, d7, add, shift) \ 105 | d0 = _mm256_add_epi32(d0, add); \ 106 | d1 = _mm256_add_epi32(d1, add); \ 107 | d2 = _mm256_add_epi32(d2, add); \ 108 | d3 = _mm256_add_epi32(d3, add); \ 109 | d4 = _mm256_add_epi32(d4, add); \ 110 | d5 = _mm256_add_epi32(d5, add); \ 111 | d6 = _mm256_add_epi32(d6, add); \ 112 | d7 = _mm256_add_epi32(d7, add); \ 113 | d0 = _mm256_srai_epi32(d0, shift); \ 114 | d1 = _mm256_srai_epi32(d1, shift); \ 115 | d2 = _mm256_srai_epi32(d2, shift); \ 116 | d3 = _mm256_srai_epi32(d3, shift); \ 117 | d4 = _mm256_srai_epi32(d4, shift); \ 118 | d5 = _mm256_srai_epi32(d5, shift); \ 119 | d6 = _mm256_srai_epi32(d6, shift); \ 120 | d7 = _mm256_srai_epi32(d7, shift) 121 | 122 | #endif /* _XEVE_TQ_AVX_H_ */ 123 | 124 | // clang-format on 125 | -------------------------------------------------------------------------------- /src_base/neon/xeve_itdq_neon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_ITDQ_NEON_H_ 32 | #define _XEVE_ITDQ_NEON_H_ 33 | 34 | #if ARM_NEON 35 | extern const XEVE_ITXB xeve_tbl_itxb_neon[MAX_TR_LOG2]; 36 | void xeve_itx_pb4b_neon (void * src, void * dst, int shift, int line, int step); 37 | void xeve_itx_pb8b_neon (void * src, void * dst, int shift, int line, int step); 38 | void xeve_itx_pb16b_neon(void * src, void * dst, int shift, int line, int step); 39 | void xeve_itx_pb32b_neon(void * src, void * dst, int shift, int line, int step); 40 | void xeve_itx_pb64b_neon(void * src, void * dst, int shift, int line, int step); 41 | #endif /* ARM_NEON */ 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src_base/neon/xeve_mc_neon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_MC_NEON_H_ 32 | #define _XEVE_MC_NEON_H_ 33 | #if ARM_NEON 34 | extern const XEVE_MC_L xeve_tbl_mc_l_neon[2][2]; 35 | extern const XEVE_MC_C xeve_tbl_mc_c_neon[2][2]; 36 | void xeve_average_16b_no_clip_neon(s16 *src, s16 *ref, s16 *dst, int s_src, int s_ref, int s_dst, int wd, int ht); 37 | void xeve_mc_filter_c_4pel_vert_neon(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 38 | , int height, int min_val, int max_val, int offset, int shift, s8 is_last); 39 | void xeve_mc_filter_c_4pel_horz_neon(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff 40 | , int width, int height, int min_val, int max_val, int offset, int shift, s8 is_last); 41 | void xeve_mc_filter_l_8pel_horz_clip_neon(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 42 | , int height, int min_val, int max_val, int offset, int shift); 43 | void xeve_mc_filter_l_8pel_vert_clip_neon(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 44 | , int height, int min_val, int max_val, int offset, int shift); 45 | void xeve_mc_filter_l_8pel_horz_no_clip_neon(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 46 | , int height, int offset, int shift); 47 | #endif /* ARM_NEON */ 48 | 49 | #endif /* _XEVE_MC_NEON_H_ */ 50 | -------------------------------------------------------------------------------- /src_base/neon/xeve_sad_neon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_SAD_NEON_H_ 32 | #define _XEVE_SAD_NEON_H_ 33 | 34 | #include "xeve_port.h" 35 | #include "xeve_sad.h" 36 | 37 | #if ARM_NEON 38 | extern const XEVE_FN_SAD xeve_tbl_sad_16b_neon[8][8]; 39 | extern const XEVE_FN_SSD xeve_tbl_ssd_16b_neon[8][8]; 40 | extern const XEVE_FN_DIFF xeve_tbl_diff_16b_neon[8][8]; 41 | extern const XEVE_FN_SATD xeve_tbl_satd_16b_neon[1]; 42 | 43 | int sad_16b_neon_4x2(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 44 | int sad_16b_neon_4x2n(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 45 | int sad_16b_neon_4x4(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 46 | int sad_16b_neon_8x2n(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 47 | int sad_16b_neon_16nx1n(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 48 | 49 | #endif /* ARM_NEON */ 50 | #endif /* _XEVE_SAD_NEON_H_ */ 51 | -------------------------------------------------------------------------------- /src_base/neon/xeve_tq_neon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_TQ_NEON_H_ 32 | #define _XEVE_TQ_NEON_H_ 33 | 34 | #if ARM_NEON 35 | extern const XEVE_TXB xeve_tbl_txb_neon[MAX_TR_LOG2]; 36 | #endif /* ARM_NEON */ 37 | 38 | #endif /* _XEVE_TQ_NEON_H_ */ 39 | -------------------------------------------------------------------------------- /src_base/sse/xeve_itdq_sse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_ITDQ_SSE_H_ 32 | #define _XEVE_ITDQ_SSE_H_ 33 | 34 | #if X86_SSE 35 | extern const XEVE_ITXB xeve_tbl_itxb_sse[MAX_TR_LOG2]; 36 | void xeve_itx_pb4b_sse (void * src, void * dst, int shift, int line, int step); 37 | void xeve_itx_pb8b_sse (void * src, void * dst, int shift, int line, int step); 38 | void xeve_itx_pb16b_sse(void * src, void * dst, int shift, int line, int step); 39 | void xeve_itx_pb32b_sse(void * src, void * dst, int shift, int line, int step); 40 | void xeve_itx_pb64b_sse(void * src, void * dst, int shift, int line, int step); 41 | #endif /* X86_SSE */ 42 | 43 | #endif /* _XEVD_ITDQ_SSE_H_ */ 44 | -------------------------------------------------------------------------------- /src_base/sse/xeve_mc_sse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_MC_SSE_H_ 32 | #define _XEVE_MC_SSE_H_ 33 | #if X86_SSE 34 | extern const XEVE_MC_L xeve_tbl_mc_l_sse[2][2]; 35 | extern const XEVE_MC_C xeve_tbl_mc_c_sse[2][2]; 36 | void xeve_average_16b_no_clip_sse(s16 *src, s16 *ref, s16 *dst, int s_src, int s_ref, int s_dst, int wd, int ht); 37 | void xeve_mc_filter_c_4pel_vert_sse(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 38 | , int height, int min_val, int max_val, int offset, int shift, s8 is_last); 39 | void xeve_mc_filter_c_4pel_horz_sse(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff 40 | , int width, int height, int min_val, int max_val, int offset, int shift, s8 is_last); 41 | void xeve_mc_filter_l_8pel_horz_clip_sse(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 42 | , int height, int min_val, int max_val, int offset, int shift); 43 | void xeve_mc_filter_l_8pel_vert_clip_sse(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 44 | , int height, int min_val, int max_val, int offset, int shift); 45 | void xeve_mc_filter_l_8pel_horz_no_clip_sse(s16 *ref, int src_stride, s16 *pred, int dst_stride, const s16 *coeff, int width 46 | , int height, int offset, int shift); 47 | #endif /* X86_SSE */ 48 | 49 | #endif /* _XEVE_MC_SSE_H_ */ 50 | -------------------------------------------------------------------------------- /src_base/sse/xeve_sad_sse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_SAD_SSE_H_ 32 | #define _XEVE_SAD_SSE_H_ 33 | 34 | #include "xeve_port.h" 35 | #include "xeve_sad.h" 36 | #if X86_SSE 37 | extern const XEVE_FN_SAD xeve_tbl_sad_16b_sse[8][8]; 38 | extern const XEVE_FN_SSD xeve_tbl_ssd_16b_sse[8][8]; 39 | extern const XEVE_FN_DIFF xeve_tbl_diff_16b_sse[8][8]; 40 | extern const XEVE_FN_SATD xeve_tbl_satd_16b_sse[1]; 41 | 42 | int sad_16b_sse_4x2(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 43 | int sad_16b_sse_4x2n(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 44 | int sad_16b_sse_4x4(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 45 | int sad_16b_sse_8x2n(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 46 | int sad_16b_sse_16nx1n(int w, int h, void * src1, void * src2, int s_src1, int s_src2, int bit_depth); 47 | 48 | #endif /* X86_SSE */ 49 | #endif /* _XEVE_SAD_SSE_H_ */ 50 | -------------------------------------------------------------------------------- /src_base/xeve_bsw.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "xeve_type.h" 32 | 33 | static int xeve_bsw_flush(XEVE_BSW * bs) 34 | { 35 | int bytes = XEVE_BSW_GET_SINK_BYTE(bs); 36 | 37 | while(bytes--) 38 | { 39 | *bs->cur++ = (bs->code >> 24) & 0xFF; 40 | bs->code <<= 8; 41 | } 42 | 43 | bs->leftbits = 32; 44 | 45 | return 0; 46 | } 47 | 48 | void xeve_bsw_init(XEVE_BSW * bs, u8 * buf, int size, XEVE_BSW_FN_FLUSH fn_flush) 49 | { 50 | bs->size = size; 51 | bs->beg = buf; 52 | bs->cur = buf; 53 | bs->end = buf + size - 1; 54 | bs->code = 0; 55 | bs->leftbits = 32; 56 | bs->fn_flush = (fn_flush == NULL ? xeve_bsw_flush : fn_flush); 57 | } 58 | 59 | void xeve_bsw_init_slice(XEVE_BSW * bs, u8 * buf, int size, XEVE_BSW_FN_FLUSH fn_flush) 60 | { 61 | bs->size = size; 62 | bs->cur = buf; 63 | //bs->end = buf + size - 1; 64 | bs->code = 0; 65 | bs->leftbits = 32; 66 | bs->fn_flush = (fn_flush == NULL ? xeve_bsw_flush : fn_flush); 67 | } 68 | 69 | void xeve_bsw_deinit(XEVE_BSW * bs) 70 | { 71 | bs->fn_flush(bs); 72 | } 73 | 74 | #if TRACE_HLS 75 | void xeve_bsw_write_ue_trace(XEVE_BSW * bs, u32 val, char * name) 76 | { 77 | int len_i, len_c, info, nn; 78 | u32 code; 79 | 80 | if (name) 81 | { 82 | XEVE_TRACE_STR(name); 83 | XEVE_TRACE_STR(" "); 84 | XEVE_TRACE_INT(val); 85 | XEVE_TRACE_STR("\n"); 86 | } 87 | 88 | nn = ((val + 1) >> 1); 89 | for (len_i = 0; len_i < 16 && nn != 0; len_i++) 90 | { 91 | nn >>= 1; 92 | } 93 | 94 | info = val + 1 - (1 << len_i); 95 | code = (1 << len_i) | ((info)& ((1 << len_i) - 1)); 96 | 97 | len_c = (len_i << 1) + 1; 98 | 99 | xeve_bsw_write_trace(bs, code, 0, len_c); 100 | } 101 | 102 | int xeve_bsw_write_trace(XEVE_BSW * bs, u32 val, char * name, int len) /* len(1 ~ 32) */ 103 | { 104 | int leftbits; 105 | 106 | xeve_assert(bs); 107 | 108 | if (name) 109 | { 110 | XEVE_TRACE_STR(name); 111 | XEVE_TRACE_STR(" "); 112 | XEVE_TRACE_INT(val); 113 | XEVE_TRACE_STR("\n"); 114 | } 115 | 116 | leftbits = bs->leftbits; 117 | val <<= (32 - len); 118 | bs->code |= (val >> (32 - leftbits)); 119 | 120 | if (len < leftbits) 121 | { 122 | bs->leftbits -= len; 123 | } 124 | else 125 | { 126 | xeve_assert_rv(bs->cur + 4 <= bs->end, -1); 127 | 128 | bs->leftbits = 0; 129 | bs->fn_flush(bs); 130 | bs->code = (leftbits < 32 ? val << leftbits : 0); 131 | bs->leftbits = 32 - (len - leftbits); 132 | } 133 | 134 | return 0; 135 | } 136 | 137 | int xeve_bsw_write1_trace(XEVE_BSW * bs, int val, char * name) 138 | { 139 | xeve_assert(bs); 140 | 141 | if (name) 142 | { 143 | XEVE_TRACE_STR(name); 144 | XEVE_TRACE_STR(" "); 145 | XEVE_TRACE_INT(val); 146 | XEVE_TRACE_STR("\n"); 147 | } 148 | 149 | bs->leftbits--; 150 | bs->code |= ((val & 0x1) << bs->leftbits); 151 | 152 | if (bs->leftbits == 0) 153 | { 154 | xeve_assert_rv(bs->cur <= bs->end, -1); 155 | bs->fn_flush(bs); 156 | 157 | bs->code = 0; 158 | bs->leftbits = 32; 159 | } 160 | 161 | return 0; 162 | } 163 | 164 | void xeve_bsw_write_se_trace(XEVE_BSW * bs, int val, char * name) 165 | { 166 | if (name) 167 | { 168 | XEVE_TRACE_STR(name); 169 | XEVE_TRACE_STR(" "); 170 | XEVE_TRACE_INT(val); 171 | XEVE_TRACE_STR("\n"); 172 | } 173 | 174 | xeve_bsw_write_ue_trace(bs, val <= 0 ? (-val * 2) : (val * 2 - 1), 0); 175 | } 176 | #else 177 | int xeve_bsw_write1(XEVE_BSW * bs, int val) 178 | { 179 | xeve_assert(bs); 180 | 181 | bs->leftbits--; 182 | bs->code |= ((val & 0x1) << bs->leftbits); 183 | 184 | if (bs->leftbits == 0) 185 | { 186 | xeve_assert_rv(bs->cur <= bs->end, -1); 187 | bs->fn_flush(bs); 188 | 189 | bs->code = 0; 190 | bs->leftbits = 32; 191 | } 192 | 193 | return 0; 194 | } 195 | 196 | int xeve_bsw_write(XEVE_BSW * bs, u32 val, int len) /* len(1 ~ 32) */ 197 | { 198 | int leftbits; 199 | 200 | xeve_assert(bs); 201 | xeve_assert(len <= 32); // to avoid shifting by a negative value 202 | 203 | leftbits = bs->leftbits; 204 | val <<= (32 - len); 205 | bs->code |= (val >> (32 - leftbits)); 206 | 207 | if(len < leftbits) 208 | { 209 | bs->leftbits -= len; 210 | } 211 | else 212 | { 213 | xeve_assert_rv(bs->cur + 4 <= bs->end, -1); 214 | 215 | bs->leftbits = 0; 216 | bs->fn_flush(bs); 217 | bs->code = (leftbits < 32 ? val << leftbits : 0); 218 | bs->leftbits = 32 - (len - leftbits); 219 | } 220 | 221 | return 0; 222 | } 223 | 224 | void xeve_bsw_write_ue(XEVE_BSW * bs, u32 val) 225 | { 226 | int len_i, len_c, info, nn; 227 | u32 code; 228 | 229 | nn = ((val + 1) >> 1); 230 | for(len_i = 0; len_i < 16 && nn != 0; len_i++) 231 | { 232 | nn >>= 1; 233 | } 234 | 235 | info = val + 1 - (1 << len_i); 236 | code = (1 << len_i) | ((info)& ((1 << len_i) - 1)); 237 | 238 | len_c = (len_i << 1) + 1; 239 | 240 | xeve_bsw_write(bs, code, len_c); 241 | } 242 | 243 | void xeve_bsw_write_se(XEVE_BSW * bs, int val) 244 | { 245 | xeve_bsw_write_ue(bs, val <= 0 ? (-val * 2) : (val * 2 - 1)); 246 | } 247 | #endif -------------------------------------------------------------------------------- /src_base/xeve_bsw.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_BSW_H_ 32 | #define _XEVE_BSW_H_ 33 | 34 | #include "xeve_port.h" 35 | 36 | typedef struct _XEVE_BSW XEVE_BSW; 37 | 38 | /*! Function pointer for */ 39 | typedef int (*XEVE_BSW_FN_FLUSH)(XEVE_BSW *bs); 40 | 41 | /*! Bitstream structure */ 42 | struct _XEVE_BSW 43 | { 44 | /* buffer */ 45 | u32 code; 46 | /* bits left in buffer */ 47 | int leftbits; 48 | /*! address of current writing position */ 49 | u8 * cur; 50 | /*! address of bitstream buffer end */ 51 | u8 * end; 52 | /*! address of bitstream buffer begin */ 53 | u8 * beg; 54 | /*! size of bitstream buffer in byte */ 55 | int size; 56 | /*! address of function for flush */ 57 | XEVE_BSW_FN_FLUSH fn_flush; 58 | /*! arbitrary data, if needs */ 59 | int ndata[4]; 60 | /*! arbitrary address, if needs */ 61 | void * pdata[4]; 62 | }; 63 | 64 | #define XEVE_BSW_IS_BYTE_ALIGN(bs) !((bs)->leftbits & 0x7) 65 | 66 | /* get number of byte written */ 67 | #define XEVE_BSW_GET_WRITE_BYTE(bs) (int)((bs)->cur - (bs)->beg) 68 | 69 | /* number of bytes to be sunk */ 70 | #define XEVE_BSW_GET_SINK_BYTE(bs) ((32 - (bs)->leftbits + 7) >> 3) 71 | 72 | void xeve_bsw_init(XEVE_BSW * bs, u8 * buf, int size, XEVE_BSW_FN_FLUSH fn_flush); 73 | void xeve_bsw_init_slice(XEVE_BSW * bs, u8 * buf, int size, XEVE_BSW_FN_FLUSH fn_flush); 74 | void xeve_bsw_deinit(XEVE_BSW * bs); 75 | #if TRACE_HLS 76 | #define xeve_bsw_write1(A, B) xeve_bsw_write1_trace(A, B, #B) 77 | int xeve_bsw_write1_trace(XEVE_BSW * bs, int val, char* name); 78 | 79 | #define xeve_bsw_write(A, B, C) xeve_bsw_write_trace(A, B, #B, C) 80 | int xeve_bsw_write_trace(XEVE_BSW * bs, u32 val, char* name, int len); 81 | 82 | #define xeve_bsw_write_ue(A, B) xeve_bsw_write_ue_trace(A, B, #B) 83 | void xeve_bsw_write_ue_trace(XEVE_BSW * bs, u32 val, char* name); 84 | 85 | #define xeve_bsw_write_se(A, B) xeve_bsw_write_se_trace(A, B, #B) 86 | void xeve_bsw_write_se_trace(XEVE_BSW * bs, int val, char* name); 87 | #else 88 | int xeve_bsw_write1(XEVE_BSW * bs, int val); 89 | int xeve_bsw_write(XEVE_BSW * bs, u32 val, int len); 90 | void xeve_bsw_write_ue(XEVE_BSW * bs, u32 val); 91 | void xeve_bsw_write_se(XEVE_BSW * bs, int val); 92 | #endif 93 | 94 | #endif /* _XEVE_BSW_H_ */ 95 | -------------------------------------------------------------------------------- /src_base/xeve_df.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_DF_H_ 32 | #define _XEVE_DF_H_ 33 | 34 | int xeve_deblock(XEVE_CTX * ctx, XEVE_PIC * pic, int tile_idx, int filter_across_boundary, XEVE_CORE * core); 35 | void xeve_deblock_unit(XEVE_CTX * ctx, XEVE_PIC * pic, int x, int y, int cuw, int cuh, int is_hor_edge, XEVE_CORE * core, int boundary_filtering); 36 | void xeve_deblock_cu_hor(XEVE_PIC *pic, int x_pel, int y_pel, int cuw, int cuh, u32 *map_scu, s8 (*map_refi)[REFP_NUM], s16 (*map_mv)[REFP_NUM][MV_D] 37 | , int w_scu, TREE_CONS tree_cons, u8* map_tidx, int boundary_filtering 38 | , int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc, int* qp_chroma_dynamic[2]); 39 | void xeve_deblock_cu_ver(XEVE_PIC *pic, int x_pel, int y_pel, int cuw, int cuh, u32 *map_scu, s8 (*map_refi)[REFP_NUM], s16 (*map_mv)[REFP_NUM][MV_D] 40 | , int w_scu, u32 *map_cu, TREE_CONS tree_cons, u8 *map_tidx, int boundary_filtering 41 | , int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc, int* qp_chroma_dynamic[2]); 42 | 43 | void xeve_deblock_tree(XEVE_CTX * ctx, XEVE_PIC * pic, int x, int y, int cuw, int cuh, int cud, int cup, int is_hor_edge 44 | , TREE_CONS tree_cons, XEVE_CORE * core, int boundary_filtering); 45 | #endif /* _XEVE_DF_H_ */ 46 | -------------------------------------------------------------------------------- /src_base/xeve_eco.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_ECO_H_ 32 | #define _XEVE_ECO_H_ 33 | 34 | #include "xeve_def.h" 35 | #include "xeve_type.h" 36 | 37 | #define GET_SBAC_ENC(bs) ((XEVE_SBAC *)(bs)->pdata[1]) 38 | 39 | void sbac_encode_bin_ep(u32 bin, XEVE_SBAC *sbac, XEVE_BSW *bs); 40 | void sbac_encode_bins_ep(u32 value, int num_bin, XEVE_SBAC *sbac, XEVE_BSW *bs); 41 | void sbac_write_truncate_unary_sym(u32 sym, u32 num_ctx, u32 max_num, XEVE_SBAC *sbac, SBAC_CTX_MODEL *model, XEVE_BSW *bs); 42 | void xeve_sbac_reset(XEVE_SBAC * sbac, u8 slice_type, u8 slice_qp, int sps_cm_init_flag); 43 | void xeve_sbac_finish(XEVE_BSW *bs); 44 | void xeve_sbac_encode_bin(u32 bin, XEVE_SBAC *sbac, SBAC_CTX_MODEL *ctx_model, XEVE_BSW *bs); 45 | void xeve_sbac_encode_bin_trm(u32 bin, XEVE_SBAC *sbac, XEVE_BSW *bs); 46 | int xeve_eco_nal_unit_len(void * buf, int size); 47 | int xeve_eco_nalu(XEVE_BSW * bs, XEVE_NALU * nalu); 48 | int xeve_eco_sps(XEVE_BSW * bs, XEVE_SPS * sps); 49 | int xeve_eco_pps(XEVE_BSW * bs, XEVE_SPS * sps, XEVE_PPS * pps); 50 | int xeve_eco_sh(XEVE_BSW * bs, XEVE_SPS * sps, XEVE_PPS * pps, XEVE_SH * sh, int nut); 51 | int xeve_eco_sei(XEVE_CTX * ctx, XEVE_BSW * bs); 52 | int xeve_eco_emitsei(XEVE_CTX * ctx, XEVE_BSW * bs); 53 | int xeve_eco_vui(XEVE_BSW * bs, XEVE_VUI * vui); 54 | int xeve_eco_signature(XEVE_CTX * ctx, XEVE_BSW * bs); 55 | int xeve_eco_pic_signature(XEVE_CTX * ctx, XEVE_BSW * bs, u8 pic_sign[N_C][16]); 56 | int xeve_eco_pred_mode(XEVE_BSW * bs, u8 pred_mode, int ctx); 57 | int xeve_eco_intra_dir(XEVE_BSW *bs, u8 ipm, u8 * mpm); 58 | void xeve_eco_direct_mode_flag(XEVE_BSW *bs, int direct_mode_flag); 59 | void xeve_eco_skip_flag(XEVE_BSW * bs, int flag, int ctx); 60 | int xeve_eco_mvp_idx(XEVE_BSW *bs, int mvp_idx); 61 | void xeve_eco_inter_pred_idc(XEVE_BSW * bs, s8 refi[REFP_NUM], int slice_type, int cuw, int cuh, int is_sps_admvp); 62 | int xeve_eco_mvd(XEVE_BSW * bs, s16 mvd[MV_D]); 63 | int xeve_eco_refi(XEVE_BSW * bs, int num_refp, int refi); 64 | int xeve_eco_dqp(XEVE_BSW * bs, int ref_qp, int cur_qp); 65 | int xeve_eco_split_mode(XEVE_BSW *bs, XEVE_CTX *c, XEVE_CORE *core, int cud, int cup, int cuw, int cuh, int lcu_s, int x, int y); 66 | void xeve_eco_tile_end_flag(XEVE_BSW * bs, int flag); 67 | int cu_init(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int cup, int cuw, int cuh); 68 | void coef_rect_to_series(XEVE_CTX * ctx, s16 *coef_src[N_C], int x, int y, int cuw, int cuh, s16 coef_dst[N_C][MAX_CU_DIM], XEVE_CORE * core); 69 | int xeve_eco_coef(XEVE_CTX * ctx, XEVE_CORE * core, XEVE_BSW * bs, s16 coef[N_C][MAX_CU_DIM], u8 pred_mode, int enc_dqp, int b_no_cbf, int run_stats); 70 | void xeve_eco_run_length_cc(XEVE_CTX * ctx, XEVE_BSW *bs, s16 *coef, int log2_w, int log2_h, int num_sig, int ch_type); 71 | int xeve_eco_cbf(XEVE_BSW * bs, int cbf_y, int cbf_u, int cbf_v, u8 pred_mode, int b_no_cbf, int is_sub, int sub_pos, int cbf_all, int run[N_C], TREE_CONS tree_cons, int chroma_format_idc); 72 | int xeve_eco_unit(XEVE_CTX * ctx, XEVE_CORE * core, int x, int y, int cup, int cuw, int cuh, TREE_CONS tree_cons, XEVE_BSW * bs); 73 | 74 | #endif /* _XEVE_ECO_H_ */ 75 | -------------------------------------------------------------------------------- /src_base/xeve_enc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_ENC_H_ 32 | #define _XEVE_ENC_H_ 33 | 34 | /* Convert XEVE into XEVE_CTX */ 35 | #define XEVE_ID_TO_CTX_R(id, ctx) \ 36 | xeve_assert_r((id)); \ 37 | (ctx) = (XEVE_CTX *)id; \ 38 | xeve_assert_r((ctx)->magic == XEVE_MAGIC_CODE); 39 | 40 | /* Convert XEVE into XEVE_CTX with return value if assert on */ 41 | #define XEVE_ID_TO_CTX_RV(id, ctx, ret) \ 42 | xeve_assert_rv((id), (ret)); \ 43 | (ctx) = (XEVE_CTX *)id; \ 44 | xeve_assert_rv((ctx)->magic == XEVE_MAGIC_CODE, (ret)); 45 | 46 | 47 | 48 | XEVE_CTX * xeve_ctx_alloc(void); 49 | void xeve_ctx_free(XEVE_CTX * ctx); 50 | XEVE_CORE * xeve_core_alloc(int chroma_format_idc); 51 | void xeve_core_free(XEVE_CORE * core); 52 | 53 | int xeve_pic(XEVE_CTX * ctx, XEVE_BITB * bitb, XEVE_STAT * stat); 54 | int xeve_platform_init(XEVE_CTX * ctx); 55 | void xeve_platform_deinit(XEVE_CTX * ctx); 56 | int xeve_pic_prepare(XEVE_CTX * ctx, XEVE_BITB * bitb, XEVE_STAT * stat); 57 | int xeve_pic_finish(XEVE_CTX * ctx, XEVE_BITB * bitb, XEVE_STAT * stat); 58 | int xeve_pic(XEVE_CTX * ctx, XEVE_BITB * bitb, XEVE_STAT * stat); 59 | int xeve_enc(XEVE_CTX * ctx, XEVE_BITB * bitb, XEVE_STAT * stat); 60 | int xeve_push_frm(XEVE_CTX * ctx, XEVE_IMGB * img); 61 | int xeve_ready(XEVE_CTX * ctx); 62 | void xeve_flush(XEVE_CTX * ctx); 63 | int xeve_picbuf_get_inbuf(XEVE_CTX * ctx, XEVE_IMGB ** img); 64 | 65 | 66 | void xeve_platform_init_func(XEVE_CTX * ctx); 67 | int xeve_platform_init(XEVE_CTX * ctx); 68 | int xeve_create_bs_buf(XEVE_CTX * ctx, int max_bs_buf_size); 69 | int xeve_delete_bs_buf(XEVE_CTX * ctx); 70 | int xeve_encode_sps(XEVE_CTX * ctx); 71 | int xeve_encode_pps(XEVE_CTX * ctx); 72 | int xeve_encode_sei(XEVE_CTX * ctx); 73 | int xeve_check_frame_delay(XEVE_CTX * ctx); 74 | int xeve_check_more_frames(XEVE_CTX * ctx); 75 | 76 | int xeve_set_init_param(XEVE_CTX * ctx, XEVE_PARAM * param); 77 | int xeve_pic_finish(XEVE_CTX *ctx, XEVE_BITB *bitb, XEVE_STAT *stat); 78 | void xeve_set_nalu(XEVE_NALU * nalu, int nalu_type, int nuh_temporal_id); 79 | void xeve_set_vui(XEVE_CTX * ctx, XEVE_VUI * vui); 80 | void xeve_set_sps(XEVE_CTX * ctx, XEVE_SPS * sps); 81 | void xeve_set_pps(XEVE_CTX * ctx, XEVE_PPS * pps); 82 | int xeve_set_active_pps_info(XEVE_CTX * ctx); 83 | void xeve_set_sh(XEVE_CTX *ctx, XEVE_SH *sh); 84 | int xeve_set_tile_info(XEVE_CTX * ctx); 85 | int xeve_header(XEVE_CTX * ctx); 86 | 87 | int xeve_init_core_mt(XEVE_CTX * ctx, int tile_num, XEVE_CORE * core, int thread_cnt); 88 | int xeve_deblock_mt(void * arg); 89 | int xeve_loop_filter(XEVE_CTX * ctx, XEVE_CORE * core); 90 | void xeve_recon(XEVE_CTX * ctx, XEVE_CORE * core, s16 *coef, pel *pred, int is_coef, int cuw, int cuh, int s_rec, pel *rec, int bit_depth); 91 | 92 | int xeve_param_apply_ppt_baseline(XEVE_PARAM* param, int profile, int preset, int tune); 93 | int xeve_param_init(XEVE_PARAM* param); 94 | 95 | void xeve_param2string(XEVE_PARAM * param, char * sei_buf, int padx, int pady); 96 | #endif /* _XEVE_ENC_H_ */ 97 | 98 | -------------------------------------------------------------------------------- /src_base/xeve_fcst.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_FCST_H_ 32 | #define _XEVE_FCST_H_ 33 | 34 | #include "xeve_def.h" 35 | #include "xeve_type.h" 36 | 37 | #define LOG2_AQ_BLK_SIZE 4 38 | 39 | /* constant for AQ strength */ 40 | #define AQ_STR_CONST 0.75 41 | #define AQ_STRENGTH 0.5 42 | /* blk-tree strength */ 43 | #define LCU_STRENGTH 0.75 44 | 45 | #define SEARCH_RANGE_IPEL 64 46 | #define INIT_SDS_PTS 4 47 | /* initial direction of diamond searhc pattern */ 48 | #define RC_INIT_QP 28 49 | 50 | /* foracast calculation unit depth 51 | 0: same as lcu (depth 0) 52 | 1: 1/4 size of lcu (depth 1) 53 | */ 54 | 55 | enum PREV_PIC 56 | { 57 | PREV0, 58 | PREV1 59 | }; 60 | 61 | enum PRED_TYPE 62 | { 63 | INTRA, 64 | INTER_UNI0, 65 | INTER_UNI1, 66 | INTER_UNI2, 67 | INTER_L0 = 1, 68 | INTER_L1 = 2, 69 | INTER_BI = 3, 70 | }; 71 | 72 | enum SCENE_TYPE 73 | { 74 | SCENE_NORMAL, 75 | SCENE_HIGH, 76 | SCENE_LOW, 77 | SCENE_EX_LOW, 78 | }; 79 | 80 | enum QPA_TYPE 81 | { 82 | QPA_OFF, 83 | QPA_AQ_TREE, /* turn on adaptive qantization + block tree */ 84 | QPA_AQ, /* turn on adaptive qantization only */ 85 | QPA_TREE, /* turn on block tree only */ 86 | }; 87 | 88 | 89 | /* check whether B picture could be exist or not */ 90 | #define B_PIC_ENABLED(ctx) (ctx->param.bframes > 0) 91 | /* complexity threthold */ 92 | 93 | int xeve_forecast_fixed_gop(XEVE_CTX* ctx); 94 | void xeve_gen_subpic(pel* src_y, pel* dst_y, int w, int h, int s_s, int d_s, int bit_depth); 95 | s32 xeve_fcst_get_scene_type(XEVE_CTX * ctx, XEVE_PICO * pico); 96 | 97 | #endif /* _XEVE_FCST_H_ */ 98 | -------------------------------------------------------------------------------- /src_base/xeve_ipred.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_IPRED_H_ 32 | #define _XEVE_IPRED_H_ 33 | 34 | #include "xeve_def.h" 35 | 36 | void xeve_get_nbr(int x, int y, int cuw, int cuh, pel *src, int s_src, u16 avail_cu, pel nb[N_C][N_REF][MAX_CU_SIZE * 3], int scup, u32 *map_scu 37 | , int w_scu, int h_scu, int ch_type, int constrained_intra_pred, u8* map_tidx, int bit_depth, int chroma_format_idc); 38 | void xeve_ipred(pel *src_le, pel *src_up, pel *src_ri, u16 avail_lr, pel *dst, int ipm, int w, int h); 39 | void xeve_ipred_uv(pel *src_le, pel *src_up, pel *src_ri, u16 avail_lr, pel *dst, int ipm_c, int ipm, int w, int h); 40 | void xeve_get_mpm(int x_scu, int y_scu, int cuw, int cuh, u32 * map_scu, s8 * map_ipm, int scup, int w_scu, u8 ** mpm, u8 * map_tidx); 41 | 42 | #endif /* _XEVE_IPRED_H_ */ 43 | -------------------------------------------------------------------------------- /src_base/xeve_itdq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_ITDQ_H_ 32 | #define _XEVE_ITDQ_H_ 33 | 34 | #include "xeve_def.h" 35 | 36 | // clang-format off 37 | 38 | #define ITX_SHIFT1 (7) /* shift after 1st IT stage */ 39 | #define ITX_SHIFT2(bit_depth) (12 - (bit_depth - 8)) /* shift after 2nd IT stage */ 40 | 41 | #define ITX_CLIP(x) \ 42 | (s16)(((x)MAX_TX_VAL)? MAX_TX_VAL: (x))) 43 | 44 | #define MAX_TX_DYNAMIC_RANGE_32 31 45 | #define MAX_TX_VAL_32 2147483647 46 | #define MIN_TX_VAL_32 (-2147483647-1) 47 | #define ITX_CLIP_32(x) \ 48 | (s32)(((x)<=MIN_TX_VAL_32)? MIN_TX_VAL_32: (((x)>=MAX_TX_VAL_32)? MAX_TX_VAL_32: (x))) 49 | 50 | // clang-format on 51 | 52 | void xeve_itdq(XEVE_CTX* ctx, XEVE_CORE* core, s16 coef[N_C][MAX_CU_DIM], int nnz_sub[N_C][MAX_SUB_TB_NUM]); 53 | void xeve_itx_pb2b (void * src, void * dst, int shift, int line, int step); 54 | void xeve_itx_pb4b (void * src, void * dst, int shift, int line, int step); 55 | void xeve_itx_pb8b (void * src, void * dst, int shift, int line, int step); 56 | void xeve_itx_pb16b(void * src, void * dst, int shift, int line, int step); 57 | void xeve_itx_pb32b(void * src, void * dst, int shift, int line, int step); 58 | void xeve_itx_pb64b(void * src, void * dst, int shift, int line, int step); 59 | 60 | extern const XEVE_ITXB xeve_tbl_itxb[MAX_TR_LOG2]; 61 | 62 | #endif /* _XEVE_ITDQ_H_ */ 63 | -------------------------------------------------------------------------------- /src_base/xeve_mc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_MC_H_ 32 | #define _XEVE_MC_H_ 33 | 34 | // clang-format off 35 | 36 | #define MAC_SFT_N0 (6) 37 | #define MAC_ADD_N0 0 38 | 39 | #define MAC_SFT_0N MAC_SFT_N0 40 | #define MAC_ADD_0N MAC_ADD_N0 41 | 42 | #define MAC_8TAP(c, r0, r1, r2, r3, r4, r5, r6, r7) \ 43 | ((c)[0]*(r0)+(c)[1]*(r1)+(c)[2]*(r2)+(c)[3]*(r3)+(c)[4]*(r4)+\ 44 | (c)[5]*(r5)+(c)[6]*(r6)+(c)[7]*(r7)) 45 | #define MAC_8TAP_N0(c, r0, r1, r2, r3, r4, r5, r6, r7) \ 46 | ((MAC_8TAP(c, r0, r1, r2, r3, r4, r5, r6, r7) + MAC_ADD_N0) >> MAC_SFT_N0) 47 | #define MAC_8TAP_0N(c, r0, r1, r2, r3, r4, r5, r6, r7) \ 48 | ((MAC_8TAP(c, r0, r1, r2, r3, r4, r5, r6, r7) + MAC_ADD_0N) >> MAC_SFT_0N) 49 | #define MAC_8TAP_NN_S1(c, r0, r1, r2, r3, r4, r5, r6, r7, offset, shift) \ 50 | ((MAC_8TAP(c,r0,r1,r2,r3,r4,r5,r6,r7) + offset) >> shift) 51 | #define MAC_8TAP_NN_S2(c, r0, r1, r2, r3, r4, r5, r6, r7, offset, shift) \ 52 | ((MAC_8TAP(c,r0,r1,r2,r3,r4,r5,r6,r7) + offset) >> shift) 53 | #define MAC_4TAP(c, r0, r1, r2, r3) \ 54 | ((c)[0]*(r0)+(c)[1]*(r1)+(c)[2]*(r2)+(c)[3]*(r3)) 55 | #define MAC_4TAP_N0(c, r0, r1, r2, r3) \ 56 | ((MAC_4TAP(c, r0, r1, r2, r3) + MAC_ADD_N0) >> MAC_SFT_N0) 57 | #define MAC_4TAP_0N(c, r0, r1, r2, r3) \ 58 | ((MAC_4TAP(c, r0, r1, r2, r3) + MAC_ADD_0N) >> MAC_SFT_0N) 59 | #define MAC_4TAP_NN_S1(c, r0, r1, r2, r3, offset, shift) \ 60 | ((MAC_4TAP(c, r0, r1, r2, r3) + offset) >> shift) 61 | #define MAC_4TAP_NN_S2(c, r0, r1, r2, r3, offset, shift) \ 62 | ((MAC_4TAP(c, r0, r1, r2, r3) + offset) >> shift) 63 | 64 | #define MAC_BL(c, r0, r1) \ 65 | ((c)[0]*(r0)+(c)[1]*(r1)) 66 | #define MAC_BL_N0(c, r0, r1) \ 67 | ((MAC_BL(c, r0, r1) + MAC_ADD_N0) >> MAC_SFT_N0) 68 | #define MAC_BL_0N(c, r0, r1) \ 69 | ((MAC_BL(c, r0, r1) + MAC_ADD_0N) >> MAC_SFT_0N) 70 | #define MAC_BL_NN_S1(c, r0, r1, offset, shift) \ 71 | ((MAC_BL(c, r0, r1) + offset) >> shift) 72 | #define MAC_BL_NN_S2(c, r0, r1, offset, shift) \ 73 | ((MAC_BL(c, r0, r1) + offset) >> shift) 74 | 75 | 76 | /* padding for store intermediate values, which should be larger than 77 | 1+ half of filter tap */ 78 | #define MC_IBUF_PAD_C 4 79 | #define MC_IBUF_PAD_L 8 80 | #define MC_IBUF_PAD_BL 2 81 | 82 | extern const s16 xeve_tbl_mc_l_coeff[16][8]; 83 | extern const s16 xeve_tbl_mc_c_coeff[32][4]; 84 | 85 | typedef void (*XEVE_MC_L) (pel *ref, int gmv_x, int gmv_y, int s_ref, int s_pred, pel *pred, int w, int h, int bit_depth, const s16(*mc_l_coeff)[8]); 86 | typedef void (*XEVE_MC_C) (pel *ref, int gmv_x, int gmv_y, int s_ref, int s_pred, pel *pred, int w, int h, int bit_depth, const s16(*mc_c_coeff)[4]); 87 | typedef void (*XEVE_AVG_NO_CLIP)(s16 *src, s16 *ref, s16 *dst, int s_src, int s_ref, int s_dst, int wd, int ht); 88 | 89 | extern const XEVE_MC_L xeve_tbl_mc_l[2][2]; 90 | extern const XEVE_MC_C xeve_tbl_mc_c[2][2]; 91 | 92 | extern const XEVE_MC_L (*xeve_func_mc_l)[2]; 93 | extern const XEVE_MC_C (*xeve_func_mc_c)[2]; 94 | extern XEVE_AVG_NO_CLIP xeve_func_average_no_clip; 95 | 96 | #define xeve_mc_l(ori_mv_x, ori_mv_y, ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth, mc_l_coeff) \ 97 | (xeve_func_mc_l[((ori_mv_x) | ((ori_mv_x)>>1) | ((ori_mv_x)>>2) | ((ori_mv_x)>>3)) & 0x1])\ 98 | [((ori_mv_y) | ((ori_mv_y)>>1) | ((ori_mv_y)>>2) | ((ori_mv_y)>>3)) & 0x1]\ 99 | (ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth, mc_l_coeff) 100 | 101 | #define xeve_mc_c(ori_mv_x, ori_mv_y, ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth, mc_c_coeff) \ 102 | (xeve_func_mc_c[((ori_mv_x) | ((ori_mv_x)>>1) | ((ori_mv_x)>>2)| ((ori_mv_x)>>3) | ((ori_mv_x)>>4)) & 0x1]\ 103 | [((ori_mv_y) | ((ori_mv_y)>>1) | ((ori_mv_y)>>2) | ((ori_mv_y)>>3) | ((ori_mv_y)>>4)) & 0x1])\ 104 | (ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth, mc_c_coeff) 105 | 106 | // clang-format on 107 | 108 | void xeve_mc(int x, int y, int pic_w, int pic_h, int w, int h, s8 refi[REFP_NUM], s16(*mv)[MV_D], XEVE_REFP(*refp)[REFP_NUM], pel pred[REFP_NUM][N_C][MAX_CU_DIM], int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc); 109 | void xeve_mv_clip(int x, int y, int pic_w, int pic_h, int w, int h, s8 refi[REFP_NUM], s16 mv[REFP_NUM][MV_D], s16(*mv_t)[MV_D]); 110 | void xeve_average_16b_no_clip(s16 *src, s16 *ref, s16 *dst, int s_src, int s_ref, int s_dst, int wd, int ht); 111 | void xeve_mc_l_00(pel *ref, int gmv_x, int gmv_y, int s_ref, int s_pred, pel *pred, int w, int h, int bit_depth, const s16(*mc_l_coeff)[8]); 112 | void xeve_mc_c_00(s16 *ref, int gmv_x, int gmv_y, int s_ref, int s_pred, s16 *pred, int w, int h, int bit_depth, const s16(*mc_c_coeff)[4]); 113 | #endif /* _XEVE_MC_H_ */ 114 | -------------------------------------------------------------------------------- /src_base/xeve_mode.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_MODE_H_ 32 | #define _XEVE_MODE_H_ 33 | 34 | void xeve_pic_expand(XEVE_CTX *ctx, XEVE_PIC *pic); 35 | XEVE_PIC * xeve_pic_alloc(PICBUF_ALLOCATOR *pa, int *ret); 36 | void xeve_pic_free(PICBUF_ALLOCATOR *pa, XEVE_PIC *pic); 37 | 38 | void xeve_bsw_skip_slice_size(XEVE_BSW *bs); 39 | int xeve_bsw_write_nalu_size(XEVE_BSW *bs); 40 | 41 | void xeve_diff_pred(int x, int y, int log2_cuw, int log2_cuh, XEVE_PIC *org, pel pred[N_C][MAX_CU_DIM], s16 diff[N_C][MAX_CU_DIM], int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc); 42 | 43 | #define SBAC_STORE(dst, src) xeve_mcpy(&dst, &src, sizeof(XEVE_SBAC)) 44 | #define SBAC_LOAD(dst, src) xeve_mcpy(&dst, &src, sizeof(XEVE_SBAC)) 45 | #define DQP_STORE(dst, src) xeve_mcpy(&dst, &src, sizeof(XEVE_DQP)) 46 | #define DQP_LOAD(dst, src) xeve_mcpy(&dst, &src, sizeof(XEVE_DQP)) 47 | void xeve_set_qp(XEVE_CTX *ctx, XEVE_CORE *core, u8 qp); 48 | 49 | MODE_CONS xeve_derive_mode_cons(XEVE_CTX *ctx, int luc_num, int cup); 50 | 51 | int xeve_mode_create(XEVE_CTX * ctx, int complexity); 52 | void xeve_rdo_bit_cnt_cu_intra(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s16 coef[N_C][MAX_CU_DIM]); 53 | void xeve_rdo_bit_cnt_cu_intra_luma(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s16 coef[N_C][MAX_CU_DIM]); 54 | void xeve_rdo_bit_cnt_cu_intra_chroma(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s16 coef[N_C][MAX_CU_DIM]); 55 | void xeve_rdo_bit_cnt_cu_inter(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s8 refi[REFP_NUM], s16 mvd[REFP_NUM][MV_D], s16 coef[N_C][MAX_CU_DIM], int pidx, u8 * mvp_idx, u8 mvr_idx, u8 bi_idx, s16 affine_mvd[REFP_NUM][VER_NUM][MV_D]); 56 | void xeve_rdo_bit_cnt_cu_inter_comp(XEVE_CORE * core, s16 coef[N_C][MAX_CU_DIM], int ch_type, int pidx, XEVE_CTX * ctx, TREE_CONS tree_cons); 57 | void xeve_rdo_bit_cnt_cu_skip(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, int mvp_idx0, int mvp_idx1, int c_num, int tool_mmvd); 58 | void xeve_rdo_bit_cnt_mvp(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s8 refi[REFP_NUM], s16 mvd[REFP_NUM][MV_D], int pidx, int mvp_idx); 59 | void xeve_rdo_bit_cnt_intra_dir(XEVE_CTX * ctx, XEVE_CORE * core, int ipm); 60 | 61 | void xeve_sbac_bit_reset(XEVE_SBAC * sbac); 62 | u32 xeve_get_bit_number(XEVE_SBAC * sbac); 63 | void xeve_init_bits_est(); 64 | u16 xeve_get_lr(u16 avail_lr); 65 | void calc_delta_dist_filter_boundary(XEVE_CTX* ctx, XEVE_PIC *pic_rec, XEVE_PIC *pic_org, int cuw, int cuh, pel(*src)[MAX_CU_DIM], int s_src, int x, int y, u16 avail_lr 66 | , u8 intra_flag, u8 cbf_l, s8 *refi, s16(*mv)[MV_D], u8 is_mv_from_mvf, XEVE_CORE * core); 67 | void copy_to_cu_data(XEVE_CTX *ctx, XEVE_CORE *core, XEVE_MODE *mi, s16 coef_src[N_C][MAX_CU_DIM]); 68 | int mode_cu_init(XEVE_CTX * ctx, XEVE_CORE * core, int x, int y, int log2_cuw, int log2_cuh, int cud); 69 | void update_map_scu(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int src_cuw, int src_cuh); 70 | void clear_map_scu(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int cuw, int cuh); 71 | double mode_check_inter(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int log2_cuw, int log2_cuh, int cud, XEVE_MODE *mi, double cost_best); 72 | double mode_check_intra(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int log2_cuw, int log2_cuh, int cud, XEVE_MODE *mi, double cost_best); 73 | 74 | int check_nev_block(XEVE_CTX *ctx, int x0, int y0, int log2_cuw, int log2_cuh, int *do_curr, int *do_split, int cud, int *nbr_map_skip_flag, XEVE_CORE * core); 75 | int init_cu_data(XEVE_CU_DATA *cu_data, int log2_cuw, int log2_cuh, int qp_y, int qp_u, int qp_v); 76 | void get_min_max_qp(XEVE_CTX * ctx, XEVE_CORE *core, s8 * min_qp, s8 * max_qp, int * is_dqp_set, SPLIT_MODE split_mode, int cuw, int cuh, u8 qp, int x0, int y0); 77 | void set_lambda(XEVE_CTX* ctx, XEVE_CORE * core, XEVE_SH* sh, s8 qp); 78 | int copy_cu_data(XEVE_CU_DATA *dst, XEVE_CU_DATA *src, int x, int y, int log2_cuw, int log2_cuh, int log2_cus, int cud, TREE_CONS tree_cons, int chroma_format_idc); 79 | void mode_cpy_rec_to_ref(XEVE_CORE *core, int x, int y, int w, int h, XEVE_PIC *pic, TREE_CONS tree_cons, int chroma_format_idc); 80 | int get_cu_pred_data(XEVE_CU_DATA *src, int x, int y, int log2_cuw, int log2_cuh, int log2_cus, int cud, XEVE_MODE *mi, XEVE_CTX *ctx, XEVE_CORE *core); 81 | 82 | int xeve_mode_init_mt(XEVE_CTX *ctx, int tile_idx); 83 | int mode_init_lcu(XEVE_CTX *ctx, XEVE_CORE *core); 84 | void update_to_ctx_map(XEVE_CTX *ctx, XEVE_CORE *core); 85 | 86 | #endif /* _XEVE_MODE_H_ */ 87 | -------------------------------------------------------------------------------- /src_base/xeve_param_parse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_PARAM_PARSE_H_ 32 | #define _XEVE_PARAM_PARSE_H_ 33 | 34 | #ifdef __cplusplus 35 | 36 | extern "C" 37 | { 38 | #endif 39 | 40 | #include 41 | 42 | /** 43 | * @brief Set value for a given param 44 | * 45 | * @param params pointer to XEVE_PARAM struct 46 | * @param name param's name 47 | * @param value param's value 48 | * @retval XEVE_ERR 49 | * @retval XEVE_ERR_INVALID_ARGUMENT if the param of a given name not exists 50 | * @retval XEVE_OK Ok 51 | */ 52 | int xeve_param_set_val( XEVE_PARAM* params, const char* name, const char* value ); 53 | 54 | #ifdef __cplusplus 55 | extern "C" 56 | { 57 | #endif 58 | 59 | #endif /*_XEVE_PARAM_PARSE_H_ */ 60 | 61 | 62 | -------------------------------------------------------------------------------- /src_base/xeve_picman.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_PICMAN_H_ 32 | #define _XEVE_PICMAN_H_ 33 | 34 | /* macros for reference picture flag */ 35 | #define IS_REF(pic) (((pic)->is_ref) != 0) 36 | #define SET_REF_UNMARK(pic) (((pic)->is_ref) = 0) 37 | #define SET_REF_MARK(pic) (((pic)->is_ref) = 1) 38 | #define PRINT_DPB(pm)\ 39 | xeve_print("%s: current num_ref = %d, dpb_size = %d\n", __FUNCTION__, \ 40 | pm->cur_num_ref_pics, picman_get_num_allocated_pics(pm)); 41 | 42 | /*Declaration for ref pic marking and ref pic list construction functions */ 43 | int xeve_picman_refp_init(XEVE_PM *pm, int max_num_ref_pics, int slice_type, u32 poc, u8 layer_id, int last_intra, XEVE_REFP (*refp)[REFP_NUM]); 44 | void xeve_picman_update_pic_ref(XEVE_PM * pm); 45 | XEVE_PIC * xeve_picman_get_empty_pic(XEVE_PM *pm, int *err); 46 | int xeve_picman_put_pic(XEVE_PM *pm, XEVE_PIC *pic, int is_idr, u32 poc, u8 layer_id, int need_for_output, XEVE_REFP (*refp)[REFP_NUM], int ref_pic, int pnpf, int ref_pic_gap_length); 47 | XEVE_PIC * xeve_picman_out_pic(XEVE_PM *pm, int *err); 48 | int xeve_picman_deinit(XEVE_PM *pm); 49 | int xeve_picman_init(XEVE_PM *pm, int max_pb_size, int max_num_ref_pics, PICBUF_ALLOCATOR *pa); 50 | void xeve_set_refp(XEVE_REFP * refp, XEVE_PIC * pic_ref); 51 | int xeve_picman_move_pic(XEVE_PM *pm, int from, int to); 52 | 53 | #endif /* _XEVE_PICMAN_H_ */ 54 | -------------------------------------------------------------------------------- /src_base/xeve_port.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include "xeve_port.h" 33 | 34 | #if XEVE_TRACE 35 | void xeve_trace0(char * filename, int line, const char *fmt, ...) 36 | { 37 | char str[1024]={'\0',}; 38 | if(filename != NULL && line >= 0) sprintf(str, "[%s:%d] ", filename, line); 39 | va_list args; 40 | va_start(args, fmt); 41 | vsprintf(str + strlen(str), fmt, args); 42 | va_end(args); 43 | printf("%s", str); 44 | } 45 | 46 | void xeve_trace_line(char * pre) 47 | { 48 | char str[128]={'\0',}; 49 | const int chars = 80; 50 | int len = (pre == NULL)? 0: (int)strlen(pre); 51 | if(len > 0) 52 | { 53 | sprintf(str, "%s ", pre); 54 | len = (int)strlen(str); 55 | } 56 | for(int i = len ; i< chars; i++) {str[i] = '=';} 57 | str[chars] = '\0'; 58 | printf("%s\n", str); 59 | } 60 | 61 | #endif /* XEVE_TRACE */ 62 | -------------------------------------------------------------------------------- /src_base/xeve_port.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_PORT_H_ 32 | #define _XEVE_PORT_H_ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | // clang-format off 41 | 42 | /***************************************************************************** 43 | * types 44 | *****************************************************************************/ 45 | typedef int8_t s8; 46 | typedef uint8_t u8; 47 | typedef int16_t s16; 48 | typedef uint16_t u16; 49 | typedef int32_t s32; 50 | typedef uint32_t u32; 51 | typedef int64_t s64; 52 | typedef uint64_t u64; 53 | 54 | typedef s16 pel; 55 | typedef s32 double_pel; 56 | /***************************************************************************** 57 | * limit constant 58 | *****************************************************************************/ 59 | #define XEVE_UINT16_MAX ((u16)0xFFFF) 60 | #define XEVE_UINT16_MIN ((u16)0x0) 61 | #define XEVE_INT16_MAX ((s16)0x7FFF) 62 | #define XEVE_INT16_MIN ((s16)0x8000) 63 | 64 | #define XEVE_UINT_MAX ((u32)0xFFFFFFFF) 65 | #define XEVE_UINT_MIN ((u32)0x0) 66 | #define XEVE_INT_MAX ((int)0x7FFFFFFF) 67 | #define XEVE_INT_MIN ((int)0x80000000) 68 | 69 | #define XEVE_UINT32_MAX ((u32)0xFFFFFFFF) 70 | #define XEVE_UINT32_MIN ((u32)0x0) 71 | #define XEVE_INT32_MAX ((s32)0x7FFFFFFF) 72 | #define XEVE_INT32_MIN ((s32)0x80000000) 73 | 74 | #define XEVE_UINT64_MAX ((u64)0xFFFFFFFFFFFFFFFFL) 75 | #define XEVE_UINT64_MIN ((u64)0x0L) 76 | #define XEVE_INT64_MAX ((s64)0x7FFFFFFFFFFFFFFFL) 77 | #define XEVE_INT64_MIN ((s64)0x8000000000000000L) 78 | 79 | /***************************************************************************** 80 | * memory operations 81 | *****************************************************************************/ 82 | #define xeve_malloc(size) malloc((size)) 83 | #define xeve_malloc_fast(size) xeve_malloc((size)) 84 | 85 | #define xeve_mfree(m) if(m){free(m);} 86 | #define xeve_mfree_fast(m) if(m){xeve_mfree(m);} 87 | 88 | #define xeve_mcpy(dst,src,size) memcpy((dst), (src), (size)) 89 | #define xeve_mset(dst,v,size) memset((dst), (v), (size)) 90 | #define xeve_mset_x64a(dst,v,size) memset((dst), (v), (size)) 91 | #define xeve_mset_x128(dst,v,size) memset((dst), (v), (size)) 92 | #define xeve_mcmp(dst,src,size) memcmp((dst), (src), (size)) 93 | static __inline void xeve_mset_16b(s16 * dst, s16 v, int cnt) 94 | { 95 | int i; 96 | for(i=0; i 132 | #define xeve_assert(x) \ 133 | {if(!(x)){assert(x);}} 134 | #define xeve_assert_r(x) \ 135 | {if(!(x)){assert(x); return;}} 136 | #define xeve_assert_rv(x,r) \ 137 | {if(!(x)){assert(x); return (r);}} 138 | #define xeve_assert_g(x,g) \ 139 | {if(!(x)){assert(x); goto g;}} 140 | #define xeve_assert_gv(x,r,v,g) \ 141 | {if(!(x)){assert(x); (r)=(v); goto g;}} 142 | 143 | #ifndef ARM 144 | #define X86_SSE 1 145 | #define ARM_NEON 0 146 | #else 147 | #define X86_SSE 0 148 | #define ARM_NEON 1 149 | #endif 150 | 151 | #if ARM_NEON 152 | #include 153 | #else 154 | #if X86_SSE 155 | #ifdef _WIN32 156 | #include 157 | #include 158 | #include 159 | #include 160 | #else 161 | #include 162 | #endif 163 | #endif 164 | #endif 165 | 166 | // clang-format on 167 | 168 | #endif /* _XEVE_PORT_H_ */ -------------------------------------------------------------------------------- /src_base/xeve_pred.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_PRED_H_ 32 | #define _XEVE_PRED_H_ 33 | 34 | #include "xeve_type.h" 35 | 36 | /* Intra prediction */ 37 | int xeve_pintra_create(XEVE_CTX * ctx, int complexity); 38 | int xeve_pintra_set_complexity(XEVE_CTX * ctx, int complexity); 39 | int xeve_pintra_init_mt(XEVE_CTX * ctx, int tile_idx); 40 | int xeve_pintra_analyze_lcu(XEVE_CTX * ctx, XEVE_CORE * core); 41 | double xeve_pinter_analyze_cu(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int log2_cuw, int log2_cuh, XEVE_MODE *mi, s16 coef[N_C][MAX_CU_DIM], pel *rec[N_C], int s_rec[N_C]); 42 | double xeve_pintra_analyze_cu_simple(XEVE_CTX* ctx, XEVE_CORE* core, int x, int y, int log2_cuw, int log2_cuh, s16 coef[N_C][MAX_CU_DIM]); 43 | int xeve_pinter_init_lcu(XEVE_CTX *ctx, XEVE_CORE *core); 44 | 45 | /* Inter prediction */ 46 | extern const XEVE_PRED_INTER_COMP tbl_inter_pred_comp[2]; 47 | 48 | #define BI_ITER 4 49 | #define MAX_FIRST_SEARCH_STEP 3 50 | #define MAX_REFINE_SEARCH_STEP 2 51 | #define RASTER_SEARCH_STEP 5 52 | #define RASTER_SEARCH_THD 5 53 | #define REFINE_SEARCH_THD 0 54 | #define BI_STEP 5 55 | 56 | int xeve_pinter_create(XEVE_CTX * ctx, int complexity); 57 | 58 | #endif /* _XEVE_PRED_H_ */ 59 | -------------------------------------------------------------------------------- /src_base/xeve_recon.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "xeve_def.h" 32 | #include "xeve_recon.h" 33 | #include 34 | 35 | 36 | void xeve_recon_blk(s16 *coef, pel *pred, int is_coef, int cuw, int cuh, int s_rec, pel *rec, int bit_depth) 37 | { 38 | int i, j; 39 | s16 t0; 40 | 41 | if(is_coef == 0) /* just copy pred to rec */ 42 | { 43 | for(i = 0; i < cuh; i++) 44 | { 45 | for(j = 0; j < cuw; j++) 46 | { 47 | rec[i * s_rec + j] = XEVE_CLIP3(0, (1 << bit_depth) - 1, pred[i * cuw + j]); 48 | } 49 | } 50 | } 51 | else /* add b/w pred and coef and copy it into rec */ 52 | { 53 | for(i = 0; i < cuh; i++) 54 | { 55 | for(j = 0; j < cuw; j++) 56 | { 57 | t0 = coef[i * cuw + j] + pred[i * cuw + j]; 58 | rec[i * s_rec + j] = XEVE_CLIP3(0, (1 << bit_depth) - 1, t0); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src_base/xeve_recon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_RECON_H_ 32 | #define _XEVE_RECON_H_ 33 | 34 | void xeve_recon_blk(s16 *coef, pel *pred, int is_coef, int cuw, int cuh, int s_rec, pel *rec, int bit_depth); 35 | 36 | #endif /* _XEVE_RECON_H_ */ 37 | -------------------------------------------------------------------------------- /src_base/xeve_sad.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_SAD_H_ 32 | #define _XEVE_SAD_H_ 33 | 34 | #include "xeve_port.h" 35 | 36 | int sad_16b(int w, int h, void *src1, void *src2, int s_src1, int s_src2, int bit_depth); 37 | void diff_16b(int w, int h, void *src1, void *src2, int s_src1, int s_src2, int s_diff, s16 * diff, int bit_depth); 38 | s64 ssd_16b(int w, int h, void *src1, void *src2, int s_src1, int s_src2, int bit_depth); 39 | int xeve_had_2x2(pel *org, pel *cur, int s_org, int s_cur, int step); 40 | 41 | typedef int (*XEVE_FN_SAD) (int w, int h, void *src1, void *src2, int s_src1, int s_src2, int bit_depth); 42 | typedef int (*XEVE_FN_SATD) (int w, int h, void *src1, void *src2, int s_src1, int s_src2, int bit_depth); 43 | typedef s64 (*XEVE_FN_SSD) (int w, int h, void *src1, void *src2, int s_src1, int s_src2, int bit_depth); 44 | typedef void (*XEVE_FN_DIFF) (int w, int h, void *src1, void *src2, int s_src1, int s_src2, int s_diff, s16 *diff, int bit_depth); 45 | 46 | extern const XEVE_FN_SAD xeve_tbl_sad_16b[8][8]; 47 | extern const XEVE_FN_SSD xeve_tbl_ssd_16b[8][8]; 48 | extern const XEVE_FN_DIFF xeve_tbl_diff_16b[8][8]; 49 | extern const XEVE_FN_SATD xeve_tbl_satd_16b[1]; 50 | 51 | extern const XEVE_FN_SAD (* xeve_func_sad)[8]; 52 | extern const XEVE_FN_SSD (* xeve_func_ssd)[8]; 53 | extern const XEVE_FN_DIFF (* xeve_func_diff)[8]; 54 | extern const XEVE_FN_SATD (* xeve_func_satd); 55 | 56 | #define xeve_sad_16b(log2w, log2h, src1, src2, s_src1, s_src2, bit_depth)\ 57 | xeve_func_sad[log2w][log2h](1<<(log2w), 1<<(log2h), src1, src2, s_src1, s_src2, bit_depth) 58 | #define xeve_sad_bi_16b(log2w, log2h, src1, src2, s_src1, s_src2, bit_depth)\ 59 | (xeve_func_sad[log2w][log2h](1<<(log2w), 1<<(log2h), src1, src2, s_src1, s_src2, bit_depth) >> 1) 60 | #define xeve_satd_16b(log2w, log2h, src1, src2, s_src1, s_src2, bit_depth)\ 61 | xeve_func_satd[0](1<<(log2w), 1<<(log2h), src1, src2, s_src1, s_src2, bit_depth) 62 | #define xeve_satd_bi_16b(log2w, log2h, src1, src2, s_src1, s_src2, bit_depth)\ 63 | (xeve_func_satd[0](1<<(log2w), 1<<(log2h), src1, src2, s_src1, s_src2, bit_depth) >> 1) 64 | #define xeve_ssd_16b(log2w, log2h, src1, src2, s_src1, s_src2, bit_depth)\ 65 | xeve_func_ssd[log2w][log2h](1<<(log2w), 1<<(log2h), src1, src2, s_src1, s_src2, bit_depth) 66 | #define xeve_diff_16b(log2w, log2h, src1, src2, s_src1, s_src2, s_diff, diff, bit_depth) \ 67 | xeve_func_diff[log2w][log2h](1<<(log2w), 1<<(log2h), src1, src2, s_src1, s_src2, s_diff, diff, bit_depth) 68 | 69 | #endif /* _XEVE_SAD_H_ */ 70 | -------------------------------------------------------------------------------- /src_base/xeve_tbl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_TBL_H_ 32 | #define _XEVE_TBL_H_ 33 | 34 | #include "xeve_def.h" 35 | 36 | extern const u8 xeve_tbl_mpm[6][6][5]; 37 | extern const u8 xeve_tbl_log2[257]; 38 | extern const s8 xeve_tbl_tm2[2][2]; 39 | extern const s8 xeve_tbl_tm4[4][4]; 40 | extern const s8 xeve_tbl_tm8[8][8]; 41 | extern const s8 xeve_tbl_tm16[16][16]; 42 | extern const s8 xeve_tbl_tm32[32][32]; 43 | extern const s8 xeve_tbl_tm64[64][64]; 44 | 45 | extern const int xeve_tbl_dq_scale_b[6]; 46 | extern const u8 xeve_tbl_df_st[4][52]; 47 | extern const int xeve_tbl_qp_chroma_ajudst[XEVE_MAX_QP_TABLE_SIZE]; 48 | 49 | extern const int xeve_min_in_group[LAST_SIGNIFICANT_GROUPS]; 50 | extern const int xeve_group_idx[MAX_TR_SIZE]; 51 | extern const int xeve_go_rice_range[MAX_GR_ORDER_RESIDUAL]; 52 | extern const int xeve_go_rice_para_coeff[32]; 53 | extern const u8 * xeve_tbl_mv_bits; 54 | extern const u8 xeve_tbl_refi_bits[17][16]; 55 | extern const u8 xeve_tbl_mvp_idx_bits[5][4]; 56 | extern const int xeve_quant_scale[2][6]; 57 | 58 | #define RATE_TO_COST_LAMBDA(l, r) ((double)r * l) 59 | #define RATE_TO_COST_SQRT_LAMBDA(l, r) ((double)r * l) 60 | 61 | extern const s8 xeve_tbl_slice_depth_P[5][16]; 62 | extern const s8 xeve_tbl_slice_depth[5][15]; 63 | extern const QP_ADAPT_PARAM xeve_qp_adapt_param_ra[3][8]; 64 | extern const QP_ADAPT_PARAM xeve_qp_adapt_param_ld[8]; 65 | extern const QP_ADAPT_PARAM xeve_qp_adapt_param_ai[8]; 66 | 67 | extern const u16 xeve_tbl_scan[MAX_TR_LOG2][MAX_TR_LOG2][MAX_TR_DIM]; 68 | #endif /* _XEVE_TBL_H_ */ 69 | -------------------------------------------------------------------------------- /src_base/xeve_thread_pool.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_THREAD_POOL_ 32 | #define _XEVE_THREAD_POOL_ 33 | 34 | typedef void* POOL_THREAD; 35 | typedef int (*THREAD_ENTRY) (void * arg); 36 | typedef struct _THREAD_CONTROLLER THREAD_CONTROLLER; 37 | typedef void* SYNC_OBJ; 38 | 39 | /***************************** Salient points **************************************************** 40 | ****************************** Thread Controller object will create, run and destroy*************** 41 | ****************************** threads. Thread Controller has to be initialised ******************* 42 | ****************************** before invoking handler functions. Thread controller*************** 43 | ****************************** should be de-initialized to release handler functions*************** 44 | ****************************************************************************************************/ 45 | 46 | typedef enum _THREAD_RESULT 47 | { 48 | THREAD_SUCCESS = 0, 49 | THREAD_OUT_OF_MEMORY, 50 | THREAD_INVALID_ARG, 51 | THREAD_INVALID_STATE, 52 | THREAD_UNKNOWN_ERROR 53 | 54 | }THREAD_RESULT; 55 | 56 | typedef enum _THREAD_STATUS 57 | { 58 | THREAD_SUSPENDED = 0, 59 | THREAD_RUNNING, 60 | THREAD_TERMINATED 61 | 62 | }THREAD_STATUS; 63 | 64 | struct _THREAD_CONTROLLER 65 | { 66 | //Handler function to create requested thread, thread created is in suspended state 67 | POOL_THREAD (*create)(THREAD_CONTROLLER * tc, int thread_id); 68 | //Handler function to wake up suspended thread and assign task to complete 69 | THREAD_RESULT (*run) (POOL_THREAD thread_id, THREAD_ENTRY entry, void * arg); 70 | //Handler function to get result from the task assigned to the thread in consideration 71 | THREAD_RESULT (*join)(POOL_THREAD thread_id, int * res); 72 | //Handler function to terminate a thread in consideration 73 | THREAD_RESULT (*release)(POOL_THREAD *thread_id); 74 | //handle for mask number of allowed thread 75 | int max_task_cnt; 76 | }; 77 | 78 | THREAD_RESULT init_thread_controller(THREAD_CONTROLLER * tc, int maxtask); 79 | THREAD_RESULT dinit_thread_controller(THREAD_CONTROLLER * tc); 80 | 81 | /*** Create a synchronization object which can be used to control race conditions across threads, synchronization object will be on encoding context*****/ 82 | 83 | SYNC_OBJ get_synchronized_object(); 84 | THREAD_RESULT release_synchornized_object(SYNC_OBJ * sobj); //sync object will be deleted 85 | int spinlock_wait(volatile int * addr, int val); 86 | void threadsafe_assign(volatile int * addr, int val); 87 | int threadsafe_decrement(SYNC_OBJ sobj, volatile int * pcnt); 88 | 89 | #endif 90 | 91 | -------------------------------------------------------------------------------- /src_base/xeve_tq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVE_TQ_H_ 32 | #define _XEVE_TQ_H_ 33 | 34 | #include "xeve_type.h" 35 | 36 | #define GET_I_COST(rate, lamba) (rate*lamba) 37 | #define GET_IEP_RATE (32768) 38 | 39 | extern const XEVE_TXB xeve_tbl_txb[MAX_TR_LOG2]; 40 | extern const int xeve_quant_scale[2][6]; 41 | 42 | int xeve_rdoq_set_ctx_cc(XEVE_CORE * core, int ch_type, int prev_level); 43 | int xeve_sub_block_tq(XEVE_CTX * ctx, XEVE_CORE * core, s16 coef[N_C][MAX_CU_DIM], int log2_cuw, int log2_cuh, int slice_type, int nnz[N_C], int is_intra, int run_stats); 44 | int xeve_rdoq_run_length_cc(u8 qp, double d_lambda, u8 is_intra, s16 *src_coef, s16 *dst_tmp, int log2_cuw, int log2_cuh, int ch_type, XEVE_CORE * core, int bit_depth); 45 | void xeve_init_err_scale(XEVE_CTX * ctx); 46 | extern const XEVE_TXB(*xeve_func_txb)[MAX_TR_LOG2]; 47 | void tx_pb2b(void* src, void* dst, int shift, int line, int step); 48 | void tx_pb4b(void* src, void* dst, int shift, int line, int step); 49 | void tx_pb8b(void* src, void* dst, int shift, int line, int step); 50 | void tx_pb16b(void* src, void* dst, int shift, int line, int step); 51 | void tx_pb32b(void* src, void* dst, int shift, int line, int step); 52 | void tx_pb64b(void* src, void* dst, int shift, int line, int step); 53 | #endif /* _XEVE_TQ_H_ */ 54 | -------------------------------------------------------------------------------- /src_main/avx/xevem_itdq_avx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVEM_ITDQ_AVX_H_ 32 | #define _XEVEM_ITDQ_AVX_H_ 33 | 34 | #if X86_SSE 35 | extern const XEVE_ITX xeve_tbl_itx_avx[MAX_TR_LOG2]; 36 | #endif /* X86_SSE */ 37 | 38 | #endif /* _XEVEM_ITDQ_AVX_H_ */ 39 | -------------------------------------------------------------------------------- /src_main/avx/xevem_tq_avx.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _XEVEM_TQ_AVX_H_ 32 | #define _XEVEM_TQ_AVX_H_ 33 | 34 | #if X86_SSE 35 | #include "xeve_tq_avx.h" 36 | 37 | extern const XEVE_TX xeve_tbl_tx_avx[MAX_TR_LOG2]; 38 | #endif /* X86_SSE */ 39 | 40 | #endif /* _XEVEM_TQ_AVX_H_ */ 41 | -------------------------------------------------------------------------------- /src_main/sse/xevem_itdq_sse.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_ITDQ_SSE_H_ 37 | #define _XEVEM_ITDQ_SSE_H_ 38 | 39 | #include "xeve_def.h" 40 | #if X86_SSE 41 | extern const XEVE_INV_TRANS xeve_itrans_map_tbl_sse[16][5]; 42 | 43 | void xeve_itrans_ats_intra_DST7_B8_sse(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 44 | void xeve_itrans_ats_intra_DST7_B16_sse(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 45 | void xeve_itrans_ats_intra_DST7_B32_sse(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 46 | void xeve_itrans_ats_intra_DCT8_B8_sse(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 47 | void xeve_itrans_ats_intra_DCT8_B16_sse(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 48 | void xeve_itrans_ats_intra_DCT8_B32_sse(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 49 | #endif /* X86_SSE */ 50 | #endif /* _XEVE_ITDQ_SSE_H_ */ 51 | -------------------------------------------------------------------------------- /src_main/sse/xevem_mc_sse.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_MC_SSE_H_ 37 | #define _XEVEM_MC_SSE_H_ 38 | 39 | #if X86_SSE 40 | extern const XEVEM_MC xeve_tbl_dmvr_mc_l_sse[2][2]; 41 | extern const XEVEM_MC xeve_tbl_dmvr_mc_c_sse[2][2]; 42 | extern const XEVEM_MC xeve_tbl_bl_mc_l_sse[2][2]; 43 | 44 | 45 | void xevem_scaled_horizontal_sobel_filter_sse(pel *pred, int pred_stride, int *derivate, int derivate_buf_stride, int width, int height); 46 | void xevem_scaled_vertical_sobel_filter_sse(pel *pred, int pred_stride, int *derivate, int derivate_buf_stride, int width, int height); 47 | void xevem_equal_coeff_computer_sse(pel *residue, int residue_stride, int **derivate, int derivate_buf_stride, s64(*equal_coeff)[7], int width, int height, int vertex_num); 48 | #endif /* X86_SSE */ 49 | 50 | #endif /* _XEVEM_MC_SSE_H_ */ 51 | -------------------------------------------------------------------------------- /src_main/xevem_df.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_DF_H_ 37 | #define _XEVEM_DF_H_ 38 | 39 | #include "xevem_type.h" 40 | 41 | int xevem_deblock(XEVE_CTX * ctx, XEVE_PIC * pic, int tile_idx, int filter_across_boundary, XEVE_CORE * core); 42 | void xevem_deblock_unit(XEVE_CTX * ctx, XEVE_PIC * pic, int x, int y, int cuw, int cuh, int is_hor_edge, XEVE_CORE * core, int boundary_filtering); 43 | void xevem_deblock_cu_hor(XEVE_PIC *pic, int x_pel, int y_pel, int cuw, int cuh, u32 *map_scu, s8(*map_refi)[REFP_NUM], s16(*map_mv)[REFP_NUM][MV_D] 44 | , int w_scu, int log2_max_cuwh, XEVE_REFP(*refp)[REFP_NUM], int ats_inter_mode, TREE_CONS tree_cons, u8* map_tidx 45 | , int boundary_filtering, int tool_addb, u8* map_ats_inter, int bit_depth_luma, int bit_depth_chroma, int chroma_formad_idc, int* qp_chroma_dynamic[2]); 46 | void xevem_deblock_cu_ver(XEVE_PIC *pic, int x_pel, int y_pel, int cuw, int cuh, u32 *map_scu, s8(*map_refi)[REFP_NUM], s16(*map_mv)[REFP_NUM][MV_D] 47 | , int w_scu, int log2_max_cuwh, u32 *map_cu, XEVE_REFP(*refp)[REFP_NUM], int ats_inter_mode, TREE_CONS tree_cons, u8 *map_tidx 48 | , int boundary_filtering, int tool_addb, u8* map_ats_inter, int bit_depth_luma, int bit_depth_chroma, int chroma_formad_idc, int* qp_chroma_dynamic[2]); 49 | void xevem_deblock_tree(XEVE_CTX * ctx, XEVE_PIC * pic, int x, int y, int cuw, int cuh, int cud, int cup, int is_hor_edge 50 | , TREE_CONS tree_cons, XEVE_CORE * core, int boundary_filtering); 51 | 52 | #endif /* _XEVEM_DF_H_ */ 53 | -------------------------------------------------------------------------------- /src_main/xevem_dra.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVE_DRA_H_ 37 | #define _XEVE_DRA_H_ 38 | 39 | #include "xeve_def.h" 40 | #include 41 | 42 | // clang-format off 43 | 44 | #define DRA_SCALE_NUMFBITS 9 // # frac. bits for scale (Y/Cb/Cr) 45 | #define DRA_INVSCALE_NUMFBITS 9 // # frac. bits for inv. scale (Y/Cb/Cr) 46 | #define DRA_OFFSET_NUMFBITS 7 // # frac. bits for offset (Y/Cb/Cr) 47 | #define DRA_LUT_MAXSIZE 1024 48 | 49 | #define NUM_CHROMA_QP_OFFSET_LOG 55 50 | #define NUM_CHROMA_QP_SCALE_EXP 25 51 | 52 | typedef struct _QUANT_PARAM_DRA { 53 | 54 | int value; // Currently 32 bit is considered sufficient 55 | int num_frac_bits; 56 | int num_tot_bits; 57 | }QUANT_PARAM_DRA; 58 | 59 | typedef struct _DRA_CHROMA_OFF_CONTROL 60 | { 61 | BOOL enabled; ///< Enabled flag (0:default) 62 | double cb_qp_scale; ///< Chroma Cb QP Scale (1.0:default) 63 | double cr_qp_scale; ///< Chroma Cr QP Scale (1.0:default) 64 | double chroma_qp_scale; ///< Chroma QP Scale (0.0:default) 65 | double chroma_qp_offset; ///< Chroma QP Offset (0.0:default) 66 | int dra_table_idx; 67 | int dra_cb_qp_offset; 68 | int dra_cr_qp_offset; 69 | }DRA_CHROMA_OFF_CONTROL; 70 | 71 | typedef struct _DRA_SCALE_MAPPING 72 | { 73 | double dra_scale_map_y[256][2]; ///< first=luma level, second=delta QP. 74 | } DRA_SCALE_MAPPING; 75 | 76 | typedef struct _SIG_PARAM_DRA 77 | { 78 | int signal_dra_flag; // flag has 3 positions at encoder: -1: not initialized, 0: initialized and sent, 1: initialized, to be sent 79 | int dra_table_idx; 80 | BOOL equal_ranges_flag; 81 | int delta_val; 82 | int num_ranges; 83 | int in_ranges[33]; 84 | int dra_descriptor1; 85 | int dra_descriptor2; 86 | int dra_cb_scale_value; 87 | int dra_cr_scale_value; 88 | int dra_scale_value[33 - 1]; 89 | }SIG_PARAM_DRA; 90 | 91 | typedef struct _DRA_CONTROL 92 | { 93 | BOOL flag_enabled; 94 | DRA_SCALE_MAPPING dra_scale_map; 95 | DRA_CHROMA_OFF_CONTROL chroma_qp_model; 96 | 97 | //------ Signalled DRA Params ------// 98 | int dra_descriptor1; 99 | int dra_descriptor2; 100 | SIG_PARAM_DRA signalled_dra; 101 | 102 | //------ DRA Model ------// 103 | int num_ranges; 104 | int in_ranges[33]; 105 | double out_ranges[33]; 106 | double dra_scales[33 - 1]; 107 | double dra_offets[33 - 1]; 108 | 109 | int dra_cb_scale_value; 110 | int dra_cr_scale_value; 111 | int out_ranges_s32[33]; 112 | int dra_scales_s32[33 - 1]; 113 | int inv_dra_scales_s32[33 - 1]; 114 | int inv_dra_offsets_s32[33 - 1]; 115 | int chroma_dra_scales_s32[2][33 - 1]; 116 | int chroma_inv_dra_scales_s32[2][33 - 1]; 117 | 118 | //------ DRA LUT ------// 119 | int luma_scale_lut[DRA_LUT_MAXSIZE]; // LUT for luma and correspionding QP offset 120 | int xevem_luma_inv_scale_lut[DRA_LUT_MAXSIZE]; // LUT for luma and correspionding QP offset 121 | int int_chroma_scale_lut[2][DRA_LUT_MAXSIZE]; // LUT for chroma scales 122 | int xevem_int_chroma_inv_scale_lut[2][DRA_LUT_MAXSIZE]; // LUT for chroma scales 123 | //------ Gammut mapping ------// 124 | //------ Adaptive mapping ------// 125 | double dra_hist_norm; 126 | int global_offset; 127 | int global_end; 128 | 129 | } DRA_CONTROL; 130 | 131 | // clang-format on 132 | 133 | void xeve_init_dra(DRA_CONTROL *dra_mapping, int total_change_points, int *luma_change_points, int* qps, int bit_depth); 134 | int xeve_analyze_input_pic(XEVE_CTX * ctx, DRA_CONTROL *dra_mapping, int bit_depth); 135 | int xeve_generate_dra_array(XEVE_CTX * ctx, SIG_PARAM_DRA * dra_control_array, DRA_CONTROL * tmp_dra_control, int num_aps, int bit_depth); 136 | 137 | /* DRA APS buffer functions are listed below: */ 138 | void xeve_reset_aps_gen_read_buffer(XEVE_APS_GEN *tmp_aps_gen_array); 139 | void xeve_apply_dra_from_array(XEVE_CTX * ctx, XEVE_IMGB * dst, XEVE_IMGB * src, SIG_PARAM_DRA * dra_control_array, int dra_id, int backward_map); 140 | 141 | int xevem_set_active_dra_info(XEVE_CTX * ctx); 142 | 143 | #endif 144 | /* _XEVE_DRA_H_ */ 145 | -------------------------------------------------------------------------------- /src_main/xevem_eco.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_ECO_H_ 37 | #define _XEVEM_ECO_H_ 38 | 39 | #include "xeve_def.h" 40 | #include "xevem_type.h" 41 | 42 | void xevem_sbac_reset(XEVE_SBAC *sbac, u8 slice_type, u8 slice_qp, int sps_cm_init_flag); 43 | int xevem_eco_aps_gen(XEVE_BSW * bs, XEVE_APS_GEN * aps, int bit_depth); 44 | int xevem_eco_sps(XEVE_BSW * bs, XEVE_SPS * sps); 45 | int xevem_eco_pps(XEVE_BSW * bs, XEVE_SPS * sps, XEVE_PPS * pps); 46 | int xevem_eco_sh(XEVE_BSW * bs, XEVE_SPS * sps, XEVE_PPS * pps, XEVE_SH * sh, int nut); 47 | int xevem_eco_split_mode(XEVE_BSW *bs, XEVE_CTX *c, XEVE_CORE *core, int cud, int cup, int cuw, int cuh, int lcu_s, int x, int y); 48 | int xevem_eco_unit(XEVE_CTX * ctx, XEVE_CORE * core, int x, int y, int cup, int cuw, int cuh, TREE_CONS tree_cons, XEVE_BSW * bs); 49 | int xevem_eco_intra_dir(XEVE_BSW *bs, u8 ipm, u8 mpm[2], u8 mpm_ext[8], u8 pims[IPD_CNT]); 50 | int xevem_eco_intra_dir_c(XEVE_BSW *bs, u8 ipm, u8 ipm_l); 51 | void xevem_intra_mode_write_trunc_binary(int symbol, int max_symbol, XEVE_SBAC *sbac, XEVE_BSW *bs); 52 | void xevem_eco_ibc_flag(XEVE_BSW * bs, int flag, int ctx); 53 | int xevem_eco_mode_constr(XEVE_BSW * bs, MODE_CONS mode_cons, int ctx); 54 | int xevem_eco_suco_flag(XEVE_BSW *bs, XEVE_CTX *c, XEVE_CORE *core, int cud, int cup, int cuw, int cuh, int lcu_s, s8 split_mode, int boundary, u8 log2_max_cuwh); 55 | int xevem_eco_mvr_idx(XEVE_BSW *bs, u8 mvr_idx); 56 | int xevem_eco_merge_idx(XEVE_BSW *bs, int merge_idx); 57 | void xevem_eco_merge_mode_flag(XEVE_BSW *bs, int merge_mode_flag); 58 | int xevem_eco_bi_idx(XEVE_BSW * bs, u8 bi_idx); 59 | void xevem_eco_mmvd_flag(XEVE_BSW * bs, int flag); 60 | int xevem_eco_mmvd_info(XEVE_BSW *bs, int mvp_idx, int type); 61 | int xevem_eco_affine_mvp_idx(XEVE_BSW *bs, int mvp_idx); 62 | void xevem_eco_affine_flag(XEVE_BSW * bs, int flag, int ctx); 63 | void xevem_eco_affine_mode(XEVE_BSW * bs, int flag); 64 | int xevem_eco_affine_mrg_idx(XEVE_BSW *bs, s16 affine_mrg_idx); 65 | void xevem_eco_affine_mvd_flag(XEVE_BSW *bs, int flag, int refi); 66 | int xevem_eco_coef_main(XEVE_CTX * ctx, XEVE_CORE * core, XEVE_BSW * bs, s16 coef[N_C][MAX_CU_DIM], u8 pred_mode, int enc_dqp, int b_no_cbf, int run_stats); 67 | void xevem_eco_alf_golomb(XEVE_BSW * bs, int coeff, int k_min_tab, const BOOL signed_coeff); 68 | int xevem_eco_alf_aps_param(XEVE_BSW * bs, XEVE_APS_GEN * aps); 69 | int xevem_eco_alf_sh_param(XEVE_BSW * bs, XEVE_SH * sh); 70 | int xevem_eco_dra_aps_param(XEVE_BSW * bs, XEVE_APS_GEN * aps, int bit_depth); 71 | int xeve_eco_udata_hdr(XEVE_CTX * ctx, XEVE_BSW * bs, u8 pic_sign[N_C][16]); 72 | int xeve_eco_pic_signature_main(XEVE_CTX * ctx, XEVE_BSW * bs, u8 pic_sign[N_C][16]); 73 | #if GRAB_STAT 74 | void ence_stat_cu(int x, int y, int cuw, int cuh, int cup, void *ctx, void *core, TREE_CONS tree_cons); 75 | #endif 76 | #endif /* _XEVE_ECO_H_ */ 77 | -------------------------------------------------------------------------------- /src_main/xevem_ibc_hash.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef __XEVE_IBC_HASH__ 37 | #define __XEVE_IBC_HASH__ 38 | 39 | // clang-format off 40 | 41 | #include 42 | #include "xeve_def.h" 43 | #include "xevem_type.h" 44 | 45 | typedef struct _POSITION 46 | { 47 | int x, y; 48 | }POSITION; 49 | 50 | typedef struct _POS_NODE 51 | { 52 | struct _POS_NODE * next; 53 | u32 key; 54 | u16 x, y; 55 | }POS_NODE; 56 | 57 | typedef struct _HASH_KEY_NODE 58 | { 59 | u32 key; 60 | u32 size; 61 | POS_NODE * pos; 62 | POS_NODE * pos_end; 63 | struct _HASH_KEY_NODE * next; 64 | }HASH_KEY_NODE; 65 | 66 | struct _XEVE_IBC_HASH 67 | { 68 | int pic_width; 69 | int pic_height; 70 | int search_range_4small_blk; 71 | u32 hash_table_size; 72 | u32 max_hash_cand; 73 | u32 cand_num; 74 | 75 | POS_NODE ** map_pos_to_hash; 76 | HASH_KEY_NODE * map_hash_to_pos; 77 | u8 * map_hash_to_pos_used; 78 | POS_NODE * cand_pos; 79 | }; 80 | 81 | XEVE_IBC_HASH * xeve_ibc_hash_create(XEVE_CTX * ctx, int pic_width, int pic_height); 82 | int xeve_ibc_hash_init(XEVE_CTX * ctx, XEVE_IBC_HASH * ibc_hash, const int pic_width, const int pic_height); 83 | void xeve_ibc_hash_destroy(XEVE_IBC_HASH * ibc_hash); 84 | void xeve_ibc_hash_clear(XEVE_IBC_HASH * ibc_hash); 85 | void xeve_ibc_hash_insert(XEVE_IBC_HASH * ibc_hash, u32 key, u16 x, u16 y); 86 | void xeve_ibc_hash_rebuild(XEVE_IBC_HASH * ibc_hash, const XEVE_PIC* pic); 87 | void xeve_ibc_hash_build(XEVE_IBC_HASH * ibc_hash, const XEVE_PIC* pic); 88 | BOOL xeve_ibc_hash_match(XEVE_CTX *ctx, XEVE_IBC_HASH * ibc_hash, int cu_x, int cu_y, int log2_cuw, int log2_cuh); 89 | u32 xeve_ibc_hash_search(XEVE_CTX *ctx, XEVE_IBC_HASH* p, int cu_x, int cu_y, int log2_cuw, int log2_cuh, s16 mvp[MV_D], s16 mv[MV_D], XEVE_CORE * core); 90 | int xeve_ibc_hash_hit_ratio(XEVE_CTX* ctx, XEVE_IBC_HASH* p, int cu_x, int cu_y, int log2_cuw, int log2_cuh); 91 | HASH_KEY_NODE * xeve_ibc_hash_get_key_node(XEVE_IBC_HASH * ibc_hash, u32 key); 92 | u32 xeve_ibc_hash_calc_block_key(const pel* pel, const int stride, const int width, const int height, unsigned int crc); 93 | u32 xeve_ibc_hash_crc32_16bit(u32 crc, const pel pel); 94 | 95 | // clang-format on 96 | 97 | #endif // __XEVE_IBC_HASH__ 98 | -------------------------------------------------------------------------------- /src_main/xevem_ipred.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_IPRED_H_ 37 | #define _XEVEM_IPRED_H_ 38 | 39 | #include "xeve_def.h" 40 | 41 | // clang-format off 42 | 43 | #define XEVE_IPRED_CHK_CONV(mode)\ 44 | ((mode) == IPD_VER || (mode) == IPD_HOR || (mode) == IPD_DC || (mode) == IPD_BI) 45 | 46 | #define XEVE_IPRED_CONV_L2C(mode)\ 47 | ((mode) == IPD_VER) ? IPD_VER_C : \ 48 | ((mode) == IPD_HOR ? IPD_HOR_C : ((mode) == IPD_DC ? IPD_DC_C : IPD_BI_C)) 49 | 50 | #define XEVE_IPRED_CONV_L2C_CHK(mode, chk) \ 51 | if(XEVE_IPRED_CHK_CONV(mode)) \ 52 | {\ 53 | (mode) = ((mode) == IPD_VER) ? IPD_VER_C : ((mode) == IPD_HOR ? IPD_HOR_C:\ 54 | ((mode) == IPD_DC ? IPD_DC_C : IPD_BI_C)); \ 55 | (chk) = 1; \ 56 | }\ 57 | else \ 58 | (chk) = 0; 59 | 60 | // clang-format on 61 | 62 | void xevem_get_nbr(int x, int y, int cuw, int cuh, pel *src, int s_src, u16 avail_cu, pel nb[N_C][N_REF][MAX_CU_SIZE * 3], int scup, u32 *map_scu 63 | , int w_scu, int h_scu, int ch_type, int constrained_intra_pred, u8 * map_tidx, int bit_depth, int chroma_format_idc); 64 | void xevem_ipred(pel *src_le, pel *src_up, pel *src_ri, u16 avail_lr, pel *dst, int ipm, int w, int h, int bit_depth); 65 | void xevem_ipred_uv(pel *src_le, pel *src_up, pel *src_ri, u16 avail_lr, pel *dst, int ipm_c, int ipm, int w, int h, int bit_depth); 66 | void xevem_get_mpm(int x_scu, int y_scu, int cuw, int cuh, u32 * map_scu, s8 * map_ipm, int scup, int w_scu, u8 mpm[2], u16 avail_lr, u8 mpm_ext[8], u8 pms[IPD_CNT], u8 * map_tidx); 67 | 68 | typedef void(*XEVE_INTRA_PRED_ANG)(pel *src_le, pel *src_up, pel *src_ri, u16 avail_lr, pel *dst, int w, int h, int ipm, int bit_depth); 69 | extern const XEVE_INTRA_PRED_ANG xeve_tbl_intra_pred_ang[3][2]; 70 | extern const XEVE_INTRA_PRED_ANG (*xeve_func_intra_pred_ang)[2]; 71 | 72 | #endif /* _XEVEM_IPRED_H_ */ 73 | -------------------------------------------------------------------------------- /src_main/xevem_itdq.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_ITDQ_H_ 37 | #define _XEVEM_ITDQ_H_ 38 | 39 | #include "xevem_type.h" 40 | 41 | extern const XEVE_INV_TRANS (*xeve_func_itrans)[5]; 42 | extern const XEVE_INV_TRANS xeve_itrans_map_tbl[16][5]; 43 | 44 | void xevem_itdq(XEVE_CTX* ctx, XEVE_CORE* core, s16 coef[N_C][MAX_CU_DIM], int nnz_sub[N_C][MAX_SUB_TB_NUM]); 45 | void xeve_itrans_ats_intra(s16 *coef, int log2_cuw, int log2_cuh, u8 ats_mode, int skip_w, int skip_h, int bit_depth); 46 | void xeve_it_MxN_ats_intra(s16 *coef, int tuw, int tuh, int bit_depth, const int max_log2_tr_dynamic_range, u8 ats_intra_tridx, int skip_w, int skip_h); 47 | void xeve_itrans_ats_intra_DST7_B4(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 48 | void xeve_itrans_ats_intra_DST7_B8(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 49 | void xeve_itrans_ats_intra_DST7_B16(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 50 | void xeve_itrans_ats_intra_DST7_B32(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 51 | void xeve_itrans_ats_intra_DCT8_B4(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 52 | void xeve_itrans_ats_intra_DCT8_B8(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 53 | void xeve_itrans_ats_intra_DCT8_B16(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 54 | void xeve_itrans_ats_intra_DCT8_B32(s16 *coeff, s16 *block, int shift, int line, int skip_line, int skip_line_2); 55 | void itx_pb4(s16* src, s16* dst, int shift, int line); 56 | void itx_pb8(s16* src, s16* dst, int shift, int line); 57 | void itx_pb16(s16* src, s16* dst, int shift, int line); 58 | void itx_pb32(s16* src, s16* dst, int shift, int line); 59 | void itx_pb64(s16* src, s16* dst, int shift, int line); 60 | 61 | extern const XEVE_ITX(*xeve_func_itx)[MAX_TR_LOG2]; 62 | extern const XEVE_ITX xeve_tbl_itx[MAX_TR_LOG2]; 63 | #endif /* _XEVEM_ITDQ_H_ */ 64 | -------------------------------------------------------------------------------- /src_main/xevem_mc.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_MC_H_ 37 | #define _XEVEM_MC_H_ 38 | 39 | 40 | extern const s16 xevem_tbl_mc_l_coeff[16][8]; 41 | extern const s16 xevem_tbl_mc_c_coeff[32][4]; 42 | 43 | extern const s16 xeve_tbl_bl_mc_l_coeff[16][2]; 44 | extern const s16 tbl_bl_eif_32_phases_mc_l_coeff[32][2]; 45 | 46 | typedef void (*XEVEM_MC) (pel *ref, int gmv_x, int gmv_y, int s_ref, int s_pred, pel *pred, int w, int h, int bit_depth); 47 | typedef int (*XEVE_DMVR_SAD_MR)(int w, int h, void * src1, void * src2, int s_src1, int s_src2, s16 delta); 48 | 49 | extern const XEVEM_MC xevem_tbl_dmvr_mc_l[2][2]; 50 | extern const XEVEM_MC xevem_tbl_dmvr_mc_c[2][2]; 51 | extern const XEVEM_MC xevem_tbl_bl_mc_l[2][2]; 52 | 53 | extern const XEVEM_MC (*xevem_func_dmvr_mc_l)[2]; 54 | extern const XEVEM_MC (*xevem_func_dmvr_mc_c)[2]; 55 | extern const XEVEM_MC (*xevem_func_bl_mc_l)[2]; 56 | 57 | #define xeve_dmvr_mc_l(ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth) \ 58 | (xevem_func_dmvr_mc_l[((gmv_x) | ((gmv_x)>>1) | ((gmv_x)>>2) | ((gmv_x)>>3)) & 0x1])\ 59 | [((gmv_y) | ((gmv_y)>>1) | ((gmv_y)>>2) | ((gmv_y)>>3)) & 0x1]\ 60 | (ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth) 61 | 62 | #define xeve_dmvr_mc_c(ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth) \ 63 | (xevem_func_dmvr_mc_c[((gmv_x) | ((gmv_x)>>1) | ((gmv_x)>>2)| ((gmv_x)>>3) | ((gmv_x)>>4)) & 0x1]\ 64 | [((gmv_y) | ((gmv_y)>>1) | ((gmv_y)>>2) | ((gmv_y)>>3) | ((gmv_y)>>4)) & 0x1])\ 65 | (ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth) 66 | 67 | #define xeve_bl_mc_l(ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth) \ 68 | (xevem_func_bl_mc_l[((gmv_x) | ((gmv_x)>>1) | ((gmv_x)>>2) | ((gmv_x)>>3)) & 0x1])\ 69 | [((gmv_y) | ((gmv_y)>>1) | ((gmv_y)>>2) | ((gmv_y)>>3)) & 0x1]\ 70 | (ref, gmv_x, gmv_y, s_ref, s_pred, pred, w, h, bit_depth) 71 | 72 | void xevem_mc(int x, int y, int pic_w, int pic_h, int w, int h, s8 refi[REFP_NUM], s16(*mv)[MV_D], XEVE_REFP(*refp)[REFP_NUM], pel pred[REFP_NUM][N_C][MAX_CU_DIM] 73 | , int poc_c, pel *dmvr_ref_pred_template, pel dmvr_ref_pred_interpolated[REFP_NUM][(MAX_CU_SIZE + ((DMVR_NEW_VERSION_ITER_COUNT + 1) * REF_PRED_EXTENTION_PEL_COUNT)) * (MAX_CU_SIZE + ((DMVR_NEW_VERSION_ITER_COUNT + 1) * REF_PRED_EXTENTION_PEL_COUNT))] 74 | , pel dmvr_half_pred_interpolated[REFP_NUM][(MAX_CU_SIZE + 1) * (MAX_CU_SIZE + 1)], BOOL apply_DMVR, pel dmvr_padding_buf[REFP_NUM][N_C][PAD_BUFFER_STRIDE * PAD_BUFFER_STRIDE] 75 | , u8 *cu_dmvr_flag, s16 dmvr_mv[MAX_CU_CNT_IN_LCU][REFP_NUM][MV_D], int sps_admvp_flag, int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc); 76 | 77 | void xeve_IBC_mc(int x, int y, int log2_cuw, int log2_cuh, s16 mv[MV_D], XEVE_PIC *ref_pic, pel pred[N_C][MAX_CU_DIM], TREE_CONS tree_cons, int chroma_format_idc); 78 | void xeve_affine_mc(int x, int y, int pic_w, int pic_h, int w, int h, s8 refi[REFP_NUM], s16 mv[REFP_NUM][VER_NUM][MV_D], XEVE_REFP(*refp)[REFP_NUM] 79 | , pel pred[2][N_C][MAX_CU_DIM], int vertex_num, pel* tmp_buffer, int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc); 80 | void xeve_affine_mc_l(int x, int y, int pic_w, int pic_h, int cuw, int cuh, s16 ac_mv[VER_NUM][MV_D], XEVE_PIC* ref_pic, pel pred[MAX_CU_DIM] 81 | , int vertex_num, pel* tmp_buffer, int bit_depth_luma, int bit_depth_chroma, int chroma_format_idc); 82 | 83 | void xevem_scaled_horizontal_sobel_filter(pel *pred, int pred_stride, int *derivate, int derivate_buf_stride, int width, int height); 84 | void xevem_scaled_vertical_sobel_filter(pel *pred, int pred_stride, int *derivate, int derivate_buf_stride, int width, int height); 85 | void xevem_equal_coeff_computer(pel *residue, int residue_stride, int **derivate, int derivate_buf_stride, s64(*equal_coeff)[7], int width, int height, int vertex_num); 86 | 87 | typedef void (*XEVE_AFFINE_H_SOBEL_FLT)(pel *pred, int pred_stride, int *derivate, int derivate_buf_stride, int width, int height); 88 | typedef void (*XEVE_AFFINE_V_SOBEL_FLT)(pel *pred, int pred_stride, int *derivate, int derivate_buf_stride, int width, int height); 89 | typedef void (*XEVE_AFFINE_EQUAL_COEF)(pel *residue, int residue_stride, int **derivate, int derivate_buf_stride, s64(*equal_coeff)[7], int width, int height, int vertex_num); 90 | 91 | extern XEVE_AFFINE_H_SOBEL_FLT xevem_func_aff_h_sobel_flt; 92 | extern XEVE_AFFINE_V_SOBEL_FLT xevem_func_aff_v_sobel_flt; 93 | extern XEVE_AFFINE_EQUAL_COEF xevem_func_aff_eq_coef_comp; 94 | 95 | #endif /* _XEVEM_MC_H_ */ 96 | -------------------------------------------------------------------------------- /src_main/xevem_mode.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_MODE_H_ 37 | #define _XEVEM_MODE_H_ 38 | 39 | #include "xeve_mode.h" 40 | 41 | void xeve_rdo_bit_cnt_cu_skip_main(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, int mvp_idx0, int mvp_idx1, int c_num, int tool_mmvd); 42 | void xeve_rdo_bit_cnt_affine_mvp(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s8 refi[REFP_NUM], s16 mvd[REFP_NUM][VER_NUM][MV_D], int pidx, int mvp_idx, int vertex_num); 43 | void xeve_rdo_bit_cnt_cu_ibc(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s16 mvd[MV_D], s16 coef[N_C][MAX_CU_DIM], u8 mvp_idx, u8 pred_mode); 44 | void xeve_rdo_bit_cnt_cu_inter_main(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s8 refi[REFP_NUM], s16 mvd[REFP_NUM][MV_D], s16 coef[N_C][MAX_CU_DIM], int pidx, u8 * mvp_idx, u8 mvr_idx, u8 bi_idx, s16 affine_mvd[REFP_NUM][VER_NUM][MV_D]); 45 | void xeve_rdo_bit_cnt_cu_intra_main(XEVE_CTX * ctx, XEVE_CORE * core, s32 slice_type, s32 cup, s16 coef[N_C][MAX_CU_DIM]); 46 | void xeve_rdo_bit_cnt_intra_dir_main(XEVE_CTX * ctx, XEVE_CORE * core, int ipm); 47 | void xevem_rdo_bit_cnt_intra_ext(XEVE_CTX * ctx, XEVE_CORE * core); 48 | void xevem_rdo_bit_cnt_intra_ext_c(XEVE_CTX * ctx, XEVE_CORE * core); 49 | void update_history_buffer_affine(XEVE_HISTORY_BUFFER *history_buffer, XEVE_MODE *mi, int slice_type, XEVE_CORE *core); 50 | void mode_reset_intra_main(XEVE_CORE *core); 51 | void xeve_mode_create_main(XEVE_CTX * ctx); 52 | void copy_to_cu_data_main(XEVE_CTX *ctx, XEVE_CORE *core, XEVE_MODE *mi, s16 coef_src[N_C][MAX_CU_DIM]); 53 | void xeve_split_tbl_init(XEVE_CTX *ctx); 54 | void xeve_set_affine_mvf(XEVE_CTX * ctx, XEVE_CORE * core, int w, int h, s8 refi[REFP_NUM], s16 mv[REFP_NUM][VER_NUM][MV_D], int vertex_num); 55 | int xeve_hmvp_init(XEVE_HISTORY_BUFFER *history_buffer); 56 | void xeve_init_bef_data(XEVE_CORE * core, XEVE_CTX * ctx); 57 | #endif /* _XEVE_MODE_H_ */ 58 | -------------------------------------------------------------------------------- /src_main/xevem_picman.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_PICMAN_H_ 37 | #define _XEVEM_PICMAN_H_ 38 | 39 | #include "xevem_type.h" 40 | 41 | extern const XEVE_RPL pre_define_rpls[2][4][2][XEVE_MAX_NUM_RPLS]; /* [Reordering] [GOP size 4, 8, 16] [List 0, 1] */ 42 | 43 | void select_assign_rpl_for_sh(XEVE_CTX *ctx, XEVE_SH *sh); 44 | int xeve_picman_rpl_refp_init(XEVE_CTX * ctx, XEVE_SH *sh); 45 | 46 | #endif /* _XEVEM_PICMAN_H_ */ 47 | -------------------------------------------------------------------------------- /src_main/xevem_pred.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_PRED_H_ 37 | #define _XEVEM_PRED_H_ 38 | 39 | #include "xevem_type.h" 40 | 41 | /* Intra prediction */ 42 | int xevem_pintra_create(XEVE_CTX * ctx, int complexity); 43 | 44 | /* Inter prediction */ 45 | int xevem_pinter_create(XEVE_CTX * ctx, int complexity); 46 | 47 | /* IBC prediction */ 48 | #define GET_BV_COST(ctx, mv_bits) ((u32)(core->sqrt_lambda[0] * mv_bits / 65536.0)) 49 | 50 | u32 get_bv_cost_bits(int mv_x, int mv_y); 51 | int xevem_pibc_create(XEVE_CTX * ctx, int complexity); 52 | 53 | void reset_ibc_search_range(XEVE_CTX *ctx, int cu_x, int cu_y, int log2_cuw, int log2_cuh, XEVE_CORE * core); 54 | int is_bv_valid(XEVE_CTX *ctx, int x, int y, int width, int height, int log2_cuw, int log2_cuh 55 | , int pic_width, int pic_height, int x_bv, int y_bv, int ctu_size, XEVE_CORE * core); 56 | 57 | #endif /* _XEVEM_PRED_H_ */ 58 | -------------------------------------------------------------------------------- /src_main/xevem_recon.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_RECON_H_ 37 | #define _XEVEM_RECON_H_ 38 | 39 | void xeve_recon_w_ats(s16 *coef, pel *pred, int is_coef, int cuw, int cuh, int s_rec, pel *rec, u8 ats_inter_info, int bit_depth); 40 | 41 | void xeve_htdf(s16* rec, int qp, int w, int h, int s, BOOL intra_block_flag, pel* rec_pic, int s_pic, int avail_cu 42 | , int scup, int w_scu, int h_scu, u32 * map_scu, int constrained_intra_pred, int bit_depth); 43 | 44 | #endif /* _XEVEM_RECON_H_ */ 45 | -------------------------------------------------------------------------------- /src_main/xevem_stat.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "xevem_stat.h" 32 | #include 33 | 34 | #if GRAB_STAT 35 | typedef struct _STAT_DEBUG 36 | { 37 | FILE* f; 38 | ENUM_STAT_USAGE usage; 39 | int start_poc; 40 | int end_poc; 41 | Stat_Log stat_log; 42 | 43 | int cur_poc; 44 | BOOL isRDO; 45 | BOOL started; 46 | 47 | BOOL active; 48 | } STAT_DEBUG; 49 | 50 | STAT_DEBUG g_stat; 51 | 52 | static void stat_check_conditions() 53 | { 54 | BOOL poc_state = FALSE; 55 | if (g_stat.end_poc == -1) 56 | poc_state = (g_stat.started || (g_stat.cur_poc == g_stat.start_poc)); 57 | else 58 | poc_state = (g_stat.cur_poc >= g_stat.start_poc) && (g_stat.cur_poc <= g_stat.end_poc); 59 | BOOL enc_state = (g_stat.usage == esu_rdo_and_enc) || (g_stat.usage == (g_stat.isRDO ? esu_only_rdo : esu_only_enc)); 60 | g_stat.active = poc_state && enc_state; 61 | 62 | if (g_stat.active && !g_stat.started && (g_stat.cur_poc == g_stat.start_poc)) 63 | g_stat.started = TRUE; 64 | } 65 | 66 | void xeve_stat_init(const char *fileName, ENUM_STAT_USAGE usage, int start_poc, int end_poc, Stat_Log stat_log) 67 | { 68 | g_stat.f = fopen(fileName, "w"); 69 | g_stat.usage = usage; 70 | g_stat.cur_poc = 0; 71 | g_stat.start_poc = start_poc; 72 | g_stat.end_poc = end_poc; 73 | g_stat.active = FALSE; 74 | g_stat.isRDO = TRUE; 75 | g_stat.started = FALSE; 76 | g_stat.stat_log = stat_log; 77 | } 78 | 79 | void xeve_stat_write_cu_str(int x, int y, int cuw, int cuh, const char* name, int value) 80 | { 81 | if (g_stat.active) 82 | { 83 | fprintf(g_stat.f, "BlockStat: POC %d @(%4d,%4d) [%2dx%2d] %s=%d\n", g_stat.cur_poc, x, y, cuw, cuh, name, value); 84 | } 85 | } 86 | 87 | void xeve_stat_write_cu_vec(int x, int y, int cuw, int cuh, const char* name, int vec_x, int vec_y) 88 | { 89 | if (g_stat.active) 90 | { 91 | fprintf(g_stat.f, "BlockStat: POC %d @(%4d,%4d) [%2dx%2d] %s={%4d,%4d}\n", g_stat.cur_poc, x, y, cuw, cuh, name, vec_x, vec_y); 92 | } 93 | } 94 | 95 | 96 | void xeve_stat_write_comment(const char* format, ...) 97 | { 98 | va_list args; 99 | va_start(args, format); 100 | fprintf(g_stat.f, "# "); 101 | vfprintf(g_stat.f, format, args); 102 | fprintf(g_stat.f, "\n"); 103 | va_end(args); 104 | } 105 | void xeve_stat_write_type(const char* name, const char* type, const char* range) 106 | { 107 | fprintf(g_stat.f, "# Block Statistic Type: %s; %s; ", name, type); 108 | if (range) 109 | fprintf(g_stat.f, range); 110 | fprintf(g_stat.f, "\n"); 111 | } 112 | 113 | 114 | static void xeve_stat_tree(void *ctx, void *core, int x, int y, int cuw, int cuh, int cup, int cud, int lcu_size, int pic_w, int pic_h, int log2_culine, s8(*map_split)[NUM_BLOCK_SHAPE][MAX_CU_CNT_IN_LCU], s8(*map_suco)[NUM_BLOCK_SHAPE][MAX_CU_CNT_IN_LCU], TREE_CONS tree_cons) 115 | { 116 | s8 split_mode; 117 | s8 suco_flag = 0; 118 | 119 | xeve_get_split_mode(&split_mode, cud, cup, cuw, cuh, lcu_size, map_split); 120 | xeve_get_suco_flag(&suco_flag, cud, cup, cuw, cuh, lcu_size, map_suco); 121 | 122 | if (split_mode != NO_SPLIT) 123 | { 124 | XEVE_SPLIT_STRUCT split_struct; 125 | int suco_order[SPLIT_MAX_PART_COUNT]; 126 | 127 | xeve_split_get_part_structure(split_mode, x, y, cuw, cuh, cup, cud, log2_culine, &split_struct); 128 | xeve_split_get_suco_order(suco_flag, split_mode, suco_order); 129 | 130 | BOOL mode_cons_changed = xeve_signal_mode_cons(&tree_cons, &split_struct.tree_cons); 131 | 132 | for (int part_num = 0; part_num < split_struct.part_count; ++part_num) 133 | { 134 | int cur_part_num = suco_order[part_num]; 135 | int sub_cuw = split_struct.width[cur_part_num]; 136 | int sub_cuh = split_struct.height[cur_part_num]; 137 | int x_pos = split_struct.x_pos[cur_part_num]; 138 | int y_pos = split_struct.y_pos[cur_part_num]; 139 | 140 | if (x_pos < pic_w && y_pos < pic_h) 141 | { 142 | xeve_stat_tree(ctx, core, x_pos, y_pos, sub_cuw, sub_cuh, split_struct.cup[cur_part_num], split_struct.cud[cur_part_num], lcu_size, pic_w, pic_h, log2_culine, map_split, map_suco 143 | , split_struct.tree_cons); 144 | } 145 | } 146 | 147 | if (mode_cons_changed && !xeve_check_all(split_struct.tree_cons)) 148 | { 149 | TREE_CONS local_cons = split_struct.tree_cons; 150 | local_cons.tree_type = TREE_C; 151 | g_stat.stat_log(x, y, cuw, cuh, cup, ctx, core, local_cons); 152 | } 153 | } 154 | else 155 | { 156 | g_stat.stat_log(x, y, cuw, cuh, cup, ctx, core, tree_cons); 157 | } 158 | 159 | } 160 | 161 | void xeve_stat_write_lcu(int x, int y, int pic_w, int pic_h, int lcu_size, int log2_culine, void *ctx, void *core, s8(*map_split)[NUM_BLOCK_SHAPE][MAX_CU_CNT_IN_LCU], s8(*map_suco)[NUM_BLOCK_SHAPE][MAX_CU_CNT_IN_LCU]) 162 | { 163 | xeve_stat_tree(ctx, core, x, y, lcu_size, lcu_size, 0, 0, lcu_size, pic_w, pic_h, log2_culine, map_split, map_suco 164 | , xeve_get_default_tree_cons() ); 165 | } 166 | 167 | void xeve_stat_finish() 168 | { 169 | fclose(g_stat.f); 170 | } 171 | 172 | void xeve_stat_set_poc(int poc) 173 | { 174 | g_stat.cur_poc = poc; 175 | stat_check_conditions(); 176 | } 177 | 178 | void xeve_stat_set_enc_state(BOOL isRDO) 179 | { 180 | g_stat.isRDO = isRDO; 181 | stat_check_conditions(); 182 | } 183 | 184 | #endif -------------------------------------------------------------------------------- /src_main/xevem_stat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020, Samsung Electronics Co., Ltd. 2 | All Rights Reserved. */ 3 | /* 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | - Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the copyright owner, nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #pragma once 32 | #ifndef _XEVEM_STAT_H_ 33 | #define _XEVEM_STAT_H_ 34 | #include "xevem_type.h" 35 | #if GRAB_STAT 36 | 37 | typedef enum _ENUM_STAT_USAGE 38 | { 39 | esu_only_enc, 40 | esu_only_rdo, 41 | esu_rdo_and_enc, 42 | } ENUM_STAT_USAGE; 43 | 44 | typedef void(*Stat_Log)(int x, int y, int cuw, int cuh, int cup, void *ctx, void *core, TREE_CONS tree_cons); 45 | 46 | void xeve_stat_init(const char *fileName, ENUM_STAT_USAGE usage, int start_poc, int end_poc, Stat_Log stat_log); 47 | 48 | void xeve_stat_set_poc(int poc); 49 | 50 | void xeve_stat_set_enc_state(BOOL isRDO); 51 | 52 | void xeve_stat_write_lcu(int x, int y, int pic_w, int pic_h, int lcu_size, int log2_culine, void *ctx, void *core, s8(*map_split)[NUM_BLOCK_SHAPE][MAX_CU_CNT_IN_LCU], s8(*map_suco)[NUM_BLOCK_SHAPE][MAX_CU_CNT_IN_LCU]); 53 | 54 | void xeve_stat_write_cu_str(int x, int y, int cuw, int cuh, const char* name, int value); 55 | void xeve_stat_write_cu_vec(int x, int y, int cuw, int cuh, const char* name, int vec_x, int vec_y); 56 | void xeve_stat_write_comment(const char* format, ...); 57 | void xeve_stat_write_type(const char* name, const char* type, const char* range); 58 | 59 | void xeve_stat_finish(); 60 | #endif 61 | 62 | #endif -------------------------------------------------------------------------------- /src_main/xevem_tbl.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_TBL_H_ 37 | #define _XEVEM_TBL_H_ 38 | 39 | #include "xeve_def.h" 40 | 41 | extern const u8 xevem_tbl_split_flag_ctx[6][6]; 42 | extern const int xevem_tbl_dq_scale[6]; 43 | extern const int xevem_tbl_ipred_adi[32][4]; 44 | extern const int xevem_tbl_ipred_dxdy[IPD_CNT][2]; 45 | extern const int xevem_tbl_qp_chroma_ajudst[XEVE_MAX_QP_TABLE_SIZE]; 46 | 47 | extern const s16 xevem_init_cbf_luma[2][NUM_CTX_CBF_LUMA]; 48 | extern const s16 xevem_init_cbf_cb[2][NUM_CTX_CBF_CR]; 49 | extern const s16 xevem_init_cbf_cr[2][NUM_CTX_CBF_CB]; 50 | extern const s16 xevem_init_cbf_all[2][NUM_CTX_CBF_ALL]; 51 | extern const s16 xevem_init_dqp[2][NUM_CTX_DELTA_QP]; 52 | extern const s16 xevem_init_pred_mode[2][NUM_CTX_PRED_MODE]; 53 | extern const s16 xevem_init_mode_cons[2][NUM_CTX_MODE_CONS]; 54 | extern const s16 xevem_init_direct_mode_flag[2][NUM_CTX_DIRECT_MODE_FLAG]; 55 | extern const s16 xevem_init_merge_mode_flag[2][NUM_CTX_MERGE_MODE_FLAG]; 56 | extern const s16 xevem_init_inter_dir[2][NUM_CTX_INTER_PRED_IDC]; 57 | extern const s16 xevem_init_intra_dir[2][NUM_CTX_INTRA_PRED_MODE]; 58 | extern const s16 xevem_init_intra_luma_pred_mpm_flag[2][NUM_CTX_INTRA_LUMA_PRED_MPM_FLAG]; 59 | extern const s16 xevem_init_intra_luma_pred_mpm_idx[2][NUM_CTX_INTRA_LUMA_PRED_MPM_IDX]; 60 | extern const s16 xevem_init_intra_chroma_pred_mode[2][NUM_CTX_INTRA_CHROMA_PRED_MODE]; 61 | extern const s16 xevem_init_mmvd_flag[2][NUM_CTX_MMVD_FLAG]; 62 | extern const s16 xevem_init_mmvd_merge_idx[2][NUM_CTX_MMVD_MERGE_IDX]; 63 | extern const s16 xevem_init_mmvd_distance_idx[2][NUM_CTX_MMVD_DIST_IDX]; 64 | extern const s16 xevem_init_mmvd_direction_idx[2][NUM_CTX_MMVD_DIRECTION_IDX]; 65 | extern const s16 xevem_init_mmvd_group_idx[2][NUM_CTX_MMVD_GROUP_IDX]; 66 | extern const s16 xevem_init_merge_idx[2][NUM_CTX_MERGE_IDX]; 67 | extern const s16 xevem_init_mvp_idx[2][NUM_CTX_MVP_IDX]; 68 | extern const s16 xevem_init_affine_mvp_idx[2][NUM_CTX_AFFINE_MVP_IDX]; 69 | extern const s16 xevem_init_mvr_idx[2][NUM_CTX_AMVR_IDX]; 70 | extern const s16 xevem_init_bi_idx[2][NUM_CTX_BI_PRED_IDX]; 71 | extern const s16 xevem_init_mvd[2][NUM_CTX_MVD]; 72 | extern const s16 xevem_init_refi[2][NUM_CTX_REF_IDX]; 73 | extern const s16 xevem_init_btt_split_flag[2][NUM_CTX_BTT_SPLIT_FLAG]; 74 | extern const s16 xevem_init_btt_split_dir[2][NUM_CTX_BTT_SPLIT_DIR]; 75 | extern const s16 xevem_init_btt_split_type[2][NUM_CTX_BTT_SPLIT_TYPE]; 76 | extern const s16 xevem_init_run[2][NUM_CTX_CC_RUN]; 77 | extern const s16 xevem_init_last[2][NUM_CTX_CC_LAST]; 78 | extern const s16 xevem_init_level[2][NUM_CTX_CC_LEVEL]; 79 | extern const s16 xevem_init_suco_flag[2][NUM_CTX_SUCO_FLAG]; 80 | extern const s16 xevem_init_alf_ctb_flag[2][NUM_CTX_ALF_CTB_FLAG]; 81 | extern const s16 xevem_init_split_cu_flag[2][NUM_CTX_SPLIT_CU_FLAG]; 82 | extern const s16 xevem_init_sig_coeff_flag[2][NUM_CTX_SIG_COEFF_FLAG]; 83 | extern const s16 xevem_init_coeff_abs_level_greaterAB_flag[2][NUM_CTX_GTX]; 84 | extern const s16 xevem_init_last_sig_coeff_x_prefix[2][NUM_CTX_LAST_SIG_COEFF]; 85 | extern const s16 xevem_init_last_sig_coeff_y_prefix[2][NUM_CTX_LAST_SIG_COEFF]; 86 | extern const s16 xevem_init_affine_flag[2][NUM_CTX_AFFINE_FLAG]; 87 | extern const s16 xevem_init_affine_mode[2][NUM_CTX_AFFINE_MODE]; 88 | extern const s16 xevem_init_affine_mrg[2][NUM_CTX_AFFINE_MRG]; 89 | extern const s16 xevem_init_affine_mvd_flag[2][NUM_CTX_AFFINE_MVD_FLAG]; 90 | extern const s16 xevem_init_skip_flag[2][NUM_CTX_SKIP_FLAG]; 91 | extern const s16 xevem_init_ats_intra_cu[2][NUM_CTX_ATS_INTRA_CU_FLAG]; 92 | extern const s16 xevem_init_ibc_flag[2][NUM_CTX_IBC_FLAG]; 93 | extern const s16 xevem_init_ats_mode[2][NUM_CTX_ATS_MODE_FLAG]; 94 | extern const s16 xevem_init_ats_cu_inter_flag[2][NUM_CTX_ATS_INTER_FLAG]; 95 | extern const s16 xevem_init_ats_cu_inter_quad_flag[2][NUM_CTX_ATS_INTER_QUAD_FLAG]; 96 | extern const s16 xevem_init_ats_cu_inter_hor_flag[2][NUM_CTX_ATS_INTER_HOR_FLAG]; 97 | extern const s16 xevem_init_ats_cu_inter_pos_flag[2][NUM_CTX_ATS_INTER_POS_FLAG]; 98 | 99 | extern const int xevem_tbl_tr_subset_intra[4]; 100 | 101 | /* Range of intra ATS is 4 to 32 */ 102 | extern const s8 xevem_tbl_tr[NUM_TRANS_TYPE][4][1024]; 103 | extern const s8 xevem_tbl_inv_tr[NUM_TRANS_TYPE][4][1024]; 104 | 105 | extern const u8 xevem_addb_alpha_tbl[52]; 106 | extern const u8 xevem_addb_beta_tbl[52]; 107 | extern const u8 xevem_addb_clip_tbl[52][5]; 108 | 109 | /* HDR */ 110 | extern const int xevem_dra_chroma_qp_offset_tbl[NUM_CHROMA_QP_OFFSET_LOG]; 111 | extern const int xevem_dra_exp_nom_v2[NUM_CHROMA_QP_SCALE_EXP]; 112 | 113 | extern const s8 xevem_tbl_poc_gop_offset[9][31]; 114 | extern const s8 xevem_tbl_slice_depth_orig[9][32]; 115 | 116 | #endif /* _XEVE_TBL_H_ */ 117 | -------------------------------------------------------------------------------- /src_main/xevem_tq.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_TQ_H_ 37 | #define _XEVEM_TQ_H_ 38 | 39 | #include "xeve_type.h" 40 | 41 | int xevem_rdoq_set_ctx_cc(XEVE_CORE * core, int ch_type, int prev_level); 42 | int xevem_sub_block_tq(XEVE_CTX * ctx, XEVE_CORE * core, s16 coef[N_C][MAX_CU_DIM], int log2_cuw, int log2_cuh, int slice_type, int nnz[N_C], int is_intra, int run_stats); 43 | extern const XEVE_TX(*xeve_func_tx)[MAX_TR_LOG2]; 44 | extern const XEVE_TX xeve_tbl_tx[MAX_TR_LOG2]; 45 | void tx_pb2(s16* src, s16* dst, int shift, int line); 46 | void tx_pb4(s16* src, s16* dst, int shift, int line); 47 | void tx_pb8(s16* src, s16* dst, int shift, int line); 48 | void tx_pb16(s16* src, s16* dst, int shift, int line); 49 | void tx_pb32(s16* src, s16* dst, int shift, int line); 50 | void tx_pb64(s16* src, s16* dst, int shift, int line); 51 | #endif /* _XEVE_TQ_H_ */ 52 | -------------------------------------------------------------------------------- /src_main/xevem_type.h: -------------------------------------------------------------------------------- 1 | /* The copyright in this software is being made available under the BSD 2 | License, included below. This software may be subject to contributor and 3 | other third party rights, including patent rights, and no such rights are 4 | granted under this license. 5 | 6 | Copyright (c) 2020, Samsung Electronics Co., Ltd. 7 | All Rights Reserved. */ 8 | /* 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | - Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | 15 | - Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | - Neither the name of the copyright owner, nor the names of its contributors 20 | may be used to endorse or promote products derived from this software 21 | without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 | POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef _XEVEM_TYPE_H_ 37 | #define _XEVEM_TYPE_H_ 38 | 39 | // clang-format off 40 | 41 | #include "xeve_type.h" 42 | #include "xevem_dra.h" 43 | 44 | /***************************************************************************** 45 | * pre-defined function structure 46 | *****************************************************************************/ 47 | typedef void (*XEVE_INV_TRANS)(s16*, s16*, int, int, int, int); 48 | typedef void(*XEVE_TX)(s16* coef, s16* t, int shift, int line); 49 | typedef void(*XEVE_ITX)(s16* coef, s16* t, int shift, int line); 50 | 51 | typedef struct _XEVE_BEF_DATA 52 | { 53 | int visit; 54 | int nosplit; 55 | int split; 56 | int ipm[2]; 57 | int split_visit; 58 | double split_cost[MAX_SPLIT_NUM]; 59 | /* splits which are not tried in the first visit (each bit corresponds to one split mode)*/ 60 | u8 remaining_split; 61 | int suco[3]; 62 | int mvr_idx; 63 | int bi_idx; 64 | s16 mmvd_idx; 65 | int affine_flag; 66 | int ats_intra_cu_idx_intra; 67 | int ats_intra_cu_idx_inter; 68 | double pred_mode_cost[3]; 69 | int pred_best_mode; 70 | } XEVE_BEF_DATA; 71 | 72 | typedef struct _XEVE_MMVD_OPT XEVE_MMVD_OPT; 73 | struct _XEVE_MMVD_OPT 74 | { 75 | int ref_ctu[PRED_MAX_REF_FRAMES]; 76 | int poc_to_idx[PRED_MAX_I_PERIOD]; // maximum I period allowed is 100 77 | int i_period; 78 | int ref_buf_idx[PRED_MAX_REF_FRAMES]; // 2 reference frames per ctu 79 | pel pred_bi[PRED_MAX_REF_FRAMES][16][PRED_BI_SIZE]; 80 | int enabled; 81 | }; 82 | 83 | /***************************************************************************** 84 | * CORE information used for encoding process. 85 | * 86 | * The variables in this structure are very often used in encoding process. 87 | *****************************************************************************/ 88 | typedef struct _XEVEM_CORE 89 | { 90 | XEVE_CORE core; 91 | /* intra prediction mode */ 92 | u8 mpm_ext[8]; 93 | u8 pims[IPD_CNT]; /* probable intra mode set*/ 94 | /* ibc flag for MODE_IBC */ 95 | u8 ibc_flag; 96 | /* history-based prediction buffer */ 97 | XEVE_HISTORY_BUFFER tmp_mot_lut[NUM_CU_LOG2][NUM_CU_LOG2]; 98 | XEVE_HISTORY_BUFFER best_mot_lut[NUM_CU_LOG2][NUM_CU_LOG2]; 99 | XEVE_HISTORY_BUFFER history_buffer; 100 | /* mmvd_flag for MODE_INTER */ 101 | u8 mmvd_flag; 102 | /* affine flag for MODE_INTER */ 103 | u8 affine_flag; 104 | /* ats */ 105 | u8 ats_intra_cu; 106 | u8 ats_mode; 107 | u8 ats_inter_info; 108 | /* temporal pixel buffer for inter prediction */ 109 | pel eif_tmp_buffer[(MAX_CU_SIZE + 2) * (MAX_CU_SIZE + 2)]; 110 | u8 eval_mvp_idx[MAX_NUM_MVP]; 111 | u8 dmvr_flag; 112 | XEVE_BEF_DATA bef_data[NUM_CU_LOG2][NUM_CU_LOG2][MAX_CU_CNT_IN_LCU][MAX_BEF_DATA_NUM]; 113 | XEVE_MMVD_OPT mmvd_opt; 114 | }XEVEM_CORE; 115 | 116 | /****************************************************************************** 117 | * CONTEXT used for encoding process. 118 | * 119 | * All have to be stored are in this structure. 120 | *****************************************************************************/ 121 | typedef struct _XEVEM_CTX 122 | { 123 | XEVE_CTX bctx; 124 | 125 | DRA_CONTROL dra_control; 126 | SIG_PARAM_DRA * dra_array; 127 | 128 | /* ibc prediction analysis */ 129 | XEVE_PIBC pibc[XEVE_MAX_THREADS]; 130 | XEVE_IBC_HASH * ibc_hash; 131 | 132 | int (*fn_pibc_init_lcu)(XEVE_CTX * ctx, XEVE_CORE * core); 133 | double(*fn_pibc_analyze_cu)(XEVE_CTX *ctx, XEVE_CORE *core, int x, int y, int log2_cuw, int log2_cuh, XEVE_MODE *mi, s16 coef[N_C][MAX_CU_DIM], pel *rec[N_C], int s_rec[N_C]); 134 | int (*fn_pibc_set_complexity)(XEVE_CTX * ctx, int complexity); 135 | int (*fn_pibc_init_tile)(XEVE_CTX * ctx, int tile_idx); 136 | 137 | /* adaptive loop filter */ 138 | XEVE_ALF * enc_alf; 139 | 140 | int (*fn_alf)(XEVE_CTX * ctx, XEVE_PIC * pic, XEVE_SH* sh, XEVE_APS* aps); 141 | 142 | /* affine map (width in SCU x height in SCU) of raster scan order in a frame */ 143 | u32 * map_affine; 144 | 145 | /* map for ats intra */ 146 | u8 * map_ats_intra_cu; 147 | u8 * map_ats_mode_h; 148 | u8 * map_ats_mode_v; 149 | u8 * map_ats_inter; 150 | 151 | u32 * ats_inter_pred_dist[XEVE_MAX_THREADS]; 152 | u8 * ats_inter_info_pred[XEVE_MAX_THREADS]; //best-mode ats_inter info 153 | u8 * ats_inter_num_pred[XEVE_MAX_THREADS]; 154 | 155 | }XEVEM_CTX; 156 | 157 | #include "xevem_alf.h" 158 | #include "xevem_df.h" 159 | #include "xevem_eco.h" 160 | #include "xevem_ibc_hash.h" 161 | #include "xevem_ipred.h" 162 | #include "xevem_itdq.h" 163 | #include "xevem_mc.h" 164 | #include "xevem_mode.h" 165 | #include "xevem_picman.h" 166 | #include "xevem_pred.h" 167 | #include "xevem_recon.h" 168 | #include "xevem_tbl.h" 169 | #include "xevem_tq.h" 170 | #include "xevem_util.h" 171 | #ifndef ARM 172 | #include "xevem_tq_avx.h" 173 | #include "xevem_itdq_avx.h" 174 | #include "xevem_itdq_sse.h" 175 | #include "xevem_mc_sse.h" 176 | #endif 177 | #if GRAB_STAT 178 | #include "xevem_stat.h" 179 | #endif 180 | 181 | // clang-format on 182 | 183 | #endif /* _XEVE_TYPE_H_ */ 184 | --------------------------------------------------------------------------------